@ -0,0 +1,147 @@ |
||||
<template> |
||||
<view class="page_css"> |
||||
<view class="container"> |
||||
<betone-header-top :title="title" /> |
||||
<u-form :model="forgotInfo" :rules="rules" ref="forgotForm"> |
||||
<u-form-item prop="mobile" :border-bottom="false" label-position="top" label="手机号" :required="true"> |
||||
<u-input v-model="forgotInfo.mobile" :border="true" placeholder="请输入" /> |
||||
</u-form-item> |
||||
<u-form-item prop="verificationCode" :border-bottom="false" label-position="top" label="验证码" |
||||
:required="true"> |
||||
<betone-new-input v-model="forgotInfo.verificationCode" placeholder="请输入手机6位数验证码" :isSms="true" |
||||
@ch="sendCode" ref="verificationCode" /> |
||||
</u-form-item> |
||||
<u-form-item prop="password" :border-bottom="false" label-position="top" label="密码" :required="true"> |
||||
<u-input v-model="forgotInfo.password" type="password" :border="true" :password-icon="true" /> |
||||
</u-form-item> |
||||
<u-form-item prop="confirmPassword" :border-bottom="false" label-position="top" label="确认密码" |
||||
:required="true"> |
||||
<u-input v-model="forgotInfo.confirmPassword" type="password" :border="true" |
||||
:password-icon="true" /> |
||||
</u-form-item> |
||||
</u-form> |
||||
<u-button class="item-bottom" type="primary" @click="formSubmit()"> |
||||
确定 |
||||
</u-button> |
||||
</view> |
||||
</view> |
||||
</template> |
||||
<script> |
||||
export default { |
||||
|
||||
data() { |
||||
return { |
||||
title: "忘记密码", |
||||
forgotInfo: { |
||||
mobile: '', |
||||
verificationCode: '',//验证码 |
||||
password: "",//密码 |
||||
confirmPassword: '',//确认密码 |
||||
}, |
||||
rules: { |
||||
mobile: [ |
||||
{ |
||||
type: "string", |
||||
required: true, |
||||
message: "请输入手机号", |
||||
trigger: ["blur", "change"], |
||||
}, |
||||
{ |
||||
validator: (rule, value, callback) => { |
||||
return this.$u.test.mobile(value); |
||||
}, |
||||
message: '请输入正确的手机号', |
||||
trigger: ["change", "blur"] |
||||
}, |
||||
], |
||||
password: [ |
||||
{ |
||||
type: "string", |
||||
required: true, |
||||
message: "请输入密码", |
||||
trigger: ["blur", "change"], |
||||
}, |
||||
{ |
||||
min: 8, |
||||
max: 16, |
||||
message: '长度在8-16个字符之间' |
||||
}, |
||||
], |
||||
confirmPassword: [ |
||||
{ |
||||
type: "string", |
||||
required: true, |
||||
message: "请确认密码", |
||||
trigger: ["blur"], |
||||
}, |
||||
{ |
||||
asyncValidator: (rules, value, callback) => { |
||||
if (value != this.forgotInfo.password) { |
||||
callback(new Error('两次密码校验不一致')) |
||||
} |
||||
callback() |
||||
}, |
||||
message: '两次密码校验不一致', |
||||
trigger: ["blur"] |
||||
}, |
||||
], |
||||
verificationCode: { |
||||
type: "string", |
||||
required: true, |
||||
message: "请输入验证码", |
||||
trigger: ["blur", "change"], |
||||
}, |
||||
}, |
||||
} |
||||
}, |
||||
onReady() { |
||||
this.$refs.forgotForm.setRules(this.rules); |
||||
}, |
||||
methods: { |
||||
// 发送验证码 |
||||
sendCode() { |
||||
if (this.registerInfo.phoneNumber == '') { |
||||
uni.$u.toast("请先输入手机号"); |
||||
return false; |
||||
} |
||||
let query = { |
||||
phone: this.registerInfo.phoneNumber |
||||
} |
||||
this.$u.api.sendVerify(query).then(res => { |
||||
if (res.code == 200) { |
||||
this.$refs.verificationCode.sendSuceess() |
||||
} |
||||
}) |
||||
|
||||
}, |
||||
formSubmit() { |
||||
this.$refs.forgotForm.validate(valid => { |
||||
if (valid) { |
||||
console.log('校验通过') |
||||
uni.$u.toast('修改成功,请登录'); |
||||
setTimeout(() => { |
||||
uni.navigateTo({ |
||||
url: "/pages/login/login", |
||||
}); |
||||
}, 1000) |
||||
} else { |
||||
console.log('校验失败') |
||||
} |
||||
}) |
||||
|
||||
|
||||
} |
||||
} |
||||
} |
||||
</script> |
||||
<style lang="scss" scoped> |
||||
.page_css { |
||||
.container { |
||||
padding: 32rpx 64rpx 32rpx 64rpx; |
||||
|
||||
.item-bottom { |
||||
margin-top: 64rpx; |
||||
} |
||||
} |
||||
} |
||||
</style> |
||||
@ -1,65 +0,0 @@ |
||||
<template> |
||||
<view class="page_css"> |
||||
<view class="container"> |
||||
<betone-header-top :title="title" /> |
||||
<u-form labelPosition="left" :model="forgotInfo" :rules="rules" ref="registerForm"> |
||||
<u-form-item prop="businessName" :border-bottom="false" label-position="top" label="手机号"> |
||||
<u-input v-model="forgotInfo.mobile" :border="true" placeholder="请输入" /> |
||||
</u-form-item> |
||||
<u-form-item prop="businessName" :border-bottom="false" label-position="top" label="验证码"> |
||||
|
||||
</u-form-item> |
||||
<u-form-item prop="businessName" :border-bottom="false" label-position="top" label="密码"> |
||||
<u-input v-model="forgotInfo.password" type="password" :border="true" :password-icon="true" /> |
||||
</u-form-item> |
||||
<u-form-item prop="businessName" :border-bottom="false" label-position="top" label="确认密码"> |
||||
<u-input v-model="forgotInfo.confirmPassword" type="password" :border="true" :password-icon="true" /> |
||||
</u-form-item> |
||||
</u-form> |
||||
<!-- <u-button @click="submit">确定</u-button> --> |
||||
</view> |
||||
</view> |
||||
</template> |
||||
<script> |
||||
export default { |
||||
data() { |
||||
return { |
||||
title: "忘记密码", |
||||
forgotInfo: { |
||||
mobile: '', |
||||
verificationCode:'',//验证码 |
||||
password:"",//密码 |
||||
confirmPassword:'',//确认密码 |
||||
}, |
||||
rules: { |
||||
mobile: [ |
||||
{ |
||||
required: true, |
||||
message: '请输入手机号', |
||||
trigger: ['change', 'blur'], |
||||
}, |
||||
{ |
||||
// 自定义验证函数,见上说明 |
||||
validator: (rule, value, callback) => { |
||||
// 上面有说,返回true表示校验通过,返回false表示不通过 |
||||
// this.$u.test.mobile()就是返回true或者false的 |
||||
return this.$u.test.mobile(value); |
||||
}, |
||||
message: '手机号码不正确', |
||||
// 触发器可以同时用blur和change |
||||
trigger: ['change', 'blur'], |
||||
} |
||||
] |
||||
}, |
||||
} |
||||
} |
||||
} |
||||
</script> |
||||
<style lang="scss" scoped> |
||||
.page_css { |
||||
.container { |
||||
padding: 32rpx 64rpx 32rpx 64rpx; |
||||
|
||||
} |
||||
} |
||||
</style> |
||||
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 305 B |
|
Before Width: | Height: | Size: 52 KiB After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 305 B |
|
Before Width: | Height: | Size: 438 B |
|
Before Width: | Height: | Size: 3.0 KiB |
|
Before Width: | Height: | Size: 4.0 KiB |
|
Before Width: | Height: | Size: 509 B |
|
Before Width: | Height: | Size: 741 B |
|
Before Width: | Height: | Size: 4.2 KiB |
|
Before Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 308 B |
|
Before Width: | Height: | Size: 318 B |
|
Before Width: | Height: | Size: 6.4 KiB |
|
Before Width: | Height: | Size: 5.7 KiB |
|
Before Width: | Height: | Size: 704 B |
|
Before Width: | Height: | Size: 2.3 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 761 B |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 452 B After Width: | Height: | Size: 285 B |
|
Before Width: | Height: | Size: 703 B |
|
Before Width: | Height: | Size: 44 KiB |
|
Before Width: | Height: | Size: 6.1 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 903 B |
|
Before Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 636 B |
|
Before Width: | Height: | Size: 386 B |
|
Before Width: | Height: | Size: 871 B |
|
Before Width: | Height: | Size: 877 B |
|
Before Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 600 B |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 464 B |
|
Before Width: | Height: | Size: 599 B |
|
Before Width: | Height: | Size: 748 B |
|
Before Width: | Height: | Size: 309 B |
|
Before Width: | Height: | Size: 3.9 KiB |
|
Before Width: | Height: | Size: 812 B |
|
Before Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 733 B |
|
Before Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 349 B |
|
Before Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 292 B |
|
Before Width: | Height: | Size: 845 B |
|
Before Width: | Height: | Size: 476 B |
|
Before Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 675 B |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 754 B |
|
Before Width: | Height: | Size: 859 B |
|
Before Width: | Height: | Size: 8.1 KiB |
|
Before Width: | Height: | Size: 886 B |
|
Before Width: | Height: | Size: 17 KiB |
|
Before Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 748 B |
|
Before Width: | Height: | Size: 1023 B |
|
Before Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 47 KiB |
|
Before Width: | Height: | Size: 32 KiB |
|
Before Width: | Height: | Size: 32 KiB |
|
Before Width: | Height: | Size: 46 KiB |
|
Before Width: | Height: | Size: 34 KiB |
|
Before Width: | Height: | Size: 4.9 KiB |
|
Before Width: | Height: | Size: 53 KiB |
|
Before Width: | Height: | Size: 32 KiB |
|
Before Width: | Height: | Size: 54 KiB |
|
Before Width: | Height: | Size: 7.6 KiB |
|
Before Width: | Height: | Size: 86 KiB |
|
Before Width: | Height: | Size: 6.9 KiB |