2022-01-08 15:42:53 +00:00
|
|
|
|
<template>
|
2025-08-01 09:42:39 +08:00
|
|
|
|
<div class="login-page">
|
2025-10-30 10:37:43 +08:00
|
|
|
|
<div class="login-box">
|
|
|
|
|
|
<div class="login-left">
|
|
|
|
|
|
<div class="login-title-welcome">
|
|
|
|
|
|
<img src="../assets/logo/logo.png" alt="logo" class="logo-img" />
|
2025-10-31 09:41:31 +08:00
|
|
|
|
<span class="login-title">欢迎使用科伦普冷轧涂镀数智一体化平台</span>
|
2025-10-30 10:37:43 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
<p>
|
|
|
|
|
|
嘉祥科伦普重工有限公司是山东省重点工程项目,是济宁市工程之一,也是科伦普产品结构调整重要的工程项目。工程采用了外方技术总负责、关键设备整体引进、点菜集成、国内技术总成、自主创新、单体设备引进等多种建设方
|
|
|
|
|
|
案,保证了技术先进和人才的培养,确保工程投产后达产达效。
|
|
|
|
|
|
</p>
|
|
|
|
|
|
<p>
|
|
|
|
|
|
科伦普冷轧重工有限公司是设计年产量150万 吨,能向广大用户提供热轧酸洗、热轧镀锌、冷硬、罩式退火、冷轧镀锌、铝锌合金、锌铝合金、锌铝镁、镀铬等各大类产品。产品覆盖东北、华北、华东、华南等地区。
|
|
|
|
|
|
</p>
|
2025-08-01 09:42:39 +08:00
|
|
|
|
</div>
|
2025-10-30 10:37:43 +08:00
|
|
|
|
|
|
|
|
|
|
<div class="login-right">
|
2025-08-01 09:42:39 +08:00
|
|
|
|
<el-form ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form">
|
2025-10-30 10:37:43 +08:00
|
|
|
|
<h2>登录</h2>
|
2025-08-01 09:42:39 +08:00
|
|
|
|
<el-form-item prop="username">
|
|
|
|
|
|
<el-input v-model="loginForm.username" type="text" auto-complete="off" placeholder="账号">
|
|
|
|
|
|
<svg-icon slot="prefix" icon-class="user" class="el-input__icon input-icon" />
|
|
|
|
|
|
</el-input>
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
<el-form-item prop="password">
|
|
|
|
|
|
<el-input v-model="loginForm.password" type="password" auto-complete="off" placeholder="密码"
|
|
|
|
|
|
@keyup.enter.native="handleLogin">
|
|
|
|
|
|
<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>
|
2025-11-20 13:29:02 +08:00
|
|
|
|
<el-checkbox v-model="loginForm.rememberMe" style="margin:10px 0px 25px 0px;">记住密码</el-checkbox>
|
2025-08-01 09:42:39 +08:00
|
|
|
|
<el-form-item style="width:100%;">
|
2025-10-30 10:37:43 +08:00
|
|
|
|
<el-button :loading="loading" size="medium" type="primary"
|
|
|
|
|
|
style="width:100%; height: 40px; font-size: 16px;" @click.native.prevent="handleLogin">
|
2025-08-01 09:42:39 +08:00
|
|
|
|
<span v-if="!loading">登 录</span>
|
|
|
|
|
|
<span v-else>登 录 中...</span>
|
|
|
|
|
|
</el-button>
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
</el-form>
|
|
|
|
|
|
</div>
|
2022-01-08 15:42:53 +00:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
|
import { getCodeImg } from "@/api/login";
|
2026-01-04 18:11:22 +08:00
|
|
|
|
import { encrypt, decrypt } from '@/utils/jsencrypt' // 保留加密解密工具
|
2022-01-08 15:42:53 +00:00
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
|
name: "Login",
|
|
|
|
|
|
data() {
|
|
|
|
|
|
return {
|
|
|
|
|
|
codeUrl: "",
|
|
|
|
|
|
loginForm: {
|
2026-01-04 18:11:22 +08:00
|
|
|
|
username: "", // 默认账号为空
|
|
|
|
|
|
password: "", // 默认密码为空
|
2022-01-08 15:42:53 +00:00
|
|
|
|
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,
|
|
|
|
|
|
// 验证码开关
|
2022-09-18 23:27:06 +08:00
|
|
|
|
captchaEnabled: true,
|
2022-01-08 15:42:53 +00:00
|
|
|
|
// 注册开关
|
|
|
|
|
|
register: false,
|
|
|
|
|
|
redirect: undefined
|
|
|
|
|
|
};
|
|
|
|
|
|
},
|
|
|
|
|
|
watch: {
|
|
|
|
|
|
$route: {
|
2025-08-01 09:42:39 +08:00
|
|
|
|
handler: function (route) {
|
2022-01-08 15:42:53 +00:00
|
|
|
|
this.redirect = route.query && route.query.redirect;
|
|
|
|
|
|
},
|
|
|
|
|
|
immediate: true
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
created() {
|
|
|
|
|
|
this.getCode();
|
2026-01-04 18:11:22 +08:00
|
|
|
|
this.getLocalStorage(); // 初始化读取localStorage,替换原来的getCookie
|
2022-01-08 15:42:53 +00:00
|
|
|
|
},
|
|
|
|
|
|
methods: {
|
|
|
|
|
|
getCode() {
|
|
|
|
|
|
getCodeImg().then(res => {
|
2022-09-18 23:27:06 +08:00
|
|
|
|
this.captchaEnabled = res.data.captchaEnabled === undefined ? true : res.data.captchaEnabled;
|
|
|
|
|
|
if (this.captchaEnabled) {
|
2022-01-08 15:42:53 +00:00
|
|
|
|
this.codeUrl = "data:image/gif;base64," + res.data.img;
|
|
|
|
|
|
this.loginForm.uuid = res.data.uuid;
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
},
|
2026-01-04 18:11:22 +08:00
|
|
|
|
// 读取localStorage中的账号密码(替换原来的getCookie方法)
|
|
|
|
|
|
getLocalStorage() {
|
|
|
|
|
|
const username = localStorage.getItem("username"); // 读取localStorage
|
|
|
|
|
|
const password = localStorage.getItem("password");
|
|
|
|
|
|
const rememberMe = localStorage.getItem('rememberMe');
|
2022-01-08 15:42:53 +00:00
|
|
|
|
this.loginForm = {
|
2026-01-04 18:11:22 +08:00
|
|
|
|
username: username === null ? this.loginForm.username : username, // 无缓存则保持默认空值
|
|
|
|
|
|
password: password === null ? this.loginForm.password : decrypt(password), // 解密后填充密码
|
|
|
|
|
|
rememberMe: rememberMe === null ? false : (rememberMe === 'true'), // localStorage存储字符串,需转为布尔值
|
|
|
|
|
|
code: "",
|
|
|
|
|
|
uuid: ""
|
2022-01-08 15:42:53 +00:00
|
|
|
|
};
|
|
|
|
|
|
},
|
|
|
|
|
|
handleLogin() {
|
|
|
|
|
|
this.$refs.loginForm.validate(valid => {
|
|
|
|
|
|
if (valid) {
|
|
|
|
|
|
this.loading = true;
|
2026-01-04 18:11:22 +08:00
|
|
|
|
// 根据是否勾选“记住密码”,操作localStorage
|
2022-01-08 15:42:53 +00:00
|
|
|
|
if (this.loginForm.rememberMe) {
|
2026-01-04 18:11:22 +08:00
|
|
|
|
// 存储账号(明文,可按需加密)、加密后的密码、记住密码状态
|
|
|
|
|
|
localStorage.setItem("username", this.loginForm.username);
|
|
|
|
|
|
localStorage.setItem("password", encrypt(this.loginForm.password));
|
|
|
|
|
|
localStorage.setItem('rememberMe', this.loginForm.rememberMe.toString()); // 布尔值转字符串存储
|
2022-01-08 15:42:53 +00:00
|
|
|
|
} else {
|
2026-01-04 18:11:22 +08:00
|
|
|
|
// 不勾选则清除localStorage中的对应缓存
|
|
|
|
|
|
localStorage.removeItem("username");
|
|
|
|
|
|
localStorage.removeItem("password");
|
|
|
|
|
|
localStorage.removeItem('rememberMe');
|
2022-01-08 15:42:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
this.$store.dispatch("Login", this.loginForm).then(() => {
|
2025-08-01 09:42:39 +08:00
|
|
|
|
this.$router.push({ path: this.redirect || "/" }).catch(() => { });
|
2022-01-08 15:42:53 +00:00
|
|
|
|
}).catch(() => {
|
|
|
|
|
|
this.loading = false;
|
2022-09-18 23:27:06 +08:00
|
|
|
|
if (this.captchaEnabled) {
|
2022-01-08 15:42:53 +00:00
|
|
|
|
this.getCode();
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style rel="stylesheet/scss" lang="scss">
|
2025-08-28 16:44:04 +08:00
|
|
|
|
// 引入全局主题变量,假设你有全局的variables.scss定义了以下变量
|
2025-10-30 10:37:43 +08:00
|
|
|
|
$--color-background: #f5f5f5;
|
2025-09-26 14:52:51 +08:00
|
|
|
|
$--color-text-primary: #111;
|
2025-08-28 16:44:04 +08:00
|
|
|
|
$--color-text-secondary: #b6bdc5;
|
|
|
|
|
|
$--border-color-light: #4c5057;
|
2025-09-26 14:52:51 +08:00
|
|
|
|
$--color-primary: #657b96;
|
2025-10-30 10:37:43 +08:00
|
|
|
|
$--metal-gradient-light: linear-gradient(145deg, #f5f5f550, #ffffff50);
|
2025-08-28 16:44:04 +08:00
|
|
|
|
|
2025-08-01 09:42:39 +08:00
|
|
|
|
.login-page {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
height: 100vh;
|
2025-10-30 10:37:43 +08:00
|
|
|
|
justify-content: center;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
background: url('../assets/images/login.jpg'); // 金属渐变背景
|
2025-10-30 18:01:19 +08:00
|
|
|
|
// 拉伸且不重复
|
|
|
|
|
|
background-size: cover;
|
|
|
|
|
|
background-position: center;
|
|
|
|
|
|
background-repeat: no-repeat;
|
2025-10-30 10:37:43 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.login-box {
|
|
|
|
|
|
width: 50%;
|
|
|
|
|
|
height: 50%;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
justify-content: center;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.login-left,
|
|
|
|
|
|
.login-right {
|
|
|
|
|
|
// flex: 1;
|
|
|
|
|
|
height: 100%;
|
|
|
|
|
|
padding: 20px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.login-left {
|
|
|
|
|
|
flex: 4;
|
|
|
|
|
|
background-color: #637288;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
// box-shadow: 0 0 20px rgba(0, 0, 0, 0.3); // 增加阴影增强质感
|
|
|
|
|
|
p {
|
|
|
|
|
|
text-indent: 2em;
|
|
|
|
|
|
}
|
2025-08-01 09:42:39 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-10-30 10:37:43 +08:00
|
|
|
|
.login-title-welcome {
|
2025-08-01 09:42:39 +08:00
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
justify-content: center;
|
|
|
|
|
|
gap: 12px;
|
|
|
|
|
|
|
|
|
|
|
|
.logo-img {
|
|
|
|
|
|
width: 64px;
|
|
|
|
|
|
height: 64px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.login-title {
|
2025-10-31 09:41:31 +08:00
|
|
|
|
font-size: 18px ;
|
2025-08-28 16:44:04 +08:00
|
|
|
|
color: $--color-text-primary; // 白色文字
|
2025-08-01 09:42:39 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-01-08 15:42:53 +00:00
|
|
|
|
.login-form {
|
|
|
|
|
|
.el-input {
|
2025-10-10 10:24:31 +08:00
|
|
|
|
margin-top: 20px;
|
2025-10-30 10:37:43 +08:00
|
|
|
|
|
2022-01-08 15:42:53 +00:00
|
|
|
|
input {
|
2025-09-30 20:52:52 +08:00
|
|
|
|
height: 40px !important;
|
2025-08-28 16:44:04 +08:00
|
|
|
|
color: $--color-text-primary; // 白色文字
|
|
|
|
|
|
background: transparent;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
&:focus-within {
|
|
|
|
|
|
border-color: $--color-primary; // 聚焦时显示主题色边框
|
2022-01-08 15:42:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2025-08-01 09:42:39 +08:00
|
|
|
|
|
2022-01-08 15:42:53 +00:00
|
|
|
|
.input-icon {
|
2025-08-01 09:42:39 +08:00
|
|
|
|
height: 40px;
|
|
|
|
|
|
width: 16px;
|
2022-01-08 15:42:53 +00:00
|
|
|
|
margin-left: 2px;
|
2025-08-28 16:44:04 +08:00
|
|
|
|
color: $--color-text-secondary; // 浅灰色图标
|
2022-01-08 15:42:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2025-08-01 09:42:39 +08:00
|
|
|
|
|
2022-01-08 15:42:53 +00:00
|
|
|
|
.login-code {
|
|
|
|
|
|
width: 33%;
|
2025-08-01 09:42:39 +08:00
|
|
|
|
height: 40px;
|
2022-01-08 15:42:53 +00:00
|
|
|
|
float: right;
|
2025-10-30 10:37:43 +08:00
|
|
|
|
|
2022-01-08 15:42:53 +00:00
|
|
|
|
img {
|
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
|
vertical-align: middle;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2025-08-01 09:42:39 +08:00
|
|
|
|
|
|
|
|
|
|
.login-code-img {
|
2022-01-08 15:42:53 +00:00
|
|
|
|
width: 100%;
|
2025-08-01 09:42:39 +08:00
|
|
|
|
height: 40px;
|
2025-08-28 16:44:04 +08:00
|
|
|
|
opacity: 0.8;
|
2025-10-30 10:37:43 +08:00
|
|
|
|
|
2025-08-28 16:44:04 +08:00
|
|
|
|
&:hover {
|
|
|
|
|
|
opacity: 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.el-checkbox {
|
|
|
|
|
|
color: $--color-text-primary; // 白色文字
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.el-button--primary {
|
|
|
|
|
|
background: $--color-primary; // 主题色按钮
|
|
|
|
|
|
border: none;
|
2025-09-26 14:52:51 +08:00
|
|
|
|
color: #111;
|
2025-08-01 09:42:39 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.login-right {
|
2025-10-30 10:37:43 +08:00
|
|
|
|
flex: 3;
|
|
|
|
|
|
background: #ffffff; // 金属渐变背景
|
2025-08-01 09:42:39 +08:00
|
|
|
|
display: flex;
|
|
|
|
|
|
justify-content: center;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.login-illustration {
|
2022-01-08 15:42:53 +00:00
|
|
|
|
text-align: center;
|
|
|
|
|
|
}
|
2025-08-01 09:42:39 +08:00
|
|
|
|
|
|
|
|
|
|
.illustration-img {
|
|
|
|
|
|
width: 320px;
|
|
|
|
|
|
margin-bottom: 32px;
|
2025-08-28 16:44:04 +08:00
|
|
|
|
opacity: 0.9;
|
2025-08-01 09:42:39 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.login-slogan {
|
|
|
|
|
|
.slogan-title {
|
|
|
|
|
|
font-size: 20px;
|
|
|
|
|
|
font-weight: 600;
|
2025-08-28 16:44:04 +08:00
|
|
|
|
color: $--color-text-primary; // 白色文字
|
2025-08-01 09:42:39 +08:00
|
|
|
|
margin-bottom: 12px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.slogan-desc {
|
|
|
|
|
|
font-size: 15px;
|
2025-08-28 16:44:04 +08:00
|
|
|
|
color: $--color-text-secondary; // 浅灰色文字
|
2025-08-01 09:42:39 +08:00
|
|
|
|
}
|
2022-01-08 15:42:53 +00:00
|
|
|
|
}
|
2025-08-28 16:44:04 +08:00
|
|
|
|
</style>
|