259 lines
7.1 KiB
Vue
259 lines
7.1 KiB
Vue
<template>
|
|
<view class="content">
|
|
<TopSafe></TopSafe>
|
|
<Header :title="topText" />
|
|
<view class="contract-view">
|
|
<view class="mid-box">
|
|
<view class="input-view">
|
|
<u-icon name="phone" style="margin-left:32rpx" size="24"></u-icon>
|
|
<up-input placeholder="请输入手机号" border="surround" v-model="form.mobile" :customStyle="inputCss"></up-input>
|
|
</view>
|
|
<view class="input-view">
|
|
<u-icon name="clock" style="margin-left:32rpx" size="24"></u-icon>
|
|
<up-input placeholder="请输入验证码" border="surround" v-model="form.smsCode" :customStyle="inputCss">
|
|
<template #suffix style="margin-right: 10rpx;">
|
|
<view v-if="countdown" class="code-warp">
|
|
<up-count-down :time="60 * 1000" format="ss" @finish="countdown = false"></up-count-down>
|
|
<text style="margin-left: 10rpx;">s</text>
|
|
</view>
|
|
<view v-else @click="getMobileCode" class="code_msg">
|
|
获取验证码
|
|
<qiaobao-assistant page-key="pages/rwa_package/forgotPass/forgotPass" title="账户登录" />
|
|
</view>
|
|
</template>
|
|
</up-input>
|
|
</view>
|
|
<view class="input-view">
|
|
<u-icon name="lock" style="margin-left:32rpx" size="24"></u-icon>
|
|
<up-input placeholder="请输入密码" border="surround" v-model="form.pass" :customStyle="inputCss"
|
|
:type="loginPasswordIsShow ? 'text' : 'password'">
|
|
<template #suffix style="margin-right: 10rpx;">
|
|
<up-image v-if="loginPasswordIsShow" src="/pages/login_package/static/login/show.png" width="20" height="20" bgColor="#f1f6ff00"
|
|
@click="loginPasswordIsShow = false;"></up-image>
|
|
<up-image v-else src="/pages/login_package/static/login/hidden.png" width="20" height="20" bgColor="#f1f6ff00"
|
|
@click="loginPasswordIsShow = true;"></up-image>
|
|
</template>
|
|
</up-input>
|
|
</view>
|
|
<view class="input-view">
|
|
<u-icon name="lock" style="margin-left:32rpx" size="24"></u-icon>
|
|
<up-input placeholder="请输入密码" border="surround" v-model="form.passOne" :customStyle="inputCss"
|
|
:type="loginPassword2IsShow ? 'text' : 'password'">
|
|
<template #suffix style="margin-right: 10rpx;">
|
|
<up-image v-if="loginPassword2IsShow" src="/pages/login_package/static/login/show.png" width="20" height="20" bgColor="#f1f6ff00"
|
|
@click="loginPassword2IsShow = false;"></up-image>
|
|
<up-image v-else src="/pages/login_package/static/login/hidden.png" width="20" height="20" bgColor="#f1f6ff00"
|
|
@click="loginPassword2IsShow = true;"></up-image>
|
|
</template>
|
|
</up-input>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="bottom-btn">
|
|
<MyBtn @ok="registerFun"></MyBtn>
|
|
</view>
|
|
<up-toast ref="uToastRef"></up-toast>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import { getUserList } from '@/api/common.js';
|
|
import MyBtn from '@/components/common/my-btn.vue'
|
|
import { forgotPassword,forgotPayPassword } from '@/api/auth.js';
|
|
import Header from '@/components/common/header.vue';
|
|
import { clear } from '@/utils/auth.js';
|
|
import TopSafe from '@/components/common/top-safe.nvue'
|
|
import CryptoJS from 'crypto-js';
|
|
|
|
export default {
|
|
components: { Header, TopSafe,MyBtn },
|
|
data() {
|
|
return {
|
|
form:{
|
|
mobile:'',
|
|
smsCode:'',
|
|
pass:'',
|
|
passOne:''
|
|
},
|
|
loginPasswordIsShow:false,
|
|
loginPassword2IsShow:false,
|
|
countdown: false,// 清空倒计时
|
|
inputCss: {
|
|
"height": '80rpx',
|
|
"background": "#F3F3F3FF",
|
|
"border-radius": "30rpx",
|
|
"border": "0rpx",
|
|
"padding-left": "12rpx",
|
|
},
|
|
topText:'',
|
|
type:'1'
|
|
};
|
|
},
|
|
onShow() {
|
|
},
|
|
onLoad(options) {
|
|
if(options.type){
|
|
this.type = options.type;
|
|
this.init();
|
|
}
|
|
},
|
|
methods: {
|
|
init(){
|
|
if(this.type == '1'){
|
|
this.topText = '设置交易密码';
|
|
}else if(this.type == '2'){
|
|
this.topText = '设置登录密码';
|
|
}else if(this.type == '3'){
|
|
this.topText = '找回登录密码';
|
|
}
|
|
},
|
|
async getMobileCode() {
|
|
const form = this.form;
|
|
if (!form.mobile) {
|
|
this.$refs.uToastRef.show({
|
|
type: 'error',
|
|
message: "请输入手机号码",
|
|
});
|
|
return;
|
|
}
|
|
this.countdown = true;
|
|
|
|
const params = {
|
|
mobile: form.mobile,
|
|
type: this.type == '1' ? 'tradepw' : 'passwd'
|
|
}
|
|
const response = await getUserList(params);
|
|
if (response && response.bizcode === 100) {
|
|
this.$refs.uToastRef.show({
|
|
type: 'success',
|
|
message: response.msg,
|
|
});
|
|
} else {
|
|
this.countdown = false;
|
|
}
|
|
},
|
|
registerFun(){
|
|
if (!this.form.mobile) {
|
|
this.$refs.uToastRef.show({
|
|
type: 'error',
|
|
message: "请输入手机号码",
|
|
});
|
|
return;
|
|
}
|
|
if (!this.form.smsCode) {
|
|
this.$refs.uToastRef.show({
|
|
type: 'error',
|
|
message: "请输入验证码",
|
|
});
|
|
return;
|
|
}
|
|
if (!this.form.pass || !this.form.passOne) {
|
|
this.$refs.uToastRef.show({
|
|
type: 'error',
|
|
message: "请输入密码",
|
|
});
|
|
return;
|
|
}
|
|
if (this.form.pass !== this.form.passOne) {
|
|
this.$refs.uToastRef.show({
|
|
type: 'error',
|
|
message: "两次输入的登录密码不一致",
|
|
});
|
|
return;
|
|
}
|
|
let params = {
|
|
verificationCode:this.form.smsCode,
|
|
newPassword:CryptoJS.MD5(this.form.pass).toString(),
|
|
phone:this.form.mobile
|
|
}
|
|
if(this.type == '1'){
|
|
if (this.form.pass.length != 6 || this.form.passOne.length != 6) {
|
|
this.$refs.uToastRef.show({
|
|
type: 'error',
|
|
message: "请输入6位密码",
|
|
});
|
|
return;
|
|
}
|
|
forgotPayPassword(params).then(res=>{
|
|
if(res.bizcode == 100){
|
|
this.$refs.uToastRef.show({
|
|
type: 'success',
|
|
message: "密码设置成功",
|
|
});
|
|
setTimeout(()=>{
|
|
uni.navigateBack();
|
|
},2000)
|
|
//
|
|
}
|
|
})
|
|
}else{
|
|
|
|
forgotPassword(params).then(res=>{
|
|
if(res.bizcode == 100){
|
|
this.$refs.uToastRef.show({
|
|
type: 'success',
|
|
message: "密码设置成功",
|
|
});
|
|
clear();
|
|
setTimeout(()=>{
|
|
uni.redirectTo({
|
|
url: '/pages/login_package/login/login'
|
|
})
|
|
},2000)
|
|
}
|
|
})
|
|
}
|
|
|
|
|
|
},
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.bottom-btn{
|
|
width: 100%;
|
|
margin-bottom:92rpx;
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
padding: 0 32rpx;
|
|
box-sizing: border-box;
|
|
position: relative;
|
|
|
|
}
|
|
.contract-view {
|
|
width: 100%;
|
|
height: calc(100% - 88rpx - 92rpx - 88rpx - var(--status-bar-height));
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
overflow-y: auto;
|
|
padding: 0 32rpx;
|
|
box-sizing: border-box;
|
|
// background-color: #fff;
|
|
.mid-box{
|
|
width:100%;
|
|
border-radius: 16rpx;
|
|
padding: 16rpx 32rpx 48rpx;
|
|
margin-top:32rpx;
|
|
box-sizing: border-box;
|
|
background-color: #fff;
|
|
display: flex;
|
|
flex-direction: column;
|
|
.input-view{
|
|
width:100%;
|
|
height:100rpx;
|
|
background-color: #f5f5f5;
|
|
border-radius: 20rpx;
|
|
margin-top:32rpx;
|
|
display: flex;
|
|
flex-direction: row;
|
|
align-items: center;
|
|
|
|
}
|
|
}
|
|
|
|
}
|
|
</style>
|