Commit bc36244f2534cd905667d804b96a0077b79b717a

Authored by yvan.ni
1 parent 6e1a4f66

更换手机的点击打转转优化

packageB/pages/user/Change_phone/Change_phone.js
@@ -21,6 +21,9 @@ Page({ @@ -21,6 +21,9 @@ Page({
21 code: "", //验证码 21 code: "", //验证码
22 change_phone: "", //新手机号码 22 change_phone: "", //新手机号码
23 send: 1, //发送类型 23 send: 1, //发送类型
  24 +
  25 + changing:0
  26 +
24 }, 27 },
25 /** 28 /**
26 * 生命周期函数--监听页面加载 29 * 生命周期函数--监听页面加载
@@ -127,6 +130,11 @@ Page({ @@ -127,6 +130,11 @@ Page({
127 } 130 }
128 }, 131 },
129 change_phone: function() { 132 change_phone: function() {
  133 +
  134 + if(this.data.changing) return false;
  135 + this.data.changing=1;
  136 +
  137 +
130 var th = this; 138 var th = this;
131 var code = th.data.code; 139 var code = th.data.code;
132 var mobile = th.data.mobile; 140 var mobile = th.data.mobile;
@@ -136,19 +144,27 @@ Page({ @@ -136,19 +144,27 @@ Page({
136 } 144 }
137 145
138 if(!change_phone){ 146 if(!change_phone){
  147 + this.data.changing=0;
139 return getApp().my_warnning("请输入手机号", 0, th); 148 return getApp().my_warnning("请输入手机号", 0, th);
140 } 149 }
141 150
142 var ob=util.check_mobile(change_phone); 151 var ob=util.check_mobile(change_phone);
143 if(ob.code==-1){ 152 if(ob.code==-1){
  153 + this.data.changing=0;
144 return getApp().my_warnning(ob.title, 0, th); 154 return getApp().my_warnning(ob.title, 0, th);
145 } 155 }
146 156
147 if(!code){ 157 if(!code){
  158 + this.data.changing=0;
148 return getApp().my_warnning("请输入验证码", 0, th); 159 return getApp().my_warnning("请输入验证码", 0, th);
149 } 160 }
  161 +
  162 + wx.showLoading();
150 getApp().request.put("/api/weshop/users/updateMobile/" + r.stoid + '/' + o.user_id + '/' + code + '/' + mobile, { 163 getApp().request.put("/api/weshop/users/updateMobile/" + r.stoid + '/' + o.user_id + '/' + code + '/' + mobile, {
151 success: function(res) { 164 success: function(res) {
  165 + th.data.changing=0;
  166 + wx.hideLoading();
  167 +
152 if (res.data.code == 0) { 168 if (res.data.code == 0) {
153 var url = "/packageG/pages/user/userinfo/userinfo?change_phone" + change_phone 169 var url = "/packageG/pages/user/userinfo/userinfo?change_phone" + change_phone
154 getApp().globalData.userInfo.mobile = mobile; 170 getApp().globalData.userInfo.mobile = mobile;