|
@@ -1,13 +1,11 @@
|
|
|
<template>
|
|
|
<div class="login-container">
|
|
|
- <el-form
|
|
|
- ref="loginForm"
|
|
|
- :model="loginForm"
|
|
|
- :rules="loginRules"
|
|
|
- class="login-form"
|
|
|
- auto-complete="on"
|
|
|
- label-position="left"
|
|
|
- >
|
|
|
+ <el-form ref="loginForm"
|
|
|
+ :model="loginForm"
|
|
|
+ :rules="loginRules"
|
|
|
+ class="login-form"
|
|
|
+ auto-complete="on"
|
|
|
+ label-position="left">
|
|
|
<div class="title-container">
|
|
|
<h3 class="title">大雅乐盟后台管理系统</h3>
|
|
|
</div>
|
|
@@ -16,43 +14,38 @@
|
|
|
<span class="svg-container">
|
|
|
<svg-icon icon-class="user" />
|
|
|
</span>
|
|
|
- <el-input
|
|
|
- ref="username"
|
|
|
- v-model="loginForm.username"
|
|
|
- placeholder="Username"
|
|
|
- name="username"
|
|
|
- type="text"
|
|
|
- tabindex="1"
|
|
|
- auto-complete="on"
|
|
|
- />
|
|
|
+ <el-input ref="username"
|
|
|
+ v-model="loginForm.username"
|
|
|
+ placeholder="Username"
|
|
|
+ name="username"
|
|
|
+ type="text"
|
|
|
+ tabindex="1"
|
|
|
+ auto-complete="on" />
|
|
|
</el-form-item>
|
|
|
|
|
|
<el-form-item prop="password">
|
|
|
<span class="svg-container">
|
|
|
<svg-icon icon-class="password" />
|
|
|
</span>
|
|
|
- <el-input
|
|
|
- :key="passwordType"
|
|
|
- ref="password"
|
|
|
- v-model="loginForm.password"
|
|
|
- :type="passwordType"
|
|
|
- placeholder="Password"
|
|
|
- name="password"
|
|
|
- tabindex="2"
|
|
|
- auto-complete="on"
|
|
|
- @keyup.enter.native="handleLogin"
|
|
|
- />
|
|
|
- <span class="show-pwd" @click="showPwd">
|
|
|
+ <el-input :key="passwordType"
|
|
|
+ ref="password"
|
|
|
+ v-model="loginForm.password"
|
|
|
+ :type="passwordType"
|
|
|
+ placeholder="Password"
|
|
|
+ name="password"
|
|
|
+ tabindex="2"
|
|
|
+ auto-complete="on"
|
|
|
+ @keyup.enter.native="handleLogin" />
|
|
|
+ <span class="show-pwd"
|
|
|
+ @click="showPwd">
|
|
|
<svg-icon :icon-class="passwordType === 'password' ? 'eye' : 'eye-open'" />
|
|
|
</span>
|
|
|
</el-form-item>
|
|
|
|
|
|
- <el-button
|
|
|
- :loading="loading"
|
|
|
- type="primary"
|
|
|
- style="width:100%;margin-bottom:30px;"
|
|
|
- @click.native.prevent="handleLogin"
|
|
|
- >登录</el-button>
|
|
|
+ <el-button :loading="loading"
|
|
|
+ type="primary"
|
|
|
+ style="width:100%;margin-bottom:30px;"
|
|
|
+ @click.native.prevent="handleLogin">登录</el-button>
|
|
|
|
|
|
<div class="tips">
|
|
|
<span style="margin-right:20px;">username: admin</span>
|
|
@@ -67,7 +60,7 @@ import { validUsername } from "@/utils/validate";
|
|
|
|
|
|
export default {
|
|
|
name: "Login",
|
|
|
- data() {
|
|
|
+ data () {
|
|
|
const validateUsername = (rule, value, callback) => {
|
|
|
if (!validUsername(value)) {
|
|
|
callback(new Error("Please enter the correct user name"));
|
|
@@ -102,14 +95,14 @@ export default {
|
|
|
},
|
|
|
watch: {
|
|
|
$route: {
|
|
|
- handler: function(route) {
|
|
|
+ handler: function (route) {
|
|
|
this.redirect = route.query && route.query.redirect;
|
|
|
},
|
|
|
immediate: true
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
- showPwd() {
|
|
|
+ showPwd () {
|
|
|
if (this.passwordType === "password") {
|
|
|
this.passwordType = "";
|
|
|
} else {
|
|
@@ -119,7 +112,7 @@ export default {
|
|
|
this.$refs.password.focus();
|
|
|
});
|
|
|
},
|
|
|
- handleLogin() {
|
|
|
+ handleLogin () {
|
|
|
this.$refs.loginForm.validate(valid => {
|
|
|
if (valid) {
|
|
|
this.loading = true;
|
|
@@ -210,7 +203,7 @@ $light_gray: #eee;
|
|
|
}
|
|
|
|
|
|
.tips {
|
|
|
- font-size: 14px;
|
|
|
+ font-size: 16px;
|
|
|
color: #fff;
|
|
|
margin-bottom: 10px;
|
|
|
|