From 153404ffa0a9c6d23d2c2732b46fa6929e86294f Mon Sep 17 00:00:00 2001
From: k94314517 <8417338+k94314517@user.noreply.gitee.com>
Date: 星期三, 18 六月 2025 13:56:18 +0800
Subject: [PATCH] 111
---
h5/utils/http.interceptor.js | 57 ++++++++++++++++++++++++++++++++++++++++++++-------------
1 files changed, 44 insertions(+), 13 deletions(-)
diff --git a/h5/utils/http.interceptor.js b/h5/utils/http.interceptor.js
index 6d17428..88bc070 100644
--- a/h5/utils/http.interceptor.js
+++ b/h5/utils/http.interceptor.js
@@ -1,14 +1,23 @@
+import { decryptedData } from '@/utils/decryption.js'
const install = (Vue, vm) => {
+ // 鏄惁姝e湪鍒锋柊鐨勬爣璁�
+ let isRefreshing = false
+ // 閲嶈瘯闃熷垪锛屾瘡涓�椤瑰皢鏄竴涓緟鎵ц鐨勫嚱鏁板舰寮�
+ let requests = []
+
// 璇锋眰鎷︽埅鍣�
uni.$u.http.interceptors.request.use((config) => {
- uni.showLoading({
- title: '鍔犺浇涓�',
- mask: true
- });
- // const Headtoken = vm.$store.state.token || ''
- // if (Headtoken) {
- // config.header['eva-auth-token'] = Headtoken;
+ // if (!['mobile/chatLog/unReadMessageNum', 'mobile/Message/messageList'].includes(config.url)) {
+ // uni.showLoading({ title: '璇锋眰涓�' });
// }
+ uni.showLoading({ title: '璇锋眰涓�' });
+ let Headtoken
+ if (vm.$store.state.userInfo) {
+ Headtoken = vm.$store.state.userInfo.token
+ }
+ if (Headtoken) {
+ config.header['web_token'] = Headtoken;
+ }
return config
}, config => {
return Promise.reject(config)
@@ -18,21 +27,43 @@
uni.$u.http.interceptors.response.use((response) => {
uni.hideLoading();
// 鐧诲綍杩囨湡
- if (response.data.code === 401) {
- uni.navigateTo({
- url: '/packageA/loginAgain/loginAgain'
- });
+ if (response.data.code === 5112) {
+ uni.showToast({
+ title: '鐧诲綍杩囨湡锛屾鍦ㄩ噸鏂拌烦杞巿鏉�',
+ icon: 'none',
+ duration: 2000,
+ success() {
+ setTimeout(() => {
+ let loc_href = encodeURIComponent("https://dmtest.ahapp.net/lianhelihua_web/")
+ let corpId = 'wweea8f71b54e3b835';
+ let agentId = '1000095';
+ let wxUrl = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${corpId}&redirect_uri=${loc_href}&response_type=code&scope=snsapi_base&state=#wechat_redirect`
+ location.href = wxUrl;
+ }, 1500)
+ }
+ })
+ return
}
if (response.data.code !== 200) {
uni.showToast({
- title: response.data.message,
+ title: response.data.message || response.data.msg,
icon: "none",
duration: 2000
});
}
+ if (response.data.message) {
+ const tm = response.data.message
+ const list = tm.split(' ')
+ let msg = list[0]
+ if (list.length > 1 && response.data.data) {
+ msg = decryptedData(list[1], list[0])
+ response.data.data = decryptedData(list[1], response.data.data)
+ console.log(response.data.data)
+ response.data.message = msg
+ }
+ }
return response.data;
}, (response) => {
- uni.hideLoading();
return Promise.reject(response)
})
}
--
Gitblit v1.9.3