Commit b0260112e5ff9fb9f29982b1ae2c9e8959bf49b3
1 parent
fb7bc2c7
v1.9 登陆错误信息提示
Showing
2 changed files
with
5 additions
and
2 deletions
src/api/user/loginApi.js
| @@ -13,7 +13,7 @@ export function login(data) { | @@ -13,7 +13,7 @@ export function login(data) { | ||
| 13 | // 可以在这里添加其他登录成功后的处理 | 13 | // 可以在这里添加其他登录成功后的处理 |
| 14 | resolve(res) | 14 | resolve(res) |
| 15 | } else { | 15 | } else { |
| 16 | - reject(new Error(res.msg || '登录失败')) | 16 | + reject(res.msg || '登录失败') |
| 17 | } | 17 | } |
| 18 | }).catch(error => { | 18 | }).catch(error => { |
| 19 | reject(error) | 19 | reject(error) |
src/views/user/login/Login.vue
| @@ -86,10 +86,13 @@ export default { | @@ -86,10 +86,13 @@ export default { | ||
| 86 | this.loading = true; | 86 | this.loading = true; |
| 87 | try { | 87 | try { |
| 88 | const { data } = await login(this.loginForm).catch(error => { | 88 | const { data } = await login(this.loginForm).catch(error => { |
| 89 | - this.$message.error(error.response.data); | 89 | + this.$message.error(error); |
| 90 | this.refreshCaptcha(); | 90 | this.refreshCaptcha(); |
| 91 | return { data: [] }; | 91 | return { data: [] }; |
| 92 | }); | 92 | }); |
| 93 | + if (!data || data.length == 0) { | ||
| 94 | + return; | ||
| 95 | + } | ||
| 93 | 96 | ||
| 94 | if (data && data.length > 1) { | 97 | if (data && data.length > 1) { |
| 95 | this.$refs.selectLoginUserRef.openDialog(data); | 98 | this.$refs.selectLoginUserRef.openDialog(data); |