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
e6c53dad
Commit
e6c53dad
authored
Apr 07, 2017
by
nano
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lint
parent
497759fa
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
141 additions
and
139 deletions
+141
-139
i18n.json
i18n.json
+2
-2
src/models/common.js
src/models/common.js
+9
-6
src/router.js
src/router.js
+1
-1
src/routes/Index.js
src/routes/Index.js
+60
-61
src/routes/Profiles.js
src/routes/Profiles.js
+69
-69
No files found.
i18n.json
View file @
e6c53dad
{
"en"
:
{
"en
-US
"
:
{
"title"
:
"MoeCube"
,
"Home"
:
"Home"
,
"username"
:
"User Name"
,
...
...
@@ -82,7 +82,7 @@
"没毛用"
:
"防逗号报错,上线删"
},
"zh"
:
{
"zh
-CN
"
:
{
"title"
:
"萌立方"
,
"Home"
:
"主页"
,
"username"
:
"用户名"
,
...
...
src/models/common.js
View file @
e6c53dad
...
...
@@ -14,10 +14,13 @@ export default {
...
state
,
...
action
.
payload
,
};
},
changeLanguage
(
state
,
{
payload
:
id
}
)
{
localStorage
.
setItem
(
'
locale
'
,
id
.
id
);
changeLanguage
(
state
,
action
)
{
localStorage
.
setItem
(
'
locale
'
,
action
.
payload
.
language
);
history
.
go
(
0
);
return
state
;
return
{
...
state
,
...
action
.
payload
,
};
},
},
effects
:
{},
...
...
@@ -26,8 +29,8 @@ export default {
let
client
;
const
language
=
localStorage
.
getItem
(
'
locale
'
)
||
navigator
.
language
||
(
navigator
.
languages
&&
navigator
.
languages
[
0
])
||
navigator
.
userLanguage
;
const
languageWithoutRegionCode
=
language
.
toLowerCase
().
split
(
/
[
_-
]
+/
)[
0
];
const
messages
=
i18n
[
language
WithoutRegionCode
];
//
const languageWithoutRegionCode = language.toLowerCase().split(/[_-]+/)[0];
const
messages
=
i18n
[
language
];
const
{
userAgent
}
=
navigator
;
...
...
@@ -35,7 +38,7 @@ export default {
client
=
'
electron
'
;
}
dispatch
({
type
:
'
init
'
,
payload
:
{
language
:
languageWithoutRegionCode
,
messages
,
client
}
});
dispatch
({
type
:
'
init
'
,
payload
:
{
language
,
messages
,
client
}
});
},
},
};
src/router.js
View file @
e6c53dad
import
{
Route
,
Router
,
Redirect
}
from
'
dva/router
'
;
import
{
Route
,
Router
}
from
'
dva/router
'
;
import
React
from
'
react
'
;
import
Active
from
'
./routes/Activate.js
'
;
...
...
src/routes/Index.js
View file @
e6c53dad
...
...
@@ -7,6 +7,11 @@ import { FormattedMessage as Format } from 'react-intl';
import
Particles
from
'
react-particles-js
'
;
import
logo
from
'
../assets/MoeCube.png
'
;
const
languageMap
=
{
'
zh-CN
'
:
'
中文
'
,
'
en-US
'
:
'
English
'
,
}
const
{
Header
,
Footer
}
=
Layout
;
const
particleConfig
=
{
particles
:
{
...
...
@@ -122,70 +127,64 @@ const particleConfig = {
retina_detect
:
true
,
};
function
Index
({
children
,
messages
,
dispatch
,
client
})
{
const
language
=
localStorage
.
getItem
(
'
locale
'
)
||
navigator
.
language
||
(
navigator
.
languages
&&
navigator
.
languages
[
0
])
||
navigator
.
userLanguage
||
navigator
.
browserLanguage
||
'
zh-CN
'
;
function
Index
({
children
,
messages
,
dispatch
,
client
,
token
,
language
})
{
const
menu
=
(
<
Menu
style
=
{{
transform
:
'
translateX(-16px)
'
}}
>
<
Menu
.
Item
key
=
"
0
"
>
<
a
onClick
=
{()
=>
{
dispatch
({
type
:
'
common/changeLanguage
'
,
payload
:
{
id
:
'
en-US
'
}
});
}}
>
&
nbsp
;
English
<
/a
>
<
/Menu.Item
>
<
Menu
.
Item
key
=
"
1
"
>
<
a
onClick
=
{()
=>
{
dispatch
({
type
:
'
common/changeLanguage
'
,
payload
:
{
id
:
'
zh-EN
'
}
});
}}
>
&
nbsp
;
中文
<
/a
>
<
/Menu.Item
>
{
Object
.
keys
(
languageMap
).
map
((
lan
,
i
)
=>
{
return
(
<
Menu
.
Item
key
=
{
i
}
>
<
a
onClick
=
{()
=>
{
dispatch
({
type
:
'
common/changeLanguage
'
,
payload
:
{
language
:
lan
}
})
}}
>
{
languageMap
[
lan
]}
<
/a
>
<
/Menu.Item
>
)
})
}
<
/Menu
>
);
return
(
<
div
style
=
{{
display
:
'
flex
'
,
flexDirection
:
'
column
'
,
flex
:
1
,
minHeight
:
'
100%
'
}}
>
<
DocumentTitle
title
=
{
messages
.
title
||
'
Moe Cube
'
}
/
>
<
DocumentTitle
title
=
{
messages
.
title
||
'
Moe Cube
'
}
/
>
{
client
!==
'
electron
'
&&
<
Header
style
=
{{
display
:
'
flex
'
,
alignItems
:
'
center
'
}}
>
<
Link
to
=
"
/
"
style
=
{{
marginTop
:
'
20px
'
}}
>
<
img
alt
=
"
logo
"
src
=
{
logo
}
style
=
{{
width
:
'
140px
'
,
height
:
'
44px
'
}}
/
>
<
/Link
>
<
Header
style
=
{{
display
:
'
flex
'
,
alignItems
:
'
center
'
}}
>
<
Link
to
=
"
/
"
style
=
{{
marginTop
:
'
20px
'
}}
>
<
img
alt
=
"
logo
"
src
=
{
logo
}
style
=
{{
width
:
'
140px
'
,
height
:
'
44px
'
}}
/
>
<
/Link
>
<
Menu
theme
=
"
dark
"
mode
=
"
horizontal
"
defaultSelectedKeys
=
{[
'
1
'
]}
style
=
{{
lineHeight
:
'
64px
'
}}
>
<
Menu
.
Item
key
=
"
1
"
>
<
Link
to
=
"
/
"
>
<
Format
id
=
"
Home
"
/>
<
/Link
>
<
/Menu.Item
>
<
/Menu
>
<
Menu
theme
=
"
dark
"
mode
=
"
horizontal
"
defaultSelectedKeys
=
{[
'
1
'
]}
style
=
{{
lineHeight
:
'
64px
'
}}
>
<
Menu
.
Item
key
=
"
1
"
>
<
Link
to
=
"
/
"
>
<
Format
id
=
"
Home
"
/>
<
/Link
>
<
/Menu.Item
>
<
/Menu
>
<
Menu
theme
=
"
dark
"
mode
=
"
horizontal
"
defaultSelectedKeys
=
{[
'
1
'
]}
style
=
{{
lineHeight
:
'
64px
'
,
position
:
'
absolute
'
,
right
:
'
50px
'
}}
>
{
localStorage
.
getItem
(
'
token
'
)
?
(
<
Menu
.
Item
key
=
"
1
"
>
<
div
onClick
=
{()
=>
{
dispatch
({
type
:
'
auth/signOut
'
});
}}
>
<
Format
id
=
"
sign-out
"
/>
<
/div
>
<
/Menu.Item>
)
:
(
''
)
}
<
/Menu
>
<
Menu
theme
=
"
dark
"
mode
=
"
horizontal
"
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
>
}
<
Particles
...
...
@@ -198,13 +197,9 @@ function Index({ children, messages, dispatch, client }) {
<
Footer
style
=
{{
width
:
'
100%
'
,
justifyContent
:
'
space-between
'
,
display
:
'
flex
'
,
zIndex
:
100
}}
>
<
div
><
Dropdown
overlay
=
{
menu
}
trigger
=
{[
'
click
'
]}
>
{
language
===
'
en-US
'
?
<
a
className
=
"
ant-dropdown-link changelanguage
"
>
&
nbsp
;
English
<
Icon
type
=
"
down
"
className
=
"
flag
"
/>
<
/a> : <a className="ant-dropdown-link changelanguage"
>
&
nbsp
;
中文
<
Icon
type
=
"
down
"
className
=
"
flag
"
/>
<
/a
>
}
<
a
className
=
"
ant-dropdown-link changelanguage
"
>
{
languageMap
[
language
]}
<
Icon
type
=
"
down
"
className
=
"
flag
"
/>
<
/a
>
<
/Dropdown></
div
>
<
div
>
©
MoeCube
2017
all
right
reserved
.
<
/div
>
<
/Footer
>
...
...
@@ -214,9 +209,13 @@ function Index({ children, messages, dispatch, client }) {
function
mapStateToProps
(
state
)
{
const
{
common
:
{
messages
,
client
},
common
:
{
messages
,
client
,
language
},
user
:
{
user
,
token
},
}
=
state
;
return
{
token
,
user
,
language
,
messages
,
client
,
};
...
...
src/routes/Profiles.js
View file @
e6c53dad
...
...
@@ -96,75 +96,75 @@ class Profiles extends React.Component {
/* eslint-disable jsx-a11y/label-has-for */
return
(
<
div
style
=
{{
flex
:
1
,
height
:
'
100%
'
}}
>
<
Spin
spinning
=
{
loading
}
delay
=
{
100
}
>
<
Tabs
defaultActiveKey
=
"
1
"
className
=
"
app-detail-nav
"
>
<
TabPane
tab
=
{
<
span
><
Icon
type
=
"
user
"
/><
Format
id
=
{
'
user-info
'
}
/> </
span
>
}
key
=
"
1
"
>
<
Form
onSubmit
=
{
this
.
onUpdateSubmit
}
>
<
FormItem
style
=
{{
display
:
'
flex
'
,
justifyContent
:
'
center
'
}}
>
<
div
style
=
{{
display
:
isUpload
?
'
flex
'
:
'
none
'
,
flexDirection
:
'
column
'
}}
>
<
Cropper
ref
=
{(
cropper
)
=>
{
this
.
cropper
=
cropper
;
}}
src
=
{
imageUrl
||
defaultAvatar
}
style
=
{{
maxHeight
:
'
20vw
'
,
maxWidth
:
'
20vw
'
}}
aspectRatio
=
{
1
/
1
}
guides
/>
<
Button
type
=
"
primary
"
onClick
=
{
this
.
handleUpload
}
>
<
Icon
type
=
"
upload
"
/>
<
Format
id
=
"
upload
"
/>
<
/Button
>
<
/div
>
<
div
style
=
{{
display
:
!
isUpload
?
'
flex
'
:
'
none
'
,
flexDirection
:
'
column
'
}}
>
<
img
alt
=
"
avatar
"
src
=
{
avatar
||
imageUrl
||
defaultAvatar
}
/
>
<
Button
onClick
=
{()
=>
{
dispatch
({
type
:
'
upload/start
'
});
}}
>
<
label
>
<
Icon
type
=
"
plus
"
/><
Format
id
=
"
Change-Avatar
"
/>
<
input
type
=
"
file
"
onChange
=
{
this
.
onGetFile
}
ref
=
{(
file
)
=>
{
this
.
file
=
file
;
}}
style
=
{{
display
:
'
none
'
}}
/
>
<
/label
>
<
/Button
>
<
/div
>
<
/FormItem
>
<
FormItem
{...
nameProps
.
fromItem
}
>
{
getFieldDecorator
(
'
name
'
,
{
...
nameProps
.
decorator
})(
<
Input
{...
nameProps
.
input
}
/>
,
)}
<
/FormItem
>
<
FormItem
>
<
div
className
=
{
styles
.
wrapSubmit
}
>
<
Button
type
=
"
primary
"
htmlType
=
"
submit
"
size
=
"
large
"
><
Format
id
=
{
'
save
'
}
/></
Button
>
<
/div
>
<
/FormItem
>
<
/Form
>
<
/TabPane
>
<
TabPane
tab
=
{
<
span
><
Icon
type
=
"
setting
"
/><
Format
id
=
{
'
account-info
'
}
/></
span
>
}
key
=
"
2
"
>
<
Tabs
type
=
"
card
"
className
=
"
app-detail-nav
"
>
<
TabPane
tab
=
{
messages
[
'
reset-username
'
]}
key
=
{
0
}
>
<
UserNameForm
/>
<
/TabPane
>
<
TabPane
tab
=
{
messages
[
'
reset-email
'
]}
key
=
{
1
}
>
<
EmailForm
/>
<
/TabPane
>
<
TabPane
tab
=
{
messages
[
'
reset-password
'
]}
key
=
{
2
}
>
<
PasswordForm
/>
<
/TabPane
>
<
/Tabs
>
<
/TabPane
>
<
/Tabs
>
<
/Spin
>
<
Spin
spinning
=
{
loading
}
delay
=
{
100
}
>
<
Tabs
defaultActiveKey
=
"
1
"
className
=
"
app-detail-nav
"
>
<
TabPane
tab
=
{
<
span
><
Icon
type
=
"
user
"
/><
Format
id
=
{
'
user-info
'
}
/> </
span
>
}
key
=
"
1
"
>
<
Form
onSubmit
=
{
this
.
onUpdateSubmit
}
>
<
FormItem
style
=
{{
display
:
'
flex
'
,
justifyContent
:
'
center
'
}}
>
<
div
style
=
{{
display
:
isUpload
?
'
flex
'
:
'
none
'
,
flexDirection
:
'
column
'
}}
>
<
Cropper
ref
=
{(
cropper
)
=>
{
this
.
cropper
=
cropper
;
}}
src
=
{
imageUrl
||
defaultAvatar
}
style
=
{{
maxHeight
:
'
20vw
'
,
maxWidth
:
'
20vw
'
}}
aspectRatio
=
{
1
/
1
}
guides
/>
<
Button
type
=
"
primary
"
onClick
=
{
this
.
handleUpload
}
>
<
Icon
type
=
"
upload
"
/>
<
Format
id
=
"
upload
"
/>
<
/Button
>
<
/div
>
<
div
style
=
{{
display
:
!
isUpload
?
'
flex
'
:
'
none
'
,
flexDirection
:
'
column
'
}}
>
<
img
alt
=
"
avatar
"
src
=
{
avatar
||
imageUrl
||
defaultAvatar
}
/
>
<
Button
onClick
=
{()
=>
{
dispatch
({
type
:
'
upload/start
'
});
}}
>
<
label
>
<
Icon
type
=
"
plus
"
/><
Format
id
=
"
Change-Avatar
"
/>
<
input
type
=
"
file
"
onChange
=
{
this
.
onGetFile
}
ref
=
{(
file
)
=>
{
this
.
file
=
file
;
}}
style
=
{{
display
:
'
none
'
}}
/
>
<
/label
>
<
/Button
>
<
/div
>
<
/FormItem
>
<
FormItem
{...
nameProps
.
fromItem
}
>
{
getFieldDecorator
(
'
name
'
,
{
...
nameProps
.
decorator
})(
<
Input
{...
nameProps
.
input
}
/>
,
)}
<
/FormItem
>
<
FormItem
>
<
div
className
=
{
styles
.
wrapSubmit
}
>
<
Button
type
=
"
primary
"
htmlType
=
"
submit
"
size
=
"
large
"
><
Format
id
=
{
'
save
'
}
/></
Button
>
<
/div
>
<
/FormItem
>
<
/Form
>
<
/TabPane
>
<
TabPane
tab
=
{
<
span
><
Icon
type
=
"
setting
"
/><
Format
id
=
{
'
account-info
'
}
/></
span
>
}
key
=
"
2
"
>
<
Tabs
type
=
"
card
"
className
=
"
app-detail-nav
"
>
<
TabPane
tab
=
{
messages
[
'
reset-username
'
]}
key
=
{
0
}
>
<
UserNameForm
/>
<
/TabPane
>
<
TabPane
tab
=
{
messages
[
'
reset-email
'
]}
key
=
{
1
}
>
<
EmailForm
/>
<
/TabPane
>
<
TabPane
tab
=
{
messages
[
'
reset-password
'
]}
key
=
{
2
}
>
<
PasswordForm
/>
<
/TabPane
>
<
/Tabs
>
<
/TabPane
>
<
/Tabs
>
<
/Spin
>
<
/div
>
);
}
...
...
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