|
|
@@ -60,9 +60,9 @@
|
|
|
return {
|
|
|
title: '个人中心页面',
|
|
|
nowHeight:getApp().globalData.glbalHeight,
|
|
|
- isShowAuthBtn:getApp().globalData.isAuth,
|
|
|
- userName:getApp().globalData.user_name || '阿拉灯神丁',
|
|
|
- userHeadUrl:getApp().globalData.user_headUrl || '../../static/rabotHead.png',
|
|
|
+ isShowAuthBtn:true,
|
|
|
+ userName:getApp().globalData.user_name,
|
|
|
+ userHeadUrl:getApp().globalData.user_headUrl,
|
|
|
userTime:getApp().globalData.times,
|
|
|
userTotalTime:getApp().globalData.total_times
|
|
|
}
|
|
|
@@ -70,7 +70,7 @@
|
|
|
onLoad() {
|
|
|
},
|
|
|
onShow(){
|
|
|
- this.loginUserInfo();
|
|
|
+ this.getUserTimes();
|
|
|
},
|
|
|
methods: {
|
|
|
// 获取用户信息
|
|
|
@@ -87,7 +87,7 @@
|
|
|
this.isShowAuthBtn = true;
|
|
|
}
|
|
|
},
|
|
|
- loginUserInfo(){
|
|
|
+ getUserTimes(){
|
|
|
let that = this;
|
|
|
uni.request({
|
|
|
url:getApp().globalData.shareUrl, //需要设置为全局
|
|
|
@@ -96,12 +96,10 @@
|
|
|
'content-type': 'application/x-www-form-urlencoded'
|
|
|
},
|
|
|
data: {
|
|
|
- method: 'auth',
|
|
|
+ method: 'getUserInfo',
|
|
|
timestamp: getApp().globalData.globalTimestamp, //Date.now()
|
|
|
uid:getApp().globalData.user_id,
|
|
|
- sign: md5('auth' + getApp().globalData.globalTimestamp),
|
|
|
- nickname:getApp().globalData.user_name,
|
|
|
- headimg:getApp().globalData.user_headUrl
|
|
|
+ sign: md5('getUserInfo' + getApp().globalData.globalTimestamp),
|
|
|
},
|
|
|
success: res => {
|
|
|
that.isShowAuthBtn = res.data.msg.isauth === '0';
|
|
|
@@ -112,6 +110,27 @@
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
+ loginUserInfo(){
|
|
|
+ let that = this;
|
|
|
+ uni.request({
|
|
|
+ url:getApp().globalData.shareUrl, //需要设置为全局
|
|
|
+ method: 'POST',
|
|
|
+ header: {
|
|
|
+ 'content-type': 'application/x-www-form-urlencoded'
|
|
|
+ },
|
|
|
+ data: {
|
|
|
+ method: 'auth',
|
|
|
+ timestamp: getApp().globalData.globalTimestamp, //Date.now()
|
|
|
+ uid:getApp().globalData.user_id,
|
|
|
+ sign: md5('auth' + getApp().globalData.globalTimestamp),
|
|
|
+ nickname:getApp().globalData.user_name,
|
|
|
+ headimg:getApp().globalData.user_headUrl
|
|
|
+ },
|
|
|
+ success: res => {
|
|
|
+ console.log('已授权')
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
goMyAskPage(){
|
|
|
uni.navigateBack({
|
|
|
delta:0
|