Commit 35253f72 by LJM

js

parent 17edccd3
Showing with 125 additions and 15 deletions
......@@ -11,6 +11,7 @@
<text class="tt">{{ item }}</text>
</view>
</view>
<!-- 身份验证 -->
<template v-if="curr == 0">
<view class="input-box mobile row verCenter" style="margin-bottom: 24rpx;">
<view class="picker-box">
......@@ -21,53 +22,162 @@
</view>
</picker>
</view>
<input type="number" placeholder="请输入手机号码" placeholder-style="color:#919399;" class="uni-input" />
<input type="number" placeholder="请输入手机号码" placeholder-style="color:#919399;" class="uni-input" v-model="formParams.account" />
</view>
<view class="input-box verification-code row bothSide verCenter" style="margin-bottom: 24rpx;">
<input type="text" placeholder="请输入图中字符,不区分大小写" placeholder-style="color:#919399;" class="uni-input" />
<image src="https://www.ichunt.com/v3/public/verify" class="pic"></image>
<view class="input-box verification-code row bothSide verCenter" style="margin-bottom: 24rpx;" v-if="verify_flag">
<input type="text" placeholder="请输入图中字符,不区分大小写" placeholder-style="color:#919399;" class="uni-input" v-model="formParams.verify" />
<image :src="url" class="pic" @click="refresh()"></image>
</view>
<view class="input-box code row bothSide verCenter" style="margin-bottom: 40rpx;">
<input type="number" placeholder="请输入短信验证码" placeholder-style="color:#919399;" class="uni-input" />
<text class="code">获取验证码</text>
<input type="number" placeholder="请输入验证码" placeholder-style="color:#919399;" class="uni-input" v-model="formParams.sms_verify" />
<text class="code" @click="countdownChange()" :class="{ disabled: code_disabled }">{{ code_text }}</text>
</view>
<view class="btn row rowCenter verCenter" @click="submit(1)">提交</view>
</template>
<!-- 重置密码 -->
<template v-else-if="curr == 1">
<view class="input-box pwd row bothSide verCenter" style="margin-bottom: 40px;">
<input type="number" placeholder="请输入6-20位数字、字母或符号组合密码" placeholder-style="color:#919399;" class="uni-input" />
<text class="iconfont icon-a-juxingbeifen14"></text>
<template v-if="pwd_flag">
<input type="password" placeholder="请输入6-20位数字、字母或符号组合密码" placeholder-style="color:#919399;" class="uni-input" v-model="formParams.password" />
<text class="iconfont icon-a-juxingbeifen14" @click="pwd_flag = false"></text>
</template>
<template v-else>
<input type="text" placeholder="请输入6-20位数字、字母或符号组合密码" placeholder-style="color:#919399;" class="uni-input" v-model="formParams.password" />
<text class="iconfont icon-juxing" @click="pwd_flag = true"></text>
</template>
</view>
<view class="btn row rowCenter verCenter" @click="submit(2)">提交</view>
</template>
<!-- 完成 -->
<template v-else-if="curr == 2">
<view class="success column rowCenter verCenter">
<image src="../../static/success.png" class="p1"></image>
<text class="success-t1">密码重置成功</text>
<view class="success-btn row rowCenter verCenter">去登录</view>
<navigator class="success-btn row rowCenter verCenter" url="/login" hover-class="none">去登录</navigator>
</view>
</template>
</view>
</template>
<script>
import navElement from '@/components/nav.vue';
import { Ichunt_Api, Api_Url, Code_Url } from '@/util/api.js';
export default {
components: {
navElement
},
data() {
return {
code_text: '获取验证码',
code_disabled: false,
index: 0,
array: ['0086', '00886', '00853', '00852'],
textArr: ['身份验证', '重置密码', '完成'],
curr: 0
verify_flag: false, //是否显示验证码
pwd_flag: true,
curr: 2,
url: Code_Url,
formParams: {
password: '',
sms_verify: '',
account: '',
verify: '',
intl_code: '0086'
}
};
},
onLoad() {},
methods: {
bindPickerChange: function(e) {
console.log('picker发送选择改变,携带值为', e.detail.value);
this.index = e.detail.value;
this.formParams.intl_code = this.array[e.detail.value];
},
/**
* 手机验证码
*/
countdownChange() {
var reg = /^1(3[0-9]|4[01456879]|5[0-35-9]|6[2567]|7[0-8]|8[0-9]|9[0-35-9])\d{8}$/;
if (!this.formParams.account) {
uni.showToast({
title: '请输入手机号',
icon: 'none'
});
return false;
}
if (!reg.test(this.formParams.account)) {
uni.showToast({
title: '手机格式错误',
icon: 'none'
});
return false;
}
this.request(Api_Url + '/public/findsmsverify', 'POST', { mobile: this.formParams.account, verify: this.formParams.verify, intl_code: this.formParams.intl_code, type: 2 }, true, true).then(res => {
if (res.err_code === 0) {
if (!this.code_disabled) {
const countdown = startCountdown({
duration: 60,
onTick: remainingTime => {
this.code_disabled = true;
this.code_text = `重新发送${remainingTime}S`;
},
onComplete: () => {
this.code_disabled = false;
this.code_text = `获取验证码`;
}
});
countdown.start();
}
} else if (res.err_code === 10001 || res.err_code === 10002) {
uni.showModal({
itle: '提示',
content: res.err_msg,
showCancel: false,
success: res => {
if (res.confirm) {
this.verify_flag = true;
this.refresh(); //刷新验证码
} else if (res.cancel) {
}
}
});
} else {
this.verify_flag = false;
uni.showModal({
itle: '提示',
content: res.err_msg,
showCancel: false
});
}
});
},
submit(type) {
this.curr = type;
if (type == 1) {
this.curr = type;
} else if (type == 2) {
this.request(Api_Url + '/reg/changePasswordFromMsg', 'POST', { account: this.formParams.account, password: this.formParams.password, intl_code: this.formParams.intl_code }, true, true).then(res => {
if (res.err_code === 0) {
this.curr = type;
} else if (res.err_code === 10001 || res.err_code === 10002) {
uni.showModal({
itle: '提示',
content: res.err_msg,
showCancel: false,
success: res => {
if (res.confirm) {
this.verify_flag = true;
this.refresh(); //刷新验证码
}
}
});
} else {
this.verify_flag = false;
uni.showModal({
itle: '提示',
content: res.err_msg,
showCancel: false
});
}
});
}
}
}
};
......
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