瀏覽代碼

调整用户注册授权逻辑

master
=chenming 5 年之前
父節點
當前提交
c1698741e8
共有 1 個檔案被更改,包括 26 行新增21 行删除
  1. +26
    -21
      laomenkuang_project/pages/register/register.js

+ 26
- 21
laomenkuang_project/pages/register/register.js 查看文件

@@ -154,29 +154,36 @@ Page({
console.log(this.data.minter)
},
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){//点击按钮注册
console.log(e)
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(){//注册接口
if (this.data.yesRegister){
@@ -215,7 +222,7 @@ Page({
wx.setStorageSync('user_phone', e.data.user_phone);
wx.setStorageSync("userInfo", this.data.userInfo)
wx.setStorageSync('state', 1);
app.globalData.userInfo = e.data;
// app.globalData.userInfo = e.data;
this.submitUser();
this.setData({
minter: 60,
@@ -227,9 +234,7 @@ Page({
})
} else {
console.log(5555)
wx.switchTab({
url: '../index/index'
})
wx.navigateBack();
}
} else {
this.data.yesRegister = false;

Loading…
取消
儲存