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