From bfd70830b78bc42e0a284baa044efacc29897cd5 Mon Sep 17 00:00:00 2001
From: MrShi <1878285526@qq.com>
Date: 星期二, 28 四月 2026 22:02:46 +0800
Subject: [PATCH] 小程序改bug
---
small-program/utils/http.interceptor.js | 18 ++++++++++++++++--
1 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/small-program/utils/http.interceptor.js b/small-program/utils/http.interceptor.js
index b55252e..e30dbe3 100644
--- a/small-program/utils/http.interceptor.js
+++ b/small-program/utils/http.interceptor.js
@@ -1,11 +1,15 @@
const install = (Vue, vm) => {
// 璇锋眰鎷︽埅鍣�
uni.$u.http.interceptors.request.use((config) => {
- const Headtoken = vm.$store.state.token
uni.showLoading({ title: '鍔犺浇涓�' });
+ let Headtoken = vm.$store.state.token || ''
+ let shopHeadtoken= vm.$store.state.shopToken || ''
// 鍒ゆ柇鏈夋棤token锛屾湁鍒欏姞鍏ヨ姹傚ご涓�
if (Headtoken) {
config.header['token'] = Headtoken;
+ }
+ if (shopHeadtoken) {
+ config.header['shopToken'] = shopHeadtoken;
}
return config;
}, config => {
@@ -15,12 +19,22 @@
// 鍝嶅簲鎷︽埅鍣�
uni.$u.http.interceptors.response.use((response) => {
uni.hideLoading();
- if (response.data.code === 5113) {
+ if (response.data.code === 5113 || response.data.code === 5112) {
+ uni.clearStorageSync("userInfo")
+ uni.clearStorageSync("token")
uni.switchTab({
url: '/pages/index/index'
});
return
}
+ if (response.data.code === 51131|| response.data.code === 51121) {
+ uni.clearStorageSync("shopInfo")
+ uni.clearStorageSync("shopToken")
+ uni.navigateTo({
+ url: '/shop/pages/login/login'
+ });
+ return
+ }
if (response.data.code !== 200) {
uni.showToast({
title: response.data.message,
--
Gitblit v1.9.3