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
陈智峰
jinfa-platform
Commits
c0db64a0
Commit
c0db64a0
authored
Jul 17, 2020
by
前端-许佳敏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
对接注册接口
parent
9743ea94
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
58 additions
and
8 deletions
+58
-8
regExp.ts
src/constants/regExp.ts
+12
-0
register.tsx
src/pages/user/register.tsx
+15
-8
API.d.ts
src/services/user/API.d.ts
+15
-0
index.ts
src/services/user/index.ts
+16
-0
No files found.
src/constants/regExp.ts
0 → 100644
View file @
c0db64a0
/**
* 正则表达式集合
*/
export
const
PATTERN_MAPS
=
{
// 8-20位, 大小写字幕 + 数字组合
password
:
/^
(?=
.*
[
a-z
])(?=
.*
[
A-Z
])[
a-zA-Z
\d]{8,20}
$/
,
email
:
/^
[\w
-
]
+
(\.[\w
-
]
+
)
*@
[\w
-
]
+
(\.[\w
-
]
+
)
+$/
,
phone
:
/^1
[
3|4|5|6|7|8|9
][
0-9
]{9}
$/
,
smsCode
:
/^
\d{6}
$/
}
\ No newline at end of file
src/pages/user/register.tsx
View file @
c0db64a0
...
...
@@ -16,6 +16,9 @@ import { FormStep, FormBlock, Input, Password, Checkbox } from '@formily/antd-co
import
SchemaForm
,
{
Field
,
FormMegaLayout
,
FormButtonGroup
,
createFormActions
,
FormEffectHooks
}
from
'@formily/antd'
;
import
useCountDown
from
'@/utils/hooks'
;
import
{
GlobalConfig
}
from
'@/global/config'
;
import
{
omit
}
from
'@/utils'
;
import
{
postUserRegister
}
from
'@/services/user'
;
import
{
PATTERN_MAPS
}
from
'@/constants/regExp'
;
const
{
TextArea
}
=
Input
;
const
Step
=
Steps
.
Step
...
...
@@ -196,11 +199,11 @@ const UserRegistry = () => {
})
const
handleActionBtn
=
()
=>
{
actions
.
dispatch
(
'onFormStepNext'
,
()
=>
{
// 校验后触发跳转
actions
.
validate
(
'*'
).
then
(
data
=>
{
actions
.
dispatch
(
'onFormStepNext'
,
{})
setCurrent
(
current
+
1
)
})
// FormStep
// FormStep.onStepNext$()
}
const
mapMemberType
=
GlobalConfig
.
userRegister
.
useType
.
memberType
.
map
(
v
=>
{
return
{
...
...
@@ -222,7 +225,10 @@ const UserRegistry = () => {
formCache
=
Object
.
assign
(
values
,
formCache
)
// 写死传入的区号
formCache
.
countryCode
=
'+86'
console
.
log
(
formCache
)
const
params
=
omit
(
formCache
,
[
'isRead'
,
'confirmPassword'
])
postUserRegister
(
params
).
then
(()
=>
{
console
.
log
(
'register success'
)
})
})
}
return
(
...
...
@@ -231,6 +237,7 @@ const UserRegistry = () => {
<
div
className=
{
cx
(
styles
.
registerBox
,
globalStyles
.
lingxiBusinessMarginContent
)
}
>
<
div
>
<
SchemaForm
name=
'registerForm'
actions=
{
actions
}
components=
{
{
Input
,
...
...
@@ -252,11 +259,11 @@ const UserRegistry = () => {
>
</
FormStep
>
<
FormMegaLayout
className=
{
styles
.
registerForm
}
name=
'message'
>
<
Field
name=
"phone"
x
-
rules=
{
{
required
:
true
,
pattern
:
/^1
[
3|4|5|6|7|8|9
][
0-9
]
{9}$/
}
}
x
-
component
-
props=
{
{
placeholder
:
'请输入你的手机号码'
,
size
:
'large'
}
}
x
-
props=
{
{
addonBefore
:
<
div
className=
{
styles
.
formBefore
}
>
+86
</
div
>}
}
x
-
component=
"Input"
/>
<
Field
name=
"smsCode"
x
-
rules=
{
{
required
:
true
,
pattern
:
/^
\d
{6}$/
}
}
x
-
component
-
props=
{
{
size
:
'large'
,
style
:
{
width
:
220
}}
}
x
-
props=
{
{
addonAfter
:
<
Button
disabled=
{
isActive
}
style=
{
{
minWidth
:
110
,
marginLeft
:
8
}
}
size=
'large'
onClick=
{
start
}
>
{
text
}
</
Button
>}
}
x
-
component=
"Input"
/>
<
Field
name=
"password"
x
-
rules=
{
{
required
:
true
}
}
x
-
component
-
props=
{
{
placeholder
:
'设置你的登录密码'
,
size
:
'large'
}
}
x
-
component=
"Password"
/>
<
Field
name=
"phone"
x
-
rules=
{
{
required
:
true
,
pattern
:
PATTERN_MAPS
.
phone
}
}
x
-
component
-
props=
{
{
placeholder
:
'请输入你的手机号码'
,
size
:
'large'
}
}
x
-
props=
{
{
addonBefore
:
<
div
className=
{
styles
.
formBefore
}
>
+86
</
div
>}
}
x
-
component=
"Input"
/>
<
Field
name=
"smsCode"
x
-
rules=
{
{
required
:
true
,
pattern
:
PATTERN_MAPS
.
smsCode
}
}
x
-
component
-
props=
{
{
size
:
'large'
,
style
:
{
width
:
220
}}
}
x
-
props=
{
{
addonAfter
:
<
Button
disabled=
{
isActive
}
style=
{
{
minWidth
:
110
,
marginLeft
:
8
}
}
size=
'large'
onClick=
{
start
}
>
{
text
}
</
Button
>}
}
x
-
component=
"Input"
/>
<
Field
name=
"password"
x
-
rules=
{
{
required
:
true
,
pattern
:
PATTERN_MAPS
.
password
}
}
x
-
component
-
props=
{
{
placeholder
:
'设置你的登录密码'
,
size
:
'large'
}
}
x
-
component=
"Password"
/>
<
Field
name=
"confirmPassword"
x
-
rules=
{
{
required
:
true
}
}
x
-
component
-
props=
{
{
placeholder
:
'请再次输入你的登录密码'
,
size
:
'large'
}
}
x
-
component=
"Password"
/>
<
Field
name=
"email"
x
-
rules=
{
{
message
:
'请输入正确的邮箱'
,
pattern
:
/^
[\w
-
]
+
(\.[\w
-
]
+
)
*@
[\w
-
]
+
(\.[\w
-
]
+
)
+$/
}
}
x
-
component
-
props=
{
{
placeholder
:
'请输入你的邮箱(选填)'
,
size
:
'large'
,
type
:
'email'
}
}
x
-
component=
"Input"
/>
<
Field
name=
"email"
x
-
rules=
{
{
message
:
'请输入正确的邮箱'
,
pattern
:
PATTERN_MAPS
.
email
}
}
x
-
component
-
props=
{
{
placeholder
:
'请输入你的邮箱(选填)'
,
size
:
'large'
,
type
:
'email'
}
}
x
-
component=
"Input"
/>
<
Field
name=
"isRead"
x
-
rules=
{
{
message
:
'请勾选'
,
required
:
true
}
}
x
-
component
-
props=
{
{
children
:<
span
style=
{
{
fontSize
:
12
}
}
>
阅读并同意
<
span
className=
'commonPickColor'
>
《会员服务协议》《法律条款》《隐私政策》
</
span
></
span
>
}
}
x
-
component=
"CheckBoxSingle"
/>
...
...
src/services/user/API.d.ts
0 → 100644
View file @
c0db64a0
declare
namespace
UserModalApi
{
interface
registerModal
{
countryCode
:
string
;
phone
:
string
;
smsCode
:
string
;
password
:
string
;
email
?:
string
;
typeId
:
number
;
businessTypeId
:
number
;
detail
:
{
[
key
:
string
]:
any
}
}
}
\ No newline at end of file
src/services/user/index.ts
0 → 100644
View file @
c0db64a0
import
request
from
'@/utils/request'
;
const
prefix
=
'/member/merchant'
/**
* @description 用户基础注册接口
* @param {MemberApi.RegisterBasicModel} params
* @todo 注册接口
*/
export
async
function
postUserRegister
(
params
:
UserModalApi
.
registerModal
)
{
return
request
(
'/member/register'
,
{
method
:
'post'
,
data
:
params
})
}
\ No newline at end of file
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