| | |
| | | } |
| | | }, |
| | | created() { |
| | | axios.get('/api/auth/captcha-config') |
| | | axios.get('/api/auth/captcha-config', { timeout: 10000 }) |
| | | .then(res => { |
| | | const d = res.data |
| | | if (d && d.code === 200) this.captchaRequired = d.data.required !== false |
| | |
| | | password: this.form.password, |
| | | captchaId: this.captchaId, |
| | | captchaClickIds: this.clickIds |
| | | }).then(res => { |
| | | }, { timeout: 15000 }).then(res => { |
| | | this.loggingIn = false |
| | | const d = res.data |
| | | if (d.code === 200) { |
| | |
| | | this.$message.error(d.message || '登录失败,请重试') |
| | | if (this.$refs.captcha) this.$refs.captcha.load() |
| | | } |
| | | }).catch(() => { |
| | | }).catch(e => { |
| | | this.loggingIn = false |
| | | if (e && e.code === 'ECONNABORTED') { this.$message.error('登录请求超时,请重试'); return } |
| | | this.$message.error('网络错误,登录失败') |
| | | }) |
| | | }) |