From 033c70962c386363c4f23fdddd54022a954e75bb Mon Sep 17 00:00:00 2001 From: zzc <1761997216@qq.com> Date: Mon, 2 Mar 2026 11:14:00 +0800 Subject: [PATCH] fix: daily page --- pages.json | 18 +++++++++--------- pages/greeting/daily.vue | 40 +++++++++++++++++++++++++++++++++++----- 2 files changed, 44 insertions(+), 14 deletions(-) diff --git a/pages.json b/pages.json index 3d9e4e8..d5e95c4 100644 --- a/pages.json +++ b/pages.json @@ -1,5 +1,14 @@ { "pages": [ + { + "path": "pages/index/index", + "style": { + "navigationBarTitleText": "新春祝福", + "enablePullDownRefresh": true, + "navigationStyle": "custom", + "backgroundColor": "#FFFFFF" + } + }, { "path": "pages/greeting/daily", "style": { @@ -16,15 +25,6 @@ "enablePullDownRefresh": false } }, - { - "path": "pages/index/index", - "style": { - "navigationBarTitleText": "新春祝福", - "enablePullDownRefresh": true, - "navigationStyle": "custom", - "backgroundColor": "#FFFFFF" - } - }, { "path": "pages/make/index", "style": { diff --git a/pages/greeting/daily.vue b/pages/greeting/daily.vue index 6849621..2049341 100644 --- a/pages/greeting/daily.vue +++ b/pages/greeting/daily.vue @@ -138,7 +138,12 @@ import { ref, computed, onMounted, watch } from "vue"; import { getBavBarHeight } from "@/utils/system"; import NavBar from "@/components/NavBar/NavBar.vue"; -import { onShareAppMessage } from "@dcloudio/uni-app"; +import { + onShareAppMessage, + onShareTimeline, + onShow, + onLoad, +} from "@dcloudio/uni-app"; import { useUserStore } from "@/stores/user"; const userStore = useUserStore(); @@ -266,18 +271,43 @@ const saveCard = () => { // }); // }; -onShareAppMessage(() => { +onShareAppMessage((res) => { const fromUser = userStore.userInfo?.nickName || "神秘好友"; const fromAvatar = userStore.userInfo?.avatarUrl || ""; + + // Log the share attempt and path + console.log("Sharing daily greeting", { + res, + fromUser, + content: currentQuote.value.text, + }); + + const path = `/pages/greeting/share?content=${encodeURIComponent( + currentQuote.value.text, + )}&author=${encodeURIComponent( + authorName.value || currentQuote.value.author, + )}&fromUser=${encodeURIComponent(fromUser)}&fromAvatar=${encodeURIComponent( + fromAvatar, + )}`; + + console.log("Share path:", path); + return { title: `${fromUser}给你发来了一份今日问候`, - path: `/pages/greeting/share?content=${encodeURIComponent( + path: path, + }; +}); + +onShareTimeline(() => { + const fromUser = userStore.userInfo?.nickName || "神秘好友"; + return { + title: `${fromUser}给你发来了一份今日问候`, + query: `content=${encodeURIComponent( currentQuote.value.text, )}&author=${encodeURIComponent( authorName.value || currentQuote.value.author, - )}&fromUser=${encodeURIComponent(fromUser)}&fromAvatar=${encodeURIComponent( - fromAvatar, )}`, + imageUrl: "", // Optional: add a custom image if needed }; });