diff --git a/src/pages/detail/indexNewsInfo.vue b/src/pages/detail/indexNewsInfo.vue index be573cf..d4a9c43 100644 --- a/src/pages/detail/indexNewsInfo.vue +++ b/src/pages/detail/indexNewsInfo.vue @@ -125,16 +125,24 @@ onLoad(async (option: any) => { wxShare(); } } + if (option?.phone) { + uni.setStorageSync("token", option.phone); + // 去除链接中的phone字段 + let url = window.location.href; + url = url.replace(/phone=[^&]+&?/i, ""); + // 刷新本页面 + window.location.href = url; + window.location.reload(); + } + console.log("🚀 ~ Date.now():", Date.now()); // 打开页面时链接中带有time字段,表示上次分享的时间 let shareTime = option?.time || 0; // 现在的时间对比上次的分享时间,如果超过24小时,则刷新推荐栏目 - if (Date.now() - shareTime > 24 * 60 * 60 * 1000) { + if (uni.getStorageSync("token") && Date.now() - shareTime > 24 * 60 * 60 * 1000) { uni.removeStorageSync("token"); - // 刷新本页面 - uni.reLaunch({ - url: curPages[curPages.length - 1].route, - }); + // 1766373354519 + window.location.reload(); } }); diff --git a/src/utils/util.ts b/src/utils/util.ts index 95b68fa..1c67ea7 100644 --- a/src/utils/util.ts +++ b/src/utils/util.ts @@ -81,15 +81,10 @@ export const jumpUrl = (url) => { window.open(url, "_blank"); }; - export function getNavHeight() { const systemInfo = uni.getSystemInfoSync(); - console.log(systemInfo); const statusBarHeight = systemInfo.statusBarHeight; // 状态栏高度 - const navigationBarHeight = systemInfo.platform === 'android' ? statusBarHeight + 48 : statusBarHeight + 44; // 通常安卓底部有48px的导航栏,iOS是44px - console.log('状态栏高度:', statusBarHeight); - console.log('导航栏高度:', navigationBarHeight); + const navigationBarHeight = systemInfo.platform === "android" ? statusBarHeight + 48 : statusBarHeight + 44; // 通常安卓底部有48px的导航栏,iOS是44px - return statusBarHeight - -} \ No newline at end of file + return statusBarHeight; +}