Commit 65c02fb0 authored by nano's avatar nano

update

parent 7ceb460f
let publicPath = 'https://cdn01.moecube.com/accounts/'
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 {
......
......@@ -159,7 +159,6 @@
"i_not_found":"用户不存在",
"i_key_time_out":"此链接已过期",
"i_key_invalid":"此链接已失效",
"没毛用":"防逗号报错,上线删"
}
......
{
"private": true,
"scripts": {
"start": "cross-env BUILD=development roadhog server",
"build:dev": "cross-env BUILD=development roadhog build",
"build": "roadhog build",
"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",
"lint": "eslint --ext .js src test",
"precommit": "npm run lint"
},
......
......@@ -144,7 +144,7 @@ export default {
if (data.active) {
yield put(routerRedux.replace('/profiles'));
} else {
yield put(routerRedux.replace('/verify'));
yield put(routerRedux.replace('/signin'));
}
}
} catch (error) {
......@@ -204,11 +204,21 @@ export default {
const token = localStorage.getItem('token');
if (token) {
dispatch({ type: 'getAuthUser', payload: { token } });
} else {
if(location.pathname == '/profiles') {
dispatch(routerRedux.replace('/signin'))
}
}
history.listen(({ pathname }) => {
history.listen(({ pathname, query }) => {
if (pathname === '/') {
dispatch({ type: 'preLogin', payload: { token } });
}
if (pathname === '/reset' || pathname == "/activate"){
if (!query["key"]) {
message.error("缺少参数")
}
}
});
},
},
......
......@@ -124,7 +124,7 @@ const particleConfig = {
function Index({ children, messages, dispatch }) {
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'}/>
<Header style={{ display: 'flex', alignItems: 'center' }}>
......
......@@ -35,7 +35,7 @@ class Login extends React.Component {
const { intl: { messages } } = this.context;
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}>
<Form onSubmit={this.onSubmitLogin} className="login-form">
......
......@@ -101,44 +101,32 @@ class Profiles extends React.Component {
<Form onSubmit={this.onUpdateSubmit}>
<FormItem style={{ display: 'flex', justifyContent: 'center' }}>
{
isUpload ?
<div>
<Cropper
ref={(cropper) => {
this.cropper = cropper;
}}
src={imageUrl || defaultAvatar}
style={{ height: '20vw', width: '20vw' }}
aspectRatio={1 / 1}
guides
/>
<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}>
<Icon type="upload"/> upload
</Button>
</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'}}>
<Cropper
ref={cropper => {
this.cropper = cropper;
}}
src={ imageUrl || defaultAvatar}
style={{ height: '20vw', width: '20vw' }}
aspectRatio={1 / 1}
guides={true}
/>
<Button type="primary" onClick={this.handleUpload}>
<Icon type="upload"/> upload
</Button>
</div>
<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 {...nameProps.fromItem}>
......
......@@ -60,22 +60,23 @@ class Register extends React.Component {
const emailProps = {
hasFeedback: true,
validateStatus: checkEmail,
help: isEmailExists ? messages.i_email_exists : '',
extra: isEmailExists ? messages['i_email_exists'] : '',
};
const emailInputProps = {
onBlur: () => dispatch({ type: 'auth/checkEmail', payload: { ...form.getFieldsValue() } }),
onBlur: () => !form.getFieldError("email") && dispatch({ type: 'auth/checkEmail', payload: { ...form.getFieldsValue() } }),
placeholder: messages.email,
};
const usernameProps = {
hasFeedback: true,
validateStatus: checkUsername,
help: isUserNameExists ? 'username exists' : '',
extra: isUserNameExists ? 'username exists' : '',
};
const usernameInputProps = {
onBlur: () => dispatch({ type: 'auth/checkUsername', payload: { ...form.getFieldsValue() } }),
onBlur: () => !form.getFieldError("username") && dispatch({ type: 'auth/checkUsername', payload: { ...form.getFieldsValue() } }),
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