fix: 修复部分Android手机划掉App后token丢失导致强制重新登录
This commit is contained in:
@ -5,12 +5,14 @@ export default {
|
||||
onLaunch() {
|
||||
console.log("生产流转 T1.0.2 启动");
|
||||
|
||||
// 无 Token 跳转登录页
|
||||
const token = uni.getStorageSync("access_token");
|
||||
if (!token) {
|
||||
// 无登录态跳转登录页 — 双重检测防止部分手机划掉App后storage丢失
|
||||
const token = uni.getStorageSync("access_token") || uni.getStorageSync("refresh_token");
|
||||
const user = uni.getStorageSync("user");
|
||||
if (!token && !user) {
|
||||
uni.reLaunch({ url: "/pages/login/login" });
|
||||
return;
|
||||
}
|
||||
// token可能已过期但存在 → 正常启动,让401拦截器自动续期
|
||||
|
||||
// 🚀 OTA 热更新检测(仅 App 端生效)
|
||||
// #ifdef APP-PLUS
|
||||
|
||||
Reference in New Issue
Block a user