Commit 6ecfedde authored by ddcat1115's avatar ddcat1115

fix login page

parent 246fd23c
...@@ -65,7 +65,8 @@ const proxy = { ...@@ -65,7 +65,8 @@ const proxy = {
'GET /api/fake_chart_data': getFakeChartData, 'GET /api/fake_chart_data': getFakeChartData,
'GET /api/profile': getProfileData, 'GET /api/profile': getProfileData,
'POST /api/login/account': (req, res) => { 'POST /api/login/account': (req, res) => {
res.send({ status: 'error', type: 'account' }); const { password, userName } = req.body;
res.send({ status: password === '888888' && userName === 'admin' ? 'ok' : 'error', type: 'account' });
}, },
'POST /api/login/mobile': (req, res) => { 'POST /api/login/mobile': (req, res) => {
res.send({ status: 'ok', type: 'mobile' }); res.send({ status: 'ok', type: 'mobile' });
......
...@@ -13,7 +13,7 @@ export default { ...@@ -13,7 +13,7 @@ export default {
type: 'changeSubmitting', type: 'changeSubmitting',
payload: true, payload: true,
}); });
const response = yield call(fakeAccountLogin); const response = yield call(fakeAccountLogin, payload);
yield put({ yield put({
type: 'loginHandle', type: 'loginHandle',
payload: response, payload: response,
......
...@@ -61,7 +61,14 @@ export default class Login extends Component { ...@@ -61,7 +61,14 @@ export default class Login extends Component {
} }
msg = (message) => { msg = (message) => {
return <Alert style={{ marginBottom: 16 }} message={message} type="error" showIcon closable />; return (<Alert
key={new Date().getTime()}
style={{ marginBottom: 16 }}
message={message}
type="error"
showIcon
closable
/>);
} }
render() { render() {
...@@ -73,7 +80,12 @@ export default class Login extends Component { ...@@ -73,7 +80,12 @@ export default class Login extends Component {
<Form onSubmit={this.handleSubmit}> <Form onSubmit={this.handleSubmit}>
<Tabs className={styles.tabs} activeKey={type} onChange={this.onSwitch}> <Tabs className={styles.tabs} activeKey={type} onChange={this.onSwitch}>
<TabPane tab="θ΄¦ζˆ·ε―†η η™»ε½•" key="account"> <TabPane tab="θ΄¦ζˆ·ε―†η η™»ε½•" key="account">
{login.status === 'error' && login.type === 'account' && this.msg('θ΄¦ζˆ·ζˆ–ε―†η ι”™θ――')} {
login.status === 'error' &&
login.type === 'account' &&
login.submitting === false &&
this.msg('θ΄¦ζˆ·ζˆ–ε―†η ι”™θ――')
}
<FormItem> <FormItem>
{getFieldDecorator('userName', { {getFieldDecorator('userName', {
rules: [{ rules: [{
...@@ -82,7 +94,7 @@ export default class Login extends Component { ...@@ -82,7 +94,7 @@ export default class Login extends Component {
})( })(
<Input <Input
prefix={<Icon type="user" style={{ fontSize: 14, color: 'rgba(0, 0, 0, 0.25)' }} />} prefix={<Icon type="user" style={{ fontSize: 14, color: 'rgba(0, 0, 0, 0.25)' }} />}
placeholder="账户" placeholder="admin"
/> />
)} )}
</FormItem> </FormItem>
...@@ -95,13 +107,18 @@ export default class Login extends Component { ...@@ -95,13 +107,18 @@ export default class Login extends Component {
<Input <Input
prefix={<Icon type="lock" style={{ fontSize: 14, color: 'rgba(0, 0, 0, 0.25)' }} />} prefix={<Icon type="lock" style={{ fontSize: 14, color: 'rgba(0, 0, 0, 0.25)' }} />}
type="password" type="password"
placeholder="密码" placeholder="888888"
/> />
)} )}
</FormItem> </FormItem>
</TabPane> </TabPane>
<TabPane tab="ζ‰‹ζœΊε·η™»ε½•" key="mobile"> <TabPane tab="ζ‰‹ζœΊε·η™»ε½•" key="mobile">
{login.status === 'error' && login.type === 'mobile' && this.msg('ιͺŒθ―η ι”™θ――')} {
login.status === 'error' &&
login.type === 'mobile' &&
login.submitting === false &&
this.msg('ιͺŒθ―η ι”™θ――')
}
<FormItem> <FormItem>
{getFieldDecorator('mobile', { {getFieldDecorator('mobile', {
rules: [{ rules: [{
......
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