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