Commit a1691abc authored by GuanHua's avatar GuanHua

fix: 注册页面密码校验提示

parent 1d8932ff
...@@ -51,9 +51,7 @@ const useLinkageValidateEffects = () => { ...@@ -51,9 +51,7 @@ const useLinkageValidateEffects = () => {
countryCode: prefixCode, countryCode: prefixCode,
phone: fieldState.value phone: fieldState.value
}, { ctlType: 'none', useCache: true, ttl: 60 * 1000 }).then(({ code, data }) => { }, { ctlType: 'none', useCache: true, ttl: 60 * 1000 }).then(({ code, data }) => {
if (code === 1000) { if (code !== 1000) {
} else {
setFieldState('phone', state => { setFieldState('phone', state => {
state.errors = ['手机号已存在'] state.errors = ['手机号已存在']
}) })
...@@ -61,19 +59,10 @@ const useLinkageValidateEffects = () => { ...@@ -61,19 +59,10 @@ const useLinkageValidateEffects = () => {
}) })
} }
}) })
onFieldValueChange$('*(password,confirmPassword)').subscribe(fieldState => { onFieldValueChange$('*(confirmPassword)').subscribe(fieldState => {
const selfName = fieldState.name
const selfValue = fieldState.value const selfValue = fieldState.value
const otherName = selfName == 'password' ? 'confirmPassword' : 'password' const otherValue = getFieldState('password', state => state.value)
const otherValue = getFieldState(otherName, state => state.value) setFieldState('confirmPassword', state => {
setFieldState(otherName, state => {
if (selfValue && otherValue && selfValue !== otherValue) {
state.errors = ['两次密码输入不一致']
} else {
state.errors = ['']
}
})
setFieldState(selfName, state => {
if (selfValue && otherValue && selfValue !== otherValue) { if (selfValue && otherValue && selfValue !== otherValue) {
state.errors = ['两次密码输入不一致'] state.errors = ['两次密码输入不一致']
} else { } else {
...@@ -81,6 +70,26 @@ const useLinkageValidateEffects = () => { ...@@ -81,6 +70,26 @@ const useLinkageValidateEffects = () => {
} }
}) })
}) })
// onFieldValueChange$('*(password,confirmPassword)').subscribe(fieldState => {
// const selfName = fieldState.name
// const selfValue = fieldState.value
// const otherName = selfName == 'password' ? 'confirmPassword' : 'password'
// const otherValue = getFieldState(otherName, state => state.value)
// setFieldState(otherName, state => {
// if (selfValue && otherValue && selfValue !== otherValue) {
// state.errors = ['两次密码输入不一致']
// } else {
// state.errors = ['']
// }
// })
// setFieldState(selfName, state => {
// if (selfValue && otherValue && selfValue !== otherValue) {
// state.errors = ['两次密码输入不一致']
// } else {
// state.errors = ['']
// }
// })
// })
} }
let timeChange: any; // 定时器 let timeChange: any; // 定时器
......
...@@ -80,10 +80,10 @@ export const registerStep0Schema: ISchema = { ...@@ -80,10 +80,10 @@ export const registerStep0Schema: ISchema = {
required: true, required: true,
message: '请输入密码' message: '请输入密码'
}, },
{ // {
pattern: PATTERN_MAPS.password, // pattern: PATTERN_MAPS.password,
message: '请输入正确的密码' // message: '请输入正确的密码'
} // }
], ],
"x-component-props": { "x-component-props": {
type: 'password', type: 'password',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment