Commit 65c02fb0 authored by nano's avatar nano

update

parent 7ceb460f
let publicPath = 'https://cdn01.moecube.com/accounts/' let publicPath = 'https://cdn01.moecube.com/accounts/'
let defineConf = { let defineConf = {
apiRoot: process.env["BUILD"] == 'development' ? 'http://114.215.243.95:8082' : 'https://api.moeube.com/accounts' apiRoot: process.env["API_ROOT"]
} }
export default { export default {
......
...@@ -159,7 +159,6 @@ ...@@ -159,7 +159,6 @@
"i_not_found":"用户不存在", "i_not_found":"用户不存在",
"i_key_time_out":"此链接已过期", "i_key_time_out":"此链接已过期",
"i_key_invalid":"此链接已失效", "i_key_invalid":"此链接已失效",
"没毛用":"防逗号报错,上线删" "没毛用":"防逗号报错,上线删"
} }
......
{ {
"private": true, "private": true,
"scripts": { "scripts": {
"start": "cross-env BUILD=development roadhog server", "start": "cross-env API_ROOT=http://192.168.1.9:3000 roadhog server",
"build:dev": "cross-env BUILD=development roadhog build", "build:dev": "cross-env API_ROOT=http://114.215.243.95:8082 roadhog build",
"build": "roadhog build", "build": "cross-env API_ROOT=https://api.moeube.com/accounts roadhog build",
"lint": "eslint --ext .js src test", "lint": "eslint --ext .js src test",
"precommit": "npm run lint" "precommit": "npm run lint"
}, },
......
...@@ -144,7 +144,7 @@ export default { ...@@ -144,7 +144,7 @@ export default {
if (data.active) { if (data.active) {
yield put(routerRedux.replace('/profiles')); yield put(routerRedux.replace('/profiles'));
} else { } else {
yield put(routerRedux.replace('/verify')); yield put(routerRedux.replace('/signin'));
} }
} }
} catch (error) { } catch (error) {
...@@ -204,11 +204,21 @@ export default { ...@@ -204,11 +204,21 @@ export default {
const token = localStorage.getItem('token'); const token = localStorage.getItem('token');
if (token) { if (token) {
dispatch({ type: 'getAuthUser', payload: { token } }); dispatch({ type: 'getAuthUser', payload: { token } });
} else {
if(location.pathname == '/profiles') {
dispatch(routerRedux.replace('/signin'))
}
} }
history.listen(({ pathname }) => {
history.listen(({ pathname, query }) => {
if (pathname === '/') { if (pathname === '/') {
dispatch({ type: 'preLogin', payload: { token } }); dispatch({ type: 'preLogin', payload: { token } });
} }
if (pathname === '/reset' || pathname == "/activate"){
if (!query["key"]) {
message.error("缺少参数")
}
}
}); });
}, },
}, },
......
...@@ -124,7 +124,7 @@ const particleConfig = { ...@@ -124,7 +124,7 @@ const particleConfig = {
function Index({ children, messages, dispatch }) { function Index({ children, messages, dispatch }) {
return ( return (
<div style={{ display: 'flex', flexDirection: 'column', flexGrow: 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'}/>
<Header style={{ display: 'flex', alignItems: 'center' }}> <Header style={{ display: 'flex', alignItems: 'center' }}>
......
...@@ -35,7 +35,7 @@ class Login extends React.Component { ...@@ -35,7 +35,7 @@ class Login extends React.Component {
const { intl: { messages } } = this.context; const { intl: { messages } } = this.context;
return ( return (
<div style={{ display: 'flex', flexGrow: 1, justifyContent: 'center', alignItems: 'center', height: '100%' }}> <div style={{ display: 'flex', flex: 1, justifyContent: 'center', alignItems: 'center', height: '100%' }}>
<Spin spinning={loading} delay={100}> <Spin spinning={loading} delay={100}>
<Form onSubmit={this.onSubmitLogin} className="login-form"> <Form onSubmit={this.onSubmitLogin} className="login-form">
......
...@@ -101,44 +101,32 @@ class Profiles extends React.Component { ...@@ -101,44 +101,32 @@ class Profiles extends React.Component {
<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'}}>
isUpload ?
<div>
<Cropper <Cropper
ref={(cropper) => { ref={cropper => {
this.cropper = cropper; this.cropper = cropper;
}} }}
src={imageUrl || defaultAvatar} src={ imageUrl || defaultAvatar}
style={{ height: '20vw', width: '20vw' }} style={{ height: '20vw', width: '20vw' }}
aspectRatio={1 / 1} aspectRatio={1 / 1}
guides guides={true}
/> />
<Button>
<label>
<Icon type="plus"/> add file
<input
type="file"
onChange={this.onGetFile}
ref={(file) => {
this.file = file;
}}
style={{ display: 'none' }}
/>
</label>
</Button>
<Button type="primary" onClick={this.handleUpload}> <Button type="primary" onClick={this.handleUpload}>
<Icon type="upload"/> upload <Icon type="upload"/> upload
</Button> </Button>
</div> </div>
:
<img
alt="avatar"
src={avatar || imageUrl || defaultAvatar}
style={{ height: '256px', width: '256px' }}
onClick={() => dispatch({ type: 'upload/start' })}
/>
}
<div style={{ display: !isUpload ? 'flex' : 'none', flexDirection: 'column'}}>
<img src={avatar || imageUrl || defaultAvatar}/>
<Button onClick={() => { dispatch({ type: 'upload/start' }) }}>
<label>
<Icon type="plus"/> Change Avatar
<input type="file" onChange={this.onGetFile} ref={file => {
this.file = file;
}} style={{ display: 'none' }}/>
</label>
</Button>
</div>
</FormItem> </FormItem>
<FormItem {...nameProps.fromItem}> <FormItem {...nameProps.fromItem}>
......
...@@ -60,22 +60,23 @@ class Register extends React.Component { ...@@ -60,22 +60,23 @@ class Register extends React.Component {
const emailProps = { const emailProps = {
hasFeedback: true, hasFeedback: true,
validateStatus: checkEmail, validateStatus: checkEmail,
help: isEmailExists ? messages.i_email_exists : '', extra: isEmailExists ? messages['i_email_exists'] : '',
}; };
const emailInputProps = { const emailInputProps = {
onBlur: () => dispatch({ type: 'auth/checkEmail', payload: { ...form.getFieldsValue() } }), onBlur: () => !form.getFieldError("email") && dispatch({ type: 'auth/checkEmail', payload: { ...form.getFieldsValue() } }),
placeholder: messages.email, placeholder: messages.email,
}; };
const usernameProps = { const usernameProps = {
hasFeedback: true, hasFeedback: true,
validateStatus: checkUsername, validateStatus: checkUsername,
help: isUserNameExists ? 'username exists' : '', extra: isUserNameExists ? 'username exists' : '',
}; };
const usernameInputProps = { const usernameInputProps = {
onBlur: () => dispatch({ type: 'auth/checkUsername', payload: { ...form.getFieldsValue() } }), onBlur: () => !form.getFieldError("username") && dispatch({ type: 'auth/checkUsername', payload: { ...form.getFieldsValue() } }),
placeholder: messages.username, placeholder: messages.username,
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment