mirror of
https://github.com/crmeb/CRMEB.git
synced 2026-10-31 15:00:52 +00:00
update template/xcx/components/authorize/authorize.js.
修改小程序授权获取用户信息
This commit is contained in:
parent
dfc780b20a
commit
155a8b822e
@ -25,11 +25,17 @@ Component({
|
||||
cloneIner: null,
|
||||
loading:false,
|
||||
errorSum:0,
|
||||
errorNum:3
|
||||
errorNum:3,
|
||||
canIUseGetUserProfile: false // 判断是否为最新获取用户信息函数
|
||||
},
|
||||
attached() {
|
||||
this.get_logo_url();
|
||||
this.setAuthStatus();
|
||||
if (wx.getUserProfile) {
|
||||
this.setData({
|
||||
canIUseGetUserProfile: true
|
||||
})
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
close(){
|
||||
@ -82,6 +88,24 @@ Component({
|
||||
}
|
||||
})
|
||||
},
|
||||
// 获取用户信息
|
||||
getUserProfile() {
|
||||
let that = this;
|
||||
wx.showLoading({ title: '正在登录中' });
|
||||
wx.getUserProfile({
|
||||
desc: '用于完善会员资料', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
|
||||
success: (res) => {
|
||||
Util.getCodeLogin((code)=>{
|
||||
let userInfo = res;
|
||||
userInfo.code = code.code;
|
||||
that.getWxUserInfo(userInfo);
|
||||
})
|
||||
},
|
||||
fail: (err) => {
|
||||
wx.hideLoading();
|
||||
}
|
||||
});
|
||||
},
|
||||
//授权
|
||||
setUserInfo(userInfo,isLogin) {
|
||||
let that = this;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user