Переглянути джерело

始宁农业小程序:修复自定义tabBar

panyong 2 роки тому
батько
коміт
526998d9e9

+ 6 - 0
htmldev/shiningWxMini/pages/home/home.js

@@ -69,7 +69,13 @@ Page({
    * 生命周期函数--监听页面显示
    */
   onShow() {
+    const { shop_status } = app.globalData.userInfo
+
     this.getTabBar().init()
+
+    if (shop_status === 1 && this.getTabBar().data.list.findIndex(item => item.pagePath === 'pages/news/news') === -1) {
+      this.getTabBar().setData({ list: app.globalData.tabBarList })
+    }
   },
 
   /**

+ 6 - 1
htmldev/shiningWxMini/pages/mine/mine.js

@@ -50,12 +50,17 @@ Page({
    * 生命周期函数--监听页面显示
    */
   onShow() {
-    this.getTabBar().init()
+    const { shop_status } = app.globalData.userInfo
 
+    this.getTabBar().init()
     this.setData({
       sessionId: wx.getStorageSync(sessionStorageKey),
       userInfo: app.globalData.userInfo
     })
+
+    if (shop_status === 1 && this.getTabBar().data.list.findIndex(item => item.pagePath === 'pages/news/news') === -1) {
+      this.getTabBar().setData({ list: app.globalData.tabBarList })
+    }
   },
 
   /**

+ 7 - 0
htmldev/shiningWxMini/pages/partner/partner.js

@@ -1,4 +1,5 @@
 const pages = require('../../mixin/pages')
+const app = getApp()
 
 Page({
 
@@ -31,7 +32,13 @@ Page({
    * 生命周期函数--监听页面显示
    */
   onShow() {
+    const { shop_status } = app.globalData.userInfo
+
     this.getTabBar().init()
+
+    if (shop_status === 1 && this.getTabBar().data.list.findIndex(item => item.pagePath === 'pages/news/news') === -1) {
+      this.getTabBar().setData({ list: app.globalData.tabBarList })
+    }
   },
 
   /**