From 712c080180b9e8511b4e1c26d707882a557b26c7 Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期三, 16 七月 2025 18:26:30 +0800
Subject: [PATCH] 前端
---
h5/utils/http.interceptor.js | 56 ++++++++++----------------------------------------------
1 files changed, 10 insertions(+), 46 deletions(-)
diff --git a/h5/utils/http.interceptor.js b/h5/utils/http.interceptor.js
index 88bc070..363abcb 100644
--- a/h5/utils/http.interceptor.js
+++ b/h5/utils/http.interceptor.js
@@ -1,68 +1,32 @@
-import { decryptedData } from '@/utils/decryption.js'
const install = (Vue, vm) => {
- // 鏄惁姝e湪鍒锋柊鐨勬爣璁�
- let isRefreshing = false
- // 閲嶈瘯闃熷垪锛屾瘡涓�椤瑰皢鏄竴涓緟鎵ц鐨勫嚱鏁板舰寮�
- let requests = []
-
// 璇锋眰鎷︽埅鍣�
uni.$u.http.interceptors.request.use((config) => {
- // 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
- }
+ const Headtoken = vm.$store.state.token
+ // 鍒ゆ柇鏈夋棤token锛屾湁鍒欏姞鍏ヨ姹傚ご涓�
if (Headtoken) {
- config.header['web_token'] = Headtoken;
+ config.header['token'] = Headtoken;
}
- return config
+ return config;
}, config => {
return Promise.reject(config)
})
// 鍝嶅簲鎷︽埅鍣�
uni.$u.http.interceptors.response.use((response) => {
- uni.hideLoading();
- // 鐧诲綍杩囨湡
- 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)
- }
- })
+ if (response.data.code === 5113) {
+ uni.navigateTo({
+ url: '/pages/login/login'
+ });
return
}
if (response.data.code !== 200) {
uni.showToast({
- title: response.data.message || response.data.msg,
+ title: response.data.message,
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;
+ return response.data
}, (response) => {
return Promise.reject(response)
})
--
Gitblit v1.9.3