From 4107148e5283129a52c2a1fe43dd16e6feae70ac Mon Sep 17 00:00:00 2001
From: dytyqx <1342948614@qq.com>
Date: 星期一, 30 三月 2026 13:54:46 +0800
Subject: [PATCH] Merge branch 'Dev' of http://101.37.171.70:10101/r/~jhz/STUWMS into Dev
---
main.js | 17 +++++++++++++----
1 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/main.js b/main.js
index bc323cd..755b1e0 100644
--- a/main.js
+++ b/main.js
@@ -30,12 +30,21 @@
// uniapp 鍏ㄥ眬璇锋眰鎷︽埅鍣�
uni.addInterceptor('request', {
invoke(args) {
+ // 鑾峰彇鍒板綋鍓嶈皟鐢ㄧ殑椤甸潰
+ const pages = getCurrentPages()
+ const currentPage = pages[pages.length - 1]
+
+ // 鎷垮埌椤甸潰瀹氫箟鐨� modName
+ const modName = currentPage?.$vm.HModName || ''
+
+
// 璇锋眰澶村甫涓� token
let token = uni.getStorageSync('Token')
if (token) {
// 鍏堝垵濮嬪寲锛岄槻姝� undefined 鎶ラ敊
args.header = args.header || {}
args.header.Authorization = `Bearer ${token}`
+ args.header["X-HModName"] = modName
}
},
success(res) {
@@ -43,7 +52,7 @@
if (res.data && res.data.token) {
uni.setStorageSync('Token', res.data.token)
}
-
+
// 401 鑷姩璺崇櫥褰�
if (res.statusCode === 401) {
@@ -51,7 +60,7 @@
uni.showModal({
title: '娓╅Θ鎻愮ず',
content: res.data.Message,
- showCancel:false,
+ showCancel: false,
success: () => {
uni.reLaunch({
url: '/pages/index/login'
@@ -59,12 +68,12 @@
}
})
}
- // 403 杩斿洖涓婁竴涓〉闈�
+ // 403 杩斿洖涓婁竴涓〉闈�
if (res.statusCode === 403) {
uni.showModal({
title: '娓╅Θ鎻愮ず',
content: res.data.Message,
- showCancel:false,
+ showCancel: false,
success: () => {
uni.navigateBack()
}
--
Gitblit v1.9.1