...
|
...
|
@@ -52,36 +52,41 @@ Page({ |
|
|
});
|
|
|
return Promise.resolve({code: 401, data: [], message: '未登录'});
|
|
|
}
|
|
|
accountModel.getProfile().then((res) => {
|
|
|
let defaultAvatar = '../../static/images/icons/default-avatar.png';
|
|
|
let resUserInfo = res.data || {};
|
|
|
let vip_level = resUserInfo.vip_info.cur_level
|
|
|
let vipImg = this.setVipImg(vip_level)
|
|
|
|
|
|
return Promise.all([
|
|
|
accountModel.getProfile(),
|
|
|
accountModel.getCoinTotal(),
|
|
|
indexModel.experienceCount(),
|
|
|
indexModel.discountCount()
|
|
|
]).then(res => {
|
|
|
let defaultAvatar = '../../static/images/icons/default-avatar.png';
|
|
|
let resUserInfo = res[0].data || {};
|
|
|
let vip_level = resUserInfo.vip_info.cur_level
|
|
|
let vipImg = this.setVipImg(vip_level)
|
|
|
let discountCoupon = res[3].data.couponQty;
|
|
|
let experienceCoupon = res[2].data.couponQty;
|
|
|
|
|
|
this.setData({
|
|
|
notLogin: false,
|
|
|
userInfo: Object.assign({}, this.data.userInfo, app.globalData.userInfo, {
|
|
|
nickName: resUserInfo.nickname,
|
|
|
avatarUrl: resUserInfo.head_ico || defaultAvatar,
|
|
|
phoneNum: resUserInfo.mobile,
|
|
|
defaultAvatar: (resUserInfo.head_ico || defaultAvatar) === defaultAvatar,
|
|
|
growth: resUserInfo.vip_info.cur_growth,
|
|
|
vipImg
|
|
|
}),
|
|
|
coinNum: res[1].data && res[1].data.total || 0,
|
|
|
discountCoupon,
|
|
|
experienceCoupon
|
|
|
});
|
|
|
}).catch({});
|
|
|
|
|
|
this.setData({
|
|
|
notLogin: false,
|
|
|
userInfo: Object.assign({}, this.data.userInfo, app.globalData.userInfo, {
|
|
|
nickName: resUserInfo.nickname,
|
|
|
avatarUrl: resUserInfo.head_ico || defaultAvatar,
|
|
|
phoneNum: resUserInfo.mobile,
|
|
|
defaultAvatar: (resUserInfo.head_ico || defaultAvatar) === defaultAvatar,
|
|
|
growth: resUserInfo.vip_info.cur_growth,
|
|
|
vipImg
|
|
|
})
|
|
|
});
|
|
|
})
|
|
|
accountModel.getCoinTotal().then((res) => {
|
|
|
this.setData({
|
|
|
coinNum: res.data && res.data.total || 0
|
|
|
});
|
|
|
})
|
|
|
indexModel.experienceCount().then((res) => {
|
|
|
let experienceCoupon = res.data.couponQty;
|
|
|
this.setData({
|
|
|
experienceCoupon
|
|
|
});
|
|
|
})
|
|
|
indexModel.discountCount().then((res) => {
|
|
|
let discountCoupon = res.data.couponQty;
|
|
|
this.setData({
|
|
|
discountCoupon
|
|
|
});
|
|
|
})
|
|
|
},
|
|
|
setVipImg: function (e) {
|
|
|
let img = '';
|
...
|
...
|
|