doum
2025-08-19 c2cb12bcd295512de34023fd3b0943fc8ab75f34
h5/utils/http.interceptor.js
@@ -16,7 +16,7 @@
         Headtoken = vm.$store.state.userInfo.token
      }
      if (Headtoken) {
         config.header['web_token'] = Headtoken;
         config.header['web-token'] = Headtoken;
      }
      return config
   }, config => {
@@ -25,6 +25,8 @@
   
   // 响应拦截器
   uni.$u.http.interceptors.response.use((response) => {
      console.log(location.href.split('#')[1])
      let pageUrl = location.href.split('#')[1]
      uni.hideLoading();
      // 登录过期
      if (response.data.code === 5112) {
@@ -34,22 +36,15 @@
            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`
                  let loc_href = encodeURIComponent("https://lkshereporting.unilever-china.com/lianhelihua_web/")
                  let corpId = 'ww08b163f924524474';
                  let agentId = '1000165';
                  let wxUrl = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${corpId}&redirect_uri=${loc_href}&response_type=code&scope=snsapi_base&state=p_${pageUrl}#wechat_redirect`
                  location.href = wxUrl;
               }, 1500)
            }
         })
         return
      }
      if (response.data.code !== 200) {
         uni.showToast({
            title: response.data.message || response.data.msg,
            icon: "none",
            duration: 2000
         });
      }
      if (response.data.message) {
         const tm = response.data.message
@@ -62,6 +57,13 @@
           response.data.message = msg
         }
      }
      if (response.data.code !== 200) {
         uni.showToast({
            title: response.data.message || response.data.msg,
            icon: "none",
            duration: 2000
         });
      }
      return response.data;
   }, (response) => {
      return Promise.reject(response)