Browse Source

no message

linwenxin 5 tháng trước cách đây
mục cha
commit
0a4665a836
1 tập tin đã thay đổi với 46 bổ sung41 xóa
  1. 46 41
      src/common/utils/navPag.js

+ 46 - 41
src/common/utils/navPag.js

@@ -15,6 +15,36 @@ export const navToPage = (function () {
   return async function (p, goToType = 'navigateTo') {
     var { url, ...data } = p
 
+    var userinfo = await getUserInfo()
+
+    if (
+      url &&
+      ![
+        '/pages/index/index',
+        '/pages/workorder/index',
+        '/pages/mine/index',
+        '/packageMine/pages/userinfo',
+        '/packageMine/pages/phone' // 绑定手机号码
+      ].find(item => !!~url.indexOf(item)) &&
+      !userinfo.mobile
+    ) {
+      uni.showModal({
+        title: '温馨提示',
+        content: '你尚未绑定手机号,请尽快绑定以免影响接单!',
+        cancelText: '取消',
+        confirmText: '去绑定',
+        success: res => {
+          if (res.confirm) {
+            uni[goToType]({
+              url: webHref('/packageMine/pages/phone'),
+              ...data
+            })
+          }
+        }
+      })
+      return
+    }
+
     if (
       url &&
       ![
@@ -28,49 +58,24 @@ export const navToPage = (function () {
         '/packageMine/pages/workerEnter', // 入驻师傅
         '/packageMine/pages/phone', // 绑定手机号码
         '/packageEnter/pages/insurance' // 我的保险
-      ].find(item => !!~url.indexOf(item))
+      ].find(item => !!~url.indexOf(item)) &&
+      userinfo.type !== 'WORKER'
     ) {
-      // 补充手机号判断
-      try {
-        var userinfo = await getUserInfo()
-        if (!userinfo.mobile) {
-          uni.showModal({
-            title: '温馨提示',
-            content: '你尚未绑定手机号,请尽快绑定以免影响接单!',
-            cancelText: '取消',
-            confirmText: '去绑定',
-            success: res => {
-              if (res.confirm) {
-                uni[goToType]({
-                  url: webHref('/packageMine/pages/phone'),
-                  ...data
-                })
-              }
-            }
-          })
-          return
-        }
-
-        if (userinfo.type !== 'WORKER') {
-          uni.showModal({
-            title: '温馨提示',
-            content: '你尚未入驻网点,请尽快入驻以免影响接单!',
-            cancelText: '取消',
-            confirmText: '去入驻',
-            success: res => {
-              if (res.confirm) {
-                uni[goToType]({
-                  url: webHref('/packageMine/pages/myWebsit'),
-                  ...data
-                })
-              }
-            }
-          })
-          return
+      uni.showModal({
+        title: '温馨提示',
+        content: '你尚未入驻网点,请尽快入驻以免影响接单!',
+        cancelText: '取消',
+        confirmText: '去入驻',
+        success: res => {
+          if (res.confirm) {
+            uni[goToType]({
+              url: webHref('/packageMine/pages/myWebsit'),
+              ...data
+            })
+          }
         }
-      } catch (error) {
-        console.log(error)
-      }
+      })
+      return
     }
 
     // 纯h5版本