From ef61883a5437d03c5e384ba0b35c3e0885a882ab Mon Sep 17 00:00:00 2001 From: liuguocan <527956374@qq.com> Date: 星期二, 14 三月 2023 13:57:40 +0800 Subject: [PATCH] 登录页面添加滑块校验/报表页面高度问题处理 --- src/views/user/login.vue | 57 ++++++++++++++++++++++++++++++++++----------------------- 1 files changed, 34 insertions(+), 23 deletions(-) diff --git a/src/views/login.vue b/src/views/user/login.vue similarity index 82% rename from src/views/login.vue rename to src/views/user/login.vue index 6a11fae..a093b95 100644 --- a/src/views/login.vue +++ b/src/views/user/login.vue @@ -23,19 +23,20 @@ <svg-icon slot="prefix" icon-class="password" class="el-input__icon input-icon" /> </el-input> </el-form-item> - <el-form-item prop="code" v-if="captchaEnabled"> - <el-input - v-model="loginForm.code" - auto-complete="off" - placeholder="楠岃瘉鐮�" - style="width: 63%" - @keyup.enter.native="handleLogin" - > - <svg-icon slot="prefix" icon-class="validCode" class="el-input__icon input-icon" /> - </el-input> - <div class="login-code"> - <img :src="codeUrl" @click="getCode" class="login-code-img"/> - </div> + <el-form-item> +<!-- <el-input--> +<!-- v-model="loginForm.code"--> +<!-- auto-complete="off"--> +<!-- placeholder="楠岃瘉鐮�"--> +<!-- style="width: 63%"--> +<!-- @keyup.enter.native="handleLogin"--> +<!-- >--> +<!-- <svg-icon slot="prefix" icon-class="validCode" class="el-input__icon input-icon" />--> +<!-- </el-input>--> +<!-- <div class="login-code">--> +<!-- <img :src="codeUrl" @click="getCode" class="login-code-img"/>--> +<!-- </div>--> + <drag-verify @success="verifyTrue" ref="verify"/> </el-form-item> <el-checkbox v-model="loginForm.rememberMe" style="margin:0px 0px 25px 0px;">璁颁綇瀵嗙爜</el-checkbox> <el-form-item style="width:100%;"> @@ -62,20 +63,22 @@ </template> <script> -import { getCodeImg } from "@/api/login"; +import dragVerify from './dragVerify/index.vue'// 婊戝姩楠岃瘉缁勪欢 import Cookies from "js-cookie"; import { encrypt, decrypt } from '@/utils/jsencrypt' export default { - name: "Login", + components: { + 'drag-verify': dragVerify + }, data() { return { + verify:false, codeUrl: "", loginForm: { - username: "", - password: "", + username: "supervisor", + password: "123456", rememberMe: false, - code: "", uuid: "" }, loginRules: { @@ -104,10 +107,13 @@ } }, created() { - this.getCode(); + // this.getCode(); this.getCookie(); }, methods: { + verifyTrue () { + this.verify = true + }, getCode() { getCodeImg().then(res => { // console.log(res); @@ -137,6 +143,11 @@ handleLogin() { this.$refs.loginForm.validate(valid => { if (valid) { + if (!this.verify) { + this.$message.error('璇峰厛瀹屾垚楠岃瘉') + this.loading = false + return + } this.loading = true; if (this.loginForm.rememberMe) { Cookies.set("username", this.loginForm.username, { expires: 30 }); @@ -151,9 +162,9 @@ this.$router.push({ path: this.redirect || "/" }).catch(()=>{}); }).catch(() => { this.loading = false; - if (this.captchaEnabled) { - this.getCode(); - } + // if (this.captchaEnabled) { + // this.getCode(); + // } }); } }); @@ -168,7 +179,7 @@ justify-content: center; align-items: center; height: 100%; - background-image: url("../assets/images/login-background.jpg"); + background-image: url("../../assets/images/login-background.jpg"); background-size: cover; } .title { -- Gitblit v1.9.1