Commit a8d5817a0eaae21f62aef99dc2e49c0448fb5df8

Authored by iceling
1 parent 69e7d5ef

修改更换手机js

pages/user/Change_phone/Change_phone.js
... ... @@ -12,7 +12,7 @@ Page({
12 12 data: {
13 13 iurl: r.imghost,
14 14 inputxphone: 0,
15   - mobile: 17359580658, //旧手机号码
  15 + mobile: null, //旧手机号码
16 16 currentTime: "", //验证码发送倒计时
17 17 getvcode: "获取验证码",
18 18 wxopenid: "2",
... ... @@ -26,8 +26,7 @@ Page({
26 26 */
27 27 onLoad: function(options) {
28 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 36 var wxopenid = th.data.wxopenid;
38 37 var change_phone = th.data.change_phone;
39 38 var isver = th.data.isver;
40   - console.log("iiiiiiiiiiiiii" + change_phone + mobile);
41 39 var myreg = /^(((13[0-9]{1})|(15[0-9]{1})|(18[0-9]{1})|(17[0-9]{1}))+\d{8})$/;
42 40 if (mobile.length < 11) {
43 41 getApp().my_warnning("请输入11位的手机号码", 0, th);
... ... @@ -103,21 +101,25 @@ Page({
103 101 var th = this;
104 102 var code = th.data.code;
105 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 125 ver_code: function(e) {
... ... @@ -130,10 +132,10 @@ Page({
130 132 if (code.length < 3 && code == "") {
131 133 getApp().my_warnning("请输入正确的验证码", 0, th);
132 134 return false;
133   - } else if (getvcode.length<3){
  135 + } else if (getvcode.length < 3) {
134 136 getApp().my_warnning("验证超时", 0, th);
135 137 return false;
136   - }else {
  138 + } else {
137 139 getApp().request.put("/api/weshop/users/updateMobileFirst/" + r.stoid + '/' + o.user_id + '/' + code, {
138 140 success: function(res) {
139 141 if (res.data.code == 0) {
... ...