From d4374717eb4dfa1d286532605303bf70d9a8f489 Mon Sep 17 00:00:00 2001 From: WindowBird <13870814+windows-bird@user.noreply.gitee.com> Date: Mon, 22 Sep 2025 09:51:12 +0800 Subject: [PATCH] =?UTF-8?q?=E7=99=BB=E5=BD=95=E8=BF=87=E6=9C=9F=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E5=BC=B9=E5=87=BA=E5=8E=BB=E7=99=BB=E9=99=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- utils/request.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/utils/request.js b/utils/request.js index 7596707..2e3fdfc 100644 --- a/utils/request.js +++ b/utils/request.js @@ -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 { // 处理错误响应