dev
xiaowen 3 years ago
parent 11454e5f45
commit dfd881d215

@ -54,22 +54,16 @@ Component({
let n = this.data.list.findIndex(item => item.pagePath === `${page.route}`); let n = this.data.list.findIndex(item => item.pagePath === `${page.route}`);
if(n === 2) { if(n === 2) {
app.globalData.request({ app.globalData.request({
action: 'getUserMainBrand', action: 'logOpenid',
openid: wx.getStorageSync('openid'),
token: wx.getStorageSync('token') || 't%2BrswgjvzGM=' token: wx.getStorageSync('token') || 't%2BrswgjvzGM='
}).then(res => { }).then(res => {
app.globalData.request({
action: "getUserBrandHome",
brandname: res
}).then(data => {
let brandObj = data[0];
let arr = this.data.list; let arr = this.data.list;
arr[2].selectedIconPath = brandObj.img; arr[2].selectedIconPath = res.brandnImg;
this.setData({ this.setData({
list: arr, list: arr,
selected: n selected: n
}); });
})
}) })
} else { } else {
this.setData({ this.setData({

@ -29,6 +29,12 @@ Page({
dataOption: {} dataOption: {}
}, },
onShow() { onShow() {
if(!wx.getStorageSync('token')) {
wx.navigateTo({
url: '/pages/mine/pages/bindUser/index',
})
return;
}
this.getTabBar().init(); this.getTabBar().init();
this.getBrand().then((res) => { this.getBrand().then((res) => {
let headlBrand = res; let headlBrand = res;
@ -53,13 +59,14 @@ Page({
getBrand() { getBrand() {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
app.globalData.request({ app.globalData.request({
action: 'getUserMainBrand', action: 'logOpenid',
openid: wx.getStorageSync('openid'),
token: wx.getStorageSync('token') || 't%2BrswgjvzGM=' token: wx.getStorageSync('token') || 't%2BrswgjvzGM='
}).then(res => { }).then(res => {
this.setData({ this.setData({
sBrand: res sBrand: res.brandname
}) })
resolve(res) resolve(res.brandname)
}).catch(() => { }).catch(() => {
reject(false) reject(false)
}) })

@ -135,6 +135,7 @@ Page({
let data = err.Data; let data = err.Data;
wx.setStorageSync('token', data.toKen); wx.setStorageSync('token', data.toKen);
wx.setStorageSync('userInfo', data); wx.setStorageSync('userInfo', data);
wx.setStorageSync('openid', this.data.openid);
wx.showModal({ wx.showModal({
title: '提示', title: '提示',
content: '登录成功,但未关注公众号。', content: '登录成功,但未关注公众号。',

Loading…
Cancel
Save