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
c5d1df44
Commit
c5d1df44
authored
Apr 07, 2017
by
神楽坂玲奈
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
455a6db7
20311474
Changes
14
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
247 additions
and
323 deletions
+247
-323
.eslintrc
.eslintrc
+1
-0
.idea/watcherTasks.xml
.idea/watcherTasks.xml
+0
-4
.idea/workspace.xml
.idea/workspace.xml
+181
-275
i18n.json
i18n.json
+2
-0
src/components/EmailForm.js
src/components/EmailForm.js
+1
-1
src/components/SendEmail.js
src/components/SendEmail.js
+1
-1
src/components/UserPanel.js
src/components/UserPanel.js
+7
-6
src/index.js
src/index.js
+5
-6
src/index.less
src/index.less
+3
-0
src/models/auth.js
src/models/auth.js
+13
-7
src/models/common.js
src/models/common.js
+3
-2
src/models/upload.js
src/models/upload.js
+8
-0
src/models/user.js
src/models/user.js
+11
-16
src/routes/Profiles.js
src/routes/Profiles.js
+11
-5
No files found.
.eslintrc
View file @
c5d1df44
...
...
@@ -10,6 +10,7 @@
"react/forbid-prop-types": [0],
"react/jsx-filename-extension": [1, { "extensions": [".js"] }],
"global-require": [1],
"react/jsx-closing-bracket-location":[0],
"import/prefer-default-export": [0],
"react/jsx-no-bind": [0],
"react/prop-types": [0],
...
...
.idea/watcherTasks.xml
deleted
100644 → 0
View file @
455a6db7
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<component
name=
"ProjectTasksOptions"
suppressed-tasks=
"Less"
/>
</project>
\ No newline at end of file
.idea/workspace.xml
View file @
c5d1df44
This diff is collapsed.
Click to expand it.
i18n.json
View file @
c5d1df44
...
...
@@ -23,6 +23,7 @@
"sign-up"
:
"Sign Up"
,
"sign-in"
:
"Sign In"
,
"sign-out"
:
"Sign out"
,
"User-Center"
:
"User Center"
,
"Please-sign-in"
:
"Please sign In"
,
"email-address-or-username"
:
"E-Mail or Username"
,
"register-now"
:
"register-now!"
,
...
...
@@ -106,6 +107,7 @@
"sign-up"
:
"注册"
,
"sign-in"
:
"登陆"
,
"sign-out"
:
"登出"
,
"User-Center"
:
"用户中心"
,
"Please-sign-in"
:
"您尚未登录,请先登录"
,
"email-address-or-username"
:
"邮箱或用户名"
,
"register-now"
:
"现在注册"
,
...
...
src/components/EmailForm.js
View file @
c5d1df44
...
...
@@ -81,7 +81,7 @@ class EmailForm extends React.Component {
{
getFieldDecorator
(
'
email
'
,
{
...
emailProps
.
decorator
})(
<
Input
{...
emailProps
.
input
}
onBlur
=
{()
=>
dispatch
({
type
:
'
auth/checkEmail
'
,
payload
:
{
...
form
.
getFieldsValue
(),
id
}
})}
onBlur
=
{()
=>
dispatch
({
type
:
'
auth/checkEmail
'
,
payload
:
{
...
form
.
getFieldsValue
(),
user_id
:
id
}
})}
/>
,
)}
<
/FormItem
>
...
...
src/components/SendEmail.js
View file @
c5d1df44
...
...
@@ -61,7 +61,7 @@ class EmailForm extends React.Component {
{
getFieldDecorator
(
'
email
'
,
{
...
emailProps
.
decorator
})(
<
Input
{...
emailProps
.
input
}
onBlur
=
{()
=>
dispatch
({
type
:
'
auth/checkEmail
'
,
payload
:
{
...
form
.
getFieldsValue
(),
id
}
})}
onBlur
=
{()
=>
dispatch
({
type
:
'
auth/checkEmail
'
,
payload
:
{
...
form
.
getFieldsValue
(),
user_id
:
id
}
})}
/>
,
)}
<
/FormItem
>
...
...
src/components/UserPanel.js
View file @
c5d1df44
...
...
@@ -6,20 +6,19 @@ import { FormattedMessage as Format } from 'react-intl';
const
defaultAvatar
=
require
(
'
../../public/default_avatar.jpg
'
);
function
UserPanel
({
dispatch
,
user
,
token
})
{
function
UserPanel
({
dispatch
,
user
})
{
const
{
avatar
}
=
user
;
const
menu
=
(
<
Menu
trigger
=
{[
'
click
'
]}
>
<
Menu
.
Item
>
{
// i18n
token
?
<
Link
to
=
"
/profiles
"
>
个人中心
<
/Link> : <Link to="/
signin
"
>登录</Link>
user
.
active
?
<
Link
to
=
"
/profiles
"
><
Format
id
=
"
User-Center
"
/><
/Link> : <Link to="/
signin
"
><Format id=
"
sign
-
in
"
/></Link>
}
</Menu.Item>
<Menu.Divider/>
{
token
&&
user.active
&&
<Menu.Item >
<div
onClick={() => {
...
...
@@ -38,8 +37,10 @@ function UserPanel({ dispatch, user, token }) {
<div className=
"
ant
-
dropdown
-
link
"
style={{ display: 'flex', alignItems: 'center' }}>
<img
alt=
"
avatar
"
src={avatar || defaultAvatar}
style={{ borderRadius: '40px', height: '40px', weight: 'auto' }}
/>
style={{ borderRadius: '45px',
height: '45px',
weight: '45px',
border: '2px solid rgba(255,255,255,0.2' }} />
</div>
</Dropdown>
);
...
...
src/index.js
View file @
c5d1df44
...
...
@@ -47,13 +47,12 @@ app.router(require('./router'));
addLocaleData
([...
en
,
...
zh
]);
/*eslint-disable */
let
language
=
localStorage
.
getItem
(
'
locale
'
)
||
navigator
.
language
||
(
navigator
.
languages
&&
navigator
.
languages
[
0
])
||
navigator
.
userLanguage
;
/*eslint-enable */
const
languageWithoutRegionCode
=
language
.
toLowerCase
().
split
(
/
[
_-
]
+/
)[
0
];
language
=
(
localeData
[
languageWithoutRegionCode
]
||
localeData
[
language
])
?
language
:
'
zh-CN
'
;
const
messages
=
localeData
[
languageWithoutRegionCode
]
||
localeData
[
language
]
||
localeData
.
zh
;
const
languageY
=
localStorage
.
getItem
(
'
locale
'
)
||
navigator
.
language
||
(
navigator
.
languages
&&
navigator
.
languages
[
0
])
||
navigator
.
userLanguage
;
const
anguageWithoutRegionCode
=
languageY
.
toLowerCase
().
split
(
/
[
_-
]
+/
)[
0
];
const
language
=
anguageWithoutRegionCode
===
'
zh
'
?
'
zh-CN
'
:
'
en-US
'
;
const
messages
=
localeData
[
language
];
const
App
=
app
.
start
();
ReactDOM
.
render
(
...
...
src/index.less
View file @
c5d1df44
...
...
@@ -4,6 +4,9 @@ html, body, :global(#root) {
}
:global {
.ant-layout-header, .ant-menu-item{
background: #001933 !important
}
.example-enter {
opacity: 0.01;
}
...
...
src/models/auth.js
View file @
c5d1df44
...
...
@@ -165,10 +165,10 @@ export default {
try
{
const
{
data
}
=
yield
call
(
activate
,
payload
);
if
(
data
)
{
message
.
success
(
messages
[
'
Your-account-has-been-successfully-activated!
'
],
5
);
message
.
success
(
messages
[
'
Your-account-has-been-successfully-activated!
'
],
3
);
}
}
catch
(
error
)
{
message
.
error
(
error
.
message
);
message
.
error
(
error
.
message
,
3
);
}
},
*
checkEmail
({
payload
},
{
call
,
put
})
{
...
...
@@ -178,7 +178,10 @@ export default {
}
try
{
const
{
data
}
=
yield
call
(
checkUserExists
,
{
email
:
payload
.
email
});
const
{
data
}
=
yield
call
(
checkUserExists
,
{
email
:
payload
.
email
,
user_id
:
payload
.
user_id
,
});
if
(
data
)
{
yield
put
({
type
:
'
check
'
,
payload
:
{
isEmailExists
:
true
,
checkEmail
:
'
warning
'
}
});
}
...
...
@@ -193,7 +196,10 @@ export default {
}
try
{
const
{
data
}
=
yield
call
(
checkUserExists
,
{
username
:
payload
.
username
});
const
{
data
}
=
yield
call
(
checkUserExists
,
{
username
:
payload
.
username
,
user_id
:
payload
.
user_id
,
});
if
(
data
)
{
yield
put
({
type
:
'
check
'
,
payload
:
{
isUserNameExists
:
true
,
checkUsername
:
'
warning
'
}
});
}
...
...
@@ -212,7 +218,7 @@ export default {
}
}
catch
(
error
)
{
yield
put
({
type
:
'
loginFail
'
});
message
.
error
(
messages
[
error
.
message
]
||
error
.
message
);
message
.
error
(
messages
[
error
.
message
]
||
error
.
message
,
3
);
}
},
*
forgot
({
payload
},
{
call
,
put
,
select
})
{
...
...
@@ -221,7 +227,7 @@ export default {
const
{
data
}
=
yield
call
(
forgot
,
payload
);
if
(
data
)
{
yield
put
({
type
:
'
forgotSuccess
'
});
message
.
info
(
messages
[
'
A-password-reset-email-has-been-sent-to-you.
'
],
5
);
message
.
info
(
messages
[
'
A-password-reset-email-has-been-sent-to-you.
'
],
3
);
}
}
catch
(
error
)
{
yield
put
({
type
:
'
forgotFail
'
});
...
...
@@ -237,7 +243,7 @@ export default {
yield
put
({
type
:
'
user/loginSuccess
'
,
payload
:
{
data
}
});
yield
put
({
type
:
'
loginSuccess
'
,
payload
:
{
input
:
payload
}
});
message
.
info
(
messages
[
'
Your-account-has-been-created.
'
],
5
);
message
.
info
(
messages
[
'
Your-account-has-been-created.
'
],
3
);
yield
put
(
routerRedux
.
replace
(
'
/verify
'
));
}
}
catch
(
error
)
{
...
...
src/models/common.js
View file @
c5d1df44
...
...
@@ -27,9 +27,10 @@ export default {
subscriptions
:
{
setup
({
dispatch
})
{
let
client
;
const
language
=
localStorage
.
getItem
(
'
locale
'
)
||
navigator
.
language
||
(
navigator
.
languages
&&
navigator
.
languages
[
0
])
||
navigator
.
userLanguage
;
const
language
Y
=
localStorage
.
getItem
(
'
locale
'
)
||
navigator
.
language
||
(
navigator
.
languages
&&
navigator
.
languages
[
0
])
||
navigator
.
userLanguage
;
// const languageWithoutRegionCode = language.toLowerCase().split(/[_-]+/)[0];
const
anguageWithoutRegionCode
=
languageY
.
toLowerCase
().
split
(
/
[
_-
]
+/
)[
0
];
const
language
=
anguageWithoutRegionCode
===
'
zh
'
?
'
zh-CN
'
:
'
en-US
'
;
const
messages
=
i18n
[
language
];
const
{
userAgent
}
=
navigator
;
...
...
src/models/upload.js
View file @
c5d1df44
...
...
@@ -17,6 +17,14 @@ export default {
},
};
},
abort
(
state
)
{
return
{
...
state
,
...{
isUpload
:
false
,
},
};
},
getfile
(
state
,
action
)
{
return
{
...
state
,
...
action
.
payload
,
...
...
src/models/user.js
View file @
c5d1df44
...
...
@@ -93,7 +93,7 @@ export default {
*
loginSuccess
({
payload
},
{
put
})
{
const
{
data
:
{
user
,
token
}
}
=
payload
;
if
(
!
payload
.
data
)
{
message
.
error
(
'
error
'
);
message
.
error
(
'
error
'
,
3
);
}
if
(
token
)
{
yield
put
({
type
:
'
storeToken
'
,
payload
:
{
token
}
});
...
...
@@ -108,7 +108,7 @@ export default {
if
(
user
.
active
)
{
yield
put
(
routerRedux
.
replace
(
'
/profiles
'
));
// message.info("登录成功")
// message.info("登录成功
, 3
")
}
else
{
yield
put
(
routerRedux
.
replace
(
'
/verify
'
));
}
...
...
@@ -124,7 +124,7 @@ export default {
}
}
catch
(
error
)
{
yield
put
({
type
:
'
getAuthUserFail
'
});
// message.error(error.message)
// message.error(error.messag
, 3
e)
}
},
*
preLogin
({
payload
},
{
call
,
put
})
{
...
...
@@ -149,7 +149,7 @@ export default {
}
}
catch
(
error
)
{
yield
put
(
routerRedux
.
replace
(
'
/signin
'
));
// message.error(error.message)
// message.error(error.messag
, 3
e)
}
},
*
updateProfile
({
payload
},
{
call
,
put
,
select
})
{
...
...
@@ -162,11 +162,11 @@ export default {
if
(
data
)
{
yield
put
({
type
:
'
updateProfileSuccess
'
,
payload
:
{
user
:
data
,
token
}
});
message
.
info
(
messages
.
update_success
);
message
.
info
(
messages
.
update_success
,
3
);
}
}
catch
(
error
)
{
yield
put
({
type
:
'
updateProfileFail
'
});
message
.
error
(
error
.
message
);
message
.
error
(
error
.
message
,
3
);
}
},
*
updateEmail
({
payload
},
{
call
,
put
,
select
})
{
...
...
@@ -176,11 +176,11 @@ export default {
const
{
data
}
=
yield
call
(
updateAccount
,
{
...
payload
,
token
});
if
(
data
)
{
yield
put
({
type
:
'
updateAccountSuccess
'
,
payload
:
{
user
:
data
,
token
}
});
message
.
info
(
messages
[
'
A-verification-email-has-been-sent-to-you,please-check-the-mail-to-complete.
'
]);
message
.
info
(
messages
[
'
A-verification-email-has-been-sent-to-you,please-check-the-mail-to-complete.
'
]
,
3
);
}
}
catch
(
error
)
{
yield
put
({
type
:
'
updateAccountFail
'
});
message
.
error
(
messages
[
error
.
message
]
||
error
.
message
);
message
.
error
(
messages
[
error
.
message
]
||
error
.
message
,
3
);
}
},
...
...
@@ -191,11 +191,11 @@ export default {
const
{
data
}
=
yield
call
(
updateAccount
,
{
...
payload
,
token
});
if
(
data
)
{
yield
put
({
type
:
'
updateAccountSuccess
'
,
payload
:
{
user
:
data
,
token
}
});
message
.
info
(
messages
.
update_success
);
message
.
info
(
messages
.
update_success
,
3
);
}
}
catch
(
error
)
{
yield
put
({
type
:
'
updateAccountFail
'
});
message
.
error
(
messages
[
error
.
message
]
||
error
.
message
);
message
.
error
(
messages
[
error
.
message
]
||
error
.
message
,
3
);
}
},
},
...
...
@@ -208,15 +208,10 @@ export default {
dispatch
(
routerRedux
.
replace
(
'
/signin
'
));
}
history
.
listen
(({
pathname
,
query
})
=>
{
history
.
listen
(({
pathname
})
=>
{
if
(
pathname
===
'
/
'
)
{
dispatch
({
type
:
'
preLogin
'
,
payload
:
{
token
}
});
}
if
(
pathname
===
'
/reset
'
||
pathname
===
'
/activate
'
)
{
if
(
!
query
.
key
)
{
message
.
error
(
'
缺少参数
'
);
}
}
});
},
},
...
...
src/routes/Profiles.js
View file @
c5d1df44
...
...
@@ -49,14 +49,21 @@ class Profiles extends React.Component {
};
onGetFile
=
(
e
)
=>
{
let
files
;
let
files
=
[]
;
if
(
e
.
dataTransfer
)
{
files
=
e
.
dataTransfer
.
files
;
}
else
if
(
e
.
target
)
{
files
=
e
.
target
.
files
;
}
if
(
files
.
length
<=
0
)
{
this
.
props
.
dispatch
({
type
:
'
upload/abort
'
})
return
}
const
reader
=
new
FileReader
();
reader
.
onload
=
()
=>
{
this
.
props
.
dispatch
({
type
:
'
upload/start
'
})
this
.
props
.
dispatch
({
type
:
'
upload/getfile
'
,
payload
:
{
imageUrl
:
reader
.
result
}
});
};
reader
.
readAsDataURL
(
files
[
0
]);
...
...
@@ -69,13 +76,12 @@ class Profiles extends React.Component {
const
{
user
:
{
id
}
}
=
this
.
props
;
this
.
cropper
.
getCroppedCanvas
().
toBlob
((
blob
)
=>
{
console
.
log
(
blob
);
this
.
props
.
dispatch
({
type
:
'
upload/upload
'
,
payload
:
{
image
:
blob
,
user_id
:
id
}
});
});
};
render
()
{
const
{
dispatch
,
form
,
user
,
loading
,
imageUrl
,
isUpload
}
=
this
.
props
;
const
{
form
,
user
,
loading
,
imageUrl
,
isUpload
}
=
this
.
props
;
const
{
getFieldDecorator
}
=
form
;
const
{
name
,
avatar
}
=
user
;
const
{
intl
:
{
messages
}
}
=
this
.
context
;
...
...
@@ -119,8 +125,8 @@ class Profiles extends React.Component {
<
div
style
=
{{
display
:
!
isUpload
?
'
flex
'
:
'
none
'
,
flexDirection
:
'
column
'
}}
>
<
img
alt
=
"
avatar
"
src
=
{
avatar
||
imageUrl
||
defaultAvatar
}
/
>
<
Button
onClick
=
{()
=>
{
dispatch
({
type
:
'
upload/start
'
});
}}
>
<
label
>
<
Button
style
=
{{
padding
:
'
4px 0
'
}}
>
<
label
style
=
{{
display
:
'
flex
'
,
flex
:
1
,
justifyContent
:
'
center
'
,
alignItems
:
'
center
'
}}
>
<
Icon
type
=
"
plus
"
/><
Format
id
=
"
Change-Avatar
"
/>
<
input
type
=
"
file
"
onChange
=
{
this
.
onGetFile
}
ref
=
{(
file
)
=>
{
...
...
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