2025-11-07 09:56:20 +08:00
|
|
|
|
<template>
|
2025-11-23 01:01:52 +08:00
|
|
|
|
<view class="set_password_container content_with_back">
|
|
|
|
|
|
<view class="title">重置密码</view>
|
|
|
|
|
|
<u-form class="loginForm commonPage-form" labelPosition="top" :model="formData" :rules="rules" :labelStyle="{
|
2026-01-09 20:22:25 +08:00
|
|
|
|
fontSize: '14px',
|
|
|
|
|
|
marginTop: '20rpx',
|
|
|
|
|
|
minWidth: '200rpx',
|
|
|
|
|
|
}" ref="loginForm">
|
2025-11-23 01:01:52 +08:00
|
|
|
|
<u-form-item label="密码" prop="password">
|
|
|
|
|
|
<u-input v-model="formData.password" border="surround" placeholder="请输入密码" :password="!passwordEying">
|
|
|
|
|
|
<u-icon @click="updateEye('passwordEying')" slot="suffix"
|
|
|
|
|
|
:name="passwordEying ? 'eye-off' : 'eye'"></u-icon>
|
|
|
|
|
|
</u-input>
|
|
|
|
|
|
</u-form-item>
|
|
|
|
|
|
<view class="feild_desc">6~20位,至少包含数字、字母</view>
|
|
|
|
|
|
<u-form-item label="确认密码" prop="confirmPassword">
|
|
|
|
|
|
<u-input v-model="formData.confirmPassword" border="surround" placeholder="请输入密码"
|
|
|
|
|
|
:password="!comfirmEying">
|
|
|
|
|
|
<u-icon @click="updateEye('comfirmEying')" slot="suffix"
|
|
|
|
|
|
:name="comfirmEying ? 'eye-off' : 'eye'"></u-icon>
|
|
|
|
|
|
</u-input>
|
|
|
|
|
|
</u-form-item>
|
|
|
|
|
|
</u-form>
|
|
|
|
|
|
<view class="action_btn">
|
|
|
|
|
|
<u-button type="primary" @click="doNext">
|
|
|
|
|
|
确认修改
|
|
|
|
|
|
</u-button>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
2025-11-07 09:56:20 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
2026-01-01 04:15:30 +08:00
|
|
|
|
import {businessReset} from "@/api/login";
|
|
|
|
|
|
import util from "@/util/index.js"
|
2025-11-23 01:01:52 +08:00
|
|
|
|
export default {
|
|
|
|
|
|
data() {
|
|
|
|
|
|
return {
|
|
|
|
|
|
isRegister: false,
|
|
|
|
|
|
codeValue: "",
|
|
|
|
|
|
userInfo: {
|
2025-11-27 03:55:38 +08:00
|
|
|
|
mobile: "",
|
2025-11-23 01:01:52 +08:00
|
|
|
|
email:"",
|
2025-11-27 03:55:38 +08:00
|
|
|
|
region: "",
|
2025-11-23 01:01:52 +08:00
|
|
|
|
},
|
|
|
|
|
|
formData: {
|
|
|
|
|
|
password: "",
|
|
|
|
|
|
confirmPassword: "",
|
|
|
|
|
|
},
|
|
|
|
|
|
passwordEying: false,
|
|
|
|
|
|
comfirmEying: false,
|
|
|
|
|
|
rules: {
|
|
|
|
|
|
password: [{
|
|
|
|
|
|
type: "string",
|
|
|
|
|
|
required: true,
|
|
|
|
|
|
message: "请输入密码",
|
|
|
|
|
|
trigger: ["blur", "change"],
|
|
|
|
|
|
pattern: /^(?=.*\d)(?=.*[a-zA-Z]).{7,}$/,
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
validator: (rule, value, callback) => {
|
|
|
|
|
|
return value.length >= 6;
|
|
|
|
|
|
},
|
2026-01-09 20:22:25 +08:00
|
|
|
|
message: "密码太过于简单",
|
2025-11-23 01:01:52 +08:00
|
|
|
|
trigger: ["change", "blur"],
|
|
|
|
|
|
},
|
|
|
|
|
|
],
|
|
|
|
|
|
confirmPassword: [{
|
|
|
|
|
|
type: "string",
|
|
|
|
|
|
required: true,
|
|
|
|
|
|
message: "请输入确认密码",
|
|
|
|
|
|
trigger: ["blur", "change"],
|
|
|
|
|
|
pattern: /^(?=.*\d)(?=.*[a-zA-Z]).{7,}$/,
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
validator: (rule, value, callback) => {
|
|
|
|
|
|
return value === this.formData.password;
|
|
|
|
|
|
},
|
|
|
|
|
|
message: "两次密码不一致",
|
|
|
|
|
|
trigger: ["change", "blur"],
|
|
|
|
|
|
},
|
|
|
|
|
|
],
|
|
|
|
|
|
},
|
|
|
|
|
|
};
|
|
|
|
|
|
},
|
|
|
|
|
|
onLoad(options) {
|
|
|
|
|
|
const {
|
|
|
|
|
|
userInfo,
|
|
|
|
|
|
isRegister,
|
|
|
|
|
|
codeValue
|
|
|
|
|
|
} = options;
|
2026-01-01 04:15:30 +08:00
|
|
|
|
this.userInfo = util.aesdecode(userInfo);
|
|
|
|
|
|
this.isRegister = util.parse(isRegister);
|
2025-11-23 01:01:52 +08:00
|
|
|
|
this.codeValue = codeValue;
|
|
|
|
|
|
},
|
|
|
|
|
|
onBackPress() {
|
|
|
|
|
|
return true;
|
|
|
|
|
|
},
|
|
|
|
|
|
methods: {
|
|
|
|
|
|
doNext() {
|
|
|
|
|
|
this.$refs.loginForm.validate().then((valid) => {
|
|
|
|
|
|
if (valid) {
|
|
|
|
|
|
const options = {
|
2025-11-27 03:55:38 +08:00
|
|
|
|
mobile: this.userInfo.mobile,
|
|
|
|
|
|
email: this.userInfo.email,
|
|
|
|
|
|
region: `+${this.userInfo.region}`,
|
2025-11-23 01:01:52 +08:00
|
|
|
|
code: this.codeValue,
|
|
|
|
|
|
password: this.formData.password,
|
2025-11-25 05:36:02 +08:00
|
|
|
|
platform: uni.$u.os(),
|
2025-11-23 01:01:52 +08:00
|
|
|
|
operationID: Date.now() + "",
|
|
|
|
|
|
};
|
|
|
|
|
|
businessReset(options)
|
|
|
|
|
|
.then(() => {
|
|
|
|
|
|
uni.$u.toast("密码重置成功,请前往登录!");
|
2026-01-01 04:15:30 +08:00
|
|
|
|
setTimeout(() => uni.$u.route("/pages/common/login/index"), 1000);
|
2025-11-23 01:01:52 +08:00
|
|
|
|
})
|
|
|
|
|
|
.catch((err) => {
|
|
|
|
|
|
console.log('err', err)
|
|
|
|
|
|
uni.$u.toast("密码重置失败")
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
},
|
|
|
|
|
|
updateEye(key) {
|
|
|
|
|
|
this[key] = !this[key];
|
|
|
|
|
|
},
|
|
|
|
|
|
},
|
|
|
|
|
|
};
|
2025-11-07 09:56:20 +08:00
|
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
2025-11-23 01:01:52 +08:00
|
|
|
|
.set_password_container {
|
|
|
|
|
|
margin-top: var(--status-bar-height);
|
|
|
|
|
|
background: linear-gradient(180deg,
|
|
|
|
|
|
rgba(0, 137, 255, 0.1) 0%,
|
|
|
|
|
|
rgba(255, 255, 255, 0) 100%);
|
|
|
|
|
|
padding-top: 150rpx;
|
2025-11-07 09:56:20 +08:00
|
|
|
|
|
2025-11-23 01:01:52 +08:00
|
|
|
|
.title {
|
|
|
|
|
|
font-size: 34rpx;
|
|
|
|
|
|
font-weight: 600;
|
|
|
|
|
|
margin-bottom: 116rpx;
|
|
|
|
|
|
padding-bottom: 8rpx;
|
|
|
|
|
|
color: $u-primary;
|
|
|
|
|
|
}
|
2025-11-07 09:56:20 +08:00
|
|
|
|
|
2025-11-23 01:01:52 +08:00
|
|
|
|
.feild_desc {
|
|
|
|
|
|
font-size: 24rpx;
|
|
|
|
|
|
color: $u-tips-color;
|
|
|
|
|
|
margin-top: 4rpx;
|
|
|
|
|
|
}
|
2025-11-07 09:56:20 +08:00
|
|
|
|
|
2025-11-23 01:01:52 +08:00
|
|
|
|
.action_btn {
|
|
|
|
|
|
margin-top: 12vh;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
</style>
|