MrShi
19 小时以前 47d56a8b0f22fb15a46b69dfd46fac23560ad2cd
mini-program/utils/http.interceptor.js
@@ -6,7 +6,7 @@
   
   // 请求拦截器
   uni.$u.http.interceptors.request.use((config) => {
      console.log(config)
      // console.log(config)
      if(config.data && config.data.tokenType===1){
         config.header['tokenType'] = config.data.tokenType;
         const HeadShoptoken = vm.$store.state.shopToken 
@@ -34,6 +34,7 @@
   uni.$u.http.interceptors.response.use((response) => {
      // 登录过期
      if ([5111, 5112].includes(response.data.code)) {
         vm.$store.commit('guoqi')
         if (!isRefreshing) {   // 是否已经执行刷新
            isRefreshing = true
            uni.login({
@@ -96,11 +97,14 @@
      }
      // 接口业务报错
      if (response.data.code !== 200) {
         uni.showToast({
            title: response.data.message || response.data.msg,
            icon: "none",
            duration: 2000
         });
         if(!['web/orders/orderPay'].includes(response.config.url)) {
            uni.showToast({
               title: response.data.message || response.data.msg,
               icon: "none",
               mask: true,
               duration: 2000
            });
         }
         return Promise.reject(response)
      }
      return response.data;