diff --git a/components/LuckyPopup/LuckyPopup.vue b/components/LuckyPopup/LuckyPopup.vue index 2bc2617..37782bd 100644 --- a/components/LuckyPopup/LuckyPopup.vue +++ b/components/LuckyPopup/LuckyPopup.vue @@ -148,6 +148,7 @@ import { ref, getCurrentInstance, computed } from "vue"; import calendar from "@/utils/lunar.js"; import { useUserStore } from "@/stores/user"; import { onShareAppMessage, onShareTimeline } from "@dcloudio/uni-app"; +import { getShareToken } from "@/utils/common.js"; const { proxy } = getCurrentInstance(); const userStore = useUserStore(); @@ -607,10 +608,19 @@ const onShareMoments = () => { uni.showToast({ title: "请点击右上角分享", icon: "none" }); }; -onShareAppMessage(() => { +onShareAppMessage(async () => { + const shareToken = await getShareToken("lucky_card"); return { 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}`, }; }); diff --git a/pages/index/index.vue b/pages/index/index.vue index 3a0ffd5..1b3411c 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -88,11 +88,11 @@ 已连续签到 + >本周已连续签到 {{ signInfo.continuousDays || 0 }} - 连续7天得大奖 + 连续7天得100积分 - 贺卡制作 + 问候·祝福 @@ -244,7 +244,7 @@ - + @@ -304,8 +304,7 @@ import { } from "@/api/system"; import { getUserSignInfo, userSignIn, getUserLuckInfo } from "@/api/user"; 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 LuckyPopup from "@/components/LuckyPopup/LuckyPopup.vue"; import RewardAd from "@/components/RewardAd/RewardAd.vue"; @@ -431,7 +430,10 @@ const sceneList = ref([ const wallpaperList = ref([]); const avatarList = ref([]); -onLoad(() => { +onLoad((options) => { + if (options.shareToken) { + saveViewRequest(options.shareToken, "index"); + } fetchUserSingInfo(); // 获取用户签到信息 fetchHomeData(); fetchSpecialTopic(); @@ -478,6 +480,10 @@ const fetchUserSingInfo = async () => { signInfo.value = res || {}; }; +const handleLoginSuccess = () => { + fetchUserSingInfo(); +}; + const fetchHomeData = async () => { try { const [wallpapers, avatars] = await Promise.all([