fix: index page

This commit is contained in:
zzc
2026-03-03 22:41:00 +08:00
parent fee3b05c9e
commit b39ac7cb24
2 changed files with 25 additions and 9 deletions

View File

@@ -148,6 +148,7 @@ import { ref, getCurrentInstance, computed } from "vue";
import calendar from "@/utils/lunar.js"; import calendar from "@/utils/lunar.js";
import { useUserStore } from "@/stores/user"; import { useUserStore } from "@/stores/user";
import { onShareAppMessage, onShareTimeline } from "@dcloudio/uni-app"; import { onShareAppMessage, onShareTimeline } from "@dcloudio/uni-app";
import { getShareToken } from "@/utils/common.js";
const { proxy } = getCurrentInstance(); const { proxy } = getCurrentInstance();
const userStore = useUserStore(); const userStore = useUserStore();
@@ -607,10 +608,19 @@ const onShareMoments = () => {
uni.showToast({ title: "请点击右上角分享", icon: "none" }); uni.showToast({ title: "请点击右上角分享", icon: "none" });
}; };
onShareAppMessage(() => { onShareAppMessage(async () => {
const shareToken = await getShareToken("lucky_card");
return { return {
title: "开启你的每日好运!", title: "开启你的每日好运!",
path: "/pages/index/index", path: `/pages/index/index?shareToken=${shareToken}`,
};
});
onShareTimeline(async () => {
const shareToken = await getShareToken("lucky_card_timeline");
return {
title: "开启你的每日好运!",
query: `shareToken=${shareToken}`,
}; };
}); });

View File

@@ -88,11 +88,11 @@
<view class="calendar-mode"> <view class="calendar-mode">
<view class="sign-header"> <view class="sign-header">
<text class="sign-title" <text class="sign-title"
>已连续签到 >本周已连续签到
<text class="highlight">{{ signInfo.continuousDays || 0 }}</text> <text class="highlight">{{ signInfo.continuousDays || 0 }}</text>
</text </text
> >
<text class="sign-tip">连续7天得大奖</text> <text class="sign-tip">连续7天得100积分</text>
</view> </view>
<view class="week-days"> <view class="week-days">
<view <view
@@ -150,7 +150,7 @@
<view class="section-container"> <view class="section-container">
<view class="section-header"> <view class="section-header">
<view class="title-left-decor"></view> <view class="title-left-decor"></view>
<text class="section-title">贺卡制作</text> <text class="section-title">问候·祝福</text>
</view> </view>
<scroll-view class="scene-scroll" scroll-x="true" show-scrollbar="false"> <scroll-view class="scene-scroll" scroll-x="true" show-scrollbar="false">
<view class="scene-list"> <view class="scene-list">
@@ -244,7 +244,7 @@
<!-- <view class="bottom-spacer"></view> --> <!-- <view class="bottom-spacer"></view> -->
<!-- 登录弹窗 --> <!-- 登录弹窗 -->
<LoginPopup /> <LoginPopup @logind="handleLoginSuccess" />
<!-- 运势抽奖弹窗 --> <!-- 运势抽奖弹窗 -->
<LuckyPopup ref="luckyPopupRef" /> <LuckyPopup ref="luckyPopupRef" />
<RewardAd ref="rewardAdRef" @onReward="handleAdReward" /> <RewardAd ref="rewardAdRef" @onReward="handleAdReward" />
@@ -304,8 +304,7 @@ import {
} from "@/api/system"; } from "@/api/system";
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 } from "@/utils/common.js"; import { getShareToken, saveViewRequest } from "@/utils/common.js";
import LoginPopup from "@/components/LoginPopup/LoginPopup.vue"; import LoginPopup from "@/components/LoginPopup/LoginPopup.vue";
import LuckyPopup from "@/components/LuckyPopup/LuckyPopup.vue"; import LuckyPopup from "@/components/LuckyPopup/LuckyPopup.vue";
import RewardAd from "@/components/RewardAd/RewardAd.vue"; import RewardAd from "@/components/RewardAd/RewardAd.vue";
@@ -431,7 +430,10 @@ const sceneList = ref([
const wallpaperList = ref([]); const wallpaperList = ref([]);
const avatarList = ref([]); const avatarList = ref([]);
onLoad(() => { onLoad((options) => {
if (options.shareToken) {
saveViewRequest(options.shareToken, "index");
}
fetchUserSingInfo(); // 获取用户签到信息 fetchUserSingInfo(); // 获取用户签到信息
fetchHomeData(); fetchHomeData();
fetchSpecialTopic(); fetchSpecialTopic();
@@ -478,6 +480,10 @@ const fetchUserSingInfo = async () => {
signInfo.value = res || {}; signInfo.value = res || {};
}; };
const handleLoginSuccess = () => {
fetchUserSingInfo();
};
const fetchHomeData = async () => { const fetchHomeData = async () => {
try { try {
const [wallpapers, avatars] = await Promise.all([ const [wallpapers, avatars] = await Promise.all([