From ec0dfdec18cdff004f0499ff39b7b75540125e80 Mon Sep 17 00:00:00 2001 From: weiwei Date: Mon, 12 May 2025 09:40:47 +0800 Subject: [PATCH] =?UTF-8?q?request=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/sheep/utils/request.ts | 34 +++++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/src/sheep/utils/request.ts b/src/sheep/utils/request.ts index 1d32324..a87a3e2 100644 --- a/src/sheep/utils/request.ts +++ b/src/sheep/utils/request.ts @@ -106,6 +106,26 @@ async function handleShLogin(): Promise { uni.showToast({ title: response.msg || "登录失败", icon: "none" }) } return false + + // if (response.data == -1) { + // uni.showToast({ title: "您的设备需要信任验证", icon: "none" }) + + // const pages = getCurrentPages() + // const currentPage = pages[pages.length - 1] + // const route = currentPage.route + // router.jump("/pages/user/deviceVerify", { redirect: route }) + + // return false + // } else { + // uni.removeStorageSync(TOKEN_KEY) + // uni.removeStorageSync(USER_INFO_KEY) + // if (response.msg == "token已失效") { + // uni.showToast({ title: "用户凭证已失效,请退出并重新进入智慧后勤应用", icon: "none", duration: 6000 }) + // } else { + // uni.showToast({ title: response.msg || "登录失败", icon: "none" }) + // } + // return false + // } } } catch (error) { uni.showToast({ title: "登录错误", icon: "none" }) @@ -302,13 +322,13 @@ http.interceptors.response.use( } // 显示错误信息 - // if (error?.data?.msg) { - // uni.showToast({ - // title: error.data.msg, - // icon: "none", - // mask: true, - // }) - // } + if (error?.data?.msg) { + uni.showToast({ + title: error.data.msg, + icon: "none", + mask: true, + }) + } return Promise.resolve(error.data) }, )