fix: daily page
This commit is contained in:
@@ -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
|
||||
};
|
||||
});
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user