Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
pro-blocks
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
duanledexianxianxian
pro-blocks
Commits
1d0def2a
Commit
1d0def2a
authored
Mar 31, 2019
by
陈帅
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Migrate AccountSettings and AdvancedForm
parent
ac17ede7
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
71 additions
and
91 deletions
+71
-91
AccountSettings/src/components/base.tsx
AccountSettings/src/components/base.tsx
+15
-10
AccountSettings/src/index.tsx
AccountSettings/src/index.tsx
+36
-10
AccountSettings/src/style.less
AccountSettings/src/style.less
+2
-2
AdvancedForm/src/_mock.ts
AdvancedForm/src/_mock.ts
+0
-0
AdvancedForm/src/components/PageHeaderWrapper/index.js
AdvancedForm/src/components/PageHeaderWrapper/index.js
+0
-25
AdvancedForm/src/components/PageHeaderWrapper/index.less
AdvancedForm/src/components/PageHeaderWrapper/index.less
+0
-11
AdvancedForm/src/components/TableForm.tsx
AdvancedForm/src/components/TableForm.tsx
+0
-0
AdvancedForm/src/index.tsx
AdvancedForm/src/index.tsx
+17
-32
AdvancedForm/src/model.ts
AdvancedForm/src/model.ts
+0
-0
AdvancedForm/src/service.ts
AdvancedForm/src/service.ts
+0
-0
package.json
package.json
+1
-1
No files found.
AccountSettings/src/components/base.tsx
View file @
1d0def2a
...
@@ -63,7 +63,7 @@ const validatorPhone = (rule: any, value: string, callback: (message?: string) =
...
@@ -63,7 +63,7 @@ const validatorPhone = (rule: any, value: string, callback: (message?: string) =
};
};
interface
BaseViewProps
extends
FormComponentProps
{
interface
BaseViewProps
extends
FormComponentProps
{
currentUser
:
CurrentUser
;
currentUser
?
:
CurrentUser
;
}
}
@
connect
(({
BLOCK_NAME_CAMEL_CASE
}:
{
BLOCK_NAME_CAMEL_CASE
:
{
currentUser
:
CurrentUser
}
})
=>
({
@
connect
(({
BLOCK_NAME_CAMEL_CASE
}:
{
BLOCK_NAME_CAMEL_CASE
:
{
currentUser
:
CurrentUser
}
})
=>
({
...
@@ -76,21 +76,26 @@ class BaseView extends Component<BaseViewProps> {
...
@@ -76,21 +76,26 @@ class BaseView extends Component<BaseViewProps> {
setBaseInfo
=
()
=>
{
setBaseInfo
=
()
=>
{
const
{
currentUser
,
form
}
=
this
.
props
;
const
{
currentUser
,
form
}
=
this
.
props
;
if
(
currentUser
)
{
Object
.
keys
(
form
.
getFieldsValue
()).
forEach
(
key
=>
{
Object
.
keys
(
form
.
getFieldsValue
()).
forEach
(
key
=>
{
const
obj
=
{};
const
obj
=
{};
obj
[
key
]
=
currentUser
[
key
]
||
null
;
obj
[
key
]
=
currentUser
[
key
]
||
null
;
form
.
setFieldsValue
(
obj
);
form
.
setFieldsValue
(
obj
);
});
});
}
};
};
getAvatarURL
()
{
getAvatarURL
()
{
const
{
currentUser
}
=
this
.
props
;
const
{
currentUser
}
=
this
.
props
;
if
(
currentUser
)
{
if
(
currentUser
.
avatar
)
{
if
(
currentUser
.
avatar
)
{
return
currentUser
.
avatar
;
return
currentUser
.
avatar
;
}
}
const
url
=
'
https://gw.alipayobjects.com/zos/rmsportal/BiazfanxmamNRoxxVxka.png
'
;
const
url
=
'
https://gw.alipayobjects.com/zos/rmsportal/BiazfanxmamNRoxxVxka.png
'
;
return
url
;
return
url
;
}
}
return
''
;
}
view
:
HTMLDivElement
|
undefined
;
view
:
HTMLDivElement
|
undefined
;
getViewDom
=
(
ref
:
HTMLDivElement
)
=>
{
getViewDom
=
(
ref
:
HTMLDivElement
)
=>
{
...
...
AccountSettings/src/index.tsx
View file @
1d0def2a
import
React
,
{
Component
}
from
'
react
'
;
import
React
,
{
Component
}
from
'
react
'
;
import
{
connect
}
from
'
dva
'
;
import
{
connect
}
from
'
dva
'
;
import
{
Dispatch
}
from
'
redux
'
;
import
{
FormattedMessage
}
from
'
umi-plugin-react/locale
'
;
import
{
FormattedMessage
}
from
'
umi-plugin-react/locale
'
;
import
{
Menu
}
from
'
antd
'
;
import
{
Menu
}
from
'
antd
'
;
import
styles
from
'
./style.less
'
;
import
styles
from
'
./style.less
'
;
...
@@ -7,14 +8,31 @@ import BaseView from './components/base';
...
@@ -7,14 +8,31 @@ import BaseView from './components/base';
import
SecurityView
from
'
./components/security
'
;
import
SecurityView
from
'
./components/security
'
;
import
BindingView
from
'
./components/binding
'
;
import
BindingView
from
'
./components/binding
'
;
import
NotificationView
from
'
./components/notification
'
;
import
NotificationView
from
'
./components/notification
'
;
import
{
CurrentUser
}
from
'
./data
'
;
const
{
Item
}
=
Menu
;
const
{
Item
}
=
Menu
;
@
connect
(({
BLOCK_NAME_CAMEL_CASE
})
=>
({
interface
PAGE_NAME_UPPER_CAMEL_CASEProps
{
dispatch
:
Dispatch
;
currentUser
:
CurrentUser
;
}
type
PAGE_NAME_UPPER_CAMEL_CASEStateKeys
=
'
base
'
|
'
security
'
|
'
binding
'
|
'
notification
'
;
interface
PAGE_NAME_UPPER_CAMEL_CASEState
{
mode
:
'
inline
'
|
'
horizontal
'
;
menuMap
:
{
[
key
:
string
]:
React
.
ReactNode
;
};
selectKey
:
PAGE_NAME_UPPER_CAMEL_CASEStateKeys
;
}
@
connect
(({
BLOCK_NAME_CAMEL_CASE
}:
{
BLOCK_NAME_CAMEL_CASE
:
{
currentUser
:
CurrentUser
}
})
=>
({
currentUser
:
BLOCK_NAME_CAMEL_CASE
.
currentUser
,
currentUser
:
BLOCK_NAME_CAMEL_CASE
.
currentUser
,
}))
}))
class
PAGE_NAME_UPPER_CAMEL_CASE
extends
Component
{
class
PAGE_NAME_UPPER_CAMEL_CASE
extends
Component
<
constructor
(
props
)
{
PAGE_NAME_UPPER_CAMEL_CASEProps
,
PAGE_NAME_UPPER_CAMEL_CASEState
>
{
constructor
(
props
:
PAGE_NAME_UPPER_CAMEL_CASEProps
)
{
super
(
props
);
super
(
props
);
const
menuMap
=
{
const
menuMap
=
{
base
:
<
FormattedMessage
id
=
"BLOCK_NAME.menuMap.basic"
defaultMessage
=
"Basic Settings"
/>,
base
:
<
FormattedMessage
id
=
"BLOCK_NAME.menuMap.basic"
defaultMessage
=
"Basic Settings"
/>,
...
@@ -38,6 +56,8 @@ class PAGE_NAME_UPPER_CAMEL_CASE extends Component {
...
@@ -38,6 +56,8 @@ class PAGE_NAME_UPPER_CAMEL_CASE extends Component {
};
};
}
}
main
:
HTMLDivElement
|
undefined
;
componentDidMount
()
{
componentDidMount
()
{
const
{
dispatch
}
=
this
.
props
;
const
{
dispatch
}
=
this
.
props
;
dispatch
({
dispatch
({
...
@@ -51,7 +71,7 @@ class PAGE_NAME_UPPER_CAMEL_CASE extends Component {
...
@@ -51,7 +71,7 @@ class PAGE_NAME_UPPER_CAMEL_CASE extends Component {
window
.
removeEventListener
(
'
resize
'
,
this
.
resize
);
window
.
removeEventListener
(
'
resize
'
,
this
.
resize
);
}
}
get
m
enu
=
()
=>
{
get
M
enu
=
()
=>
{
const
{
menuMap
}
=
this
.
state
;
const
{
menuMap
}
=
this
.
state
;
return
Object
.
keys
(
menuMap
).
map
(
item
=>
<
Item
key
=
{
item
}
>
{
menuMap
[
item
]
}
</
Item
>);
return
Object
.
keys
(
menuMap
).
map
(
item
=>
<
Item
key
=
{
item
}
>
{
menuMap
[
item
]
}
</
Item
>);
};
};
...
@@ -61,7 +81,7 @@ class PAGE_NAME_UPPER_CAMEL_CASE extends Component {
...
@@ -61,7 +81,7 @@ class PAGE_NAME_UPPER_CAMEL_CASE extends Component {
return
menuMap
[
selectKey
];
return
menuMap
[
selectKey
];
};
};
selectKey
=
(
{
key
}
)
=>
{
selectKey
=
(
key
:
PAGE_NAME_UPPER_CAMEL_CASEStateKeys
)
=>
{
this
.
setState
({
this
.
setState
({
selectKey
:
key
,
selectKey
:
key
,
});
});
...
@@ -75,7 +95,7 @@ class PAGE_NAME_UPPER_CAMEL_CASE extends Component {
...
@@ -75,7 +95,7 @@ class PAGE_NAME_UPPER_CAMEL_CASE extends Component {
if
(
!
this
.
main
)
{
if
(
!
this
.
main
)
{
return
;
return
;
}
}
let
mode
=
'
inline
'
;
let
mode
:
'
inline
'
|
'
horizontal
'
=
'
inline
'
;
const
{
offsetWidth
}
=
this
.
main
;
const
{
offsetWidth
}
=
this
.
main
;
if
(
this
.
main
.
offsetWidth
<
641
&&
offsetWidth
>
400
)
{
if
(
this
.
main
.
offsetWidth
<
641
&&
offsetWidth
>
400
)
{
mode
=
'
horizontal
'
;
mode
=
'
horizontal
'
;
...
@@ -117,12 +137,18 @@ class PAGE_NAME_UPPER_CAMEL_CASE extends Component {
...
@@ -117,12 +137,18 @@ class PAGE_NAME_UPPER_CAMEL_CASE extends Component {
<
div
<
div
className
=
{
styles
.
main
}
className
=
{
styles
.
main
}
ref
=
{
ref
=>
{
ref
=
{
ref
=>
{
if
(
ref
)
{
this
.
main
=
ref
;
this
.
main
=
ref
;
}
}
}
}
}
>
>
<
div
className
=
{
styles
.
leftmenu
}
>
<
div
className
=
{
styles
.
leftMenu
}
>
<
Menu
mode
=
{
mode
}
selectedKeys
=
{
[
selectKey
]
}
onClick
=
{
this
.
selectKey
}
>
<
Menu
{
this
.
getmenu
()
}
mode
=
{
mode
}
selectedKeys
=
{
[
selectKey
]
}
onClick
=
{
({
key
})
=>
this
.
selectKey
(
key
as
PAGE_NAME_UPPER_CAMEL_CASEStateKeys
)
}
>
{
this
.
getMenu
()
}
</
Menu
>
</
Menu
>
</
div
>
</
div
>
<
div
className
=
{
styles
.
right
}
>
<
div
className
=
{
styles
.
right
}
>
...
...
AccountSettings/src/style.less
View file @
1d0def2a
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
padding-top: 16px;
padding-top: 16px;
padding-bottom: 16px;
padding-bottom: 16px;
overflow: auto;
overflow: auto;
.left
m
enu {
.left
M
enu {
width: 224px;
width: 224px;
border-right: @border-width-base @border-style-base @border-color-split;
border-right: @border-width-base @border-style-base @border-color-split;
:global {
:global {
...
@@ -86,7 +86,7 @@
...
@@ -86,7 +86,7 @@
@media screen and (max-width: @screen-md) {
@media screen and (max-width: @screen-md) {
.main {
.main {
flex-direction: column;
flex-direction: column;
.left
m
enu {
.left
M
enu {
width: 100%;
width: 100%;
border: none;
border: none;
}
}
...
...
AdvancedForm/src/_mock.
j
s
→
AdvancedForm/src/_mock.
t
s
View file @
1d0def2a
File moved
AdvancedForm/src/components/PageHeaderWrapper/index.js
deleted
100644 → 0
View file @
ac17ede7
import
React
from
'
react
'
;
import
{
FormattedMessage
}
from
'
umi-plugin-react/locale
'
;
import
Link
from
'
umi/link
'
;
import
{
PageHeader
}
from
'
ant-design-pro
'
;
import
styles
from
'
./index.less
'
;
const
PageHeaderWrapper
=
({
children
,
wrapperClassName
,
...
restProps
})
=>
(
<
div
style
=
{{
margin
:
'
-24px -24px 0
'
}}
className
=
{
wrapperClassName
}
>
<
PageHeader
home
=
{
<
FormattedMessage
id
=
"
BLOCK_NAME.menu.home
"
defaultMessage
=
"
Home
"
/>
}
key
=
"
pageheader
"
{...
restProps
}
linkElement
=
{
Link
}
itemRender
=
{
item
=>
{
if
(
item
.
locale
)
{
return
<
FormattedMessage
id
=
{
item
.
locale
}
defaultMessage
=
{
item
.
title
}
/>
;
}
return
item
.
title
;
}}
/
>
{
children
?
<
div
className
=
{
styles
.
content
}
>
{
children
}
<
/div> : null
}
<
/div
>
);
export
default
PageHeaderWrapper
;
AdvancedForm/src/components/PageHeaderWrapper/index.less
deleted
100644 → 0
View file @
ac17ede7
@import '~antd/lib/style/themes/default.less';
.content {
margin: 24px 24px 0;
}
@media screen and (max-width: @screen-sm) {
.content {
margin: 24px 0 0;
}
}
AdvancedForm/src/components/TableForm.
js
→
AdvancedForm/src/components/TableForm.
tsx
View file @
1d0def2a
File moved
AdvancedForm/src/index.
js
→
AdvancedForm/src/index.
tsx
View file @
1d0def2a
import
React
,
{
PureComponent
}
from
'
react
'
;
import
React
,
{
Component
}
from
'
react
'
;
import
{
import
{
Card
,
Form
,
Icon
,
Col
,
Row
,
DatePicker
,
TimePicker
,
Input
,
Select
,
Popover
}
from
'
antd
'
;
Card
,
Button
,
Form
,
Icon
,
Col
,
Row
,
DatePicker
,
TimePicker
,
Input
,
Select
,
Popover
,
}
from
'
antd
'
;
import
{
connect
}
from
'
dva
'
;
import
{
connect
}
from
'
dva
'
;
import
{
FooterToolbar
}
from
'
ant-design-pro
'
;
import
PageHeaderWrapper
from
'
./components/PageHeaderWrapper
'
;
import
TableForm
from
'
./components/TableForm
'
;
import
TableForm
from
'
./components/TableForm
'
;
import
styles
from
'
./style.less
'
;
import
styles
from
'
./style.less
'
;
import
{
FormComponentProps
}
from
'
antd/lib/form
'
;
import
{
Dispatch
}
from
'
redux
'
;
const
{
Option
}
=
Select
;
const
{
Option
}
=
Select
;
const
{
RangePicker
}
=
DatePicker
;
const
{
RangePicker
}
=
DatePicker
;
...
@@ -57,11 +45,14 @@ const tableData = [
...
@@ -57,11 +45,14 @@ const tableData = [
},
},
];
];
@
connect
(({
loading
})
=>
({
interface
PAGE_NAME_UPPER_CAMEL_CASEProps
extends
FormComponentProps
{
dispatch
:
Dispatch
;
}
@
connect
(({
loading
}:
{
loading
:
{
effects
:
any
}
})
=>
({
submitting
:
loading
.
effects
[
'
BLOCK_NAME_CAMEL_CASE/submitAdvancedForm
'
],
submitting
:
loading
.
effects
[
'
BLOCK_NAME_CAMEL_CASE/submitAdvancedForm
'
],
}))
}))
@
Form
.
create
()
class
PAGE_NAME_UPPER_CAMEL_CASE
extends
Component
<
PAGE_NAME_UPPER_CAMEL_CASEProps
>
{
class
PAGE_NAME_UPPER_CAMEL_CASE
extends
PureComponent
{
state
=
{
state
=
{
width
:
'
100%
'
,
width
:
'
100%
'
,
};
};
...
@@ -83,7 +74,7 @@ class PAGE_NAME_UPPER_CAMEL_CASE extends PureComponent {
...
@@ -83,7 +74,7 @@ class PAGE_NAME_UPPER_CAMEL_CASE extends PureComponent {
if
(
!
errors
||
errorCount
===
0
)
{
if
(
!
errors
||
errorCount
===
0
)
{
return
null
;
return
null
;
}
}
const
scrollToField
=
fieldKey
=>
{
const
scrollToField
=
(
fieldKey
:
string
)
=>
{
const
labelNode
=
document
.
querySelector
(
`label[for="
${
fieldKey
}
"]`
);
const
labelNode
=
document
.
querySelector
(
`label[for="
${
fieldKey
}
"]`
);
if
(
labelNode
)
{
if
(
labelNode
)
{
labelNode
.
scrollIntoView
(
true
);
labelNode
.
scrollIntoView
(
true
);
...
@@ -119,7 +110,7 @@ class PAGE_NAME_UPPER_CAMEL_CASE extends PureComponent {
...
@@ -119,7 +110,7 @@ class PAGE_NAME_UPPER_CAMEL_CASE extends PureComponent {
resizeFooterToolbar
=
()
=>
{
resizeFooterToolbar
=
()
=>
{
requestAnimationFrame
(()
=>
{
requestAnimationFrame
(()
=>
{
const
sider
=
document
.
querySelectorAll
(
'
.ant-layout-sider
'
)[
0
];
const
sider
=
document
.
querySelectorAll
(
'
.ant-layout-sider
'
)[
0
]
as
HTMLDivElement
;
if
(
sider
)
{
if
(
sider
)
{
const
width
=
`calc(100% -
${
sider
.
style
.
width
}
)`
;
const
width
=
`calc(100% -
${
sider
.
style
.
width
}
)`
;
const
{
width
:
stateWidth
}
=
this
.
state
;
const
{
width
:
stateWidth
}
=
this
.
state
;
...
@@ -149,16 +140,10 @@ class PAGE_NAME_UPPER_CAMEL_CASE extends PureComponent {
...
@@ -149,16 +140,10 @@ class PAGE_NAME_UPPER_CAMEL_CASE extends PureComponent {
render
()
{
render
()
{
const
{
const
{
form
:
{
getFieldDecorator
},
form
:
{
getFieldDecorator
},
submitting
,
}
=
this
.
props
;
}
=
this
.
props
;
const
{
width
}
=
this
.
state
;
return
(
return
(
<
PageHeaderWrapper
<>
title
=
"
高级表单
"
content
=
"
高级表单常见于一次性输入和提交大批量数据的场景。
"
wrapperClassName
=
{
styles
.
advancedForm
}
>
<
Card
title
=
"仓库管理"
className
=
{
styles
.
card
}
bordered
=
{
false
}
>
<
Card
title
=
"仓库管理"
className
=
{
styles
.
card
}
bordered
=
{
false
}
>
<
Form
layout
=
"vertical"
hideRequiredMark
>
<
Form
layout
=
"vertical"
hideRequiredMark
>
<
Row
gutter
=
{
16
}
>
<
Row
gutter
=
{
16
}
>
...
@@ -309,15 +294,15 @@ class PAGE_NAME_UPPER_CAMEL_CASE extends PureComponent {
...
@@ -309,15 +294,15 @@ class PAGE_NAME_UPPER_CAMEL_CASE extends PureComponent {
initialValue
:
tableData
,
initialValue
:
tableData
,
})(<
TableForm
/>)
}
})(<
TableForm
/>)
}
</
Card
>
</
Card
>
<
FooterToolbar
style
=
{{
width
}}
>
{
/*
<FooterToolbar style={{ width }}>
{this.getErrorInfo()}
{this.getErrorInfo()}
<Button type="primary" onClick={this.validate} loading={submitting}>
<Button type="primary" onClick={this.validate} loading={submitting}>
提交
提交
</Button>
</Button>
<
/FooterToolbar
>
</FooterToolbar>
*/
}
<
/
PageHeaderWrapper
>
</>
);
);
}
}
}
}
export
default
PAGE_NAME_UPPER_CAMEL_CASE
;
export
default
Form
.
create
()(
PAGE_NAME_UPPER_CAMEL_CASE
)
;
AdvancedForm/src/model.
j
s
→
AdvancedForm/src/model.
t
s
View file @
1d0def2a
File moved
AdvancedForm/src/service.
j
s
→
AdvancedForm/src/service.
t
s
View file @
1d0def2a
File moved
package.json
View file @
1d0def2a
{
{
"private"
:
true
,
"private"
:
true
,
"scripts"
:
{
"scripts"
:
{
"dev"
:
"PAGES_PATH='A
ccountCenter
/src' umi dev"
,
"dev"
:
"PAGES_PATH='A
dvancedForm
/src' umi dev"
,
"lint:style"
:
"stylelint
\"
src/**/*.less
\"
--syntax less"
,
"lint:style"
:
"stylelint
\"
src/**/*.less
\"
--syntax less"
,
"lint"
:
"eslint --ext .js src mock tests && npm run lint:style"
,
"lint"
:
"eslint --ext .js src mock tests && npm run lint:style"
,
"lint:fix"
:
"eslint --fix --ext .js src mock tests && npm run lint:style"
,
"lint:fix"
:
"eslint --fix --ext .js src mock tests && npm run lint:style"
,
...
...
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