From d5ca9fa6df26ecb07c2a59019a85013617c621ea Mon Sep 17 00:00:00 2001 From: "471615499@qq.com" Date: Sun, 20 Oct 2024 20:13:33 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8E=BB=E6=8E=89=E9=AA=8C=E8=AF=81=E7=A0=81?= =?UTF-8?q?=E9=AA=8C=E8=AF=81=EF=BC=8C=E5=AE=9E=E7=8E=B0=E4=BC=A0=E5=8F=82?= =?UTF-8?q?=E5=B8=A6=E5=85=A5=E7=94=A8=E6=88=B7=E5=90=8D=E5=AF=86=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- src/views/user/Login.vue | 214 +++++++++++++++++++++------------------ 2 files changed, 115 insertions(+), 101 deletions(-) diff --git a/README.md b/README.md index dd95bb7..cc68e40 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ Overview ## 前端文档地址: -https://1x.antdv.com/components/ +https://1x.antdv.com/docs/vue/introduce-cn/ ---- 项目下载和运行 diff --git a/src/views/user/Login.vue b/src/views/user/Login.vue index 6398dd8..5775c27 100644 --- a/src/views/user/Login.vue +++ b/src/views/user/Login.vue @@ -1,121 +1,122 @@ @@ -135,7 +136,7 @@ export default { TwoStepCaptcha, Verify }, - data () { + data() { return { capctchaCheck: false, verify: '', @@ -157,12 +158,24 @@ export default { } } }, - created () { + created() { + + }, + mounted() { + let username = this.$route.query.username + let pwd = this.$route.query.pwd + if (username && username != '' && pwd && pwd != '') { + this.form.setFieldsValue({ + 'username': username, + 'password': pwd + }) + this.loginForm() + } }, methods: { ...mapActions(['Login', 'Logout']), // handler - handleUsernameOrEmail (rule, value, callback) { + handleUsernameOrEmail(rule, value, callback) { const { state } = this const regex = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+((\.[a-zA-Z0-9_-]{2,3}){1,2})$/ if (regex.test(value)) { @@ -172,24 +185,25 @@ export default { } callback() }, - handleTabClick (key) { + handleTabClick(key) { this.customActiveKey = key // this.form.resetFields() }, - capctchaCheckSucc (data) { + capctchaCheckSucc(data) { this.capctchaCheck = true this.verify = data.captchaVerification this.loginForm() }, - handleSubmit (e) { + handleSubmit(e) { e.preventDefault() this.loginForm() }, - loginForm () { - if (!this.capctchaCheck) { - this.$refs.verify.show() - return false - } + loginForm() { + // 验证码暂时注销掉,需要就解开即可 + // if (!this.capctchaCheck) { + // this.$refs.verify.show() + // return false + // } const { form: { validateFields }, state, @@ -224,7 +238,7 @@ export default { } }) }, - getCaptcha (e) { + getCaptcha(e) { e.preventDefault() const { form: { validateFields }, @@ -267,16 +281,16 @@ export default { } }) }, - stepCaptchaSuccess () { + stepCaptchaSuccess() { this.loginSuccess() }, - stepCaptchaCancel () { + stepCaptchaCancel() { this.Logout().then(() => { this.loginBtn = false this.stepCaptchaVisible = false }) }, - loginSuccess (res) { + loginSuccess(res) { if (res.code === 0) { this.$router.push({ name: 'repairStatistics' }, () => { // 登录跳转 this.$notification.success({ @@ -290,7 +304,7 @@ export default { this.requestFailed(res) } }, - requestFailed (err) { + requestFailed(err) { this.isLoginError = true this.errorMsg = ((err.response || {}).data || {}).msg || err.msg || '请求出现错误,请稍后再试' this.$notification['error']({ @@ -303,7 +317,7 @@ export default { } -