济菏高速业务端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

400 lines
11 KiB

1 year ago
<template>
<div class="login">
<el-form ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form">
<div style="
1 year ago
width: 100%;
text-align: center;
padding-right: 20px;
padding-bottom: 10px;
">
<!-- <img src="../assets/image/login-logo.png" width="120px;" /> -->
<div class="loginTitle">欢迎登录</div>
1 year ago
</div>
<div class="title">{{ '' }}</div>
1 year ago
<el-form-item prop="username">
<el-input v-model="loginForm.username" type="text" auto-complete="off" placeholder="请输入用户名">
<img slot="prefix" src="../assets/images/Vector.png" class="el-input__icon input-icon" />
1 year ago
</el-input>
<!-- <div style="border-bottom: 1px solid #cfcfcf; margin-top: 5px"></div> -->
1 year ago
</el-form-item>
<el-form-item prop="password">
<el-input v-model="loginForm.password" type="password" auto-complete="off" placeholder="请输入密码"
@keyup.enter.native="handleLogin">
<img slot="prefix" src="../assets/images/locked.png" class="el-input__icon input-icon" />
1 year ago
</el-input>
<!-- <div style="border-bottom: 1px solid #cfcfcf; margin-top: 5px"></div> -->
1 year ago
</el-form-item>
<Verify @success="capctchaCheckSuccess" :mode="'pop'" :captchaType="'blockPuzzle'"
:imgSize="{ width: '330px', height: '155px' }" ref="verify"></Verify>
<el-checkbox v-model="loginForm.rememberMe" style="margin:0px 0px 20px 0px;">记住密码</el-checkbox>
1 year ago
<el-form-item style="width: 100%; text-align: center">
<el-button :loading="loading" size="medium" type="goon" style="width: 100%" @click.native.prevent="handleLogin">
1 year ago
<span v-if="!loading"> </span>
<span v-else> 中...</span>
</el-button>
<div style="float: right" v-if="register">
<router-link class="link-type" :to="'/register'">立即注册</router-link>
1 year ago
</div>
</el-form-item>
</el-form>
1 year ago
<!-- 底部 -->
<div class="el-login-footer">
1 year ago
<!-- <span>Copyright ©hamdell All Rights Reserved.</span> -->
1 year ago
</div>
</div>
</template>
<script>
import Cookies from "js-cookie";
1 year ago
import { encrypt, decrypt } from "@/utils/jsencrypt";
import Verify from "@/components/Verifition/Verify";
import { getCaptchaOnOff } from "@/api/login.js";
1 year ago
import { listOrder } from "@/api/payment/order";
import { getUserDeptId } from "@/api/system/user";
import { listTunnels } from "@/api/equipment/tunnel/api.js";
import { getConfigKey } from "@/api/system/config.js";
1 year ago
export default {
1 year ago
components: { Verify },
1 year ago
name: "Login",
data() {
return {
1 year ago
title: "", // 系统标题
1 year ago
cookiePassword: "",
loginForm: {
// username: "admin",
// password: "dxc123!@#",
1 year ago
//dxc123!@#
username: "",
password: "",
1 year ago
rememberMe: false,
code: "",
1 year ago
uuid: "",
1 year ago
},
loginRules: {
username: [
1 year ago
{ required: true, trigger: "blur", message: "请输入您的账号" },
1 year ago
],
password: [
1 year ago
{ required: true, trigger: "blur", message: "请输入您的密码" },
1 year ago
],
},
loading: false,
1 year ago
// 验证码开关
captchaOnOff: false,
1 year ago
// 注册开关
register: false,
1 year ago
redirect: undefined,
1 year ago
};
},
watch: {
$route: {
1 year ago
handler: function (route) {
1 year ago
this.redirect = route.query && route.query.redirect;
},
1 year ago
immediate: true,
},
1 year ago
},
created() {
this.getCookie();
//this.getCaptchaOnOffFun();
1 year ago
this.title = systemConfig.title(systemConfig.systemType);
},
methods: {
// 获取验证码是否开启
getCaptchaOnOffFun() {
1 year ago
getCaptchaOnOff().then((response) => {
1 year ago
this.captchaOnOff = response.captchaOnOff;
1 year ago
});
1 year ago
},
// 验证码
1 year ago
capctchaCheckSuccess(params) {
1 year ago
this.loginForm.code = params.captchaVerification;
this.loading = true;
console.log(this.loginForm.rememberMe, "=======================");
if (this.loginForm.rememberMe == true) {
1 year ago
Cookies.set("username", this.loginForm.username, { expires: 30 });
1 year ago
Cookies.set("password", encrypt(this.loginForm.password), {
expires: 30,
});
1 year ago
Cookies.set("rememberMe", this.loginForm.rememberMe, { expires: 30 });
} else {
Cookies.remove("username");
Cookies.remove("password");
Cookies.remove("rememberMe");
}
1 year ago
this.$store
.dispatch("Login", this.loginForm)
.then(() => {
this.$router.push({ path: this.redirect || "/" }).catch(() => { });
1 year ago
})
.catch(() => {
this.loading = false;
});
1 year ago
},
getCookie() {
const username = Cookies.get("username");
const password = Cookies.get("password");
1 year ago
const rememberMe = Cookies.get("rememberMe");
console.log("rem", rememberMe);
1 year ago
this.loginForm = {
username: username === undefined ? this.loginForm.username : username,
1 year ago
password:
password === undefined ? this.loginForm.password : decrypt(password),
1 year ago
rememberMe: rememberMe === undefined ? false : Boolean(rememberMe),
1 year ago
};
},
handleLogin() {
1 year ago
if (this.captchaOnOff) {
this.$refs.loginForm.validate((valid) => {
if (valid) {
1 year ago
this.$refs.verify.show();
}
1 year ago
});
} else {
if (this.loginForm.rememberMe == true) {
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");
}
1 year ago
this.$store
.dispatch("Login", this.loginForm)
.then(() => {
this.$router.push({ path: this.redirect || "/" }).catch(() => { });
1 year ago
this.getManageStation();
})
.catch(() => {
this.loading = false;
});
}
1 year ago
},
1 year ago
getManageStation() {
getConfigKey("sd.moduleSwitch").then((res) => {
console.log(res, "管理站01");
this.$cache.local.set("manageStation", res.msg);
});
getConfigKey("sd.navigationBar").then((res) => {
console.log(res, "res")
1 year ago
let sideTheme = "theme-blue";
if (res.msg == "0") {
sideTheme = "theme-dark";
} else {
sideTheme = "theme-blue";
1 year ago
}
1 year ago
// console.log(res, "是否胡山隧道,胡山单独导航栏样式");
this.$cache.local.set("navigationBar", res.msg);
this.$store.dispatch("settings/changeSetting", {
key: "sideTheme",
value: sideTheme,
});
// this.sideTheme = val;
this.$cache.local.set(
"layout-setting",
`{
"topNav":${this.$store.state.settings.topNav},
"tagsView":${this.$store.state.settings.tagsView},
"weatherView":${this.$store.state.settings.weatherView},
"fixedHeader":${this.$store.state.settings.fixedHeader},
"sidebarLogo":${this.$store.state.settings.sidebarLogo},
"dynamicTitle":${this.$store.state.settings.dynamicTitle},
"sideTheme":"${sideTheme}",
"theme":"${this.$store.state.settings.theme}"
}`
);
// console.log(this.$store.state.settings.sideTheme)
1 year ago
});
},
1 year ago
},
1 year ago
};
</script>
1 year ago
<style rel="stylesheet/scss" lang="scss" scoped>
::v-deep .el-input__inner {
background-color: transparent !important;
height: 100%;
font-size: 22px;
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 400;
color: #07CAF6;
margin-left: 68px;
}
::v-deep .el-checkbox__label {
color: #fff;
font-size: 18px !important;
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 400;
color: #FFFFFF !important;
margin-bottom: 10px;
}
::v-deep .el-form-item__error {
position: absolute;
top: 75px;
}
::v-deep .el-input__inner::placeholder {
color: #07CAF6;
}
1 year ago
.login {
1 year ago
position: relative;
1 year ago
height: 100%;
background-image: url("../assets/images/login-background.png");
background-size: 100% auto;
1 year ago
}
.login::after {
content: "";
position: absolute;
width: 100%;
height: 120px;
background-image: url('../assets/images/login-head.png');
background-repeat: no-repeat;
background-size: 100% auto ;
background-position: center center;
}
1 year ago
.title {
1 year ago
margin: 0px auto 10px auto;
font-size: 24px;
1 year ago
text-align: center;
1 year ago
color: #353f55;
letter-spacing: 2px;
1 year ago
}
.login-form::after {
content: "";
position: absolute;
left: -4px;
top: 0px;
width: 4px;
height: 100%;
background: linear-gradient(180deg, #BDFFF600 0%, #BDFFF6 50%, #BDFFF600 100%);
;
}
.login-form::before {
content: "";
position: absolute;
right: -4px;
top: 0px;
width: 4px;
height: 100%;
background: linear-gradient(180deg, #BDFFF600 0%, #BDFFF6 50%, #BDFFF600 100%);
;
}
1 year ago
.login-form {
1 year ago
position: absolute;
left: 50%;
top: 20%;
transform: translateX(-50%);
width: 548px;
height: 535px;
background: #00000080;
border-radius: 0px 0px 0px 0px;
opacity: 1;
border: 4px solid #0C5963;
padding: 50px;
1 year ago
// margin-left: 50%;
.loginTitle {
display: inline-flex;
width: 100%;
height: 45px;
font-size: 30px;
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 500;
color: #FFFFFF;
justify-content: center;
align-items: center;
}
1 year ago
.el-input {
width: 420px;
height: 70px;
border-radius: 4px 4px 4px 4px;
opacity: 1;
border: 1px solid #01CFFE;
background-color: transparent;
margin-bottom: 12px;
;
1 year ago
input {
1 year ago
border: 0;
height: 35px;
1 year ago
}
}
1 year ago
.input-icon {
height: 28px;
width: 28px;
1 year ago
margin-left: 2px;
position: relative;
left: 14px;
top: 18px;
1 year ago
}
}
1 year ago
.login-tip {
font-size: 13px;
text-align: center;
color: #bfbfbf;
}
1 year ago
.login-code {
1 year ago
width: 37%;
height: 35px;
1 year ago
float: right;
1 year ago
img {
cursor: pointer;
vertical-align: middle;
}
}
1 year ago
.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;
}
1 year ago
.login-code-img {
1 year ago
height: 35px;
}
/* 重置按钮 */
.el-button--goon {
font-size: 30px;
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 400;
color: #FFFFFF;
width: 420px;
height: 70px;
background: #07CAF6;
border-radius: 4px 4px 4px 4px;
opacity: 1;
1 year ago
}
.el-button--goon:hover {}
1 year ago
</style>