pwd.data.ts
990 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import { FormSchema } from '/@/components/Form';
export const formSchema: FormSchema[] = [
{
field: 'passwordOld',
label: '当前密码',
component: 'InputPassword',
required: true,
},
{
field: 'passwordNew',
label: '新密码',
component: 'StrengthMeter',
componentProps: {
placeholder: '新密码',
},
rules: [
{
required: true,
message: '请输入新密码',
},
],
},
{
field: 'confirmPassword',
label: '确认密码',
component: 'InputPassword',
dynamicRules: ({ values }) => {
return [
{
required: true,
validator: (_, value) => {
if (!value) {
return Promise.reject('不能为空');
}
if (value !== values.passwordNew) {
return Promise.reject('两次输入的密码不一致!');
}
return Promise.resolve();
},
},
];
},
},
];