fix(utils): 移除调试日志并修复导航栏高度计算
refactor(detail): 优化token处理和页面刷新逻辑 - 在新闻详情页添加phone参数处理逻辑 - 修改token过期判断条件 - 使用window.location替代uni.reLaunch进行页面刷新
This commit is contained in:
parent
cd93d6d06d
commit
586d9c062d
|
|
@ -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();
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
}
|
||||
return statusBarHeight;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue