fix: daily page

This commit is contained in:
zzc
2026-03-02 11:14:00 +08:00
parent 38843473c4
commit 033c70962c
2 changed files with 44 additions and 14 deletions

View File

@@ -1,5 +1,14 @@
{ {
"pages": [ "pages": [
{
"path": "pages/index/index",
"style": {
"navigationBarTitleText": "新春祝福",
"enablePullDownRefresh": true,
"navigationStyle": "custom",
"backgroundColor": "#FFFFFF"
}
},
{ {
"path": "pages/greeting/daily", "path": "pages/greeting/daily",
"style": { "style": {
@@ -16,15 +25,6 @@
"enablePullDownRefresh": false "enablePullDownRefresh": false
} }
}, },
{
"path": "pages/index/index",
"style": {
"navigationBarTitleText": "新春祝福",
"enablePullDownRefresh": true,
"navigationStyle": "custom",
"backgroundColor": "#FFFFFF"
}
},
{ {
"path": "pages/make/index", "path": "pages/make/index",
"style": { "style": {

View File

@@ -138,7 +138,12 @@
import { ref, computed, onMounted, watch } from "vue"; import { ref, computed, onMounted, watch } from "vue";
import { getBavBarHeight } from "@/utils/system"; import { getBavBarHeight } from "@/utils/system";
import NavBar from "@/components/NavBar/NavBar.vue"; 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"; import { useUserStore } from "@/stores/user";
const userStore = useUserStore(); const userStore = useUserStore();
@@ -266,18 +271,43 @@ const saveCard = () => {
// }); // });
// }; // };
onShareAppMessage(() => { onShareAppMessage((res) => {
const fromUser = userStore.userInfo?.nickName || "神秘好友"; const fromUser = userStore.userInfo?.nickName || "神秘好友";
const fromAvatar = userStore.userInfo?.avatarUrl || ""; 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 { return {
title: `${fromUser}给你发来了一份今日问候`, 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, currentQuote.value.text,
)}&author=${encodeURIComponent( )}&author=${encodeURIComponent(
authorName.value || currentQuote.value.author, authorName.value || currentQuote.value.author,
)}&fromUser=${encodeURIComponent(fromUser)}&fromAvatar=${encodeURIComponent(
fromAvatar,
)}`, )}`,
imageUrl: "", // Optional: add a custom image if needed
}; };
}); });
</script> </script>