fix: scene list

This commit is contained in:
zzc
2026-03-13 03:12:52 +08:00
parent 1865b1cfcd
commit 952acbbf1f
3 changed files with 61 additions and 61 deletions

View File

@@ -302,6 +302,7 @@ import {
getCardSpecialTopic,
getShareReward,
} from "@/api/system";
import { getGreetingSceneList } from "@/api/card";
import { getUserSignInfo, userSignIn, getUserLuckInfo } from "@/api/user";
import calendar from "@/utils/lunar";
import { getShareToken, saveViewRequest } from "@/utils/common.js";
@@ -410,22 +411,7 @@ const lunarDate = computed(() => {
};
});
const sceneList = ref([
{ id: 3, name: "每日问候", icon: "/static/icon/yunshi.png", scene: "daily" },
{
id: 2,
name: "生日纪念",
icon: "/static/icon/guashi.png",
scene: "birthday",
},
{ id: 4, name: "情感表达", icon: "/static/icon/hongbao.png", scene: "love" },
{
id: 1,
name: "节日祝福",
icon: "/static/icon/celebrate.png",
scene: "holiday",
},
]);
const sceneList = ref([]);
const wallpaperList = ref([]);
const avatarList = ref([]);
@@ -437,18 +423,21 @@ onLoad((options) => {
fetchUserSingInfo(); // 获取用户签到信息
fetchHomeData();
fetchSpecialTopic();
fetchSceneList();
});
onShow(() => {
fetchHomeData();
fetchUserSingInfo();
fetchSpecialTopic();
fetchSceneList();
});
onPullDownRefresh(() => {
fetchHomeData();
fetchUserSingInfo();
fetchSpecialTopic();
fetchSceneList();
});
const specialTopic = ref(null);
@@ -466,6 +455,22 @@ const fetchSpecialTopic = async () => {
}
};
const fetchSceneList = async () => {
try {
const res = await getGreetingSceneList();
if (res && Array.isArray(res)) {
sceneList.value = res.map((item) => ({
id: item.id,
name: item.sceneName,
icon: item.imageUrl,
scene: item.scene,
}));
}
} catch (e) {
console.error("fetchSceneList error", e);
}
};
const navToSpecial = () => {
if (specialTopic.value && specialTopic.value.scene) {
uni.navigateTo({