fix: daily page
This commit is contained in:
@@ -125,7 +125,7 @@
|
||||
</view>
|
||||
<text class="btn-text">保存</text>
|
||||
</button>
|
||||
<button class="send-btn" @tap="sendGreeting">
|
||||
<button class="send-btn" open-type="share">
|
||||
<uni-icons type="paperplane-filled" size="20" color="#fff" />
|
||||
<text>立即发送今日问候</text>
|
||||
</button>
|
||||
@@ -138,6 +138,10 @@
|
||||
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 { useUserStore } from "@/stores/user";
|
||||
|
||||
const userStore = useUserStore();
|
||||
|
||||
const navBarHeight = getBavBarHeight();
|
||||
const streakDays = ref(5);
|
||||
@@ -249,13 +253,33 @@ const saveCard = () => {
|
||||
uni.showToast({ title: "保存功能开发中", icon: "none" });
|
||||
};
|
||||
|
||||
const sendGreeting = () => {
|
||||
uni.navigateTo({
|
||||
url: `/pages/make/index?scene=daily&content=${encodeURIComponent(
|
||||
// const sendGreeting = () => {
|
||||
// // Use uni.navigateTo for normal flow if not open-type="share"
|
||||
// // But here we might want to trigger share directly or just navigate to make page as before
|
||||
// // Based on user request "share after friend opens page", it implies we need to handle share
|
||||
// // Let's keep the navigation to make page for "Sending" (which usually means making a card first)
|
||||
// // BUT also add onShareAppMessage so the top right menu share works
|
||||
// uni.navigateTo({
|
||||
// url: `/pages/make/index?scene=daily&content=${encodeURIComponent(
|
||||
// currentQuote.value.text,
|
||||
// )}&author=${encodeURIComponent(authorName.value)}`,
|
||||
// });
|
||||
// };
|
||||
|
||||
onShareAppMessage(() => {
|
||||
const fromUser = userStore.userInfo?.nickName || "神秘好友";
|
||||
const fromAvatar = userStore.userInfo?.avatarUrl || "";
|
||||
return {
|
||||
title: `${fromUser}给你发来了一份今日问候`,
|
||||
path: `/pages/greeting/share?content=${encodeURIComponent(
|
||||
currentQuote.value.text,
|
||||
)}&author=${encodeURIComponent(authorName.value)}`,
|
||||
});
|
||||
};
|
||||
)}&author=${encodeURIComponent(
|
||||
authorName.value || currentQuote.value.author,
|
||||
)}&fromUser=${encodeURIComponent(fromUser)}&fromAvatar=${encodeURIComponent(
|
||||
fromAvatar,
|
||||
)}`,
|
||||
};
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
Reference in New Issue
Block a user