登录过期自动弹出去登陆
This commit is contained in:
parent
f8ac704956
commit
d4374717eb
|
|
@ -5,7 +5,7 @@ import { getAppId, getTempToken, shouldUseTempToken } from "@/config/dev.js";
|
|||
const ENV_CONFIG = {
|
||||
release: {
|
||||
// 正式版
|
||||
baseUrl: "http://192.168.2.140:4501",
|
||||
baseUrl: "http://192.168.2.158:4501",
|
||||
appId: 1,
|
||||
},
|
||||
};
|
||||
|
|
@ -169,6 +169,21 @@ export function request(options = {}) {
|
|||
|
||||
// 请求成功处理
|
||||
if (res.statusCode === 200) {
|
||||
if (res.data.code === 401) {
|
||||
uni.showModal({
|
||||
title: "登录已过期",
|
||||
content: "请先登录后再进行操作",
|
||||
confirmText: "去登录",
|
||||
cancelText: "取消",
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
uni.navigateTo({
|
||||
url: "/pages/login/login",
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
resolve(res.data);
|
||||
} else {
|
||||
// 处理错误响应
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user