Commit a8d5817a0eaae21f62aef99dc2e49c0448fb5df8
1 parent
69e7d5ef
修改更换手机js
Showing
1 changed file
with
22 additions
and
20 deletions
pages/user/Change_phone/Change_phone.js
@@ -12,7 +12,7 @@ Page({ | @@ -12,7 +12,7 @@ Page({ | ||
12 | data: { | 12 | data: { |
13 | iurl: r.imghost, | 13 | iurl: r.imghost, |
14 | inputxphone: 0, | 14 | inputxphone: 0, |
15 | - mobile: 17359580658, //旧手机号码 | 15 | + mobile: null, //旧手机号码 |
16 | currentTime: "", //验证码发送倒计时 | 16 | currentTime: "", //验证码发送倒计时 |
17 | getvcode: "获取验证码", | 17 | getvcode: "获取验证码", |
18 | wxopenid: "2", | 18 | wxopenid: "2", |
@@ -26,8 +26,7 @@ Page({ | @@ -26,8 +26,7 @@ Page({ | ||
26 | */ | 26 | */ |
27 | onLoad: function(options) { | 27 | onLoad: function(options) { |
28 | this.setData({ | 28 | this.setData({ |
29 | - // mobile: options.mobile, | ||
30 | - //wxOpneId: options.openid | 29 | + mobile: options.mobile |
31 | }) | 30 | }) |
32 | }, | 31 | }, |
33 | //获取手机验证码 | 32 | //获取手机验证码 |
@@ -37,7 +36,6 @@ Page({ | @@ -37,7 +36,6 @@ Page({ | ||
37 | var wxopenid = th.data.wxopenid; | 36 | var wxopenid = th.data.wxopenid; |
38 | var change_phone = th.data.change_phone; | 37 | var change_phone = th.data.change_phone; |
39 | var isver = th.data.isver; | 38 | var isver = th.data.isver; |
40 | - console.log("iiiiiiiiiiiiii" + change_phone + mobile); | ||
41 | var myreg = /^(((13[0-9]{1})|(15[0-9]{1})|(18[0-9]{1})|(17[0-9]{1}))+\d{8})$/; | 39 | var myreg = /^(((13[0-9]{1})|(15[0-9]{1})|(18[0-9]{1})|(17[0-9]{1}))+\d{8})$/; |
42 | if (mobile.length < 11) { | 40 | if (mobile.length < 11) { |
43 | getApp().my_warnning("请输入11位的手机号码", 0, th); | 41 | getApp().my_warnning("请输入11位的手机号码", 0, th); |
@@ -103,21 +101,25 @@ Page({ | @@ -103,21 +101,25 @@ Page({ | ||
103 | var th = this; | 101 | var th = this; |
104 | var code = th.data.code; | 102 | var code = th.data.code; |
105 | var mobile = th.data.mobile; | 103 | var mobile = th.data.mobile; |
106 | - if (th.ver_code() == false) return false; | ||
107 | - getApp().request.put("/api/weshop/users/updateMobile/" + r.stoid + '/' + o.user_id + '/' + code + '/' + mobile, { | ||
108 | - success: function(res) { | ||
109 | - if (res.data.code == 0) { | ||
110 | - getApp().my_warnning("更换成功", 0, th); | ||
111 | - // th.setData({ | ||
112 | - // url: "/pages/user/userinfo/userinfo?change_phone" + change_phone | ||
113 | - // }) | ||
114 | - } else { | ||
115 | - getApp().my_warnning("更换失败", 0, th); | ||
116 | - return false; | ||
117 | - } | ||
118 | - } | ||
119 | - }) | 104 | + var change_phone = th.data.change_phone; |
105 | + if (change_phone.length > 1) { | ||
106 | + mobile = change_phone | ||
107 | + } | ||
108 | + getApp().request.put("/api/weshop/users/updateMobile/" + r.stoid + '/' + o.user_id + '/' + code + '/' + mobile, { | ||
109 | + success: function(res) { | ||
110 | + if (res.data.code == 0) { | ||
111 | + getApp().my_warnning("更换成功", 0, th); | ||
112 | + // th.setData({ | ||
113 | + // url: "/pages/user/userinfo/userinfo?change_phone" + change_phone | ||
114 | + // }) | ||
115 | + } else { | ||
116 | + getApp().my_warnning("更换失败", 0, th); | ||
117 | + return false; | ||
118 | + } | ||
120 | 119 | ||
120 | + } | ||
121 | + }) | ||
122 | + | ||
121 | }, | 123 | }, |
122 | //判断验证码是否正确 | 124 | //判断验证码是否正确 |
123 | ver_code: function(e) { | 125 | ver_code: function(e) { |
@@ -130,10 +132,10 @@ Page({ | @@ -130,10 +132,10 @@ Page({ | ||
130 | if (code.length < 3 && code == "") { | 132 | if (code.length < 3 && code == "") { |
131 | getApp().my_warnning("请输入正确的验证码", 0, th); | 133 | getApp().my_warnning("请输入正确的验证码", 0, th); |
132 | return false; | 134 | return false; |
133 | - } else if (getvcode.length<3){ | 135 | + } else if (getvcode.length < 3) { |
134 | getApp().my_warnning("验证超时", 0, th); | 136 | getApp().my_warnning("验证超时", 0, th); |
135 | return false; | 137 | return false; |
136 | - }else { | 138 | + } else { |
137 | getApp().request.put("/api/weshop/users/updateMobileFirst/" + r.stoid + '/' + o.user_id + '/' + code, { | 139 | getApp().request.put("/api/weshop/users/updateMobileFirst/" + r.stoid + '/' + o.user_id + '/' + code, { |
138 | success: function(res) { | 140 | success: function(res) { |
139 | if (res.data.code == 0) { | 141 | if (res.data.code == 0) { |