Browse Source

小程序:商品详情接口对接

panyong 2 years ago
parent
commit
77fab11c6a
1 changed files with 8 additions and 5 deletions
  1. 8 5
      htmldev/wxMini/app.js

+ 8 - 5
htmldev/wxMini/app.js

@@ -68,6 +68,9 @@ App({
         if (temp.user_address && temp.user_address.indexOf('/') > -1) {
           temp.user_address = temp.user_address.split('/')
         }
+        if (temp.shop_status === 1) {
+          this.hasPermission()
+        }
         this.globalData.userInfo = temp
       }
     } catch (e) {}
@@ -76,15 +79,15 @@ App({
       this.fetchUserDataCallback()
       this.fetchUserDataCallback = null
     }
-    // this.hasPermission(1)
   },
   // 根据权限配置tabbar
-  hasPermission(role) {
-    if (role === 1) {
-      this.globalData.tabBarList.splice(2, 0, ...this.globalData.asyncTabBarList)
+  hasPermission() {
+    const tabBarList = this.globalData.tabBarList
+    if (tabBarList.findIndex(item => item.text === '农事天地') === -1) {
+      tabBarList.splice(2, 0, ...this.globalData.asyncTabBarList)
 
       if (this.addTabBarList) {
-        this.addTabBarList(this.globalData.tabBarList)
+        this.addTabBarList(tabBarList)
       }
     }
   }