Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
Moecube Accounts Web
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
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
MyCard
Moecube Accounts Web
Commits
40318e4c
Commit
40318e4c
authored
Apr 07, 2017
by
nano
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avatar
parent
e6c53dad
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
65 additions
and
20 deletions
+65
-20
src/components/UserPanel.css
src/components/UserPanel.css
+3
-0
src/components/UserPanel.js
src/components/UserPanel.js
+56
-0
src/router.js
src/router.js
+1
-0
src/routes/Index.js
src/routes/Index.js
+5
-20
No files found.
src/components/UserPanel.css
0 → 100644
View file @
40318e4c
.normal
{
}
src/components/UserPanel.js
0 → 100644
View file @
40318e4c
import
React
from
'
react
'
;
import
{
connect
}
from
'
dva
'
;
import
styles
from
'
./UserPanel.css
'
;
import
{
Dropdown
,
Menu
,
Icon
}
from
'
antd
'
;
import
{
FormattedMessage
as
Format
}
from
'
react-intl
'
;
import
{
Link
}
from
'
dva/router
'
const
defaultAvatar
=
require
(
'
../../public/default_avatar.jpg
'
);
function
UserPanel
({
dispatch
,
user
,
token
})
{
const
{
avatar
}
=
user
;
const
menu
=
(
<
Menu
trigger
=
{[
'
click
'
]}
>
<
Menu
.
Item
>
{
token
?
<
Link
to
=
"
/profiles
"
>
//i18n 个人中心</Link> : <Link to="/signin">//i18n 登录</Link>
}
<
/Menu.Item
>
<
Menu
.
Divider
/>
{
token
&&
<
Menu
.
Item
>
<
div
onClick
=
{()
=>
{
dispatch
({
type
:
'
auth/signOut
'
})
}}
>
<
Format
id
=
"
sign-out
"
/>
<
/div
>
<
/Menu.Item
>
}
<
/Menu
>
)
return
(
<
Dropdown
overlay
=
{
menu
}
placement
=
"
bottomCenter
"
>
<
div
className
=
"
ant-dropdown-link
"
style
=
{{
display
:
'
flex
'
,
alignItems
:
'
center
'
}}
>
<
img
alt
=
"
avatar
"
src
=
{
avatar
||
defaultAvatar
}
style
=
{{
borderRadius
:
'
40px
'
,
height
:
'
40px
'
,
weight
:
'
auto
'
}}
/
>
<
/div
>
<
/Dropdown
>
);
}
function
mapStateToProps
(
state
)
{
const
{
common
:
{
messages
,
client
,
language
},
user
:
{
user
,
token
},
}
=
state
;
return
{
token
,
user
,
language
,
messages
,
client
,
};
}
export
default
connect
(
mapStateToProps
)(
UserPanel
);
src/router.js
View file @
40318e4c
...
@@ -17,6 +17,7 @@ import Reset from './routes/Reset.js';
...
@@ -17,6 +17,7 @@ import Reset from './routes/Reset.js';
import
Verify
from
'
./routes/Verify.js
'
;
import
Verify
from
'
./routes/Verify.js
'
;
function
RouterConfig
({
history
})
{
function
RouterConfig
({
history
})
{
return
(
return
(
<
Router
history
=
{
history
}
>
<
Router
history
=
{
history
}
>
...
...
src/routes/Index.js
View file @
40318e4c
...
@@ -6,6 +6,7 @@ import DocumentTitle from 'react-document-title';
...
@@ -6,6 +6,7 @@ import DocumentTitle from 'react-document-title';
import
{
FormattedMessage
as
Format
}
from
'
react-intl
'
;
import
{
FormattedMessage
as
Format
}
from
'
react-intl
'
;
import
Particles
from
'
react-particles-js
'
;
import
Particles
from
'
react-particles-js
'
;
import
logo
from
'
../assets/MoeCube.png
'
;
import
logo
from
'
../assets/MoeCube.png
'
;
import
UserPanel
from
'
../components/UserPanel
'
const
languageMap
=
{
const
languageMap
=
{
'
zh-CN
'
:
'
中文
'
,
'
zh-CN
'
:
'
中文
'
,
...
@@ -157,8 +158,7 @@ function Index({ children, messages, dispatch, client, token, language }) {
...
@@ -157,8 +158,7 @@ function Index({ children, messages, dispatch, client, token, language }) {
theme
=
"
dark
"
theme
=
"
dark
"
mode
=
"
horizontal
"
mode
=
"
horizontal
"
defaultSelectedKeys
=
{[
'
1
'
]}
defaultSelectedKeys
=
{[
'
1
'
]}
style
=
{{
lineHeight
:
'
64px
'
}}
style
=
{{
lineHeight
:
'
64px
'
}}
>
>
<
Menu
.
Item
key
=
"
1
"
>
<
Menu
.
Item
key
=
"
1
"
>
<
Link
to
=
"
/
"
>
<
Link
to
=
"
/
"
>
<
Format
id
=
"
Home
"
/>
<
Format
id
=
"
Home
"
/>
...
@@ -166,24 +166,9 @@ function Index({ children, messages, dispatch, client, token, language }) {
...
@@ -166,24 +166,9 @@ function Index({ children, messages, dispatch, client, token, language }) {
<
/Menu.Item
>
<
/Menu.Item
>
<
/Menu
>
<
/Menu
>
<
Menu
<
div
style
=
{{
position
:
'
absolute
'
,
right
:
'
40px
'
}}
>
theme
=
"
dark
"
<
UserPanel
/>
mode
=
"
horizontal
"
<
/div
>
defaultSelectedKeys
=
{[
'
1
'
]}
style
=
{{
lineHeight
:
'
64px
'
,
position
:
'
absolute
'
,
right
:
'
50px
'
}}
>
{
token
&&
(
<
Menu
.
Item
key
=
"
1
"
>
<
div
onClick
=
{()
=>
{
dispatch
({
type
:
'
auth/signOut
'
});
}}
>
<
Format
id
=
"
sign-out
"
/>
<
/div
>
<
/Menu.Item>
)
}
<
/Menu
>
<
/Header
>
<
/Header
>
}
}
...
...
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