|
|
@ -24,7 +24,7 @@ Page({ |
|
|
|
userInfo:{ |
|
|
|
type:Object, |
|
|
|
value:{} |
|
|
|
}, |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
@ -37,10 +37,20 @@ Page({ |
|
|
|
onShow: function () { |
|
|
|
console.log('啦啦啦') |
|
|
|
this.getUserInfo() |
|
|
|
if (store.hasPhone()) { |
|
|
|
console.log('已经绑定手机号码') |
|
|
|
this.getUserInfo() |
|
|
|
} else { |
|
|
|
console.log('未绑定手机号码') |
|
|
|
wx.redirectTo({ |
|
|
|
url: '/pages/register/index', |
|
|
|
}) |
|
|
|
} |
|
|
|
}, |
|
|
|
isAuthUserInfo () { |
|
|
|
let that = this |
|
|
|
wx.showLoading() |
|
|
|
console.log('未授权') |
|
|
|
return new Promise(resolve => { |
|
|
|
wx.getSetting({ |
|
|
|
success (res) { |
|
|
@ -97,10 +107,9 @@ Page({ |
|
|
|
userModel.getUserInfo(res => { |
|
|
|
let nickName = res.result.nickName |
|
|
|
let avatarUrl = res.result.avatarUrl |
|
|
|
|
|
|
|
if (nickName && avatarUrl){ |
|
|
|
console.log('已授权') |
|
|
|
console.log(res.result) |
|
|
|
let userInfo = res.result |
|
|
|
this.setData({ |
|
|
|
userInfo: res.result, |
|
|
|
avatarUrl: res.result.avatarUrl, |
|
|
@ -110,7 +119,7 @@ Page({ |
|
|
|
store.saveUserInfo({ |
|
|
|
nickName: res.result.nickName, |
|
|
|
avatarUrl: res.result.avatarUrl, |
|
|
|
phone: res.result.phone === null ? '' : res.result.phone |
|
|
|
phone: res.result.phone || '' |
|
|
|
}) |
|
|
|
} else { |
|
|
|
console.log('未授权') |
|
|
@ -137,10 +146,6 @@ Page({ |
|
|
|
wx.navigateTo({ |
|
|
|
url: `/pages/user/${type}/index?userIcon=${this.data.userInfo.avatarUrl}&userName=${this.data.userInfo.nickName}&userPhone=${this.data.userInfo.phone || ''}&company=${this.data.userInfo.company || ''}&position=${this.data.userInfo.position || ''}`, |
|
|
|
}) |
|
|
|
} else { |
|
|
|
wx.navigateTo({ |
|
|
|
url: `/pages/user/${type}/index`, |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
}) |