diff --git a/.roadhogrc.mock.js b/.roadhogrc.mock.js index d086fa8d3335d58c14f0e9426da9068409f8ee14..811292f51fe632f7acdb39b4c2b322098bea1072 100644 --- a/.roadhogrc.mock.js +++ b/.roadhogrc.mock.js @@ -65,7 +65,8 @@ const proxy = { 'GET /api/fake_chart_data': getFakeChartData, 'GET /api/profile': getProfileData, '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) => { res.send({ status: 'ok', type: 'mobile' }); diff --git a/src/models/login.js b/src/models/login.js index f815f46b0f53081850c3226fa58d8c2924abde71..f348b36aff78f966d28ac1ac5b5b8ff44659c606 100644 --- a/src/models/login.js +++ b/src/models/login.js @@ -13,7 +13,7 @@ export default { type: 'changeSubmitting', payload: true, }); - const response = yield call(fakeAccountLogin); + const response = yield call(fakeAccountLogin, payload); yield put({ type: 'loginHandle', payload: response, diff --git a/src/routes/User/Login.js b/src/routes/User/Login.js index 35cd788df5bd35bd7b260b4b752579fb7333121e..c81f4036d5b2b6a85ebb2cefaf0e6c18001883eb 100644 --- a/src/routes/User/Login.js +++ b/src/routes/User/Login.js @@ -61,7 +61,14 @@ export default class Login extends Component { } msg = (message) => { - return ; + return (); } render() { @@ -73,7 +80,12 @@ export default class Login extends Component {
- {login.status === 'error' && login.type === 'account' && this.msg('账户或密码错误')} + { + login.status === 'error' && + login.type === 'account' && + login.submitting === false && + this.msg('账户或密码错误') + } {getFieldDecorator('userName', { rules: [{ @@ -82,7 +94,7 @@ export default class Login extends Component { })( } - placeholder="账户" + placeholder="admin" /> )} @@ -95,13 +107,18 @@ export default class Login extends Component { } type="password" - placeholder="密码" + placeholder="888888" /> )} - {login.status === 'error' && login.type === 'mobile' && this.msg('验证码错误')} + { + login.status === 'error' && + login.type === 'mobile' && + login.submitting === false && + this.msg('验证码错误') + } {getFieldDecorator('mobile', { rules: [{