From 79b03cfba202212fc865ad8a9366eae02264e76f Mon Sep 17 00:00:00 2001 From: WindowBird <13870814+windows-bird@user.noreply.gitee.com> Date: Mon, 24 Nov 2025 09:17:44 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=B7=E6=B1=82=E5=99=A8=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- manifest.json | 2 +- utils/request/index.js | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/manifest.json b/manifest.json index e1a7932..b09117d 100644 --- a/manifest.json +++ b/manifest.json @@ -2,7 +2,7 @@ "name" : "OfficeSystem", "appid" : "__UNI__53A0BE0", "description" : "", - "versionName" : "1.0.4", + "versionName" : "1.0.5", "versionCode" : "100", "transformPx" : false, /* 5+App特有相关 */ diff --git a/utils/request/index.js b/utils/request/index.js index 329e31f..365ff70 100644 --- a/utils/request/index.js +++ b/utils/request/index.js @@ -10,8 +10,8 @@ export const Request = () => { // 初始化请求配置 uni.$uv.http.setConfig((config) => { /* config 为默认全局配置*/ - config.baseURL = 'http://192.168.1.4:4001'; /* 根域名 */ - config.baseURL = 'https://pm.ccttiot.com/prod-api'; /* 根域名 */ + config.baseURL = 'http://192.168.1.2:4001'; /* 根域名 */ + // config.baseURL = 'https://pm.ccttiot.com/prod-api'; /* 根域名 */ return config }) @@ -74,7 +74,7 @@ export const Request = () => { const custom = response.config?.custom // 处理 token 过期等情况(根据实际业务调整) - if (data.code === 401 || data.code === 403) { + if (data.code === 401) { // token 过期或无效,清除登录状态 const userStore = useUserStore() userStore.logout() @@ -89,6 +89,15 @@ export const Request = () => { } } + + if (data.code === 403) { + uni.$uv.toast('无权限') + // setTimeout(() => { + // uni.reLaunch({ url: '/pages/login/index' }) + // isRedirectingToLogin = false + // }, 200) + } + if (data.code !== 200) { // 如果没有显式定义custom的toast参数为false的话,默认对报错进行toast弹出提示 if (custom?.toast !== false) {