Commit fc6e6ec9d36eedb2f5f03b165738df6bb92a357d
1 parent
e5028f23
1111
Showing
2 changed files
with
24 additions
and
14 deletions
pages/user/Change_phone/Change_phone.js
| ... | ... | @@ -11,29 +11,38 @@ Page({ |
| 11 | 11 | */ |
| 12 | 12 | data: { |
| 13 | 13 | iurl: r.imghost, |
| 14 | - inputxphone: 1, | |
| 14 | + inputxphone: 0, | |
| 15 | 15 | mobile: null, //旧手机号码 |
| 16 | 16 | currentTime: "", //验证码发送倒计时 |
| 17 | - getvcode: "获取验证码", | |
| 17 | + getvcode: "获取验证码", //显示文字 | |
| 18 | + time_len: 0, //重新获取时长 | |
| 18 | 19 | wxopenid: null, |
| 19 | 20 | isver: 0, //是否有发送验证码 |
| 20 | 21 | code: "", //验证码 |
| 21 | 22 | change_phone: "", //新手机号码 |
| 23 | + send: 1, //发送类型 | |
| 22 | 24 | }, |
| 23 | 25 | /** |
| 24 | 26 | * 生命周期函数--监听页面加载 |
| 25 | 27 | */ |
| 26 | 28 | onLoad: function(options) { |
| 29 | + var th = this; | |
| 27 | 30 | var pages = getCurrentPages(); |
| 28 | - var prevPage = pages[pages.length - 2]; //上一个页面 | |
| 31 | + var prevPage = pages[pages.length - 2]; //上一个页面 | |
| 29 | 32 | //直接调用上一个页面的setData()方法,把数据存到上一个页面中去 |
| 30 | 33 | prevPage.setData({ |
| 31 | 34 | is_zy: 1 |
| 32 | 35 | }) |
| 33 | - this.setData({ | |
| 34 | - mobile: options.mobile, | |
| 35 | - wxopenid: options.openid | |
| 36 | + getApp().getConfig2(function(ee) { | |
| 37 | + var sms_conf = ee.sms_send_type; | |
| 38 | + sms_conf = JSON.parse(sms_conf); | |
| 39 | + th.setData({ | |
| 40 | + mobile: getApp().globalData.userInfo.mobile, | |
| 41 | + wxopenid: getApp().globalData.userInfo.weapp_openid, | |
| 42 | + time_len: sms_conf.time_out | |
| 43 | + }) | |
| 36 | 44 | }) |
| 45 | + | |
| 37 | 46 | }, |
| 38 | 47 | //获取手机验证码 |
| 39 | 48 | Ver_phone: function() { |
| ... | ... | @@ -42,6 +51,7 @@ Page({ |
| 42 | 51 | var wxopenid = th.data.wxopenid; |
| 43 | 52 | var change_phone = th.data.change_phone; |
| 44 | 53 | var isver = th.data.isver; |
| 54 | + var send = th.data.send; | |
| 45 | 55 | var myreg = /^(((13[0-9]{1})|(15[0-9]{1})|(18[0-9]{1})|(17[0-9]{1}))+\d{8})$/; |
| 46 | 56 | if (mobile.length < 11) { |
| 47 | 57 | getApp().my_warnning("请输入11位的手机号码", 0, th); |
| ... | ... | @@ -66,7 +76,7 @@ Page({ |
| 66 | 76 | getApp().request.post("/api/weshop/smslog/sendsms", { |
| 67 | 77 | data: { |
| 68 | 78 | store_id: r.stoid, |
| 69 | - scene: 1, //发送类型(1短信 2语音) | |
| 79 | + scene: send, //发送类型(1短信 2语音) | |
| 70 | 80 | mobile: mobile, |
| 71 | 81 | wxopenid: wxopenid |
| 72 | 82 | }, |
| ... | ... | @@ -74,14 +84,15 @@ Page({ |
| 74 | 84 | if (res.data.code == 0) { |
| 75 | 85 | th.setData({ |
| 76 | 86 | isver: 0, |
| 77 | - getvcode: 60, | |
| 87 | + getvcode: th.data.time_len, | |
| 78 | 88 | currentTime: setInterval(th.gettime, 1000), |
| 89 | + send: 2 | |
| 79 | 90 | }) |
| 80 | 91 | } else { |
| 81 | 92 | getApp().my_warnning(res.data.msg, 0, th); |
| 82 | 93 | th.setData({ |
| 83 | 94 | isver: 0, |
| 84 | - getvcode: "重新获取" | |
| 95 | + getvcode: "重新获取", | |
| 85 | 96 | }) |
| 86 | 97 | return false; |
| 87 | 98 | } |
| ... | ... | @@ -114,9 +125,8 @@ Page({ |
| 114 | 125 | getApp().request.put("/api/weshop/users/updateMobile/" + r.stoid + '/' + o.user_id + '/' + code + '/' + mobile, { |
| 115 | 126 | success: function(res) { |
| 116 | 127 | if (res.data.code == 0) { |
| 117 | - | |
| 118 | - var url="/pages/user/userinfo/userinfo?change_phone" + change_phone | |
| 119 | - console.log("uuuuuuuu",url); | |
| 128 | + var url = "/pages/user/userinfo/userinfo?change_phone" + change_phone | |
| 129 | + getApp().globalData.userInfo.mobile = mobile; | |
| 120 | 130 | getApp().my_warnning("更换成功", 0, th); |
| 121 | 131 | getApp().goto(url); |
| 122 | 132 | ... | ... |
pages/user/userinfo/userinfo.wxml
| ... | ... | @@ -201,11 +201,11 @@ |
| 201 | 201 | </view> |
| 202 | 202 | </view> |
| 203 | 203 | <!-- 确认修改按钮 --> |
| 204 | -<cover-view class="flex-center confirm"> | |
| 204 | +<view class="flex-center confirm"> | |
| 205 | 205 | <view class="flex-center fs30 confirmtext"bindtap="confirm_revision"> |
| 206 | 206 | <view>确认修改</view> |
| 207 | 207 | </view> |
| 208 | -</cover-view> | |
| 208 | +</view> | |
| 209 | 209 | |
| 210 | 210 | <!--弹出层内容,其中的“我知道”中绑定让弹出层消失的函数:bindtap="hide"--> |
| 211 | 211 | <view class="tc_view" hidden='{{tc_hide}}' bindtap='hide_tc'> | ... | ... |