File was renamed from src/views/login.vue |
| | |
| | | <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%;"> |
| | |
| | | </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: { |
| | |
| | | } |
| | | }, |
| | | created() { |
| | | this.getCode(); |
| | | // this.getCode(); |
| | | this.getCookie(); |
| | | }, |
| | | methods: { |
| | | verifyTrue () { |
| | | this.verify = true |
| | | }, |
| | | getCode() { |
| | | getCodeImg().then(res => { |
| | | // console.log(res); |
| | |
| | | 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 }); |
| | |
| | | this.$router.push({ path: this.redirect || "/" }).catch(()=>{}); |
| | | }).catch(() => { |
| | | this.loading = false; |
| | | if (this.captchaEnabled) { |
| | | this.getCode(); |
| | | } |
| | | // if (this.captchaEnabled) { |
| | | // this.getCode(); |
| | | // } |
| | | }); |
| | | } |
| | | }); |
| | |
| | | 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 { |