|
|
|
@ -36,19 +36,10 @@ Component({ |
|
|
|
// resume的处理;
|
|
|
|
onRestart: function () { |
|
|
|
if (!this.data.firstShow) { |
|
|
|
this.setData({ |
|
|
|
height: (app.globalData.safeFragmentHeight + app.globalData.statusBarHeight - 100), |
|
|
|
CustomBar: app.globalData.CustomBar, |
|
|
|
userInfo: app.globalData.userInfo |
|
|
|
}) |
|
|
|
if (app.globalData.userInfo && app.globalData.userInfo.memberExpiredAt) { |
|
|
|
this.setData({ |
|
|
|
'userInfo.memberExpiredAt': app.globalData.userInfo.memberExpiredAt, |
|
|
|
userName: app.globalData.userInfo.realName || app.globalData.userInfo.nickname || '' |
|
|
|
}) |
|
|
|
} |
|
|
|
this.handUserInfo() |
|
|
|
this.fetchUserInfo() |
|
|
|
} |
|
|
|
this.fetchUserInfo() |
|
|
|
this.fetchOrtherInfo() |
|
|
|
this.data.firstShow = true |
|
|
|
}, |
|
|
|
onEvent: function (message) { |
|
|
|
@ -60,39 +51,13 @@ Component({ |
|
|
|
messageNumber: 0, |
|
|
|
avatarUrl: '/assets/myinfo/user-icon.png' |
|
|
|
}) |
|
|
|
this.fetchUserInfo() |
|
|
|
} |
|
|
|
}, |
|
|
|
fetchUserInfo: function () { |
|
|
|
fetchOrtherInfo: function(){ |
|
|
|
if (!app.globalData.token) { |
|
|
|
return |
|
|
|
} |
|
|
|
getBaseInfo().then(result => { |
|
|
|
app.globalData.userInfo = result.data |
|
|
|
var nickname = '' |
|
|
|
if (app.globalData.userInfo.isAuth) { |
|
|
|
nickname = result.data.realName.substring(0, 14) |
|
|
|
} else if (!util.isEmpty(result.data.nickname)) { |
|
|
|
nickname = result.data.nickname.substring(0, 14) |
|
|
|
} else if (!util.isEmpty(result.data.realName)) { |
|
|
|
nickname = result.data.realName.substring(0, 14) |
|
|
|
} |
|
|
|
app.globalData.userInfo.userName = nickname |
|
|
|
if (!util.isEmpty(result.data.avatarUrl)) { |
|
|
|
app.globalData.userInfo.avatarUrl = result.data.avatarUrl |
|
|
|
} |
|
|
|
app.globalData.userInfo.isVIP = result.data.isVIP |
|
|
|
app.globalData.userInfo.hasStore = result.data.hasStore |
|
|
|
this.setData({ |
|
|
|
avatarUrl: app.globalData.userInfo.avatarUrl, |
|
|
|
userInfo: app.globalData.userInfo, |
|
|
|
userName: nickname |
|
|
|
}) |
|
|
|
if (this.data.userInfo.isVIP == 1) { |
|
|
|
this.setData({ |
|
|
|
'userInfo.memberExpiredAt': util.formatDate(new Date(app.globalData.userInfo.memberExpiredAt.replace(/\-/g, "/")), 'Y-M-D') |
|
|
|
}) |
|
|
|
} |
|
|
|
}) |
|
|
|
getBalanceInfo().then(result => { |
|
|
|
this.setData({ |
|
|
|
accountMoney: math.minus(result.data.accountMoney, result.data.frozenMoney), |
|
|
|
@ -105,6 +70,34 @@ Component({ |
|
|
|
}) |
|
|
|
}) |
|
|
|
}, |
|
|
|
handUserInfo: function(){ |
|
|
|
var nickname = '' |
|
|
|
if (app.globalData.userInfo.isAuth) { |
|
|
|
nickname = app.globalData.userInfo.realName.substring(0, 14) |
|
|
|
} else if (!util.isEmpty(app.globalData.userInfo.nickname)) { |
|
|
|
nickname =app.globalData.userInfo.nickname.substring(0, 14) |
|
|
|
} else if (!util.isEmpty(app.globalData.userInfo.realName)) { |
|
|
|
nickname = app.globalData.userInfo.realName.substring(0, 14) |
|
|
|
} |
|
|
|
app.globalData.userInfo.userName = nickname |
|
|
|
if (!util.isEmpty(app.globalData.userInfo.avatarUrl)) { |
|
|
|
app.globalData.userInfo.avatarUrl = app.globalData.userInfo.avatarUrl |
|
|
|
} |
|
|
|
if(app.globalData.isVIP == 1 && app.globalData.userInfo.memberExpiredAt){ |
|
|
|
app.globalData.userInfo.memberExpiredAt = util.formatDate(new Date(app.globalData.userInfo.memberExpiredAt.replace(/\-/g, "/")), 'Y-M-D') |
|
|
|
} |
|
|
|
this.setData({ height: (app.globalData.safeFragmentHeight + app.globalData.statusBarHeight - 100), |
|
|
|
CustomBar: app.globalData.CustomBar, avatarUrl: app.globalData.userInfo.avatarUrl, userInfo: app.globalData.userInfo }) |
|
|
|
}, |
|
|
|
fetchUserInfo: function () { |
|
|
|
if (!app.globalData.token) { |
|
|
|
return |
|
|
|
} |
|
|
|
getBaseInfo().then(result => { |
|
|
|
app.globalData.userInfo = result.data |
|
|
|
this.handUserInfo() |
|
|
|
}) |
|
|
|
}, |
|
|
|
toPage: function (e) { |
|
|
|
if (e.currentTarget.id == 'bidding') { |
|
|
|
util.navigateTo('/pages/bidding/index/index') |
|
|
|
|