2022-01-08 15:42:53 +00:00
|
|
|
|
<template>
|
2025-08-01 09:42:39 +08:00
|
|
|
|
<div class="login-page">
|
|
|
|
|
|
<div class="login-left">
|
|
|
|
|
|
<div class="login-logo">
|
|
|
|
|
|
<img src="../assets/logo/logo.png" alt="logo" class="logo-img" />
|
|
|
|
|
|
<div class="login-title">科伦普综合办公系统</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="login-box">
|
|
|
|
|
|
<div class="login-title-welcome">欢迎使用科伦普综合办公系统</div>
|
|
|
|
|
|
<el-form ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form">
|
|
|
|
|
|
<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>
|
|
|
|
|
|
<el-checkbox v-model="loginForm.rememberMe" style="margin:0px 0px 25px 0px;">记住密码</el-checkbox>
|
|
|
|
|
|
<el-form-item style="width:100%;">
|
2025-09-26 14:52:51 +08:00
|
|
|
|
<el-button :loading="loading" size="medium" type="primary" style="width:100%; height: 40px; font-size: 16px;"
|
2025-08-01 09:42:39 +08:00
|
|
|
|
@click.native.prevent="handleLogin">
|
|
|
|
|
|
<span v-if="!loading">登 录</span>
|
|
|
|
|
|
<span v-else>登 录 中...</span>
|
|
|
|
|
|
</el-button>
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
</el-form>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="login-right">
|
|
|
|
|
|
<div class="login-illustration">
|
|
|
|
|
|
<img src="https://sf3-scmcdn-cn.feishucdn.com/goofy/ee/suite/passport/static/login/img/light.ba71f7a1.png"
|
|
|
|
|
|
alt="illustration" class="illustration-img" />
|
|
|
|
|
|
<div class="login-slogan">
|
|
|
|
|
|
<div class="slogan-title">先进团队,先用科伦普</div>
|
|
|
|
|
|
<div class="slogan-desc">人、事、信息,一处搞定</div>
|
2022-01-08 15:42:53 +00:00
|
|
|
|
</div>
|
2025-08-01 09:42:39 +08:00
|
|
|
|
</div>
|
2022-01-08 15:42:53 +00:00
|
|
|
|
</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,
|
|
|
|
|
|
// 验证码开关
|
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();
|
|
|
|
|
|
this.getCookie();
|
|
|
|
|
|
},
|
|
|
|
|
|
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;
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
},
|
|
|
|
|
|
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(() => {
|
2025-07-24 10:08:09 +08:00
|
|
|
|
this.$store.dispatch('category/getCategoryList');
|
2025-07-28 18:25:02 +08:00
|
|
|
|
this.$store.dispatch('category/getProductMap');
|
|
|
|
|
|
this.$store.dispatch('category/getRawMaterialMap');
|
2025-07-31 18:07:51 +08:00
|
|
|
|
this.$store.dispatch('category/getBomMap');
|
2025-08-13 16:39:47 +08:00
|
|
|
|
this.$store.dispatch('finance/getFinancialAccounts');
|
2025-08-14 16:30:13 +08:00
|
|
|
|
this.$store.dispatch('craft/getProcessList');
|
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-09-26 14:52:51 +08:00
|
|
|
|
$--color-background: #f5f5f5;
|
|
|
|
|
|
$--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;
|
|
|
|
|
|
$--metal-gradient-light: linear-gradient(145deg, #f5f5f5, #fff);
|
2025-08-28 16:44:04 +08:00
|
|
|
|
|
2025-08-01 09:42:39 +08:00
|
|
|
|
.login-page {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
height: 100vh;
|
2025-08-28 16:44:04 +08:00
|
|
|
|
background: $--color-background; // 改用全局深色背景变量
|
2025-08-01 09:42:39 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.login-logo {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
justify-content: center;
|
|
|
|
|
|
gap: 12px;
|
|
|
|
|
|
position: absolute;
|
|
|
|
|
|
top: 24px;
|
|
|
|
|
|
left: 24px;
|
|
|
|
|
|
|
|
|
|
|
|
.logo-img {
|
|
|
|
|
|
width: 64px;
|
|
|
|
|
|
height: 64px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.login-title {
|
|
|
|
|
|
font-size: 22px;
|
2025-08-28 16:44:04 +08:00
|
|
|
|
color: $--color-text-primary; // 白色文字
|
2025-08-01 09:42:39 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.login-left {
|
|
|
|
|
|
flex: 2;
|
2022-01-08 15:42:53 +00:00
|
|
|
|
display: flex;
|
|
|
|
|
|
justify-content: center;
|
|
|
|
|
|
align-items: center;
|
2025-08-28 16:44:04 +08:00
|
|
|
|
background: $--metal-gradient-light; // 金属渐变背景
|
2025-08-01 09:42:39 +08:00
|
|
|
|
position: relative;
|
2025-08-28 16:44:04 +08:00
|
|
|
|
box-shadow: 0 0 20px rgba(0, 0, 0, 0.3); // 增加阴影增强质感
|
2022-01-08 15:42:53 +00:00
|
|
|
|
}
|
2025-08-01 09:42:39 +08:00
|
|
|
|
|
|
|
|
|
|
.login-box {
|
|
|
|
|
|
width: 500px;
|
|
|
|
|
|
padding: 40px 32px 32px 32px;
|
|
|
|
|
|
border-radius: 12px;
|
2025-08-28 16:44:04 +08:00
|
|
|
|
box-shadow: 0 4px 32px 0 rgba(0, 0, 0, 0.2);
|
|
|
|
|
|
background: $--color-background; // 深色背景
|
2025-08-01 09:42:39 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.login-title-welcome {
|
|
|
|
|
|
font-size: 22px;
|
|
|
|
|
|
font-weight: 600;
|
2025-08-28 16:44:04 +08:00
|
|
|
|
color: $--color-text-primary; // 白色文字
|
2025-08-01 09:42:39 +08:00
|
|
|
|
text-align: left;
|
|
|
|
|
|
margin-bottom: 24px;
|
2022-01-08 15:42:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.login-form {
|
|
|
|
|
|
.el-input {
|
|
|
|
|
|
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;
|
|
|
|
|
|
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;
|
|
|
|
|
|
&: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 {
|
|
|
|
|
|
flex: 1;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
justify-content: center;
|
|
|
|
|
|
align-items: center;
|
2025-08-28 16:44:04 +08:00
|
|
|
|
background: $--metal-gradient-light; // 金属渐变背景
|
2025-08-01 09:42:39 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.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>
|