<template>
|
<div class="login Group_132">
|
<el-form ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form" style="margin-left: 0px;margin-right: 180px;">
|
<h3 class="title" style="margin-top: 80px;margin-right: 108px;margin-bottom: 0;margin-left: 109px;">欢迎来到本都都</h3>
|
<div class="second-box" style=" margin-top: 25px;
|
margin-left: 140px;
|
margin-right: 141px;
|
">
|
<div class="little-title" style=" margin-top: 20px;">
|
<h5 >登录可查看更多信息</h5>
|
<h5 >未注册的账号登录成功后会自动注册</h5></div></div>
|
<div class="yonghuming" style="margin-left: 99px;margin-right: 425px;">用户名</div>
|
|
<el-form-item prop="username" style="
|
width: 380px;
|
height: 48px;
|
margin-left: 96px;
|
margin-right: 96px;
|
">
|
|
<el-input
|
v-model="loginForm.username"
|
type="text"
|
auto-complete="off"
|
placeholder="请输入用户名"
|
style="height: 50px"
|
>
|
<!-- <svg-icon slot="prefix" icon-class="user" class="el-input__icon input-icon" /> -->
|
</el-input>
|
</el-form-item>
|
|
<div class="mima" style="
|
margin-left: 99px;
|
margin-right: 441px;">密码</div>
|
<el-form-item prop="password" style="
|
margin-left: 96px;
|
margin-right: 96px;
|
width: 380px;
|
height: 48px;">
|
<el-input
|
v-model="loginForm.password"
|
type="password"
|
auto-complete="off"
|
placeholder="密码"
|
@keyup.enter.native="handleLogin"
|
style="height: 50px"
|
show-password
|
>
|
<!-- <svg-icon slot="suffix" icon-class="eye" class="el-input_icon input-icon" onclick="show()"></svg-icon> -->
|
|
<!-- <el-input type="password" prefix-icon="el-icon-lock" v-model="loginForm.passWord" show-password></el-input> -->
|
|
|
<!-- <el-input :type="showPass ? 'text' : 'password'"
|
prefix-icon="el-icon-lock"
|
v-model="loginForm.password"
|
@keyup.enter.native="handleLogin"
|
placeholder="密码"
|
style="height: 50px"> -->
|
|
|
|
|
|
|
<!-- <svg-icon slot="prefix" icon-class="password" class="el-input__icon input-icon" /> -->
|
</el-input>
|
</el-form-item>
|
|
|
<div class="验证码" style="margin-left: 99px;margin-right: 425px;width: 48px;height: 20px;">验证码</div>
|
<el-form-item prop="code" v-if="captchaEnabled" style="margin-bottom: 76px;width: 520px;" >
|
<el-input
|
v-model="loginForm.code"
|
auto-complete="off"
|
placeholder="请输入验证码"
|
style="width: 258px ;
|
margin-left: 96px "
|
|
|
|
@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>
|
|
<div class="code" @click="getCode" style="width: 24px;
|
margin-left: 452px;
|
height: 16px;
|
font-size: 12px;
|
font-family: Microsoft YaHei-Regular, Microsoft YaHei;
|
font-weight: 400;
|
color: #37AADB;
|
line-height: 14px;
|
">刷新 </div>
|
|
</el-form-item>
|
|
|
|
<!-- <el-checkbox v-model="loginForms.rememberMe" style="margin:0px 0px 25px 0px;">记住密码</el-checkbox> -->
|
<el-form-item s style="width: 572px;height: 72px;margin-bottom: 75px;background: rgba(239,113,155,0.8);">
|
|
|
<el-button
|
:loading="loading"
|
style="width: 572px;height: 72px; background: rgba(239,113,155,0.8);"
|
size="medium"
|
type="primary"
|
@click.native.prevent="handleLogin"
|
>
|
<span v-if="!loading" style="width: 97px;height: 62px;">登录</span>
|
<span v-else>登 录 中...</span>
|
</el-button>
|
<div style="float: right;
|
height:94px;" v-if="register">
|
<router-link class="link-type" :to="'/register'">立即注册</router-link>
|
</div>
|
</el-form-item>
|
</el-form>
|
<!-- 底部 -->
|
<div class="el-login-footer" >
|
<span style="color: black; ">Copyright © GDUT All Rights Reserved.</span>
|
<a href="https://beian.miit.gov.cn/" target="_blank" style="color: black; ">粤ICP备2023050334号 </a>
|
</div>
|
</div>
|
</template>
|
|
<script>
|
import { getCodeImg } from "@/api/login";
|
import Cookies from "js-cookie";
|
import { encrypt, decrypt } from '@/utils/jsencrypt'
|
|
export default {
|
name: "Login",
|
data() {
|
return {
|
codeUrl: "",
|
loginForm: {
|
username: "admin",
|
password: "admin123",
|
rememberMe: false,
|
code: "",
|
uuid: ""
|
},
|
loginRules: {
|
username: [
|
{ required: true, trigger: "blur", message: "请输入您的账号" }
|
],
|
password: [
|
{ required: true, trigger: "blur", message: "请输入您的密码" }
|
],
|
code: [{ required: true, trigger: "change", message: "请输入验证码" }]
|
},
|
loading: false,
|
// 验证码开关
|
captchaEnabled: true,
|
// 注册开关
|
register: true,
|
redirect: undefined
|
};
|
},
|
watch: {
|
$route: {
|
handler: function(route) {
|
this.redirect = route.query && route.query.redirect;
|
},
|
immediate: true
|
}
|
},
|
created() {
|
this.getCode();
|
this.getCookie();
|
},
|
methods: {
|
getCode() {
|
getCodeImg().then(res => {
|
this.captchaEnabled = res.data.captchaEnabled === undefined ? true : res.captchaEnabled;
|
if (this.captchaEnabled) {
|
this.codeUrl = "data:image/gif;base64," + res.data.img;
|
this.loginForm.uuid = res.data.uuid;
|
}
|
});
|
},
|
getCookie() {
|
const username = Cookies.get("username");
|
const password = Cookies.get("password");
|
const rememberMe = Cookies.get('rememberMe')
|
this.loginForm = {
|
username: username === undefined ? this.loginForm.username : username,
|
password: password === undefined ? this.loginForm.password : decrypt(password),
|
rememberMe: rememberMe === undefined ? false : Boolean(rememberMe)
|
};
|
},
|
handleLogin() {
|
this.$refs.loginForm.validate(valid => {
|
if (valid) {
|
this.loading = true;
|
if (this.loginForm.rememberMe) {
|
Cookies.set("username", this.loginForm.username, { expires: 30 });
|
Cookies.set("password", encrypt(this.loginForm.password), { expires: 30 });
|
Cookies.set('rememberMe', this.loginForm.rememberMe, { expires: 30 });
|
} else {
|
Cookies.remove("username");
|
Cookies.remove("password");
|
Cookies.remove('rememberMe');
|
}
|
this.$store.dispatch("Login", this.loginForm).then(() => {
|
this.$router.push({ path: this.redirect || "/" }).catch(()=>{});
|
}).catch(() => {
|
this.loading = false;
|
if (this.captchaEnabled) {
|
this.getCode();
|
}
|
});
|
}
|
});
|
}
|
}
|
};
|
</script>
|
|
<style rel="stylesheet/scss" lang="scss">
|
.Group_132{
|
// background: no-repeat center/40% url("../assets/images/Group 132.png");
|
height: 100%;
|
width: 100%;
|
background-color: #FEF7FC;
|
//background-position: 49.5% 16.2% ;
|
// background-position: 81.7px 71.3px;
|
//background-size: auto;
|
|
}
|
|
.login {
|
display: flex;
|
justify-content: flex-end;
|
align-items: center;
|
height: 100%;
|
width: 100%;
|
background: no-repeat center/40% url("../assets/images/Group 221.png");
|
background-color: #FEF7FC;
|
|
background-position: 183px 145px;
|
//background-image: url("../assets/images/login-background.jpg");
|
//background-size: cover;
|
}
|
.title {
|
margin: 109px 0 108px 0 ;
|
width:355px;
|
height: 58px;
|
font-size: 44px;
|
text-align: center;
|
font-family: Microsoft YaHei-Bold, Microsoft YaHei;
|
font-weight: bold;
|
color: #000000;
|
|
}
|
.second-box {
|
width: 386px;
|
height: 100px;
|
border-radius: 0px 0px 0px 0px;
|
opacity: 1;
|
}
|
.little-title {
|
width: 291px;
|
height: 72px;
|
font-size: 18px;
|
font-family: Microsoft YaHei-Regular, Microsoft YaHei;
|
font-weight: 400;
|
color: #4D4D4D;
|
line-height: 21px;
|
text-align:center;
|
// -webkit-background-clip: text;
|
// -webkit-text-fill-color: transparent;
|
}
|
|
.yonghuming {
|
width: 48px;
|
height: 22px;
|
font-size: 16px;
|
font-family: Hind Madurai-Regular, Hind Madurai;
|
font-weight: 400;
|
color: #1D2129;
|
line-height: 19px;
|
|
// -webkit-background-clip: text;
|
// -webkit-text-fill-color: transparent;
|
}
|
|
.mima{
|
width: 32px;
|
height: 20px;
|
font-size: 16px;
|
font-family: Abel-Regular, Abel;
|
font-weight: 400;
|
color: #1D2129;
|
line-height: 19px;
|
|
// -webkit-background-clip: text;
|
// -webkit-text-fill-color: transparent;
|
}
|
|
.yanzhengma {
|
width: 48px;
|
height: 20px;
|
font-size: 16px;
|
font-family: Abel-Regular, Abel;
|
font-weight: 400;
|
color: #1D2129;
|
line-height: 19px;
|
|
// -webkit-background-clip: text;
|
// -webkit-text-fill-color: transparent;
|
}
|
|
|
.login-form {
|
border-radius: 6px;
|
background: #FEF7FC;
|
width: 572px;
|
padding: 25px 25px 5px 25px;
|
margin: 211px 142px 237px 1206px;
|
.el-input {
|
height: 48px;
|
input {
|
height: 48px;
|
}
|
}
|
.input-icon {
|
height: 39px;
|
width: 14px;
|
margin-left: 2px;
|
}
|
}
|
.login-tip {
|
font-size: 13px;
|
text-align: center;
|
color: #bfbfbf;
|
}
|
.login-code {
|
width: 108px;
|
height: 48px;
|
float: right;
|
margin-right: 46px;
|
|
|
img {
|
cursor: pointer;
|
vertical-align: middle;
|
|
border: 1px solid #D9D9D9;
|
}
|
}
|
.el-login-footer {
|
height: 40px;
|
line-height: 40px;
|
position: fixed;
|
bottom: 0;
|
width: 100%;
|
text-align: center;
|
color: #fff;
|
font-family: Arial;
|
font-size: 12px;
|
letter-spacing: 1px;
|
}
|
.login-code-img {
|
height: 48px;
|
width: 110px;
|
}
|
|
.code {
|
margin-left: 452px;
|
}
|
</style>
|