fix: scene list
This commit is contained in:
@@ -540,8 +540,15 @@
|
||||
@tap="selectScene(scene)"
|
||||
>
|
||||
<view class="scene-icon-box" :style="{ background: scene.bgColor }">
|
||||
<image
|
||||
v-if="scene.icon && scene.icon.includes('/')"
|
||||
:src="scene.icon"
|
||||
mode="aspectFit"
|
||||
style="width: 52rpx; height: 52rpx"
|
||||
/>
|
||||
<uni-icons
|
||||
:type="scene.icon"
|
||||
v-else
|
||||
:type="scene.icon || 'star-filled'"
|
||||
size="26"
|
||||
:color="scene.color"
|
||||
></uni-icons>
|
||||
@@ -568,6 +575,7 @@ import {
|
||||
getCardTemplateTitleList,
|
||||
getCardMusicList,
|
||||
} from "@/api/make";
|
||||
import { getGreetingSceneList } from "@/api/card";
|
||||
import { getShareReward, msgCheckApi, watchAdReward } from "@/api/system";
|
||||
import { checkAbilityAndHandle, getUnlockLabel } from "@/utils/ability.js";
|
||||
import {
|
||||
@@ -974,6 +982,7 @@ onLoad((options) => {
|
||||
if (options.author) {
|
||||
signatureName.value = decodeURIComponent(options.author);
|
||||
}
|
||||
fetchSceneList();
|
||||
});
|
||||
|
||||
const loadData = () => {
|
||||
@@ -985,51 +994,37 @@ const loadData = () => {
|
||||
|
||||
const currentScene = ref("");
|
||||
const scenePopup = ref(null);
|
||||
const scenes = [
|
||||
{
|
||||
name: "节日祝福",
|
||||
value: "holiday",
|
||||
icon: "notification-filled",
|
||||
color: "#FF3B30",
|
||||
bgColor: "#FFF5F5",
|
||||
},
|
||||
{
|
||||
name: "生日纪念",
|
||||
value: "birthday",
|
||||
icon: "calendar-filled",
|
||||
color: "#FF9500",
|
||||
bgColor: "#FFF8E5",
|
||||
},
|
||||
{
|
||||
name: "每日问候",
|
||||
value: "daily",
|
||||
icon: "star-filled",
|
||||
color: "#FFCC00",
|
||||
bgColor: "#FFFBE6",
|
||||
},
|
||||
{
|
||||
name: "情绪表达",
|
||||
value: "emotion",
|
||||
icon: "heart-filled",
|
||||
color: "#FF2D55",
|
||||
bgColor: "#FFF0F5",
|
||||
},
|
||||
{
|
||||
name: "人际关系",
|
||||
value: "relationship",
|
||||
icon: "gift-filled",
|
||||
color: "#FF5E3A",
|
||||
bgColor: "#FFF2F0",
|
||||
},
|
||||
{
|
||||
name: "职场祝福",
|
||||
value: "workplace",
|
||||
icon: "shop-filled",
|
||||
color: "#8B572A",
|
||||
bgColor: "#F9F0E6",
|
||||
},
|
||||
const scenes = ref([]);
|
||||
|
||||
const SCENE_PALETTE = [
|
||||
{ color: "#FF3B30", bgColor: "#FFF5F5" },
|
||||
{ color: "#FF9500", bgColor: "#FFF8E5" },
|
||||
{ color: "#FFCC00", bgColor: "#FFFBE6" },
|
||||
{ color: "#FF2D55", bgColor: "#FFF0F5" },
|
||||
{ color: "#FF5E3A", bgColor: "#FFF2F0" },
|
||||
{ color: "#8B572A", bgColor: "#F9F0E6" },
|
||||
];
|
||||
|
||||
const fetchSceneList = async () => {
|
||||
try {
|
||||
const res = await getGreetingSceneList("daily");
|
||||
if (res && Array.isArray(res)) {
|
||||
scenes.value = res.map((item, index) => {
|
||||
const style = SCENE_PALETTE[index % SCENE_PALETTE.length];
|
||||
return {
|
||||
name: item.sceneName,
|
||||
value: item.scene,
|
||||
icon: item.imageUrl,
|
||||
color: style.color,
|
||||
bgColor: style.bgColor,
|
||||
};
|
||||
});
|
||||
}
|
||||
} catch (e) {
|
||||
console.error("fetchSceneList error", e);
|
||||
}
|
||||
};
|
||||
|
||||
const selectScene = (scene) => {
|
||||
currentScene.value = scene.value;
|
||||
scenePopup.value.close();
|
||||
|
||||
Reference in New Issue
Block a user