From dfd881d215a1921f05049d5fe8ffd7b4a4c220f3 Mon Sep 17 00:00:00 2001 From: xiaowen <372193233@qq.com> Date: Mon, 1 Aug 2022 19:10:17 +0800 Subject: [PATCH] cxw-010203 --- custom-tab-bar/index.js | 14 ++++---------- pages/brandCrisis/index.js | 13 ++++++++++--- pages/mine/pages/bindUser/index.js | 1 + 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/custom-tab-bar/index.js b/custom-tab-bar/index.js index 5f73acf..f77d57d 100644 --- a/custom-tab-bar/index.js +++ b/custom-tab-bar/index.js @@ -54,22 +54,16 @@ Component({ let n = this.data.list.findIndex(item => item.pagePath === `${page.route}`); if(n === 2) { app.globalData.request({ - action: 'getUserMainBrand', + action: 'logOpenid', + openid: wx.getStorageSync('openid'), 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; + arr[2].selectedIconPath = res.brandnImg; this.setData({ list: arr, selected: n - }); - }) - + }); }) } else { this.setData({ diff --git a/pages/brandCrisis/index.js b/pages/brandCrisis/index.js index 3f992cd..4fd3b5e 100644 --- a/pages/brandCrisis/index.js +++ b/pages/brandCrisis/index.js @@ -29,6 +29,12 @@ Page({ dataOption: {} }, onShow() { + if(!wx.getStorageSync('token')) { + wx.navigateTo({ + url: '/pages/mine/pages/bindUser/index', + }) + return; + } this.getTabBar().init(); this.getBrand().then((res) => { let headlBrand = res; @@ -53,13 +59,14 @@ Page({ getBrand() { return new Promise((resolve, reject) => { app.globalData.request({ - action: 'getUserMainBrand', + action: 'logOpenid', + openid: wx.getStorageSync('openid'), token: wx.getStorageSync('token') || 't%2BrswgjvzGM=' }).then(res => { this.setData({ - sBrand: res + sBrand: res.brandname }) - resolve(res) + resolve(res.brandname) }).catch(() => { reject(false) }) diff --git a/pages/mine/pages/bindUser/index.js b/pages/mine/pages/bindUser/index.js index 4ef7751..8689c90 100644 --- a/pages/mine/pages/bindUser/index.js +++ b/pages/mine/pages/bindUser/index.js @@ -135,6 +135,7 @@ Page({ let data = err.Data; wx.setStorageSync('token', data.toKen); wx.setStorageSync('userInfo', data); + wx.setStorageSync('openid', this.data.openid); wx.showModal({ title: '提示', content: '登录成功,但未关注公众号。',