linwenxin 5 ماه پیش
والد
کامیت
2dc482ad60
1فایلهای تغییر یافته به همراه44 افزوده شده و 97 حذف شده
  1. 44 97
      src/common/utils/navPag.js

+ 44 - 97
src/common/utils/navPag.js

@@ -12,125 +12,72 @@ import { goLoginPage } from '@/mixins/index.js'
 import { setStorage, getStorage, removeStorage } from '@/common/utils/storage.js'
 
 export const navToPage = (function () {
-  var gopageid = null
-
-  // 需要拦截的地址
-  var blacklist = ['/packageGoods/pages/order', '/packageMine/pages/myWebsit', '/packageMine/pages/distributorEnter']
-
   return async function (p, goToType = 'navigateTo') {
     var { url, ...data } = p
 
-    if (url && blacklist.find(item => !!~url.indexOf(item))) {
+    if (
+      url &&
+      ![
+        '/pages/index/index',
+        '/pages/workorder/index',
+        '/pages/mine/index',
+        '/packageMine/pages/userinfo',
+        '/packageGoods/pages/order', // 商城
+        '/packageMine/pages/distributorEnter', // 分销员
+        '/packageMine/pages/myWebsit', // 入驻师傅
+        '/packageMine/pages/workerEnter', // 入驻师傅
+        '/packageMine/pages/phone', // 绑定手机号码
+        '/packageEnter/pages/insurance' // 我的保险
+      ].find(item => !!~url.indexOf(item))
+    ) {
+      // 补充手机号判断
       try {
         var userinfo = await getUserInfo()
-        // 补充手机号判断
-
         if (!userinfo.mobile) {
-          uni[goToType]({
-            url: webHref('/packageMine/pages/phone'),
-            ...data
+          uni.showModal({
+            title: '温馨提示',
+            content: '你尚未绑定手机号,请尽快绑定以免影响接单!',
+            cancelText: '取消',
+            confirmText: '去绑定',
+            success: res => {
+              if (res.confirm) {
+                uni[goToType]({
+                  url: webHref('/packageMine/pages/phone'),
+                  ...data
+                })
+              }
+            }
           })
           return
         }
-      } catch (error) {
-        console.log(error)
-      }
-    }
-
-    // 纯h5版本
-    uni[goToType]({
-      url: webHref(url),
-      ...data
-    })
-    return
 
-    // #ifdef H5
-    if (isWeixin()) {
-      wx.miniProgram.getEnv(res => {
-        if (res.miniprogram) {
-          var i = 0
-          ;(function goTo() {
-            if (gopageid) {
-              clearTimeout(gopageid)
-            }
-            i++
-            if (uniWebview && uniWebview[goToType]) {
-              // h5跳转小程序
-              if (getStorage('miniProgram') == 'jsm_env') {
-                // 家盛茂小程序环境
-                uniWebview[goToType]({
-                  ...(() => {
-                    if (url) {
-                      return {
-                        url: url
-                      }
-                    }
-                    return {}
-                  })(),
+        if (userinfo.type !== 'WORKER') {
+          uni.showModal({
+            title: '温馨提示',
+            content: '你尚未入驻网点,请尽快入驻以免影响接单!',
+            cancelText: '取消',
+            confirmText: '去入驻',
+            success: res => {
+              if (res.confirm) {
+                uni[goToType]({
+                  url: webHref('/packageMine/pages/myWebsit'),
                   ...data
                 })
-              } else {
-                // 原生小程序页面
-                var miniProgramPages = []
-                if (!!~miniProgramPages.indexOf(url.split('?')[0])) {
-                  // 第三方小程序跳转我们的h5页面处理
-                  uniWebview[goToType]({
-                    ...(() => {
-                      if (url) {
-                        return {
-                          url: `/pagesJsm/pages/middle?webUrl=${encodeURIComponent(webViewHref(url))}`
-                        }
-                      }
-                      return {}
-                    })(),
-                    ...data
-                  })
-                } else {
-                  // 第三方小程序跳转我们的h5页面处理
-                  uniWebview[goToType]({
-                    ...(() => {
-                      if (url) {
-                        return {
-                          url: `/pagesJsm/pages/webview?webUrl=${encodeURIComponent(webViewHref(url))}`
-                        }
-                      }
-                      return {}
-                    })(),
-                    ...data
-                  })
-                }
               }
-            } else if (i < 10) {
-              gopageid = setTimeout(function () {
-                gopageid = null
-                goTo()
-              }, 200)
             }
-          })()
-        } else {
-          // 当前环境跳转
-          uni[goToType]({
-            url: webHref(url),
-            ...data
           })
+          return
         }
-      })
-    } else {
-      // 当前环境跳转
-      uni[goToType]({
-        url: webHref(url),
-        ...data
-      })
+      } catch (error) {
+        console.log(error)
+      }
     }
-    // #endif
 
-    // #ifndef H5
-    // 当前环境跳转
+    // 纯h5版本
     uni[goToType]({
       url: webHref(url),
       ...data
     })
-    // #endif
   }
 })()