fix: share token

This commit is contained in:
zzc
2026-02-09 22:31:01 +08:00
parent 87a2383d0f
commit 85bbf9d8ac
11 changed files with 282 additions and 133 deletions

View File

@@ -129,7 +129,7 @@ import { onLoad, onShareAppMessage, onShareTimeline } from "@dcloudio/uni-app";
import { getBavBarHeight } from "@/utils/system";
import { getPageDetail } from "@/api/system";
import { getWallpaperRecommendList } from "@/api/wallpaper";
import { saveViewRequest } from "@/utils/common.js";
import { getShareToken, saveViewRequest } from "@/utils/common.js";
const navHeight = getBavBarHeight();
const statusBarHeight = uni.getSystemInfoSync().statusBarHeight;
@@ -148,20 +148,22 @@ onLoad(async (options) => {
fetchRecommend();
});
onShareAppMessage(() => {
onShareAppMessage(async () => {
const token = await getShareToken("wallpaper_detail", detailData.value?.id);
return {
title: "快来看看我刚领到的新年精美壁纸 🖼",
path: `/pages/wallpaper/detail?shareToken=${shareToken.value}`,
path: `/pages/wallpaper/detail?shareToken=${token || ""}`,
imageUrl:
detailData.value?.imageUrl ||
"https://file.lihailezzc.com/resource/8dd026d76ef7a63d123b7fd698fb989b.png",
};
});
onShareTimeline(() => {
onShareTimeline(async () => {
const token = await getShareToken("wallpaper_timeline", detailData.value?.id);
return {
title: "快来看看我刚领到的新年精美壁纸 🖼",
query: `shareToken=${shareToken.value}`,
query: `shareToken=${token}`,
imageUrl:
detailData.value?.imageUrl ||
"https://file.lihailezzc.com/resource/8dd026d76ef7a63d123b7fd698fb989b.png",
@@ -171,7 +173,7 @@ onShareTimeline(() => {
const fetchDetail = async () => {
try {
const res = await getPageDetail(shareToken.value);
saveViewRequest(shareToken.value, "wallpaper_download", res.id);
saveViewRequest(shareToken.value, "wallpaper_detail", res.id);
if (res) {
detailData.value = res;
}