fix: daily page
This commit is contained in:
@@ -20,7 +20,19 @@
|
||||
|
||||
<!-- Main Card -->
|
||||
<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">
|
||||
<uni-icons type="star-filled" size="32" color="#e6b800" />
|
||||
<view class="sparkle s1">✨</view>
|
||||
@@ -29,6 +41,7 @@
|
||||
|
||||
<view class="card-content">
|
||||
<text class="card-text">{{ content }}</text>
|
||||
<text class="card-highlight" v-if="highlight">{{ highlight }}</text>
|
||||
</view>
|
||||
|
||||
<view class="card-divider"></view>
|
||||
@@ -108,6 +121,7 @@ import { ref } from "vue";
|
||||
import { onLoad, onShareAppMessage } from "@dcloudio/uni-app";
|
||||
import { getBavBarHeight } from "@/utils/system";
|
||||
import NavBar from "@/components/NavBar/NavBar.vue";
|
||||
import { getPageDetail } from "@/api/system";
|
||||
|
||||
const navBarHeight = getBavBarHeight();
|
||||
const defaultAvatar =
|
||||
@@ -117,6 +131,8 @@ const fromUser = ref("");
|
||||
const fromAvatar = ref("");
|
||||
const content = ref("万事顺遂\n岁岁平安\n愿你的生活\n日日有小确幸");
|
||||
const author = ref("陈小明");
|
||||
const highlight = ref("");
|
||||
const backgroundUrl = ref("");
|
||||
|
||||
const hotList = ref([
|
||||
{
|
||||
@@ -133,12 +149,35 @@ const hotList = ref([
|
||||
},
|
||||
]);
|
||||
|
||||
onLoad((options) => {
|
||||
onLoad(async (options) => {
|
||||
if (options.shareToken) {
|
||||
const detail = await getPageDetail(options.shareToken);
|
||||
if (detail) {
|
||||
if (detail.from) {
|
||||
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 = () => {
|
||||
@@ -273,6 +312,15 @@ onShareAppMessage(() => {
|
||||
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 {
|
||||
width: 60rpx;
|
||||
height: 2rpx;
|
||||
|
||||
Reference in New Issue
Block a user