fix: share token
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ const hasMore = ref(true);
|
||||
const isRefreshing = ref(false);
|
||||
|
||||
onShareAppMessage(async (options) => {
|
||||
if(!isLoggedIn.value) {
|
||||
if (!isLoggedIn.value) {
|
||||
const shareToken = await getShareToken("wallpaper_download_index", "");
|
||||
return {
|
||||
title: "新春祝福",
|
||||
@@ -134,9 +134,11 @@ onShareAppMessage(async (options) => {
|
||||
}
|
||||
});
|
||||
|
||||
onShareTimeline(() => {
|
||||
onShareTimeline(async () => {
|
||||
const shareToken = await getShareToken("wallpaper_timeline");
|
||||
return {
|
||||
title: "精选新年壁纸,让手机也过年 🖼",
|
||||
query: `shareToken=${shareToken}`,
|
||||
imageUrl:
|
||||
"https://file.lihailezzc.com/resource/8dd026d76ef7a63d123b7fd698fb989b.png",
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user