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
A
ant-design-pro
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
ant-design-pro
Commits
4bb20738
Commit
4bb20738
authored
May 29, 2019
by
ιεΈ
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix code style
parent
63aebe91
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
60 additions
and
56 deletions
+60
-56
scripts/insertCode.js
scripts/insertCode.js
+1
-1
src/components/GlobalHeader/AvatarDropdown.tsx
src/components/GlobalHeader/AvatarDropdown.tsx
+6
-3
src/components/GlobalHeader/NoticeIconView.tsx
src/components/GlobalHeader/NoticeIconView.tsx
+11
-7
src/components/GlobalHeader/RightContent.tsx
src/components/GlobalHeader/RightContent.tsx
+1
-0
src/layouts/BasicLayout.tsx
src/layouts/BasicLayout.tsx
+12
-9
src/models/global.ts
src/models/global.ts
+2
-2
src/models/login.ts
src/models/login.ts
+4
-7
src/models/setting.ts
src/models/setting.ts
+7
-7
src/models/user.ts
src/models/user.ts
+13
-14
src/pages/Authorized.tsx
src/pages/Authorized.tsx
+2
-3
src/pages/Welcome.tsx
src/pages/Welcome.tsx
+1
-3
No files found.
scripts/insertCode.js
View file @
4bb20738
...
@@ -33,7 +33,7 @@ const SettingCodeString = `
...
@@ -33,7 +33,7 @@ const SettingCodeString = `
<SettingDrawer
<SettingDrawer
settings={settings}
settings={settings}
onSettingChange={config =>
onSettingChange={config =>
dispatch
!
({
dispatch({
type: 'settings/changeSetting',
type: 'settings/changeSetting',
payload: config,
payload: config,
})
})
...
...
src/components/GlobalHeader/AvatarDropdown.tsx
View file @
4bb20738
...
@@ -20,9 +20,12 @@ class AvatarDropdown extends React.Component<GlobalHeaderRightProps> {
...
@@ -20,9 +20,12 @@ class AvatarDropdown extends React.Component<GlobalHeaderRightProps> {
if
(
key
===
'
logout
'
)
{
if
(
key
===
'
logout
'
)
{
const
{
dispatch
}
=
this
.
props
;
const
{
dispatch
}
=
this
.
props
;
dispatch
!
({
if
(
dispatch
)
{
type
:
'
login/logout
'
,
dispatch
({
});
type
:
'
login/logout
'
,
});
}
return
;
return
;
}
}
router
.
push
(
`/account/
${
key
}
`
);
router
.
push
(
`/account/
${
key
}
`
);
...
...
src/components/GlobalHeader/NoticeIconView.tsx
View file @
4bb20738
...
@@ -66,16 +66,20 @@ class GlobalHeaderRight extends Component<GlobalHeaderRightProps> {
...
@@ -66,16 +66,20 @@ class GlobalHeaderRight extends Component<GlobalHeaderRightProps> {
changeReadState
=
(
clickedItem
:
NoticeItem
)
=>
{
changeReadState
=
(
clickedItem
:
NoticeItem
)
=>
{
const
{
id
}
=
clickedItem
;
const
{
id
}
=
clickedItem
;
const
{
dispatch
}
=
this
.
props
;
const
{
dispatch
}
=
this
.
props
;
dispatch
!
({
if
(
dispatch
)
{
type
:
'
global/changeNoticeReadState
'
,
dispatch
({
payload
:
id
,
type
:
'
global/changeNoticeReadState
'
,
});
payload
:
id
,
});
}
};
};
componentDidMount
()
{
componentDidMount
()
{
const
{
dispatch
}
=
this
.
props
;
const
{
dispatch
}
=
this
.
props
;
dispatch
!
({
if
(
dispatch
)
{
type
:
'
global/fetchNotices
'
,
dispatch
({
});
type
:
'
global/fetchNotices
'
,
});
}
}
}
handleNoticeClear
=
(
title
:
string
,
key
:
string
)
=>
{
handleNoticeClear
=
(
title
:
string
,
key
:
string
)
=>
{
const
{
dispatch
}
=
this
.
props
;
const
{
dispatch
}
=
this
.
props
;
...
...
src/components/GlobalHeader/RightContent.tsx
View file @
4bb20738
...
@@ -7,6 +7,7 @@ import SelectLang from '../SelectLang';
...
@@ -7,6 +7,7 @@ import SelectLang from '../SelectLang';
import
styles
from
'
./index.less
'
;
import
styles
from
'
./index.less
'
;
import
Avatar
from
'
./AvatarDropdown
'
;
import
Avatar
from
'
./AvatarDropdown
'
;
import
{
connect
}
from
'
dva
'
;
import
{
connect
}
from
'
dva
'
;
export
type
SiderTheme
=
'
light
'
|
'
dark
'
;
export
type
SiderTheme
=
'
light
'
|
'
dark
'
;
export
interface
GlobalHeaderRightProps
extends
ConnectProps
{
export
interface
GlobalHeaderRightProps
extends
ConnectProps
{
theme
?:
SiderTheme
;
theme
?:
SiderTheme
;
...
...
src/layouts/BasicLayout.tsx
View file @
4bb20738
...
@@ -41,25 +41,28 @@ const menuDataRender = (menuList: MenuDataItem[]): MenuDataItem[] => {
...
@@ -41,25 +41,28 @@ const menuDataRender = (menuList: MenuDataItem[]): MenuDataItem[] => {
};
};
const
BasicLayout
:
React
.
FC
<
BasicLayoutProps
>
=
props
=>
{
const
BasicLayout
:
React
.
FC
<
BasicLayoutProps
>
=
props
=>
{
const
{
dispatch
,
children
,
settings
,
location
}
=
props
;
const
{
dispatch
,
children
,
settings
}
=
props
;
/**
/**
* constructor
* constructor
*/
*/
useState
(()
=>
{
useState
(()
=>
{
dispatch
!
({
if
(
dispatch
)
{
type
:
'
user/fetchCurrent
'
,
dispatch
({
});
type
:
'
user/fetchCurrent
'
,
dispatch
!
({
});
type
:
'
settings/getSetting
'
,
dispatch
({
});
type
:
'
settings/getSetting
'
,
});
}
});
});
/**
/**
* init variables
* init variables
*/
*/
const
handleMenuCollapse
=
(
payload
:
boolean
)
=>
const
handleMenuCollapse
=
(
payload
:
boolean
)
=>
dispatch
!
({
dispatch
&&
dispatch
({
type
:
'
global/changeLayoutCollapsed
'
,
type
:
'
global/changeLayoutCollapsed
'
,
payload
,
payload
,
});
});
...
...
src/models/global.ts
View file @
4bb20738
...
@@ -99,7 +99,7 @@ const GlobalModel: GlobalModelType = {
...
@@ -99,7 +99,7 @@ const GlobalModel: GlobalModelType = {
},
},
reducers
:
{
reducers
:
{
changeLayoutCollapsed
(
state
,
{
payload
})
{
changeLayoutCollapsed
(
state
=
{
notices
:
[],
collapsed
:
true
}
,
{
payload
})
{
return
{
return
{
...
state
,
...
state
,
collapsed
:
payload
,
collapsed
:
payload
,
...
@@ -112,7 +112,7 @@ const GlobalModel: GlobalModelType = {
...
@@ -112,7 +112,7 @@ const GlobalModel: GlobalModelType = {
notices
:
payload
,
notices
:
payload
,
};
};
},
},
saveClearedNotices
(
state
,
{
payload
})
{
saveClearedNotices
(
state
=
{
notices
:
[],
collapsed
:
true
}
,
{
payload
})
{
return
{
return
{
collapsed
:
false
,
collapsed
:
false
,
...
state
,
...
state
,
...
...
src/models/login.ts
View file @
4bb20738
import
{
routerRedux
}
from
'
dva/router
'
;
import
{
routerRedux
}
from
'
dva/router
'
;
import
{
Reducer
}
from
'
redux
'
;
import
{
Reducer
,
AnyAction
}
from
'
redux
'
;
import
{
EffectsCommandMap
}
from
'
dva
'
;
import
{
EffectsCommandMap
}
from
'
dva
'
;
import
{
AnyAction
}
from
'
redux
'
;
import
{
stringify
,
parse
}
from
'
qs
'
;
import
{
stringify
,
parse
}
from
'
qs
'
;
export
function
getPageQuery
()
{
export
function
getPageQuery
()
{
return
parse
(
window
.
location
.
href
.
split
(
'
?
'
)[
1
]);
return
parse
(
window
.
location
.
href
.
split
(
'
?
'
)[
1
]);
}
}
export
interface
IStateType
{}
export
type
Effect
=
(
export
type
Effect
=
(
action
:
AnyAction
,
action
:
AnyAction
,
effects
:
EffectsCommandMap
&
{
select
:
<
T
>
(
func
:
(
state
:
IStateType
)
=>
T
)
=>
T
},
effects
:
EffectsCommandMap
&
{
select
:
<
T
>
(
func
:
(
state
:
{}
)
=>
T
)
=>
T
},
)
=>
void
;
)
=>
void
;
export
interface
ModelType
{
export
interface
ModelType
{
namespace
:
string
;
namespace
:
string
;
state
:
IStateType
;
state
:
{}
;
effects
:
{
effects
:
{
logout
:
Effect
;
logout
:
Effect
;
};
};
reducers
:
{
reducers
:
{
changeLoginStatus
:
Reducer
<
IStateType
>
;
changeLoginStatus
:
Reducer
<
{}
>
;
};
};
}
}
...
...
src/models/setting.ts
View file @
4bb20738
...
@@ -6,8 +6,8 @@ export interface SettingModelType {
...
@@ -6,8 +6,8 @@ export interface SettingModelType {
namespace
:
'
settings
'
;
namespace
:
'
settings
'
;
state
:
DefaultSettings
;
state
:
DefaultSettings
;
reducers
:
{
reducers
:
{
getSetting
:
Reducer
<
any
>
;
getSetting
:
Reducer
<
DefaultSettings
>
;
changeSetting
:
Reducer
<
any
>
;
changeSetting
:
Reducer
<
DefaultSettings
>
;
};
};
}
}
let
lessNodesAppended
:
boolean
;
let
lessNodesAppended
:
boolean
;
...
@@ -72,7 +72,7 @@ const updateTheme: (primaryColor?: string) => void = primaryColor => {
...
@@ -72,7 +72,7 @@ const updateTheme: (primaryColor?: string) => void = primaryColor => {
}
}
};
};
const
updateColorWeak
:
(
colorWeak
:
string
)
=>
void
=
colorWeak
=>
{
const
updateColorWeak
:
(
colorWeak
:
boolean
)
=>
void
=
colorWeak
=>
{
const
root
=
document
.
getElementById
(
'
root
'
);
const
root
=
document
.
getElementById
(
'
root
'
);
if
(
root
)
{
if
(
root
)
{
root
.
className
=
colorWeak
?
'
colorWeak
'
:
''
;
root
.
className
=
colorWeak
?
'
colorWeak
'
:
''
;
...
@@ -83,8 +83,8 @@ const SettingModel: SettingModelType = {
...
@@ -83,8 +83,8 @@ const SettingModel: SettingModelType = {
namespace
:
'
settings
'
,
namespace
:
'
settings
'
,
state
:
defaultSettings
,
state
:
defaultSettings
,
reducers
:
{
reducers
:
{
getSetting
(
state
)
{
getSetting
(
state
=
defaultSettings
)
{
const
setting
:
any
=
{};
const
setting
:
Partial
<
DefaultSettings
>
=
{};
const
urlParams
=
new
URL
(
window
.
location
.
href
);
const
urlParams
=
new
URL
(
window
.
location
.
href
);
Object
.
keys
(
state
).
forEach
(
key
=>
{
Object
.
keys
(
state
).
forEach
(
key
=>
{
if
(
urlParams
.
searchParams
.
has
(
key
))
{
if
(
urlParams
.
searchParams
.
has
(
key
))
{
...
@@ -97,13 +97,13 @@ const SettingModel: SettingModelType = {
...
@@ -97,13 +97,13 @@ const SettingModel: SettingModelType = {
if
(
state
.
primaryColor
!==
primaryColor
)
{
if
(
state
.
primaryColor
!==
primaryColor
)
{
updateTheme
(
primaryColor
);
updateTheme
(
primaryColor
);
}
}
updateColorWeak
(
colorWeak
);
updateColorWeak
(
!!
colorWeak
);
return
{
return
{
...
state
,
...
state
,
...
setting
,
...
setting
,
};
};
},
},
changeSetting
(
state
,
{
payload
})
{
changeSetting
(
state
=
defaultSettings
,
{
payload
})
{
const
urlParams
=
new
URL
(
window
.
location
.
href
);
const
urlParams
=
new
URL
(
window
.
location
.
href
);
Object
.
keys
(
defaultSettings
).
forEach
(
key
=>
{
Object
.
keys
(
defaultSettings
).
forEach
(
key
=>
{
if
(
urlParams
.
searchParams
.
has
(
key
))
{
if
(
urlParams
.
searchParams
.
has
(
key
))
{
...
...
src/models/user.ts
View file @
4bb20738
...
@@ -9,13 +9,15 @@ export interface CurrentUser {
...
@@ -9,13 +9,15 @@ export interface CurrentUser {
group
?:
string
;
group
?:
string
;
signature
?:
string
;
signature
?:
string
;
geographic
?:
any
;
geographic
?:
any
;
tags
?:
any
[];
tags
?:
{
key
:
string
;
label
:
string
;
}[];
unreadCount
?:
number
;
unreadCount
?:
number
;
}
}
export
interface
UserModelState
{
export
interface
UserModelState
{
list
:
any
[];
currentUser
?:
CurrentUser
;
currentUser
:
CurrentUser
;
}
}
export
interface
UserModelType
{
export
interface
UserModelType
{
...
@@ -26,9 +28,8 @@ export interface UserModelType {
...
@@ -26,9 +28,8 @@ export interface UserModelType {
fetchCurrent
:
Effect
;
fetchCurrent
:
Effect
;
};
};
reducers
:
{
reducers
:
{
save
:
Reducer
<
any
>
;
saveCurrentUser
:
Reducer
<
UserModelState
>
;
saveCurrentUser
:
Reducer
<
any
>
;
changeNotifyCount
:
Reducer
<
UserModelState
>
;
changeNotifyCount
:
Reducer
<
any
>
;
};
};
}
}
...
@@ -36,7 +37,6 @@ const UserModel: UserModelType = {
...
@@ -36,7 +37,6 @@ const UserModel: UserModelType = {
namespace
:
'
user
'
,
namespace
:
'
user
'
,
state
:
{
state
:
{
list
:
[],
currentUser
:
{},
currentUser
:
{},
},
},
...
@@ -58,19 +58,18 @@ const UserModel: UserModelType = {
...
@@ -58,19 +58,18 @@ const UserModel: UserModelType = {
},
},
reducers
:
{
reducers
:
{
save
(
state
,
action
)
{
return
{
...
state
,
list
:
action
.
payload
,
};
},
saveCurrentUser
(
state
,
action
)
{
saveCurrentUser
(
state
,
action
)
{
return
{
return
{
...
state
,
...
state
,
currentUser
:
action
.
payload
||
{},
currentUser
:
action
.
payload
||
{},
};
};
},
},
changeNotifyCount
(
state
,
action
)
{
changeNotifyCount
(
state
=
{
currentUser
:
{},
},
action
,
)
{
return
{
return
{
...
state
,
...
state
,
currentUser
:
{
currentUser
:
{
...
...
src/pages/Authorized.tsx
View file @
4bb20738
import
Authorized
from
'
@/utils/Authorized
'
;
import
Authorized
from
'
@/utils/Authorized
'
;
import
{
Route
}
from
'
@/models/connect
'
;
import
{
ConnectProps
,
ConnectState
,
UserModelState
,
Route
}
from
'
@/models/connect
'
;
import
{
ConnectProps
,
ConnectState
,
UserModelState
}
from
'
@/models/connect
'
;
import
{
connect
}
from
'
dva
'
;
import
{
connect
}
from
'
dva
'
;
import
pathToRegexp
from
'
path-to-regexp
'
;
import
pathToRegexp
from
'
path-to-regexp
'
;
import
React
from
'
react
'
;
import
React
from
'
react
'
;
...
@@ -11,7 +10,7 @@ interface AuthComponentProps extends ConnectProps {
...
@@ -11,7 +10,7 @@ interface AuthComponentProps extends ConnectProps {
}
}
const
getRouteAuthority
=
(
path
:
string
,
routeData
:
Route
[])
=>
{
const
getRouteAuthority
=
(
path
:
string
,
routeData
:
Route
[])
=>
{
let
authorities
:
string
[]
|
string
|
undefined
=
void
0
;
let
authorities
:
string
[]
|
string
|
undefined
=
undefined
;
routeData
.
forEach
(
route
=>
{
routeData
.
forEach
(
route
=>
{
// match prefix
// match prefix
if
(
pathToRegexp
(
`
${
route
.
path
}
(.*)`
).
test
(
path
))
{
if
(
pathToRegexp
(
`
${
route
.
path
}
(.*)`
).
test
(
path
))
{
...
...
src/pages/Welcome.tsx
View file @
4bb20738
import
React
from
'
react
'
;
import
React
from
'
react
'
;
const
Welcome
=
()
=>
(
export
default
()
=>
(
<
p
style
=
{
{
textAlign
:
'
center
'
}
}
>
<
p
style
=
{
{
textAlign
:
'
center
'
}
}
>
ζ³θ¦ζ·»ε ζ΄ε€ι‘΅ι’οΌθ―·εθ
{
'
'
}
ζ³θ¦ζ·»ε ζ΄ε€ι‘΅ι’οΌθ―·εθ
{
'
'
}
<
a
href
=
"https://umijs.org/guide/block.html"
target
=
"_blank"
rel
=
"noopener noreferrer"
>
<
a
href
=
"https://umijs.org/guide/block.html"
target
=
"_blank"
rel
=
"noopener noreferrer"
>
...
@@ -9,5 +9,3 @@ const Welcome = () => (
...
@@ -9,5 +9,3 @@ const Welcome = () => (
γ
γ
</
p
>
</
p
>
);
);
Welcome
.
title
=
'
ζ¬’θΏδ½Ώη¨
'
;
export
default
Welcome
;
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