红绿项目
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

241 lines
6.0 KiB

<template>
<view class="">
<navigation>Reset Password</navigation>
<view class="login-body">
<view class="input-item flex">
<view class="login-sigh flex">
<view class="imgcon">
<image src="../../../static/login/[email protected]" mode=""></image>
</view>
<span class="quhao">+{{areacode}}</span>
</view>
<input type="text" value="" placeholder="mobile number"
placeholder-style="color: #BFC2CCFF;font-size:14px;" v-model="mobile"
@input="btnControl" />
</view>
<view class="input-item flex">
<view class="login-sigh login-sigh2 flex">
<view class="imgcon">
<image src="../../../static/login/[email protected]" mode=""></image>
</view>
</view>
<input class="input_pcod" value="" placeholder="Picture Code"
placeholder-style="color: #BFC2CC;font-size:14px;" v-model="picCode" />
<view class="login-sigh3 flex">
<image :src="imgcodeUrl" mode="scaleToFill" class="img1"></image>
<image src="../../../static/login/[email protected]" mode="" class="img2" @click="getPicCode()">
</image>
</view>
</view>
<view class="input-item flex">
<view class="login-sigh login-sigh2 flex">
<view class="imgcon">
<image src="../../../static/login/[email protected]" mode=""></image>
</view>
</view>
<input value="" placeholder="Verification code"
placeholder-style="color: #BFC2CCFF;font-size:14px;"
v-model="infoCode" />
<view class="wrap">
<u-toast ref="uToast"></u-toast>
<u-verification-code :seconds="seconds" ref="uCode" @change="codeChange"
start-text="OTP" change-text="xs" end-text="OTP"></u-verification-code>
<u-button @tap="getCode" style="color: #954DE3FF; border-radius: 4px;font-size: 15px;width: 20px; height: 24px;line-height: 40px;">{{tips}}</u-button>
</view>
</view>
<view class="input-item flex">
<view class="login-sigh login-sigh2 flex">
<view class="imgcon">
<image src="../../../static/login/[email protected]" mode=""></image>
</view>
</view>
<input type="password" value="" placeholder="new password"
placeholder-style="color: #BFC2CCFF;font-size:14px;"
v-model="newPassword" />
</view>
<button class="login-btn" @click="resetPassword()" :class="btnNum==1?'on':''"
:disabled="btnNum==1?false:true">
Confirm
</button>
</view>
<tab-bar :selectActive="5"></tab-bar>
</view>
</template>
<script>
import api from '@/utils/api'
import utils from '@/utils'
import cont from "@/components/navigation/navigation.vue"
export default {
data() {
return {
tips: 'OTP',
seconds: 60,
mark: 'sms_user_forget_password',
mobile: '',
imgcodeUrl: '',
newPassword: '',
infoCode: '',
picCode: '',
areacode: '',
btnNum: 0,
}
},
onLoad() {
this.getPicCode();
this.areacode = uni.getStorageSync('siteInfo').areaCode;
},
methods: {
codeChange(text) {
this.tips = text;
},
btnControl() {
this.btnNum = 1;
if (this.mobile == '') {
this.btnNum = 0;
}
},
getCode() {
if (this.picCode == '') {
uni.showToast({
title: 'The graphic verification code is empty',
icon: 'none',
duration: 1500
})
return;
}
if (this.mobile == '') {
uni.showToast({
title: 'Please input mobile phone number',
icon: 'none',
duration: 1500
})
return;
}
if (this.$refs.uCode.canGetCode) {
// 模拟向后端请求验证码
uni.showLoading({
title: 'Getting captcha'
})
setTimeout(() => {
uni.hideLoading();
this.$refs.uCode.start();
}, 2000);
this.countryCode = uni.getStorageSync('siteInfo').countryCode
const post = api.sendSmsCode({
"mobile": this.mobile,
"mark": this.mark,
"countryCode": this.countryCode,
"code": this.picCode
})
post.then(res => {
var that = this;
uni.showToast({
title: 'Successfully',
icon: 'none',
duration: 2500
})
this.getPicCode();
})
.catch(e => {
uni.showToast({
title: e,
icon: 'none',
duration: 2500
})
this.getPicCode();
})
} else {
this.$u.toast('Send after the countdown');
}
},
getPicCode() {
this.imgcodeUrl = this.$constant.APP+"/api/home/imgCode?uuid=" + this.$u.guid(20);
},
resetPassword() {
var a = /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{5,19}$/;
if (this.mobile == '') {
uni.showToast({
title: 'Please input mobile phone number',
icon: 'none',
duration: 1500
})
return;
}
if (this.infoCode == '') {
uni.showToast({
title: ' Please enter the SMS verification code',
icon: 'none',
duration: 1500
})
return;
}
if (this.picCode == '') {
uni.showToast({
title: 'Please enter the Graphic verification code',
icon: 'none',
duration: 1500
})
return;
}
if (this.newPassword=='') {
uni.showToast({
title: 'Please enter new Password',
icon: 'none',
duration: 1500
})
return;
}
const post = api.forgotPassword({
'mobile': this.mobile,
'code': this.infoCode,
'newPassword': this.newPassword,
})
post.then(res => {
if (res.errCode == 'SUCCESS') {
uni.showToast({
title: 'Password modified successfully',
icon: 'success',
duration: 1500
})
} else {
uni.showToast({
title: res.errMsg,
icon: '',
duration: 1500
})
}
console.log(res.data);
})
.catch(e => {
uni.showToast({
title: e,
icon: 'none',
duration: 2500
})
})
}
},
}
</script>
<style>
@import './index.css';
</style>