From a8d5817a0eaae21f62aef99dc2e49c0448fb5df8 Mon Sep 17 00:00:00 2001 From: iceling Date: Tue, 12 Nov 2019 17:43:12 +0800 Subject: [PATCH] 修改更换手机js --- pages/user/Change_phone/Change_phone.js | 42 ++++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/pages/user/Change_phone/Change_phone.js b/pages/user/Change_phone/Change_phone.js index 8882266..e9ff6fe 100644 --- a/pages/user/Change_phone/Change_phone.js +++ b/pages/user/Change_phone/Change_phone.js @@ -12,7 +12,7 @@ Page({ data: { iurl: r.imghost, inputxphone: 0, - mobile: 17359580658, //旧手机号码 + mobile: null, //旧手机号码 currentTime: "", //验证码发送倒计时 getvcode: "获取验证码", wxopenid: "2", @@ -26,8 +26,7 @@ Page({ */ onLoad: function(options) { this.setData({ - // mobile: options.mobile, - //wxOpneId: options.openid + mobile: options.mobile }) }, //获取手机验证码 @@ -37,7 +36,6 @@ Page({ var wxopenid = th.data.wxopenid; var change_phone = th.data.change_phone; var isver = th.data.isver; - console.log("iiiiiiiiiiiiii" + change_phone + mobile); var myreg = /^(((13[0-9]{1})|(15[0-9]{1})|(18[0-9]{1})|(17[0-9]{1}))+\d{8})$/; if (mobile.length < 11) { getApp().my_warnning("请输入11位的手机号码", 0, th); @@ -103,21 +101,25 @@ Page({ var th = this; var code = th.data.code; var mobile = th.data.mobile; - if (th.ver_code() == false) return false; - getApp().request.put("/api/weshop/users/updateMobile/" + r.stoid + '/' + o.user_id + '/' + code + '/' + mobile, { - success: function(res) { - if (res.data.code == 0) { - getApp().my_warnning("更换成功", 0, th); - // th.setData({ - // url: "/pages/user/userinfo/userinfo?change_phone" + change_phone - // }) - } else { - getApp().my_warnning("更换失败", 0, th); - return false; - } - } - }) + var change_phone = th.data.change_phone; + if (change_phone.length > 1) { + mobile = change_phone + } + getApp().request.put("/api/weshop/users/updateMobile/" + r.stoid + '/' + o.user_id + '/' + code + '/' + mobile, { + success: function(res) { + if (res.data.code == 0) { + getApp().my_warnning("更换成功", 0, th); + // th.setData({ + // url: "/pages/user/userinfo/userinfo?change_phone" + change_phone + // }) + } else { + getApp().my_warnning("更换失败", 0, th); + return false; + } + } + }) + }, //判断验证码是否正确 ver_code: function(e) { @@ -130,10 +132,10 @@ Page({ if (code.length < 3 && code == "") { getApp().my_warnning("请输入正确的验证码", 0, th); return false; - } else if (getvcode.length<3){ + } else if (getvcode.length < 3) { getApp().my_warnning("验证超时", 0, th); return false; - }else { + } else { getApp().request.put("/api/weshop/users/updateMobileFirst/" + r.stoid + '/' + o.user_id + '/' + code, { success: function(res) { if (res.data.code == 0) { -- libgit2 0.21.4