From cfa3037c0b053f5ee262b951e4aceb9a3e519d67 Mon Sep 17 00:00:00 2001 From: xiaowen <372193233@qq.com> Date: Fri, 22 Jul 2022 14:42:27 +0800 Subject: [PATCH] cxw-010203 --- custom-tab-bar/index.js | 29 ++++++++++++++++++++++++++--- custom-tab-bar/index.wxml | 2 +- custom-tab-bar/index.wxss | 8 +++++--- pages/brandCrisis/index.js | 1 + 4 files changed, 33 insertions(+), 7 deletions(-) diff --git a/custom-tab-bar/index.js b/custom-tab-bar/index.js index 831cd10..bdc504b 100644 --- a/custom-tab-bar/index.js +++ b/custom-tab-bar/index.js @@ -1,3 +1,4 @@ +const app = getApp(); Component({ data: { selected: null, //当前选中的tab下标 @@ -51,9 +52,31 @@ Component({ init() { const page = getCurrentPages().pop(); let n = this.data.list.findIndex(item => item.pagePath === `${page.route}`); - this.setData({ - selected: n - }); + if(n === 2) { + app.globalData.request({ + action: 'getUserMainBrand', + token: wx.getStorageSync('token') || 't%2BrswgjvzGM=' + }).then(res => { + app.globalData.request({ + action: "getUserBrandHome", + brandname: res + }).then(data => { + let brandObj = data[0]; + let arr = this.data.list; + arr[2].selectedIconPath = brandObj.img; + this.setData({ + list: arr, + selected: n + }); + }) + + }) + } else { + this.setData({ + selected: n + }); + } + } }, }) \ No newline at end of file diff --git a/custom-tab-bar/index.wxml b/custom-tab-bar/index.wxml index 0091896..ab86092 100644 --- a/custom-tab-bar/index.wxml +++ b/custom-tab-bar/index.wxml @@ -1,7 +1,7 @@ - {{item.text}} + {{item.text}} \ No newline at end of file diff --git a/custom-tab-bar/index.wxss b/custom-tab-bar/index.wxss index 60e0030..a64c859 100644 --- a/custom-tab-bar/index.wxss +++ b/custom-tab-bar/index.wxss @@ -56,17 +56,19 @@ height: 140rpx; bottom: 25.6%; z-index: 100; - border-top-left-radius: 140rpx; - border-top-right-radius: 140rpx; + border-radius: 140rpx; background: #fff; } .tab-bar-item view.diy { margin-top: 90rpx; - background: #fff; width: 100%; height: 100%; padding-top: 58rpx; z-index: 99; + background: #fff; + } + .activeBg { + background: #0579FF; } \ No newline at end of file diff --git a/pages/brandCrisis/index.js b/pages/brandCrisis/index.js index a8d45f0..614cfaf 100644 --- a/pages/brandCrisis/index.js +++ b/pages/brandCrisis/index.js @@ -29,6 +29,7 @@ Page({ dataOption: {} }, onShow() { + this.getTabBar().init(); this.getBrand().then((res) => { let headlBrand = res; this.setData({