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
1f33b8cd
Commit
1f33b8cd
authored
Jul 22, 2020
by
前端-钟卫鹏
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' of
http://10.0.0.22:3000/lingxi/lingxi-business-paltform
into dev
parents
d0867132
c710903d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
2 deletions
+48
-2
useHttpRequest.ts
src/hooks/useHttpRequest.ts
+40
-0
index.less
src/pages/user/index.less
+4
-0
register.tsx
src/pages/user/register.tsx
+4
-2
No files found.
src/hooks/useHttpRequest.ts
0 → 100644
View file @
1f33b8cd
import
React
,
{
useState
}
from
'react'
;
import
{
IApiRequest
}
from
'@/utils/request'
;
export
interface
IHttpRequestReturn
<
T
>
{
data
:
T
|
null
,
loading
:
boolean
,
err
:
any
,
run
(
params
?:
any
)
}
/**
* 简易版本的useRequest hooks, 用于处理带有loading的业务场景
* @auth xjm
*/
export
function
useHttpRequest
<
T
>
(
api
:
(
params
?,
config
?)
=>
Promise
<
T
>
,
config
?:
IApiRequest
):
IHttpRequestReturn
<
T
>
{
const
[
loading
,
setLoading
]
=
useState
(
false
)
const
[
data
,
setData
]
=
useState
<
T
|
null
>
(
null
)
const
[
err
,
setErr
]
=
useState
()
const
run
=
(
params
)
=>
{
setLoading
(
true
)
api
(
params
).
then
((
res
:
any
)
=>
{
setData
(
res
.
data
)
}).
catch
(
err
=>
{
setErr
(
err
)
}).
finally
(()
=>
{
setTimeout
(()
=>
{
setLoading
(
false
)
},
200
)
})
}
return
{
data
,
loading
,
err
,
run
}
}
\ No newline at end of file
src/pages/user/index.less
View file @
1f33b8cd
...
...
@@ -304,4 +304,7 @@
.mr_t-40 {
margin-top: 40px;
}
.mr_t-24 {
margin-top: 24px;
}
\ No newline at end of file
src/pages/user/register.tsx
View file @
1f33b8cd
...
...
@@ -49,6 +49,7 @@ const CustomCheckbox = props => {
const
CustomInput
=
props
=>
{
const
{
help
,
...
restProps
}
=
props
console
.
log
(
props
)
return
(
<
AntdInput
{
...
restProps
}
...
...
@@ -281,7 +282,7 @@ const UserRegistry = () => {
GlobalConfig
.
userRegister
.
useDetail
.
map
(
v
=>
{
return
(
<
FormBlock
className=
{
styles
[
'mr_t-40'
]
}
visible=
{
current
===
2
}
key=
{
v
.
groupName
}
title=
{
<
span
className=
{
styles
.
commonPanelTitle
}
>
{
v
.
groupName
}
</
span
>
}
>
<
FormMegaLayout
columns=
{
2
}
grid
>
<
FormMegaLayout
columns=
{
2
}
grid
autoRow
size=
'large'
className=
{
styles
[
'mr_t-24'
]
}
>
{
v
.
elements
.
map
(
field
=>
{
// 字段类型暂时为null, 所以固定为input
...
...
@@ -309,7 +310,8 @@ const UserRegistry = () => {
pattern
:
v
.
rulePattern
}
})
}
x
-
component
-
props=
{
{
help
:
field
.
fieldRemark
,
placeholder
:
`请输入${field.fieldCNName}`
}
}
maxLength=
{
field
.
fieldLength
}
x
-
component
-
props=
{
{
help
:
field
.
fieldRemark
,
placeholder
:
`请输入${field.fieldCNName}`
,
size
:
'large'
}
}
x
-
component=
'CustomInput'
>
</
Field
>
...
...
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