|
|
@@ -20,6 +20,7 @@ Page({
|
|
|
imgServerUrl: imgServerUrl,
|
|
|
iphone: '',
|
|
|
yzm: "",
|
|
|
+ disabled: false,
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
@@ -78,36 +79,47 @@ Page({
|
|
|
},
|
|
|
//绑定手机号
|
|
|
phone_login() {
|
|
|
- if (this.data.iphone.length != 11) {
|
|
|
+ var self = this;
|
|
|
+ if (self.data.iphone.length != 11) {
|
|
|
return false;
|
|
|
}
|
|
|
- if (this.data.yzm.length != 6) {
|
|
|
+ if (self.data.yzm.length != 6) {
|
|
|
return false;
|
|
|
}
|
|
|
- var openId = wx.getStorageSync('openId');
|
|
|
- var sessionKey = wx.getStorageSync('sessionKey');
|
|
|
- var unionId = wx.getStorageSync('unionId');
|
|
|
- let paramsObj = {
|
|
|
- phone: this.data.iphone,
|
|
|
- code: this.data.yzm,
|
|
|
- openId: openId,
|
|
|
- unionId: unionId,
|
|
|
- sessionKey: sessionKey
|
|
|
+ if (!self.data.disabled) {
|
|
|
+ self.setData({
|
|
|
+ disabled: true
|
|
|
+ })
|
|
|
+ var openId = wx.getStorageSync('openId');
|
|
|
+ var sessionKey = wx.getStorageSync('sessionKey');
|
|
|
+ var unionId = wx.getStorageSync('unionId');
|
|
|
+ let paramsObj = {
|
|
|
+ phone: self.data.iphone,
|
|
|
+ code: self.data.yzm,
|
|
|
+ openId: openId,
|
|
|
+ unionId: unionId,
|
|
|
+ sessionKey: sessionKey
|
|
|
+ }
|
|
|
+ Object.assign(paramsObj);
|
|
|
+ saveMinaPhone(paramsObj).then(data => {
|
|
|
+ console.log("save", data)
|
|
|
+ wx.setStorageSync("hpuser", data.data.hpUser);
|
|
|
+ wx.setStorageSync("hpMember", data.data.hpMember);
|
|
|
+ wx.setStorageSync("user_id", data.data.hpUser.id);
|
|
|
+ wx.setStorageSync("member_id", data.data.hpMember.id);
|
|
|
+ wx.setStorageSync("user_token", data.data.hpUser.userToken);
|
|
|
+ wx.setStorageSync("phone", data.data.hpUser.phone);
|
|
|
+ showToast("登录成功");
|
|
|
+ setTimeout(function() {
|
|
|
+ wx.navigateBack();
|
|
|
+ }, 500)
|
|
|
+ })
|
|
|
}
|
|
|
- Object.assign(paramsObj);
|
|
|
- saveMinaPhone(paramsObj).then(data => {
|
|
|
- console.log("save", data)
|
|
|
- wx.setStorageSync("hpuser", data.data.hpUser);
|
|
|
- wx.setStorageSync("hpMember", data.data.hpMember);
|
|
|
- wx.setStorageSync("user_id", data.data.hpUser.id);
|
|
|
- wx.setStorageSync("member_id", data.data.hpMember.id);
|
|
|
- wx.setStorageSync("user_token", data.data.hpUser.userToken);
|
|
|
- wx.setStorageSync("phone", data.data.hpUser.phone);
|
|
|
- showToast("登录成功");
|
|
|
- setTimeout(function() {
|
|
|
- wx.navigateBack();
|
|
|
- }, 500)
|
|
|
- })
|
|
|
+ setTimeout(function() {
|
|
|
+ self.setData({
|
|
|
+ disabled: false
|
|
|
+ })
|
|
|
+ }, 1000)
|
|
|
},
|
|
|
|
|
|
})
|