From e503da2d89f3759b54679e139550facb7e49308e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=8D=E5=81=9A=E7=A0=81=E5=86=9C?= <599854767@qq.com> Date: Fri, 18 Nov 2022 13:40:27 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=99=BB=E5=BD=95=E9=AA=8C?= =?UTF-8?q?=E8=AF=81=E7=A0=81=E5=BC=80=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ZR.Vue/src/views/login.vue | 66 ++++++++++++++++++++------------------ 1 file changed, 35 insertions(+), 31 deletions(-) diff --git a/ZR.Vue/src/views/login.vue b/ZR.Vue/src/views/login.vue index 0003354..c82eb20 100644 --- a/ZR.Vue/src/views/login.vue +++ b/ZR.Vue/src/views/login.vue @@ -1,7 +1,7 @@ @@ -54,42 +61,38 @@ export default { password: '', rememberMe: false, code: '', - uuid: '' + uuid: '', }, title: defaultSettings.title, loginRules: { - username: [ - { required: true, trigger: 'blur', message: '用户名不能为空' } - ], - password: [ - { required: true, trigger: 'blur', message: '密码不能为空' } - ], - code: [{ required: true, trigger: 'change', message: '验证码不能为空' }] + username: [{ required: true, trigger: 'blur', message: '用户名不能为空' }], + password: [{ required: true, trigger: 'blur', message: '密码不能为空' }], + code: [{ required: true, trigger: 'change', message: '验证码不能为空' }], }, showCaptcha: '', loading: false, - redirect: undefined + redirect: undefined, } }, computed: { - copyRight: function() { + copyRight: function () { return defaultSettings.copyRight - } + }, }, watch: { $route: { - handler: function(route) { + handler: function (route) { this.redirect = route.query && route.query.redirect }, - immediate: true - } + immediate: true, + }, }, created() { this.getCode() this.getCookie() - this.getConfigKey('sys.account.captchaOnOff').then((response) => { - this.showCaptcha = response.data - }) + // this.getConfigKey('sys.account.captchaOnOff').then((response) => { + // this.showCaptcha = response.data + // }) }, methods: { getCode() { @@ -97,6 +100,7 @@ export default { getCodeImg().then((res) => { this.codeUrl = 'data:image/gif;base64,' + res.data.img this.loginForm.uuid = res.data.uuid + this.showCaptcha = res.data.captchaOff this.$forceUpdate() }) }, @@ -108,7 +112,7 @@ export default { this.loginForm = { username: username === undefined ? this.loginForm.username : username, password: password === undefined ? this.loginForm.password : password, - rememberMe: rememberMe === undefined ? false : Boolean(rememberMe) + rememberMe: rememberMe === undefined ? false : Boolean(rememberMe), } }, handleLogin() { @@ -118,10 +122,10 @@ export default { if (this.loginForm.rememberMe) { Cookies.set('username', this.loginForm.username, { expires: 30 }) Cookies.set('password', this.loginForm.password, { - expires: 30 + expires: 30, }) Cookies.set('rememberMe', this.loginForm.rememberMe, { - expires: 30 + expires: 30, }) } else { Cookies.remove('username') @@ -135,7 +139,7 @@ export default { this.$router.push({ path: this.redirect || '/' }) }) .catch((error) => { - this.msgError(error.msg); + this.msgError(error.msg) this.loading = false this.getCode() this.$refs.codeTxt.focus() @@ -144,8 +148,8 @@ export default { console.log('未完成') } }) - } - } + }, + }, } @@ -155,7 +159,7 @@ export default { justify-content: center; align-items: center; height: 100%; - background-image: url("../assets/image/login-background.jpg"); + background-image: url('../assets/image/login-background.jpg'); background-size: cover; // background-color: rgba(56, 157, 170, 0.82); }