Skip to content

Commit e459244

Browse files
committed
fix: 1.修复【个人中心】页面在英语环境下字段名过长被换行展示导致错位;2.修复【个人中心】页面【修改密码】校验失效。
1 parent a3f2a01 commit e459244

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-9
lines changed

src/views/Profile/components/BasicInfo.vue

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
<template>
2-
<Form ref="formRef" :labelWidth="80" :rules="rules" :schema="schema">
2+
<Form ref="formRef" :labelWidth="200" :rules="rules" :schema="schema">
33
<template #sex="form">
44
<el-radio-group v-model="form['sex']">
55
<el-radio :label="1">{{ t('profile.user.man') }}</el-radio>
66
<el-radio :label="2">{{ t('profile.user.woman') }}</el-radio>
77
</el-radio-group>
88
</template>
99
</Form>
10-
<XButton :title="t('common.save')" @click="submit()" />
11-
<XButton :title="t('common.reset')" type="danger" @click="init()" />
10+
<div style="text-align: center">
11+
<XButton :title="t('common.save')" type="primary" @click="submit()" />
12+
<XButton :title="t('common.reset')" type="danger" @click="init()" />
13+
</div>
1214
</template>
1315
<script lang="ts" setup>
1416
import type { FormRules } from 'element-plus'

src/views/Profile/components/ResetPwd.vue

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<template>
2-
<el-form ref="formRef" :model="password" :rules="rules" label-width="80px">
3-
<el-form-item :label="t('profile.password.oldPassword')">
2+
<el-form ref="formRef" :model="password" :rules="rules" :label-width="200">
3+
<el-form-item :label="t('profile.password.oldPassword')" prop="oldPassword">
44
<InputPassword v-model="password.oldPassword" />
55
</el-form-item>
6-
<el-form-item :label="t('profile.password.newPassword')">
6+
<el-form-item :label="t('profile.password.newPassword')" prop="newPassword">
77
<InputPassword v-model="password.newPassword" strength />
88
</el-form-item>
9-
<el-form-item :label="t('profile.password.confirmPassword')">
9+
<el-form-item :label="t('profile.password.confirmPassword')" prop="confirmPassword">
1010
<InputPassword v-model="password.confirmPassword" strength />
1111
</el-form-item>
1212
<el-form-item>
@@ -33,17 +33,18 @@ const password = reactive({
3333
})
3434
3535
// 表单校验
36-
const equalToPassword = (value, callback) => {
36+
const equalToPassword = (_rule, value, callback) => {
3737
if (password.newPassword !== value) {
3838
callback(new Error(t('profile.password.diffPwd')))
3939
} else {
4040
callback()
4141
}
4242
}
43+
4344
const rules = reactive<FormRules>({
4445
oldPassword: [
4546
{ required: true, message: t('profile.password.oldPwdMsg'), trigger: 'blur' },
46-
{ min: 3, max: 5, message: t('profile.password.pwdRules'), trigger: 'blur' }
47+
{ min: 6, max: 20, message: t('profile.password.pwdRules'), trigger: 'blur' }
4748
],
4849
newPassword: [
4950
{ required: true, message: t('profile.password.newPwdMsg'), trigger: 'blur' },
@@ -54,6 +55,7 @@ const rules = reactive<FormRules>({
5455
{ required: true, validator: equalToPassword, trigger: 'blur' }
5556
]
5657
})
58+
5759
const submit = (formEl: FormInstance | undefined) => {
5860
if (!formEl) return
5961
formEl.validate(async (valid) => {
@@ -63,6 +65,7 @@ const submit = (formEl: FormInstance | undefined) => {
6365
}
6466
})
6567
}
68+
6669
const reset = (formEl: FormInstance | undefined) => {
6770
if (!formEl) return
6871
formEl.resetFields()

0 commit comments

Comments
 (0)