Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
jinfa-platform
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
shenshaokai
jinfa-platform
Commits
a1691abc
Commit
a1691abc
authored
Dec 09, 2020
by
GuanHua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 注册页面密码校验提示
parent
1d8932ff
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
19 deletions
+28
-19
register.tsx
src/pages/user/register.tsx
+24
-15
index.ts
src/pages/user/schema/index.ts
+4
-4
No files found.
src/pages/user/register.tsx
View file @
a1691abc
...
...
@@ -51,9 +51,7 @@ const useLinkageValidateEffects = () => {
countryCode
:
prefixCode
,
phone
:
fieldState
.
value
},
{
ctlType
:
'none'
,
useCache
:
true
,
ttl
:
60
*
1000
}).
then
(({
code
,
data
})
=>
{
if
(
code
===
1000
)
{
}
else
{
if
(
code
!==
1000
)
{
setFieldState
(
'phone'
,
state
=>
{
state
.
errors
=
[
'手机号已存在'
]
})
...
...
@@ -61,19 +59,10 @@ const useLinkageValidateEffects = () => {
})
}
})
onFieldValueChange$
(
'*(password,confirmPassword)'
).
subscribe
(
fieldState
=>
{
const
selfName
=
fieldState
.
name
onFieldValueChange$
(
'*(confirmPassword)'
).
subscribe
(
fieldState
=>
{
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
=>
{
const
otherValue
=
getFieldState
(
'password'
,
state
=>
state
.
value
)
setFieldState
(
'confirmPassword'
,
state
=>
{
if
(
selfValue
&&
otherValue
&&
selfValue
!==
otherValue
)
{
state
.
errors
=
[
'两次密码输入不一致'
]
}
else
{
...
...
@@ -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
;
// 定时器
...
...
src/pages/user/schema/index.ts
View file @
a1691abc
...
...
@@ -80,10 +80,10 @@ export const registerStep0Schema: ISchema = {
required
:
true
,
message
:
'请输入密码'
},
{
pattern
:
PATTERN_MAPS
.
password
,
message
:
'请输入正确的密码'
}
//
{
//
pattern: PATTERN_MAPS.password,
//
message: '请输入正确的密码'
//
}
],
"x-component-props"
:
{
type
:
'password'
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment