Browse Source

Merge pull request #290 from John-Hong/John/release-2.19.0/KIP-11805

feat(KIP-11805): Temp Parking Service | 第三方车场无法链接后的前端提示
Tron 1 năm trước cách đây
mục cha
commit
8e962eb409
3 tập tin đã thay đổi với 29 bổ sung15 xóa
  1. 13 0
      src/api/request.js
  2. 1 1
      src/pages/parkingFeeV2/mixins/parkingFee.js
  3. 15 14
      src/routes/index.js

+ 13 - 0
src/api/request.js

@@ -224,7 +224,20 @@ export const createAxiosByinterceptors = (config) => {
       return response.data;
     },
     function (error) {
+      console.error('error.config.url', error.config.url)
       console.log('error', error);
+      // 请求超时
+      if (error.code === 'ECONNABORTED') {
+        let msg = '请求超时,请稍后重试'
+        if(error.config.url.indexOf('parking-lots/lbs') > -1) {
+          msg = '车场连接有问题,请联系服务台!'
+        }
+        const toast = Toast(msg)
+        setTimeout(() => {
+          toast.clear()
+        }, 3000)
+        return Promise.reject(error.code);
+      }
       // 断网
       if (error.code === 'ERR_NETWORK') {
         uni.showToast({ title: '网络连接失败,请重试', duration: 3000, icon: 'fail' });

+ 1 - 1
src/pages/parkingFeeV2/mixins/parkingFee.js

@@ -85,7 +85,7 @@ export default {
     // console.log('二次加载this.$route.query.fromPage', this.$route.query.fromPage, this.$store.state.pageHistory);
     // console.log('二次加载', this.$route.query.fromPage && !this.$store.state.pageHistory[this.$route.query.fromPage]);
     const fromPage = localStorage.getItem(`${this.$route.query.fromPage}`)
-    if (this.$route.query?.fromPage !== 'undefined' && !this.$store.state.pageHistory[this.$route.query.fromPage] && !fromPage) {
+    if (this.$route.query?.fromPage && this.$route.query?.fromPage !== 'undefined' && !this.$store.state.pageHistory[this.$route.query.fromPage] && !fromPage) {
       // console.log(93939);
       this.$store.commit('setPageHistory', {
         [this.$route.query.fromPage]: 1

+ 15 - 14
src/routes/index.js

@@ -245,20 +245,21 @@ const router = new VueRouter({
   ],
 });
 
-router.beforeEach((to, from, next) => {
-  if (from.path.indexOf('wxV2') > -1 && !to.query?.openId) {
-    /* next({
-      path: to.path,
-      query: {
-        ...from.query,
-        ...to.query
-      }
-    }); */
-    next();
-  } else {
-    next();
-  }
-});
+// router.beforeEach((to, from, next) => {
+//   // if (from.path.indexOf('wxV2') > -1 && !to.query?.openId) {
+//   //   /* next({
+//   //     path: to.path,
+//   //     query: {
+//   //       ...from.query,
+//   //       ...to.query
+//   //     }
+//   //   }); */
+//   //   next();
+//   // } else {
+//   //   next();
+//   // }
+//   next();
+// });
 // router.beforeEach((to, from, next) => {
 //   // let pageId = '';
 //   // if (window.location.href.indexOf('pageId') > 0) {