|
|
@ -1,22 +1,23 @@
|
|
|
|
<template>
|
|
|
|
<template>
|
|
|
|
<div class="login">
|
|
|
|
<div class="login">
|
|
|
|
|
|
|
|
<div class="formBox">
|
|
|
|
<el-form ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form">
|
|
|
|
<el-form ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form">
|
|
|
|
<!--h3 class="title">{{ $t('login.title') }}</h3-->
|
|
|
|
<!--h3 class="title">{{ $t('login.title') }}</h3-->
|
|
|
|
<lang-select class="set-language" />
|
|
|
|
<lang-select class="set-language"/>
|
|
|
|
<el-form-item prop="username">
|
|
|
|
<el-form-item prop="username">
|
|
|
|
<el-input v-model="loginForm.username" type="text" auto-complete="off" :placeholder="$t('login.username')">
|
|
|
|
<el-input v-model="loginForm.username" :placeholder="$t('login.username')" auto-complete="off" type="text">
|
|
|
|
<svg-icon slot="prefix" icon-class="user" class="el-input__icon input-icon" />
|
|
|
|
<svg-icon slot="prefix" class="el-input__icon input-icon" icon-class="user"/>
|
|
|
|
</el-input>
|
|
|
|
</el-input>
|
|
|
|
</el-form-item>
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item prop="password">
|
|
|
|
<el-form-item prop="password">
|
|
|
|
<el-input
|
|
|
|
<el-input
|
|
|
|
v-model="loginForm.password"
|
|
|
|
v-model="loginForm.password"
|
|
|
|
type="password"
|
|
|
|
|
|
|
|
auto-complete="off"
|
|
|
|
|
|
|
|
:placeholder="$t('login.password')"
|
|
|
|
:placeholder="$t('login.password')"
|
|
|
|
|
|
|
|
auto-complete="off"
|
|
|
|
|
|
|
|
type="password"
|
|
|
|
@keyup.enter.native="handleLogin"
|
|
|
|
@keyup.enter.native="handleLogin"
|
|
|
|
>
|
|
|
|
>
|
|
|
|
<svg-icon slot="prefix" icon-class="password" class="el-input__icon input-icon" />
|
|
|
|
<svg-icon slot="prefix" class="el-input__icon input-icon" icon-class="password"/>
|
|
|
|
</el-input>
|
|
|
|
</el-input>
|
|
|
|
</el-form-item>
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item prop="code">
|
|
|
|
<el-form-item prop="code">
|
|
|
@ -27,10 +28,10 @@
|
|
|
|
style="width: 63%"
|
|
|
|
style="width: 63%"
|
|
|
|
@keyup.enter.native="handleLogin"
|
|
|
|
@keyup.enter.native="handleLogin"
|
|
|
|
>
|
|
|
|
>
|
|
|
|
<svg-icon slot="prefix" icon-class="validCode" class="el-input__icon input-icon" />
|
|
|
|
<svg-icon slot="prefix" class="el-input__icon input-icon" icon-class="validCode"/>
|
|
|
|
</el-input>
|
|
|
|
</el-input>
|
|
|
|
<div class="login-code">
|
|
|
|
<div class="login-code">
|
|
|
|
<img :src="codeUrl" @click="getCode" class="login-code-img"/>
|
|
|
|
<img :src="codeUrl" class="login-code-img" @click="getCode"/>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</el-form-item>
|
|
|
|
</el-form-item>
|
|
|
|
<el-checkbox v-model="loginForm.rememberMe" style="margin:0px 0px 25px 0px;">记住密码</el-checkbox>
|
|
|
|
<el-checkbox v-model="loginForm.rememberMe" style="margin:0px 0px 25px 0px;">记住密码</el-checkbox>
|
|
|
@ -38,8 +39,8 @@
|
|
|
|
<el-button
|
|
|
|
<el-button
|
|
|
|
:loading="loading"
|
|
|
|
:loading="loading"
|
|
|
|
size="medium"
|
|
|
|
size="medium"
|
|
|
|
type="primary"
|
|
|
|
|
|
|
|
style="width:100%;"
|
|
|
|
style="width:100%;"
|
|
|
|
|
|
|
|
type="primary"
|
|
|
|
@click.native.prevent="handleLogin"
|
|
|
|
@click.native.prevent="handleLogin"
|
|
|
|
>
|
|
|
|
>
|
|
|
|
<span v-if="!loading">{{ $t('login.logIn') }}</span>
|
|
|
|
<span v-if="!loading">{{ $t('login.logIn') }}</span>
|
|
|
@ -52,17 +53,18 @@
|
|
|
|
<span>Copyright © 2018-2019 ruoyi.vip All Rights Reserved.</span>
|
|
|
|
<span>Copyright © 2018-2019 ruoyi.vip All Rights Reserved.</span>
|
|
|
|
</div>-->
|
|
|
|
</div>-->
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
<script>
|
|
|
|
import LangSelect from '@/components/LangSelect'
|
|
|
|
import LangSelect from '@/components/LangSelect'
|
|
|
|
import { getCodeImg } from "@/api/login";
|
|
|
|
import {getCodeImg} from "@/api/login";
|
|
|
|
import Cookies from "js-cookie";
|
|
|
|
import Cookies from "js-cookie";
|
|
|
|
import { encrypt, decrypt } from '@/utils/jsencrypt'
|
|
|
|
import {encrypt, decrypt} from '@/utils/jsencrypt'
|
|
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
export default {
|
|
|
|
name: "Login",
|
|
|
|
name: "Login",
|
|
|
|
components: { LangSelect },
|
|
|
|
components: {LangSelect},
|
|
|
|
data() {
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
return {
|
|
|
|
codeUrl: "",
|
|
|
|
codeUrl: "",
|
|
|
@ -76,12 +78,12 @@ export default {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
loginRules: {
|
|
|
|
loginRules: {
|
|
|
|
username: [
|
|
|
|
username: [
|
|
|
|
{ required: true, trigger: "blur", message: "用户名不能为空" }
|
|
|
|
{required: true, trigger: "blur", message: "用户名不能为空"}
|
|
|
|
],
|
|
|
|
],
|
|
|
|
password: [
|
|
|
|
password: [
|
|
|
|
{ required: true, trigger: "blur", message: "密码不能为空" }
|
|
|
|
{required: true, trigger: "blur", message: "密码不能为空"}
|
|
|
|
],
|
|
|
|
],
|
|
|
|
code: [{ required: true, trigger: "change", message: "验证码不能为空" }]
|
|
|
|
code: [{required: true, trigger: "change", message: "验证码不能为空"}]
|
|
|
|
},
|
|
|
|
},
|
|
|
|
loading: false,
|
|
|
|
loading: false,
|
|
|
|
redirect: undefined
|
|
|
|
redirect: undefined
|
|
|
@ -89,7 +91,7 @@ export default {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
watch: {
|
|
|
|
watch: {
|
|
|
|
$route: {
|
|
|
|
$route: {
|
|
|
|
handler: function(route) {
|
|
|
|
handler: function (route) {
|
|
|
|
this.redirect = route.query && route.query.redirect;
|
|
|
|
this.redirect = route.query && route.query.redirect;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
immediate: true
|
|
|
|
immediate: true
|
|
|
@ -121,9 +123,9 @@ export default {
|
|
|
|
if (valid) {
|
|
|
|
if (valid) {
|
|
|
|
this.loading = true;
|
|
|
|
this.loading = true;
|
|
|
|
if (this.loginForm.rememberMe) {
|
|
|
|
if (this.loginForm.rememberMe) {
|
|
|
|
Cookies.set("username", this.loginForm.username, { expires: 30 });
|
|
|
|
Cookies.set("username", this.loginForm.username, {expires: 30});
|
|
|
|
Cookies.set("password", encrypt(this.loginForm.password), { expires: 30 });
|
|
|
|
Cookies.set("password", encrypt(this.loginForm.password), {expires: 30});
|
|
|
|
Cookies.set('rememberMe', this.loginForm.rememberMe, { expires: 30 });
|
|
|
|
Cookies.set('rememberMe', this.loginForm.rememberMe, {expires: 30});
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
Cookies.remove("username");
|
|
|
|
Cookies.remove("username");
|
|
|
|
Cookies.remove("password");
|
|
|
|
Cookies.remove("password");
|
|
|
@ -133,7 +135,7 @@ export default {
|
|
|
|
.dispatch("Login", this.loginForm)
|
|
|
|
.dispatch("Login", this.loginForm)
|
|
|
|
.then(() => {
|
|
|
|
.then(() => {
|
|
|
|
this.loading = false;
|
|
|
|
this.loading = false;
|
|
|
|
this.$router.push({ path: this.redirect || "/" });
|
|
|
|
this.$router.push({path: this.redirect || "/"});
|
|
|
|
})
|
|
|
|
})
|
|
|
|
.catch(() => {
|
|
|
|
.catch(() => {
|
|
|
|
this.loading = false;
|
|
|
|
this.loading = false;
|
|
|
@ -146,16 +148,17 @@ export default {
|
|
|
|
};
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style rel="stylesheet/scss" lang="scss">
|
|
|
|
<style lang="scss" rel="stylesheet/scss">
|
|
|
|
.login {
|
|
|
|
.login {
|
|
|
|
display: flex;
|
|
|
|
position: absolute;
|
|
|
|
justify-content: right;
|
|
|
|
top:0;
|
|
|
|
padding-right:260px;
|
|
|
|
left: 0;
|
|
|
|
align-items: center;
|
|
|
|
|
|
|
|
height: 100%;
|
|
|
|
height: 100%;
|
|
|
|
|
|
|
|
width: 100%;
|
|
|
|
background-image: url("../assets/images/login-background.jpg");
|
|
|
|
background-image: url("../assets/images/login-background.jpg");
|
|
|
|
background-size: cover;
|
|
|
|
background-size: 100% 100%;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.title {
|
|
|
|
.title {
|
|
|
|
margin: 0px auto 30px auto;
|
|
|
|
margin: 0px auto 30px auto;
|
|
|
|
text-align: center;
|
|
|
|
text-align: center;
|
|
|
@ -164,35 +167,42 @@ export default {
|
|
|
|
|
|
|
|
|
|
|
|
.login-form {
|
|
|
|
.login-form {
|
|
|
|
border-radius: 6px;
|
|
|
|
border-radius: 6px;
|
|
|
|
background: #ffffff;
|
|
|
|
width: 100%;
|
|
|
|
width: 400px;
|
|
|
|
height: 100%;
|
|
|
|
padding: 25px 25px 5px 25px;
|
|
|
|
padding: 25px 25px 5px 25px;
|
|
|
|
|
|
|
|
|
|
|
|
.el-input {
|
|
|
|
.el-input {
|
|
|
|
height: 38px;
|
|
|
|
height: 38px;
|
|
|
|
|
|
|
|
|
|
|
|
input {
|
|
|
|
input {
|
|
|
|
height: 38px;
|
|
|
|
height: 38px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.input-icon {
|
|
|
|
.input-icon {
|
|
|
|
height: 39px;
|
|
|
|
height: 39px;
|
|
|
|
width: 14px;
|
|
|
|
width: 14px;
|
|
|
|
margin-left: 2px;
|
|
|
|
margin-left: 2px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.login-tip {
|
|
|
|
.login-tip {
|
|
|
|
font-size: 13px;
|
|
|
|
font-size: 13px;
|
|
|
|
text-align: center;
|
|
|
|
text-align: center;
|
|
|
|
color: #bfbfbf;
|
|
|
|
color: #bfbfbf;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.login-code {
|
|
|
|
.login-code {
|
|
|
|
width: 33%;
|
|
|
|
width: 33%;
|
|
|
|
height: 38px;
|
|
|
|
height: 38px;
|
|
|
|
float: right;
|
|
|
|
float: right;
|
|
|
|
|
|
|
|
|
|
|
|
img {
|
|
|
|
img {
|
|
|
|
cursor: pointer;
|
|
|
|
cursor: pointer;
|
|
|
|
vertical-align: middle;
|
|
|
|
vertical-align: middle;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.el-login-footer {
|
|
|
|
.el-login-footer {
|
|
|
|
height: 40px;
|
|
|
|
height: 40px;
|
|
|
|
line-height: 40px;
|
|
|
|
line-height: 40px;
|
|
|
@ -209,4 +219,13 @@ export default {
|
|
|
|
.login-code-img {
|
|
|
|
.login-code-img {
|
|
|
|
height: 38px;
|
|
|
|
height: 38px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.formBox{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
position: absolute;
|
|
|
|
|
|
|
|
top: 50%;
|
|
|
|
|
|
|
|
left: 74.7%;
|
|
|
|
|
|
|
|
width: 26%;
|
|
|
|
|
|
|
|
//height: 400px;
|
|
|
|
|
|
|
|
transform: translate(-50%,-50%);
|
|
|
|
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
</style>
|
|
|
|