Browse Source

调整用户注册授权逻辑

master
=chenming 5 years ago
parent
commit
c1698741e8
1 changed files with 26 additions and 21 deletions
  1. +26
    -21
      laomenkuang_project/pages/register/register.js

+ 26
- 21
laomenkuang_project/pages/register/register.js View File

console.log(this.data.minter) console.log(this.data.minter)
}, },
submitUser: function () {//提交用户信息 submitUser: function () {//提交用户信息
var params = {
"province": this.data.userInfo.province,
"language": this.data.userInfo.language,
"city": this.data.userInfo.city,
"gender": this.data.userInfo.gender,
"nickname": this.data.userInfo.nickName,
"headimgurl": this.data.userInfo.avatarUrl,
}
app.wxRequest(app.globalData.httpUrl + 'submit', params, e => {
console.log(e)
if (e.code == 200) {

if(this.data.userInfo && this.data.userInfo.province){
var params = {
"province": this.data.userInfo.province,
"language": this.data.userInfo.language,
"city": this.data.userInfo.city,
"gender": this.data.userInfo.gender,
"nickname": this.data.userInfo.nickName,
"headimgurl": this.data.userInfo.avatarUrl,
} }
}, this, "POST")
app.wxRequest(app.globalData.httpUrl + 'submit', params, e => {
console.log(e)
if (e.code == 200) {

}
}, this, "POST")
}
}, },
getUserFn:function(e){//点击按钮注册 getUserFn:function(e){//点击按钮注册
console.log(e) console.log(e)
this.data.userInfo = e.detail.userInfo; this.data.userInfo = e.detail.userInfo;
if (app.globalData.openId) {
this.registerFn();
} else {
app.globalData.openidSuccessFuc = this.registerFn;
if(e.detail.userInfo){
app.globalData.userInfo = e.detail.userInfo
} }
this.registerFn();
// if (app.globalData.openId) {
// } else {
// app.globalData.openidSuccessFuc = this.registerFn;
// }
}, },
registerFn:function(){//注册接口 registerFn:function(){//注册接口
if (this.data.yesRegister){ if (this.data.yesRegister){
wx.setStorageSync('user_phone', e.data.user_phone); wx.setStorageSync('user_phone', e.data.user_phone);
wx.setStorageSync("userInfo", this.data.userInfo) wx.setStorageSync("userInfo", this.data.userInfo)
wx.setStorageSync('state', 1); wx.setStorageSync('state', 1);
app.globalData.userInfo = e.data;
// app.globalData.userInfo = e.data;
this.submitUser(); this.submitUser();
this.setData({ this.setData({
minter: 60, minter: 60,
}) })
} else { } else {
console.log(5555) console.log(5555)
wx.switchTab({
url: '../index/index'
})
wx.navigateBack();
} }
} else { } else {
this.data.yesRegister = false; this.data.yesRegister = false;

Loading…
Cancel
Save