MrShi
昨天 00a7a61df86db969f2ba61c508d02ba4709ce3d4
app/utils/http.interceptor.js
@@ -1,6 +1,13 @@
const install = (Vue, vm) => {
   let arr = [
      'web/driverInfo/updateLocation',
      'web/driverInfo/activeOrderCount'
   ]
   // 请求拦截器
   uni.$u.http.interceptors.request.use((config) => {
      if (!arr.includes(config.url)) {
         uni.showLoading({ title: '加载中' });
      }
      const Headtoken = vm.$store.state.token
      // 判断有无token,有则加入请求头中
      if (Headtoken) {
@@ -13,7 +20,9 @@
   
   // 响应拦截器
   uni.$u.http.interceptors.response.use((response) => {
      // console.log(response)
      if (!arr.includes(response.config.url)) {
         uni.hideLoading();
      }
      // 未登录/登录过期
      if ([5112, 5113].includes(response.data.code)) {
         vm.$store.commit('clearAll')