fix: scene list
This commit is contained in:
@@ -185,7 +185,7 @@ onShareAppMessage(async () => {
|
|||||||
const shareToken = await getShareToken("fortune_draw", cardId.value);
|
const shareToken = await getShareToken("fortune_draw", cardId.value);
|
||||||
getRewardByShare();
|
getRewardByShare();
|
||||||
return {
|
return {
|
||||||
title: "马年运势我已经抽过了,你的会是什么?",
|
title: "今日运势我已经抽过了,你的会是什么?",
|
||||||
path: `${cardId.value ? `/pages/fortune/detail?shareToken=${shareToken}` : `/pages/fortune/index?shareToken=${shareToken}`}`,
|
path: `${cardId.value ? `/pages/fortune/detail?shareToken=${shareToken}` : `/pages/fortune/index?shareToken=${shareToken}`}`,
|
||||||
imageUrl:
|
imageUrl:
|
||||||
"https://file.lihailezzc.com/resource/8dd026d76ef7a63d123b7fd698fb989b.png",
|
"https://file.lihailezzc.com/resource/8dd026d76ef7a63d123b7fd698fb989b.png",
|
||||||
|
|||||||
@@ -302,6 +302,7 @@ import {
|
|||||||
getCardSpecialTopic,
|
getCardSpecialTopic,
|
||||||
getShareReward,
|
getShareReward,
|
||||||
} from "@/api/system";
|
} from "@/api/system";
|
||||||
|
import { getGreetingSceneList } from "@/api/card";
|
||||||
import { getUserSignInfo, userSignIn, getUserLuckInfo } from "@/api/user";
|
import { getUserSignInfo, userSignIn, getUserLuckInfo } from "@/api/user";
|
||||||
import calendar from "@/utils/lunar";
|
import calendar from "@/utils/lunar";
|
||||||
import { getShareToken, saveViewRequest } from "@/utils/common.js";
|
import { getShareToken, saveViewRequest } from "@/utils/common.js";
|
||||||
@@ -410,22 +411,7 @@ const lunarDate = computed(() => {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
const sceneList = ref([
|
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 wallpaperList = ref([]);
|
const wallpaperList = ref([]);
|
||||||
const avatarList = ref([]);
|
const avatarList = ref([]);
|
||||||
@@ -437,18 +423,21 @@ onLoad((options) => {
|
|||||||
fetchUserSingInfo(); // 获取用户签到信息
|
fetchUserSingInfo(); // 获取用户签到信息
|
||||||
fetchHomeData();
|
fetchHomeData();
|
||||||
fetchSpecialTopic();
|
fetchSpecialTopic();
|
||||||
|
fetchSceneList();
|
||||||
});
|
});
|
||||||
|
|
||||||
onShow(() => {
|
onShow(() => {
|
||||||
fetchHomeData();
|
fetchHomeData();
|
||||||
fetchUserSingInfo();
|
fetchUserSingInfo();
|
||||||
fetchSpecialTopic();
|
fetchSpecialTopic();
|
||||||
|
fetchSceneList();
|
||||||
});
|
});
|
||||||
|
|
||||||
onPullDownRefresh(() => {
|
onPullDownRefresh(() => {
|
||||||
fetchHomeData();
|
fetchHomeData();
|
||||||
fetchUserSingInfo();
|
fetchUserSingInfo();
|
||||||
fetchSpecialTopic();
|
fetchSpecialTopic();
|
||||||
|
fetchSceneList();
|
||||||
});
|
});
|
||||||
|
|
||||||
const specialTopic = ref(null);
|
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 = () => {
|
const navToSpecial = () => {
|
||||||
if (specialTopic.value && specialTopic.value.scene) {
|
if (specialTopic.value && specialTopic.value.scene) {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
|
|||||||
@@ -540,8 +540,15 @@
|
|||||||
@tap="selectScene(scene)"
|
@tap="selectScene(scene)"
|
||||||
>
|
>
|
||||||
<view class="scene-icon-box" :style="{ background: scene.bgColor }">
|
<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
|
<uni-icons
|
||||||
:type="scene.icon"
|
v-else
|
||||||
|
:type="scene.icon || 'star-filled'"
|
||||||
size="26"
|
size="26"
|
||||||
:color="scene.color"
|
:color="scene.color"
|
||||||
></uni-icons>
|
></uni-icons>
|
||||||
@@ -568,6 +575,7 @@ import {
|
|||||||
getCardTemplateTitleList,
|
getCardTemplateTitleList,
|
||||||
getCardMusicList,
|
getCardMusicList,
|
||||||
} from "@/api/make";
|
} from "@/api/make";
|
||||||
|
import { getGreetingSceneList } from "@/api/card";
|
||||||
import { getShareReward, msgCheckApi, watchAdReward } from "@/api/system";
|
import { getShareReward, msgCheckApi, watchAdReward } from "@/api/system";
|
||||||
import { checkAbilityAndHandle, getUnlockLabel } from "@/utils/ability.js";
|
import { checkAbilityAndHandle, getUnlockLabel } from "@/utils/ability.js";
|
||||||
import {
|
import {
|
||||||
@@ -974,6 +982,7 @@ onLoad((options) => {
|
|||||||
if (options.author) {
|
if (options.author) {
|
||||||
signatureName.value = decodeURIComponent(options.author);
|
signatureName.value = decodeURIComponent(options.author);
|
||||||
}
|
}
|
||||||
|
fetchSceneList();
|
||||||
});
|
});
|
||||||
|
|
||||||
const loadData = () => {
|
const loadData = () => {
|
||||||
@@ -985,51 +994,37 @@ const loadData = () => {
|
|||||||
|
|
||||||
const currentScene = ref("");
|
const currentScene = ref("");
|
||||||
const scenePopup = ref(null);
|
const scenePopup = ref(null);
|
||||||
const scenes = [
|
const scenes = ref([]);
|
||||||
{
|
|
||||||
name: "节日祝福",
|
const SCENE_PALETTE = [
|
||||||
value: "holiday",
|
{ color: "#FF3B30", bgColor: "#FFF5F5" },
|
||||||
icon: "notification-filled",
|
{ color: "#FF9500", bgColor: "#FFF8E5" },
|
||||||
color: "#FF3B30",
|
{ color: "#FFCC00", bgColor: "#FFFBE6" },
|
||||||
bgColor: "#FFF5F5",
|
{ color: "#FF2D55", bgColor: "#FFF0F5" },
|
||||||
},
|
{ color: "#FF5E3A", bgColor: "#FFF2F0" },
|
||||||
{
|
{ color: "#8B572A", bgColor: "#F9F0E6" },
|
||||||
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 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) => {
|
const selectScene = (scene) => {
|
||||||
currentScene.value = scene.value;
|
currentScene.value = scene.value;
|
||||||
scenePopup.value.close();
|
scenePopup.value.close();
|
||||||
|
|||||||
Reference in New Issue
Block a user