去掉登录页

This commit is contained in:
zhouyanli
2026-08-04 08:40:57 +08:00
parent cc43bcd0e7
commit 4d038dbaf9
3 changed files with 56 additions and 148 deletions

View File

@@ -3,7 +3,7 @@ if (process.env.NODE_ENV === 'development') {
// baseUrl = 'https://wuyeapi.ckdzkj.com'; // 开发环境
baseUrl = "http://192.168.1.222:8080"
} else {
baseUrl = 'https://wuyeapi.bugtc.com'; // 生产环境
baseUrl = 'https://wuyeapi.ckdzkj.com'; // 生产环境
}
/**
@@ -42,21 +42,10 @@ export default function request(url, data = {}, method = "GET") {
const resData = res.data || {};
// token 过期 — 清除登录态,提示用户,但不强制跳转(用户可继续浏览非敏感页面)
// token 过期 — 静默清除登录态,不强制跳转登录页
if (resData.code === 401) {
uni.showToast({ title: '登录已过期,请重新登录', icon: 'none', duration: 2000 });
uni.removeStorageSync('token');
uni.removeStorageSync('userId');
// 使用 navigateTo 而非 reLaunch,用户可通过返回按钮退出登录页
setTimeout(() => {
uni.navigateTo({
url: '/pageSubPack/loginSub/pwd-login',
fail: () => {
// 如果 navigateTo 失败(如页面栈满),则用 reLaunch
uni.reLaunch({ url: '/pageSubPack/loginSub/pwd-login' });
}
});
}, 1500);
reject({ msg: '登录过期', code: 401 });
return;
}