Procházet zdrojové kódy

【小昆山官网】忘记密码页面-输入密码格式不对时,点击修改密码报错

master
王饶冀 před 3 roky
rodič
revize
97a1ae91ed

+ 43
- 9
digital-park-web/digital-park/src/views/login/LoginFrom/LoginFrom.vue Zobrazit soubor

v-model="newPassword" v-model="newPassword"
show-password show-password
class="mb-20" class="mb-20"
:class="{'is-error':newPasswordError}"
:class="{'is-error':newPasswordError || newPasswordReg}"
@focus="clearError('newPasswordError')" @focus="clearError('newPasswordError')"
maxlength="16" maxlength="16"
> >
</form> </form>


<div class="is-error-info" v-if="newPasswordError">请输入新密码</div> <div class="is-error-info" v-if="newPasswordError">请输入新密码</div>
<div class="is-error-info" v-if="newPasswordReg">密码只能包含字母、数字且长度需要在8和16之间</div>

<form> <form>
<el-input <el-input
placeholder="请再次输入新密码" placeholder="请再次输入新密码"
show-password show-password
class="mb-20" class="mb-20"
maxlength="16" maxlength="16"
:class="{'is-error':confirmPasswordError}"
:class="{'is-error':confirmPasswordError || confirmPasswordReg}"
@focus="clearError('confirmPasswordError')" @focus="clearError('confirmPasswordError')"
@blur="checkPassword"
> >
<i slot="prefix" class="el-input__icon el-icon-lock"></i> <i slot="prefix" class="el-input__icon el-icon-lock"></i>
</el-input> </el-input>
</form> </form>


<div class="is-error-info" v-if="confirmPasswordError">请输入新密码</div>
<div class="is-error-info" v-if="confirmPasswordError">请再次输入新密码</div>
<div class="is-error-info" v-if="confirmPasswordReg">两次新密码不一致</div>
<div class="verification-code-row mb-20"> <div class="verification-code-row mb-20">
<el-input <el-input
placeholder="请输入图片验证码" placeholder="请输入图片验证码"
// 新密码 // 新密码
newPassword: "", newPassword: "",
newPasswordError: false, newPasswordError: false,
newPasswordReg: false,
// 确认密码 // 确认密码
confirmPassword: "", confirmPassword: "",
confirmPasswordError: false, confirmPasswordError: false,
confirmPasswordReg: false,
// 记住密码 // 记住密码
isRemember: false, isRemember: false,
// 加密码 // 加密码
.then((res) => { .then((res) => {
const data = res.data; const data = res.data;
if (data.status == 0) { if (data.status == 0) {
// 保存用户名 // 保存用户名
setCookie("accountName", accountName.trim()); setCookie("accountName", accountName.trim());
// 判断是否勾选记住密码 // 判断是否勾选记住密码
// 登录成功后的响应 // 登录成功后的响应
loginSuccessFn() { loginSuccessFn() {
let getLoginFrom = localStorage.getItem("loginFrom") || "/"; let getLoginFrom = localStorage.getItem("loginFrom") || "/";
this.$store.dispatch('getUserInfo').then(()=>{
this.$store.dispatch("getUserInfo").then(() => {
this.$router.push(getLoginFrom); this.$router.push(getLoginFrom);
})
});
}, },
// 检测是否通过 // 检测是否通过
checkIsAllow(checkKeyList) { checkIsAllow(checkKeyList) {
this[key] = true; this[key] = true;
flag = false; flag = false;
} }
if (key == "mobilePhoneError" && !/^1\d{10}$/.test(val)) {
this[key] = true;
flag = false;
}
if ( if (
key == "mobilePhoneError" &&
!/^1\d{10}$/.test(val)
key == "newPasswordError" &&
val &&
!/^[A-Za-z0-9]{8,16}$/.test(val)
) { ) {
this[key] = true;
this.newPasswordReg = true;
flag = false; flag = false;
} }
if (
key == "confirmPasswordError" &&
val &&
this.newPassword !== this.confirmPassword
) {
this.confirmPasswordReg = true;
}
return flag; return flag;
}, },
// 清楚错误 // 清楚错误
clearError(key) { clearError(key) {
this[key] = false; this[key] = false;
if (key == "newPasswordError") {
this.newPasswordReg = false;
}
if (key === "confirmPasswordError") {
this.confirmPasswordReg = false;
}
},
checkPassword() {
if (
this.confirmPassword &&
this.newPassword &&
this.newPassword !== this.confirmPassword
) {
this.confirmPasswordReg = true;
}
}, },
// 清除所有错误 // 清除所有错误
clearAllError() { clearAllError() {
this.passwordError = false; this.passwordError = false;
this.newPasswordError = false; this.newPasswordError = false;
this.confirmPasswordError = false; this.confirmPasswordError = false;
this.confirmPasswordReg = false;
this.newPasswordReg = false;
this.imgCodeError = false; this.imgCodeError = false;
this.phoneCodeError = false; this.phoneCodeError = false;
this.mobilePhoneError = false; this.mobilePhoneError = false;

Načítá se…
Zrušit
Uložit