You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
744 B
29 lines
744 B
/**
|
|
* @description token失效时跳转登录页方法
|
|
* @return { Function }
|
|
*/
|
|
export const httpMessage = (function () {
|
|
let isTp = true
|
|
// 返回一个闭包来保证同时间段的多次请求错误都只弹出一个窗口
|
|
return function (msg) {
|
|
if (isTp) {
|
|
isTp = false
|
|
uni.showModal({
|
|
title: '提示',
|
|
content: msg,
|
|
showCancel: false,
|
|
confirmText: '确定',
|
|
success: (res) =>{
|
|
if (res.confirm) {
|
|
isTp = true;
|
|
let pages = getCurrentPages(); // 设置登录重定向地址,登录完成后跳转回原页面
|
|
getApp().globalData.loginRedirectPage = '/'+ pages[pages.length - 1].route;
|
|
uni.redirectTo({
|
|
url: '/pages/login/login',
|
|
})
|
|
}
|
|
}
|
|
})
|
|
}
|
|
}
|
|
})()
|