fix: daily page

This commit is contained in:
zzc
2026-03-02 21:32:26 +08:00
parent d5012753c1
commit 63a6ade0d4

View File

@@ -20,7 +20,19 @@
<!-- Main Card --> <!-- Main Card -->
<view class="main-card-container"> <view class="main-card-container">
<view class="greeting-card" id="shareCard"> <view
class="greeting-card"
id="shareCard"
:style="
backgroundUrl
? {
backgroundImage: `url(${backgroundUrl})`,
backgroundSize: 'cover',
backgroundPosition: 'center',
}
: {}
"
>
<view class="card-icon"> <view class="card-icon">
<uni-icons type="star-filled" size="32" color="#e6b800" /> <uni-icons type="star-filled" size="32" color="#e6b800" />
<view class="sparkle s1"></view> <view class="sparkle s1"></view>
@@ -29,6 +41,7 @@
<view class="card-content"> <view class="card-content">
<text class="card-text">{{ content }}</text> <text class="card-text">{{ content }}</text>
<text class="card-highlight" v-if="highlight">{{ highlight }}</text>
</view> </view>
<view class="card-divider"></view> <view class="card-divider"></view>
@@ -108,6 +121,7 @@ import { ref } from "vue";
import { onLoad, onShareAppMessage } from "@dcloudio/uni-app"; import { onLoad, onShareAppMessage } from "@dcloudio/uni-app";
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 { getPageDetail } from "@/api/system";
const navBarHeight = getBavBarHeight(); const navBarHeight = getBavBarHeight();
const defaultAvatar = const defaultAvatar =
@@ -117,6 +131,8 @@ const fromUser = ref("");
const fromAvatar = ref(""); const fromAvatar = ref("");
const content = ref("万事顺遂\n岁岁平安\n愿你的生活\n日日有小确幸"); const content = ref("万事顺遂\n岁岁平安\n愿你的生活\n日日有小确幸");
const author = ref("陈小明"); const author = ref("陈小明");
const highlight = ref("");
const backgroundUrl = ref("");
const hotList = ref([ const hotList = ref([
{ {
@@ -133,12 +149,35 @@ const hotList = ref([
}, },
]); ]);
onLoad((options) => { onLoad(async (options) => {
if (options.content) content.value = decodeURIComponent(options.content); if (options.shareToken) {
if (options.author) author.value = decodeURIComponent(options.author); const detail = await getPageDetail(options.shareToken);
if (options.fromUser) fromUser.value = decodeURIComponent(options.fromUser); if (detail) {
if (options.fromAvatar) if (detail.from) {
fromAvatar.value = decodeURIComponent(options.fromAvatar); fromUser.value = detail.from.nickname;
fromAvatar.value = detail.from.avatar;
}
if (detail.content) {
const parts = detail.content.split(" ");
if (parts.length > 1) {
highlight.value = parts.pop();
content.value = parts.join("\n");
} else {
content.value = detail.content;
highlight.value = "";
}
}
author.value = detail.signature || "专属问候";
backgroundUrl.value = detail.imageUrl || "";
}
} else {
// Fallback to query params if no shareToken (legacy support or direct link)
if (options.content) content.value = decodeURIComponent(options.content);
if (options.author) author.value = decodeURIComponent(options.author);
if (options.fromUser) fromUser.value = decodeURIComponent(options.fromUser);
if (options.fromAvatar)
fromAvatar.value = decodeURIComponent(options.fromAvatar);
}
}); });
const navToMake = () => { const navToMake = () => {
@@ -273,6 +312,15 @@ onShareAppMessage(() => {
white-space: pre-wrap; white-space: pre-wrap;
} }
.card-highlight {
display: block;
font-size: 48rpx;
color: #d81e06;
font-weight: 800;
margin-top: 20rpx;
font-family: "Songti SC", serif;
}
.card-divider { .card-divider {
width: 60rpx; width: 60rpx;
height: 2rpx; height: 2rpx;