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
4d4be482
Commit
4d4be482
authored
Jun 16, 2020
by
前端-钟卫鹏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加用户注册相关api
parent
9949e9e8
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
142 additions
and
28 deletions
+142
-28
register.tsx
src/pages/user/register.tsx
+42
-24
API.d.ts
src/services/member/API.d.ts
+50
-2
index.ts
src/services/member/index.ts
+50
-2
No files found.
src/pages/user/register.tsx
View file @
4d4be482
...
@@ -11,6 +11,7 @@ import { FormPage } from 'god'
...
@@ -11,6 +11,7 @@ import { FormPage } from 'god'
import
{
IFormControllers
,
IFormButtonTypes
}
from
'god/dist/src/form-page'
import
{
IFormControllers
,
IFormButtonTypes
}
from
'god/dist/src/form-page'
import
{
Link
,
history
}
from
'umi'
import
{
Link
,
history
}
from
'umi'
import
im_success
from
'../../../mockStatic/im_success.png'
import
im_success
from
'../../../mockStatic/im_success.png'
import
{
postMemberRegister
,
getRegisterTypeList
,
postMemberRegisterType
}
from
'@/services/member'
const
{
TextArea
}
=
Input
;
const
{
TextArea
}
=
Input
;
const
Step
=
Steps
.
Step
const
Step
=
Steps
.
Step
...
@@ -40,11 +41,14 @@ const registerForm: IFormControllers[] = [
...
@@ -40,11 +41,14 @@ const registerForm: IFormControllers[] = [
inputProps
:
{
inputProps
:
{
addonBefore
:
<
div
className=
{
styles
.
formBefore
}
>
+86
</
div
>,
addonBefore
:
<
div
className=
{
styles
.
formBefore
}
>
+86
</
div
>,
placeholder
:
'请输入你的手机号码'
,
placeholder
:
'请输入你的手机号码'
,
}
},
rules
:
[
{
required
:
true
,
message
:
'手机号为必填项!'
}
]
},
},
{
{
type
:
'Verification'
,
type
:
'Verification'
,
name
:
'
c
ode'
,
name
:
'
smsC
ode'
,
span
:
24
,
span
:
24
,
inputProps
:
{
inputProps
:
{
...
@@ -58,31 +62,31 @@ const registerForm: IFormControllers[] = [
...
@@ -58,31 +62,31 @@ const registerForm: IFormControllers[] = [
type
:
'password'
,
type
:
'password'
,
placeholder
:
'设置你的密码'
,
placeholder
:
'设置你的密码'
,
},
},
//
rules: [
rules
:
[
//
{ required: true, message: '密码为必填项!' },
{
required
:
true
,
message
:
'密码为必填项!'
},
//
{ pattern: /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[^]{8,20}$/, message: '密码长度8-20个字符,必须包含大小写字母和数字!' }
{
pattern
:
/^
(?=
.*
[
a-z
])(?=
.*
[
A-Z
])(?=
.*
\d)[^]{8,20}
$/
,
message
:
'密码长度8-20个字符,必须包含大小写字母和数字!'
}
//
],
],
},
},
{
{
type
:
'Input'
,
type
:
'Input'
,
name
:
'confirm
Password
'
,
name
:
'confirm'
,
span
:
24
,
span
:
24
,
dependencies
:
[
'password'
],
dependencies
:
[
'password'
],
inputProps
:
{
inputProps
:
{
type
:
'password'
,
type
:
'password'
,
placeholder
:
'请再次输入你的登录密码'
,
placeholder
:
'请再次输入你的登录密码'
,
},
},
//
rules: [
rules
:
[
//
{ required: true, message: '请再次确认密码!' },
{
required
:
true
,
message
:
'请再次确认密码!'
},
//
({ getFieldValue }) => ({
({
getFieldValue
})
=>
({
//
validator(rule, value) {
validator
(
rule
,
value
)
{
//
if (!value || getFieldValue('password') === value) {
if
(
!
value
||
getFieldValue
(
'password'
)
===
value
)
{
//
return Promise.resolve();
return
Promise
.
resolve
();
//
}
}
//
return Promise.reject('两次的密码输入不一致!');
return
Promise
.
reject
(
'两次的密码输入不一致!'
);
//
},
},
//
}),
}),
//
]
]
},
},
{
{
type
:
'Input'
,
type
:
'Input'
,
...
@@ -125,13 +129,26 @@ let timeChange: any; // 定时器
...
@@ -125,13 +129,26 @@ let timeChange: any; // 定时器
const
UserRegistry
=
()
=>
{
const
UserRegistry
=
()
=>
{
const
[
identityForm1
]
=
Form
.
useForm
();
const
[
identityForm1
]
=
Form
.
useForm
();
const
[
licenseForm
]
=
Form
.
useForm
();
const
[
licenseForm
]
=
Form
.
useForm
();
const
[
current
,
setCurrent
]
=
useState
(
0
)
const
[
current
,
setCurrent
]
=
useState
(
1.1
)
const
handleOneSubmit
=
(
values
:
any
)
=>
{
const
handleOneSubmit
=
(
values
:
any
)
=>
{
console
.
log
(
values
,
'values'
)
let
obj
=
{
...
values
}
delete
obj
.
readme
delete
obj
.
confirm
console
.
log
(
obj
,
'values'
)
postMemberRegister
(
obj
).
then
(
res
=>
{
console
.
log
(
res
,
'res'
)
// if(res.data.id) setCurrent(1)
})
if
(
values
.
phone
)
setCurrent
(
1
)
if
(
values
.
phone
)
setCurrent
(
1
)
}
}
const
handleRegisterTypeList
=
()
=>
{
getRegisterTypeList
().
then
(
res
=>
{
console
.
log
(
res
,
'res'
)
})
}
const
handleJumpLogin
=
()
=>
{
const
handleJumpLogin
=
()
=>
{
history
.
push
(
'/user/login'
)
history
.
push
(
'/user/login'
)
}
}
...
@@ -153,6 +170,7 @@ const UserRegistry = () => {
...
@@ -153,6 +170,7 @@ const UserRegistry = () => {
const
[
time
,
setTime
]
=
useState
(
5
);
const
[
time
,
setTime
]
=
useState
(
5
);
useEffect
(()
=>
{
useEffect
(()
=>
{
clearInterval
(
timeChange
)
clearInterval
(
timeChange
)
handleRegisterTypeList
()
},
[])
},
[])
useEffect
(()
=>
{
useEffect
(()
=>
{
console
.
log
(
current
)
console
.
log
(
current
)
...
@@ -233,16 +251,16 @@ const UserRegistry = () => {
...
@@ -233,16 +251,16 @@ const UserRegistry = () => {
>
>
<
h3
className=
"commonPanelTitle"
>
请选择您的身份
</
h3
>
<
h3
className=
"commonPanelTitle"
>
请选择您的身份
</
h3
>
<
Divider
/>
<
Divider
/>
<
Form
.
Item
name=
'
identity'
>
<
Form
.
Item
name=
'
typeId'
initialValue=
"a"
>
<
Radio
.
Group
onChange=
{
onChange
}
defaultValue=
"a"
className=
{
styles
.
identityRadio
}
name=
"identity
"
>
<
Radio
.
Group
onChange=
{
onChange
}
className=
{
styles
.
identityRadio
}
name=
"typeId
"
>
<
Radio
.
Button
value=
"a"
>
企业
</
Radio
.
Button
>
<
Radio
.
Button
value=
"a"
>
企业
</
Radio
.
Button
>
<
Radio
.
Button
value=
"b"
>
个人
</
Radio
.
Button
>
<
Radio
.
Button
value=
"b"
>
个人
</
Radio
.
Button
>
</
Radio
.
Group
>
</
Radio
.
Group
>
</
Form
.
Item
>
</
Form
.
Item
>
<
h3
className=
"commonPanelTitle"
>
请选择您要开展的业务
</
h3
>
<
h3
className=
"commonPanelTitle"
>
请选择您要开展的业务
</
h3
>
<
Divider
/>
<
Divider
/>
<
Form
.
Item
name=
'business
'
>
<
Form
.
Item
name=
'business
TypeId'
initialValue=
"f"
>
<
Radio
.
Group
onChange=
{
onChange
}
defaultValue=
"f"
className=
{
styles
.
businessRadio
}
name=
"business
"
>
<
Radio
.
Group
onChange=
{
onChange
}
className=
{
styles
.
businessRadio
}
name=
"businessTypeId
"
>
<
Radio
.
Button
value=
"c"
>
采购
</
Radio
.
Button
>
<
Radio
.
Button
value=
"c"
>
采购
</
Radio
.
Button
>
<
Radio
.
Button
value=
"d"
>
商品销售
</
Radio
.
Button
>
<
Radio
.
Button
value=
"d"
>
商品销售
</
Radio
.
Button
>
<
Radio
.
Button
value=
"e"
>
加工服务
</
Radio
.
Button
>
<
Radio
.
Button
value=
"e"
>
加工服务
</
Radio
.
Button
>
...
...
src/services/member/API.d.ts
View file @
4d4be482
declare
namespace
MemberApi
{
declare
namespace
MemberApi
{
interface
RegisterBasic
Model
{
interface
RegisterBasic
DTO
{
phone
:
string
;
phone
:
string
;
smsCode
:
string
;
smsCode
:
string
;
password
:
string
;
password
:
string
;
email
:
string
;
email
:
string
;
}
}
interface
RegisterBasic
DTO
{
interface
RegisterBasic
Model
{
id
:
number
id
:
number
}
}
interface
RegisterTypeDTO
{
id
:
number
;
typeId
:
number
;
businessTypeId
:
number
;
}
interface
MemberTypeItem
{
id
:
number
;
typeName
:
string
;
}
interface
BusinessTypeItem
{
id
:
number
;
businessTypeName
:
string
;
}
interface
RegisterTypeModel
{
memberType
:
MemberTypeItem
[];
businessType
:
BusinessTypeItem
[];
}
interface
CheckRulesItem
{
id
:
number
;
ruleName
:
string
;
ruleType
:
string
;
rulePattern
:
RegExp
;
msg
:
string
;
}
interface
RegisterElementItem
{
id
:
number
;
fieldName
:
string
;
fieldCNName
:
string
;
fieldType
:
string
;
fieldLength
:
number
;
fieldEmpty
:
number
;
fieldOrder
:
number
;
fieldRemark
:
string
;
checkRules
:
CheckRulesItem
[];
}
interface
RegisterDetailElementModel
{
groupName
:
string
;
elements
:
RegisterElementItem
[];
}
}
}
\ No newline at end of file
src/services/member/index.ts
View file @
4d4be482
...
@@ -6,8 +6,56 @@ const prefix = '/member/merchant'
...
@@ -6,8 +6,56 @@ const prefix = '/member/merchant'
* @description 用户基础注册接口
* @description 用户基础注册接口
* @param {MemberApi.RegisterBasicModel} params
* @param {MemberApi.RegisterBasicModel} params
*/
*/
export
async
function
postMemberRegister
(
params
:
MemberApi
.
RegisterBasicModel
)
{
export
async
function
postMemberRegister
(
params
:
MemberApi
.
RegisterBasicDTO
)
{
return
request
<
MemberApi
.
RegisterBasicDTO
>
(
'/member/register/basic'
,
{
return
request
<
MemberApi
.
RegisterBasicModel
>
(
'/member/register/basic'
,
{
prefix
,
method
:
'post'
,
data
:
params
})
}
/**
* @description 用户会员注册 获取会员/业务类型
*
*/
export
async
function
getRegisterTypeList
()
{
return
request
<
MemberApi
.
RegisterTypeModel
>
(
'/menu/member/register/type'
,
{
prefix
})
}
/**
* @description 用户会员注册 提交会员类型业务类型
* @param {MemberApi.RegisterTypeDTO}
*/
export
async
function
postMemberRegisterType
(
params
:
MemberApi
.
RegisterTypeDTO
)
{
return
request
(
'/member/register/type'
,
{
prefix
,
method
:
'post'
,
data
:
params
})
}
/**
* @description 获取注册详情页 element元素数据
*
*/
export
async
function
getRegisterElementList
()
{
return
request
<
MemberApi
.
RegisterDetailElementModel
>
(
'/menu/member/register/detail'
,
{
prefix
})
}
/**
* @description 用户会员注册 提交注册详情
* @param {T}
*/
export
async
function
postMemberRegisterDetail
<
T
>
(
params
:
T
)
{
return
request
(
'/member/register/detail'
,
{
prefix
,
prefix
,
method
:
'post'
,
method
:
'post'
,
data
:
params
data
:
params
...
...
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