From bd3185aac32188a37709a2469406bf0bb89d22b9 Mon Sep 17 00:00:00 2001 From: zzc <1761997216@qq.com> Date: Sat, 28 Feb 2026 09:34:11 +0800 Subject: [PATCH] fix: index page --- api/system.js | 7 ++ pages/creation/index.vue | 10 +-- pages/index/index.vue | 151 +++++++++++++++++++++++++++++++++++++-- 3 files changed, 159 insertions(+), 9 deletions(-) diff --git a/api/system.js b/api/system.js index 68fbdc7..d841023 100644 --- a/api/system.js +++ b/api/system.js @@ -60,6 +60,13 @@ export const getRankList = async (scene) => { }); }; +export const getCardSpecialTopic = async () => { + return request({ + url: `/api/blessing/card/special-topic`, + method: "get", + }); +}; + export const getRandomRecommendList = async (scene) => { return request({ url: `/api/blessing/random/recommend/list?scene=${scene}`, diff --git a/pages/creation/index.vue b/pages/creation/index.vue index 5e44149..6be809b 100644 --- a/pages/creation/index.vue +++ b/pages/creation/index.vue @@ -23,7 +23,7 @@ 灵感瞬间 - + 去制作 - 新春贺卡 + 祝福贺卡 @@ -67,7 +67,7 @@ - + 编辑精选 - 查看全部 + - {{ signInfo.isSignedToday ? "已开启" : "抽取好运" }} + {{ + signInfo.isSignedToday ? "已开启今日好运" : "签到抽取好运" + }} @@ -111,6 +113,29 @@ + + + + {{ specialTopic.sceneName }} + {{ specialTopic.sceneDesc }} + {{ specialTopic.sceneBlessing }} + + + + + + + + + + @@ -227,9 +252,9 @@ import { } from "@dcloudio/uni-app"; import { useUserStore } from "@/stores/user"; import { - getRankList, watchAdReward, getRandomRecommendList, + getCardSpecialTopic, } from "@/api/system"; import { getUserSignInfo, userSignIn } from "@/api/user"; import calendar from "@/utils/lunar"; @@ -361,18 +386,44 @@ const avatarList = ref([]); onMounted(() => { fetchUserSingInfo(); // 获取用户签到信息 fetchHomeData(); + fetchSpecialTopic(); }); onShow(() => { fetchHomeData(); fetchUserSingInfo(); + fetchSpecialTopic(); }); onPullDownRefresh(() => { fetchHomeData(); fetchUserSingInfo(); + fetchSpecialTopic(); }); +const specialTopic = ref(null); + +const fetchSpecialTopic = async () => { + try { + const res = await getCardSpecialTopic(); + if (res && res.sceneName) { + specialTopic.value = res; + } else { + specialTopic.value = null; + } + } catch (e) { + console.error("fetchSpecialTopic error", e); + } +}; + +const navToSpecial = () => { + if (specialTopic.value && specialTopic.value.scene) { + uni.navigateTo({ + url: `/pages/make/index?scene=${specialTopic.value.scene}`, + }); + } +}; + const fetchUserSingInfo = async () => { if (!isLoggedIn.value) return; const res = await getUserSignInfo(); @@ -431,7 +482,6 @@ const onOpenLucky = async () => { return; } - uni.showLoading({ title: "开启好运...", mask: true }); try { const res = await userSignIn(); if (res && res.success) { @@ -443,6 +493,7 @@ const onOpenLucky = async () => { fetchUserSingInfo(); userStore.fetchUserAssets(); luckyPopupRef.value?.open(); + uni.showToast({ title: "获取40积分", icon: "none" }); } else { uni.showToast({ title: "签到失败", icon: "none" }); } @@ -675,7 +726,7 @@ onShareTimeline(() => { } .lucky-btn { - width: 180rpx; + width: 210rpx; height: 72rpx; background: linear-gradient(135deg, #b8860b 0%, #d4a017 100%); border-radius: 36rpx; @@ -781,6 +832,98 @@ onShareTimeline(() => { } } +/* Special Topic Card */ +.special-topic-card { + width: 100%; + height: 220rpx; + background: linear-gradient(135deg, #fff9f0 0%, #fff3e0 100%); + border-radius: 32rpx; + padding: 32rpx; + box-sizing: border-box; + display: flex; + align-items: center; + justify-content: space-between; + margin-bottom: 48rpx; + box-shadow: 0 12rpx 32rpx rgba(255, 152, 0, 0.08); + position: relative; + overflow: hidden; + + .topic-left { + display: flex; + flex-direction: column; + z-index: 2; + + .topic-title { + font-size: 36rpx; + font-weight: 800; + color: #d81e06; + margin-bottom: 8rpx; + } + + .topic-subtitle { + font-size: 24rpx; + color: #d81e06; + font-weight: bold; + margin-bottom: 12rpx; + } + + .topic-blessing { + font-size: 22rpx; + color: #888; + margin-bottom: 24rpx; + } + + .topic-btn { + display: inline-flex; + align-items: center; + justify-content: center; + background: #d81e06; + color: #fff; + font-size: 22rpx; + padding: 10rpx 24rpx; + border-radius: 24rpx; + margin: 0; + line-height: 1.2; + box-shadow: 0 4rpx 12rpx rgba(216, 30, 6, 0.2); + } + } + + .topic-right { + position: relative; + width: 200rpx; + height: 100%; + display: flex; + align-items: center; + justify-content: center; + + .topic-img { + width: 160rpx; + height: 160rpx; + z-index: 2; + } + + .decor-circle { + position: absolute; + border-radius: 50%; + background: rgba(255, 255, 255, 0.4); + } + + .circle-1 { + width: 120rpx; + height: 120rpx; + right: 20rpx; + top: 10rpx; + } + + .circle-2 { + width: 80rpx; + height: 80rpx; + right: 80rpx; + bottom: 20rpx; + } + } +} + /* 通用 Section 样式 */ .section-container { margin-bottom: 28rpx;