fix(utils): 移除调试日志并修复导航栏高度计算

refactor(detail): 优化token处理和页面刷新逻辑

- 在新闻详情页添加phone参数处理逻辑
- 修改token过期判断条件
- 使用window.location替代uni.reLaunch进行页面刷新
This commit is contained in:
34701892@qq.com 2025-12-22 11:17:05 +08:00
parent cd93d6d06d
commit 586d9c062d
2 changed files with 16 additions and 13 deletions

View File

@ -125,16 +125,24 @@ onLoad(async (option: any) => {
wxShare(); 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 // time
let shareTime = option?.time || 0; let shareTime = option?.time || 0;
// 24 // 24
if (Date.now() - shareTime > 24 * 60 * 60 * 1000) { if (uni.getStorageSync("token") && Date.now() - shareTime > 24 * 60 * 60 * 1000) {
uni.removeStorageSync("token"); uni.removeStorageSync("token");
// // 1766373354519
uni.reLaunch({ window.location.reload();
url: curPages[curPages.length - 1].route,
});
} }
}); });

View File

@ -81,15 +81,10 @@ export const jumpUrl = (url) => {
window.open(url, "_blank"); window.open(url, "_blank");
}; };
export function getNavHeight() { export function getNavHeight() {
const systemInfo = uni.getSystemInfoSync(); const systemInfo = uni.getSystemInfoSync();
console.log(systemInfo);
const statusBarHeight = systemInfo.statusBarHeight; // 状态栏高度 const statusBarHeight = systemInfo.statusBarHeight; // 状态栏高度
const navigationBarHeight = systemInfo.platform === 'android' ? statusBarHeight + 48 : statusBarHeight + 44; // 通常安卓底部有48px的导航栏iOS是44px const navigationBarHeight = systemInfo.platform === "android" ? statusBarHeight + 48 : statusBarHeight + 44; // 通常安卓底部有48px的导航栏iOS是44px
console.log('状态栏高度:', statusBarHeight);
console.log('导航栏高度:', navigationBarHeight);
return statusBarHeight return statusBarHeight;
}
}