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
4fdee9cc
Commit
4fdee9cc
authored
Apr 07, 2017
by
2breakegg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
change language 按钮位置
parent
323eb459
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
133 additions
and
289 deletions
+133
-289
.eslintrc
.eslintrc
+2
-0
.idea/workspace.xml
.idea/workspace.xml
+116
-57
.roadhogrc.js
.roadhogrc.js
+8
-1
package.json
package.json
+3
-3
src/models/common.js
src/models/common.js
+0
-33
src/router.js
src/router.js
+1
-1
src/routes/Profiles.js
src/routes/Profiles.js
+3
-1
src/routes/Register.js
src/routes/Register.js
+0
-193
No files found.
.eslintrc
View file @
4fdee9cc
...
...
@@ -4,6 +4,8 @@
"rules": {
"react/jsx-space-before-closing":[0],
"generator-star-spacing": [0],
"semi":[0],
"no-console":[0],
"consistent-return": [0],
"react/forbid-prop-types": [0],
"react/jsx-filename-extension": [1, { "extensions": [".js"] }],
...
...
.idea/workspace.xml
View file @
4fdee9cc
This diff is collapsed.
Click to expand it.
.roadhogrc.js
View file @
4fdee9cc
let
publicPath
=
'
https://cdn01.moecube.com/accounts/
'
const
API_ROOT
=
{
test
:
'
http://192.168.1.9:3000
'
,
dev
:
'
http://114.215.243.95:8082
'
,
prod
:
'
https://api.moeube.com/accounts
'
}
let
defineConf
=
{
apiRoot
:
process
.
env
[
"
API_ROOT
"
]
apiRoot
:
API_ROOT
[
process
.
env
[
"
ENV
"
]],
}
export
default
{
...
...
package.json
View file @
4fdee9cc
{
"private"
:
true
,
"scripts"
:
{
"start"
:
"cross-env
API_ROOT=http://192.168.1.9:3000
roadhog server"
,
"build:dev"
:
"cross-env
API_ROOT=http://114.215.243.95:8082
roadhog build"
,
"build"
:
"cross-env
API_ROOT=https://api.moeube.com/accounts
roadhog build"
,
"start"
:
"cross-env
ENV=test
roadhog server"
,
"build:dev"
:
"cross-env
ENV=dev
roadhog build"
,
"build"
:
"cross-env
ENV=prod
roadhog build"
,
"lint"
:
"eslint --ext .js src test"
,
"precommit"
:
"npm run lint"
},
...
...
src/models/common.js
deleted
100644 → 0
View file @
323eb459
import
i18n
from
'
../../i18n.json
'
;
export
default
{
namespace
:
'
common
'
,
state
:
{
language
:
'
zh-CN
'
,
messages
:
{},
},
reducers
:
{
init
(
state
,
action
)
{
return
{
...
state
,
...
action
.
payload
,
};
},
changeLanguage
(
state
,
{
payload
:
id
})
{
localStorage
.
setItem
(
'
locale
'
,
id
.
id
);
history
.
go
(
0
);
return
state
;
},
},
effects
:
{},
subscriptions
:
{
setup
({
dispatch
})
{
const
language
=
localStorage
.
getItem
(
'
locale
'
)
||
navigator
.
language
||
(
navigator
.
languages
&&
navigator
.
languages
[
0
])
||
navigator
.
userLanguage
;
const
languageWithoutRegionCode
=
language
.
toLowerCase
().
split
(
/
[
_-
]
+/
)[
0
];
const
messages
=
i18n
[
languageWithoutRegionCode
];
dispatch
({
type
:
'
init
'
,
payload
:
{
language
:
languageWithoutRegionCode
,
messages
}
});
},
},
};
src/router.js
View file @
4fdee9cc
import
{
Route
,
Router
}
from
'
dva/router
'
;
import
{
Route
,
Router
,
Redirect
}
from
'
dva/router
'
;
import
React
from
'
react
'
;
import
Active
from
'
./routes/Activate.js
'
;
...
...
src/routes/Profiles.js
View file @
4fdee9cc
...
...
@@ -95,6 +95,7 @@ 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
"
>
...
...
@@ -107,7 +108,7 @@ class Profiles extends React.Component {
this
.
cropper
=
cropper
;
}}
src
=
{
imageUrl
||
defaultAvatar
}
style
=
{{
height
:
'
20vw
'
,
w
idth
:
'
20vw
'
}}
style
=
{{
maxHeight
:
'
20vw
'
,
maxW
idth
:
'
20vw
'
}}
aspectRatio
=
{
1
/
1
}
guides
/>
...
...
@@ -164,6 +165,7 @@ class Profiles extends React.Component {
<
/TabPane
>
<
/Tabs
>
<
/Spin
>
<
/div
>
);
}
}
...
...
src/routes/Register.js
deleted
100644 → 0
View file @
323eb459
import
{
Button
,
Form
,
Icon
,
Input
,
Spin
,
Steps
}
from
'
antd
'
;
import
{
connect
}
from
'
dva
'
;
import
{
Link
}
from
'
dva/router
'
;
import
React
,
{
PropTypes
}
from
'
react
'
;
import
{
FormattedMessage
as
Format
}
from
'
react-intl
'
;
const
FormItem
=
Form
.
Item
;
const
Step
=
Steps
.
Step
;
class
Register
extends
React
.
Component
{
static
contextTypes
=
{
intl
:
PropTypes
.
object
.
isRequired
,
};
onSubmitLogin
=
(
e
)
=>
{
const
{
form
,
dispatch
}
=
this
.
props
;
if
(
e
)
{
e
.
preventDefault
();
}
form
.
validateFieldsAndScroll
((
err
,
values
)
=>
{
if
(
!
err
)
{
console
.
log
(
'
Received values of form:
'
,
values
);
const
{
email
,
username
,
password
}
=
values
;
dispatch
({
type
:
'
auth/register
'
,
payload
:
{
email
,
username
,
password
}
});
}
});
};
checkPassword
=
(
rule
,
value
,
callback
)
=>
{
const
form
=
this
.
props
.
form
;
if
(
value
&&
value
!==
form
.
getFieldValue
(
'
password
'
))
{
callback
(
this
.
context
.
intl
.
messages
[
'
Incorrect-password.2
'
]);
}
else
{
callback
();
}
};
checkConfirm
=
(
rule
,
value
,
callback
)
=>
{
const
form
=
this
.
props
.
form
;
if
(
value
)
{
form
.
validateFields
([
'
confirm
'
],
{
force
:
true
});
}
callback
();
};
render
()
{
const
{
dispatch
,
form
,
checkEmail
,
checkUsername
,
isEmailExists
,
isUserNameExists
,
loading
,
}
=
this
.
props
;
const
{
getFieldDecorator
}
=
form
;
const
{
intl
:
{
messages
}
}
=
this
.
context
;
const
emailProps
=
{
hasFeedback
:
true
,
validateStatus
:
checkEmail
,
extra
:
isEmailExists
?
messages
.
i_email_exists
:
''
,
};
const
emailInputProps
=
{
onBlur
:
()
=>
!
form
.
getFieldError
(
'
email
'
)
&&
dispatch
({
type
:
'
auth/checkEmail
'
,
payload
:
{
...
form
.
getFieldsValue
()
}
}),
placeholder
:
messages
.
email
,
};
const
usernameProps
=
{
hasFeedback
:
true
,
validateStatus
:
checkUsername
,
extra
:
isUserNameExists
?
'
username exists
'
:
''
,
};
const
usernameInputProps
=
{
onBlur
:
()
=>
!
form
.
getFieldError
(
'
username
'
)
&&
dispatch
({
type
:
'
auth/checkUsername
'
,
payload
:
{
...
form
.
getFieldsValue
()
}
}),
placeholder
:
messages
.
username
,
};
return
(
<
div
style
=
{{
display
:
'
flex
'
,
justifyContent
:
'
center
'
,
alignItems
:
'
center
'
,
height
:
'
100%
'
}}
>
<
Spin
spinning
=
{
loading
}
delay
=
{
100
}
>
<
Steps
size
=
"
large
"
current
=
{
0
}
>
<
Step
title
=
{
messages
[
'
sign-up
'
]}
icon
=
{
<
Icon
type
=
"
solution
"
/>
}
/
>
<
Step
title
=
{
messages
[
'
verify-email
'
]}
icon
=
{
<
Icon
type
=
"
mail
"
/>
}
/
>
<
/Steps
>
<
Form
onSubmit
=
{
this
.
onSubmitLogin
}
className
=
"
login-form
"
style
=
{{
marginTop
:
'
24px
'
}}
>
<
FormItem
{...
emailProps
}
>
{
getFieldDecorator
(
'
email
'
,
{
rules
:
[{
required
:
true
,
message
:
messages
[
'
Please-use-a-correct-E-Mail-address.
'
],
pattern
:
/^
\w
+
([
-+.
]\w
+
)
*@
\w
+
([
-.
]\w
+
)
*
\.\w
+
([
-.
]\w
+
)
*$/
,
}],
},
{})(
<
Input
{...
emailInputProps
}
/>
,
)}
<
/FormItem
>
<
FormItem
{...
usernameProps
}
>
{
getFieldDecorator
(
'
username
'
,
{
rules
:
[{
required
:
true
,
message
:
messages
[
'
You-can-not-use-this-username.
'
],
pattern
:
/^
[
A-Za-z0-9_
\u
4E00-
\u
9FD5
\u
3400-
\u
4DBF
\u
{20000}-
\u
{2A6DF}
\u
{2A700}-
\u
{2CEAF}
\u
F900–
\u
FAFF
\u
{2F800}-
\u
{2FA1D}
\u
AC00–
\u
D7AF
\u
3040-
\u
30FF
\u
31F0–
\u
31FF
\u
{1B000}–
\u
{1B0FF}
\u
3005
]
+$/u
,
}],
},
{})(
<
Input
{...
usernameInputProps
}
/>
,
)}
<
/FormItem
>
<
FormItem
hasFeedback
>
{
getFieldDecorator
(
'
password
'
,
{
rules
:
[{
required
:
true
,
message
:
messages
[
'
Password-length-must-be-between-8-and-24-characters.
'
],
pattern
:
/^.
{8,24}
$/
,
}],
},
{
validator
:
this
.
checkConfirm
,
})(
<
Input
prefix
=
{
<
Icon
type
=
"
lock
"
style
=
{{
fontSize
:
13
}}
/>
}
type
=
"
password
"
placeholder
=
{
messages
.
password
}
/>
,
)}
<
/FormItem
>
<
FormItem
hasFeedback
>
{
getFieldDecorator
(
'
confirm
'
,
{
rules
:
[{
required
:
true
,
message
:
messages
[
'
Password-length-must-be-between-8-and-24-characters.
'
],
pattern
:
/^.
{8,24}
$/
,
},
{
validator
:
this
.
checkPassword
,
}],
})(
<
Input
prefix
=
{
<
Icon
type
=
"
lock
"
style
=
{{
fontSize
:
13
}}
/>
}
type
=
"
password
"
onBlur
=
{
this
.
handleConfirmBlur
}
placeholder
=
{
messages
[
'
password-again
'
]}
/>
,
)}
<
/FormItem
>
<
FormItem
>
<
Button
type
=
"
primary
"
htmlType
=
"
submit
"
className
=
"
login-form-button
"
>
<
Format
id
=
{
'
sign-up
'
}
/
>
<
/Button
>
<
/FormItem
>
<
div
>
<
Link
to
=
"
/signin
"
><
Format
id
=
{
'
sign-in
'
}
/></
Link
>
<
/div
>
<
/Form
>
<
/Spin
>
<
/div
>
);
}
}
function
mapStateToProps
(
state
)
{
const
{
auth
:
{
register
,
checkEmail
,
checkUsername
,
isEmailExists
,
isUserNameExists
,
isRegisterSubmit
,
},
}
=
state
;
const
loading
=
state
.
loading
.
global
||
false
;
return
{
loading
,
register
,
checkEmail
,
checkUsername
,
isEmailExists
,
isUserNameExists
,
isRegisterSubmit
,
};
}
const
WrapperRegister
=
Form
.
create
()(
Register
);
export
default
connect
(
mapStateToProps
)(
WrapperRegister
);
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