/** * @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 uni.reLaunch({ url: '/pages/login/login', }) } } }) } } })()