Commit d333b827 by 施宇

Merge branch 'master' of http://119.23.72.7/shiyu/icsalesProgram

parents 05bd2add ce979932
......@@ -39,60 +39,60 @@ Page({
/**
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
onLoad: function (options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function() {
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function() {
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function() {
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function() {
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function() {
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function() {
onReachBottom: function () {
},
/**
* 获取验证码
*/
getCode: function() {
getCode: function () {
let self = this;
let currentTime = this.data.currentTime;
let interval = setInterval(function() {
let interval = setInterval(function () {
currentTime--;
......@@ -116,7 +116,7 @@ Page({
/**
* 发送验证码
*/
getVerificationCode: function(e) {
getVerificationCode: function (e) {
//验证必填手机号
if (this.data.formData.mobile) {
......@@ -176,7 +176,7 @@ Page({
/**
* 刷新图形验证码
*/
refreshVerification: function() {
refreshVerification: function () {
this.setData({
vcode: true
......@@ -192,7 +192,7 @@ Page({
/**
* 校验字段
*/
bindinputFn: function(e) {
bindinputFn: function (e) {
let value = e.detail.value
let reg_mobile = /^(13[0-9]|14[579]|15[0-3,5-9]|16[6]|17[0135678]|18[0-9]|19[89])\d{8}$/;
let reg_pwd = /^[0-9A-Za-z]{6,}$/;
......@@ -269,7 +269,7 @@ Page({
/**
* 校验字段
*/
calcForm: function(val, type) {
calcForm: function (val, type) {
let mobile = val.mobile;
let code = val.code;
let password = val.password;
......@@ -341,49 +341,50 @@ Page({
/**
*忘记密码
*/
formSubmit: function(e) {
formSubmit: function (e) {
if (this.data.type == 1) {
//第一步
if (this.calcForm(e.detail.value, 1)) {
//第二步
if (this.calcForm(e.detail.value, 2)) {
let params = {
mobile: this.data.formData.mobile,
code: this.data.formData.code,
password: this.data.formData.password
}
http.getData(apis.resetPassword, 'POST', params, (res) => {
if (res.errcode === 0) {
this.setData({
type: 3
});
//注入token
wx.setStorage({
key: "access_token",
data: res.data.access_token
});
this.setData({
type: 2,
btnText: '设置密码'
});
}
//注入用户id
wx.setStorage({
key: "user_id",
data: res.data.user_id
});
} else if (this.data.type == 2) {
//第二步
if (this.calcForm(e.detail.value, 2)) {
let params = {
mobile: this.data.formData.mobile,
code: this.data.formData.code,
password: this.data.formData.password
//登录环信帐号
getApp().getImUser();
} else {
wx.showToast({
title: res.errmsg,
icon: 'none',
duration: 2000
});
this.refreshVerification();
}
});
}
http.getData(apis.resetPassword, 'POST', params, (res) => {
if (res.errcode === 0) {
this.setData({
type: 3
});
} else {
wx.showToast({
title: res.errmsg,
icon: 'none',
duration: 2000
});
this.refreshVerification();
this.setData({
type: 1,
btnText: '下一步'
});
}
});
}
}
......@@ -391,7 +392,7 @@ Page({
/**
* 密码是否可见
*/
toggleFn: function(e) {
toggleFn: function (e) {
if (this.data['visiblePwd']) {
......@@ -409,4 +410,4 @@ Page({
}
}
})
})
\ No newline at end of file
......@@ -12,8 +12,7 @@
<view class="inp-wrap row verCenter {{mobileFlag ? 'inp-error':''}}">
<text class="icon iconfont iconiconxiantiaoshouji21"></text>
<view class="form-item-right row verCenter bothSide">
<input placeholder="请输入手机号" placeholder-class="placeholderClass" name="mobile" type="number" data-type="1"
bindinput='bindinputFn'></input>
<input placeholder="请输入手机号" placeholder-class="placeholderClass" name="mobile" type="number" data-type="1" bindinput='bindinputFn'></input>
<view class="areacode" bindtap="switchPrice">
<text class="tel-value">中国 + 86</text>
<text class="icon iconfont iconbianzu1"></text>
......@@ -38,10 +37,23 @@
<button class="vcode {{disabled ? 'vcode-color':''}}" disabled="{{disabled}}" bindtap="getVerificationCode">{{timeText}}</button>
</view>
</view>
<view class="inp-wrap row verCenter {{passwordFlag ? 'inp-error':''}}">
<text class="icon iconfont iconiconxiantiaoshouji2"></text>
<view class="form-item-right row verCenter bothSide">
<input placeholder="请输入新密码" placeholder-class="placeholderClass" class="pwd" name="password" data-type="4" password='{{passwordType}}' bindinput='bindinputFn'></input>
<block wx:if="{{visiblePwd}}">
<text class="icon iconfont iconiconxiantiaoshouji3 pwd-ico" bindtap="toggleFn"></text>
</block>
<block wx:else>
<text class="icon iconfont iconiconxiantiaoshouji4 pwd-ico" bindtap="toggleFn"></text>
</block>
</view>
</view>
</block>
<block wx:elif="{{type === 2}}">
<view class="inp-wrap row verCenter {{passwordFlag ? 'inp-error':''}}">
<!-- <view class="inp-wrap row verCenter {{passwordFlag ? 'inp-error':''}}">
<text class="icon iconfont iconiconxiantiaoshouji2"></text>
<view class="form-item-right row verCenter bothSide">
<input placeholder="请输入新密码" placeholder-class="placeholderClass" class="pwd" name="password" data-type="4"
......@@ -53,7 +65,7 @@
<text class="icon iconfont iconiconxiantiaoshouji4 pwd-ico" bindtap="toggleFn"></text>
</block>
</view>
</view>
</view> -->
</block>
<block wx:elif="{{type === 3}}">
......@@ -74,7 +86,7 @@
</view>
</view>
<button wx:if="{{type === 1 || type === 2}}" class="register-button" form-type="submit" disabled="{{disabledBtn}}" loading="{{loading}}">{{btnText}}</button>
<button wx:if="{{type === 1 || type === 2}}" class="register-button" form-type="submit" disabled="{{disabledBtn}}" loading="{{loading}}">设置密码</button>
</form>
</view>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment