2026-07-28 16:26:07 +08:00
|
|
|
<template>
|
|
|
|
|
<div class="login">
|
2026-08-28 10:25:05 +08:00
|
|
|
<section class="login-visual">
|
|
|
|
|
<div class="visual-brand">
|
|
|
|
|
<span class="visual-brand__index">CMVR / 2026</span>
|
|
|
|
|
<strong>{{ title }}</strong>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="visual-copy">
|
|
|
|
|
<span>INTELLIGENT TEST OPERATIONS</span>
|
|
|
|
|
<h1>机器人智能测试<br>运行中枢</h1>
|
|
|
|
|
<div class="visual-modules">
|
|
|
|
|
<span>设备接入</span>
|
|
|
|
|
<span>流程编排</span>
|
|
|
|
|
<span>巡检执行</span>
|
2026-07-28 16:26:07 +08:00
|
|
|
</div>
|
2026-08-28 10:25:05 +08:00
|
|
|
</div>
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
<main class="login-access">
|
|
|
|
|
<div class="access-index">
|
|
|
|
|
<span>SECURE ACCESS</span>
|
|
|
|
|
<strong>01</strong>
|
|
|
|
|
</div>
|
|
|
|
|
<el-form ref="loginRef" :model="loginForm" :rules="loginRules" class="login-form">
|
|
|
|
|
<div class="form-heading">
|
|
|
|
|
<span>ACCOUNT</span>
|
|
|
|
|
<h2>登录工作台</h2>
|
|
|
|
|
</div>
|
|
|
|
|
<el-form-item prop="username">
|
|
|
|
|
<el-input
|
|
|
|
|
v-model="loginForm.username"
|
|
|
|
|
type="text"
|
|
|
|
|
size="large"
|
|
|
|
|
auto-complete="off"
|
|
|
|
|
placeholder="账号"
|
|
|
|
|
>
|
|
|
|
|
<template #prefix><svg-icon icon-class="user" class="el-input__icon input-icon" /></template>
|
|
|
|
|
</el-input>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item prop="password">
|
|
|
|
|
<el-input
|
|
|
|
|
v-model="loginForm.password"
|
|
|
|
|
type="password"
|
|
|
|
|
size="large"
|
|
|
|
|
auto-complete="off"
|
|
|
|
|
placeholder="密码"
|
|
|
|
|
@keyup.enter="handleLogin"
|
|
|
|
|
>
|
|
|
|
|
<template #prefix><svg-icon icon-class="password" class="el-input__icon input-icon" /></template>
|
|
|
|
|
</el-input>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item prop="code" v-if="captchaEnabled">
|
|
|
|
|
<el-input
|
|
|
|
|
v-model="loginForm.code"
|
|
|
|
|
size="large"
|
|
|
|
|
auto-complete="off"
|
|
|
|
|
placeholder="验证码"
|
|
|
|
|
style="width: 63%"
|
|
|
|
|
@keyup.enter="handleLogin"
|
|
|
|
|
>
|
|
|
|
|
<template #prefix><svg-icon icon-class="validCode" class="el-input__icon input-icon" /></template>
|
|
|
|
|
</el-input>
|
|
|
|
|
<div class="login-code">
|
|
|
|
|
<img :src="codeUrl" @click="getCode" class="login-code-img"/>
|
|
|
|
|
</div>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<div class="form-options">
|
|
|
|
|
<el-checkbox v-model="loginForm.rememberMe">记住密码</el-checkbox>
|
|
|
|
|
<router-link v-if="register" class="link-type" :to="'/register'">立即注册</router-link>
|
2026-07-28 16:26:07 +08:00
|
|
|
</div>
|
2026-08-28 10:25:05 +08:00
|
|
|
<el-form-item class="submit-row">
|
|
|
|
|
<el-button
|
|
|
|
|
:loading="loading"
|
|
|
|
|
size="large"
|
|
|
|
|
type="primary"
|
|
|
|
|
@click.prevent="handleLogin"
|
|
|
|
|
>
|
|
|
|
|
<span v-if="!loading">进入系统</span>
|
|
|
|
|
<span v-else>正在登录...</span>
|
|
|
|
|
</el-button>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-form>
|
|
|
|
|
<div class="el-login-footer">
|
|
|
|
|
<span>{{ footerContent }}</span>
|
|
|
|
|
</div>
|
|
|
|
|
</main>
|
2026-07-28 16:26:07 +08:00
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script setup>
|
|
|
|
|
import { getCodeImg } from "@/api/login"
|
|
|
|
|
import Cookies from "js-cookie"
|
|
|
|
|
import { encrypt, decrypt } from "@/utils/jsencrypt"
|
|
|
|
|
import useUserStore from '@/store/modules/user'
|
|
|
|
|
import defaultSettings from '@/settings'
|
|
|
|
|
|
|
|
|
|
const title = import.meta.env.VITE_APP_TITLE
|
|
|
|
|
const footerContent = defaultSettings.footerContent
|
|
|
|
|
const userStore = useUserStore()
|
|
|
|
|
const route = useRoute()
|
|
|
|
|
const router = useRouter()
|
|
|
|
|
const { proxy } = getCurrentInstance()
|
|
|
|
|
|
|
|
|
|
const loginForm = ref({
|
|
|
|
|
username: "admin",
|
|
|
|
|
password: "admin123",
|
|
|
|
|
rememberMe: false,
|
|
|
|
|
code: "",
|
|
|
|
|
uuid: ""
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
const loginRules = {
|
|
|
|
|
username: [{ required: true, trigger: "blur", message: "请输入您的账号" }],
|
|
|
|
|
password: [{ required: true, trigger: "blur", message: "请输入您的密码" }],
|
|
|
|
|
code: [{ required: true, trigger: "change", message: "请输入验证码" }]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const codeUrl = ref("")
|
|
|
|
|
const loading = ref(false)
|
|
|
|
|
// 验证码开关
|
|
|
|
|
const captchaEnabled = ref(true)
|
|
|
|
|
// 注册开关
|
|
|
|
|
const register = ref(false)
|
|
|
|
|
const redirect = ref(undefined)
|
|
|
|
|
|
|
|
|
|
watch(route, (newRoute) => {
|
|
|
|
|
redirect.value = newRoute.query && newRoute.query.redirect
|
|
|
|
|
}, { immediate: true })
|
|
|
|
|
|
|
|
|
|
function handleLogin() {
|
|
|
|
|
proxy.$refs.loginRef.validate(valid => {
|
|
|
|
|
if (valid) {
|
|
|
|
|
loading.value = true
|
|
|
|
|
// 勾选了需要记住密码设置在 cookie 中设置记住用户名和密码
|
|
|
|
|
if (loginForm.value.rememberMe) {
|
|
|
|
|
Cookies.set("username", loginForm.value.username, { expires: 30 })
|
|
|
|
|
Cookies.set("password", encrypt(loginForm.value.password), { expires: 30 })
|
|
|
|
|
Cookies.set("rememberMe", loginForm.value.rememberMe, { expires: 30 })
|
|
|
|
|
} else {
|
|
|
|
|
// 否则移除
|
|
|
|
|
Cookies.remove("username")
|
|
|
|
|
Cookies.remove("password")
|
|
|
|
|
Cookies.remove("rememberMe")
|
|
|
|
|
}
|
|
|
|
|
// 调用action的登录方法
|
|
|
|
|
userStore.login(loginForm.value).then(() => {
|
|
|
|
|
const query = route.query
|
|
|
|
|
const otherQueryParams = Object.keys(query).reduce((acc, cur) => {
|
|
|
|
|
if (cur !== "redirect") {
|
|
|
|
|
acc[cur] = query[cur]
|
|
|
|
|
}
|
|
|
|
|
return acc
|
|
|
|
|
}, {})
|
|
|
|
|
router.push({ path: redirect.value || "/", query: otherQueryParams })
|
|
|
|
|
}).catch(() => {
|
|
|
|
|
loading.value = false
|
|
|
|
|
// 重新获取验证码
|
|
|
|
|
if (captchaEnabled.value) {
|
|
|
|
|
getCode()
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function getCode() {
|
|
|
|
|
getCodeImg().then(res => {
|
|
|
|
|
captchaEnabled.value = res.captchaEnabled === undefined ? true : res.captchaEnabled
|
|
|
|
|
if (captchaEnabled.value) {
|
|
|
|
|
codeUrl.value = "data:image/gif;base64," + res.img
|
|
|
|
|
loginForm.value.uuid = res.uuid
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function getCookie() {
|
|
|
|
|
const username = Cookies.get("username")
|
|
|
|
|
const password = Cookies.get("password")
|
|
|
|
|
const rememberMe = Cookies.get("rememberMe")
|
|
|
|
|
loginForm.value = {
|
|
|
|
|
username: username === undefined ? loginForm.value.username : username,
|
|
|
|
|
password: password === undefined ? loginForm.value.password : decrypt(password),
|
|
|
|
|
rememberMe: rememberMe === undefined ? false : Boolean(rememberMe)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getCode()
|
|
|
|
|
getCookie()
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style lang='scss' scoped>
|
|
|
|
|
.login {
|
2026-08-28 10:25:05 +08:00
|
|
|
display: grid;
|
|
|
|
|
grid-template-columns: minmax(0, 1fr) minmax(440px, 36vw);
|
2026-07-28 16:26:07 +08:00
|
|
|
height: 100%;
|
2026-08-27 15:40:05 +08:00
|
|
|
overflow: hidden;
|
|
|
|
|
background: var(--min-bg-page);
|
2026-07-28 16:26:07 +08:00
|
|
|
}
|
2026-08-28 10:25:05 +08:00
|
|
|
|
|
|
|
|
.login-visual {
|
|
|
|
|
position: relative;
|
|
|
|
|
isolation: isolate;
|
|
|
|
|
min-width: 0;
|
|
|
|
|
padding: 42px 48px;
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
overflow: hidden;
|
2026-07-28 16:26:07 +08:00
|
|
|
background-image: url("../assets/images/login-background.jpg");
|
2026-08-27 15:40:05 +08:00
|
|
|
background-position: center;
|
2026-07-28 16:26:07 +08:00
|
|
|
background-size: cover;
|
2026-08-28 10:25:05 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.login-visual::before {
|
|
|
|
|
content: '';
|
|
|
|
|
position: absolute;
|
|
|
|
|
inset: 0;
|
2026-07-28 16:26:07 +08:00
|
|
|
z-index: -1;
|
2026-08-28 10:25:05 +08:00
|
|
|
background: rgba(255, 255, 255, 0.68);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.visual-brand {
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
gap: 18px;
|
|
|
|
|
|
|
|
|
|
strong {
|
|
|
|
|
max-width: 420px;
|
|
|
|
|
color: var(--min-text-primary);
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
font-weight: 600;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.visual-brand__index {
|
|
|
|
|
padding-right: 18px;
|
|
|
|
|
border-right: 2px solid var(--min-primary);
|
|
|
|
|
color: var(--min-primary);
|
|
|
|
|
font-size: 11px;
|
|
|
|
|
font-weight: 600;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.visual-copy {
|
|
|
|
|
max-width: 620px;
|
|
|
|
|
|
|
|
|
|
> span {
|
|
|
|
|
color: var(--min-primary);
|
|
|
|
|
font-size: 11px;
|
|
|
|
|
font-weight: 600;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
h1 {
|
|
|
|
|
margin: 14px 0 28px;
|
|
|
|
|
color: var(--min-text-primary);
|
|
|
|
|
font-size: 52px;
|
|
|
|
|
line-height: 1.14;
|
|
|
|
|
font-weight: 600;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.visual-modules {
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-wrap: wrap;
|
|
|
|
|
gap: 0;
|
|
|
|
|
|
|
|
|
|
span {
|
|
|
|
|
min-width: 104px;
|
|
|
|
|
padding: 10px 14px;
|
|
|
|
|
border: 1px solid rgba(31, 41, 55, 0.28);
|
|
|
|
|
border-right: 0;
|
|
|
|
|
color: var(--min-text-regular);
|
|
|
|
|
background: rgba(255, 255, 255, 0.52);
|
|
|
|
|
font-size: 12px;
|
|
|
|
|
|
|
|
|
|
&:last-child {
|
|
|
|
|
border-right: 1px solid rgba(31, 41, 55, 0.28);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.login-access {
|
|
|
|
|
position: relative;
|
|
|
|
|
min-width: 0;
|
|
|
|
|
padding: 42px clamp(36px, 5vw, 76px);
|
|
|
|
|
border-left: 1px solid var(--min-border-light);
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
background: var(--min-bg-white);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.access-index {
|
|
|
|
|
position: absolute;
|
|
|
|
|
top: 32px;
|
|
|
|
|
right: 36px;
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
gap: 12px;
|
|
|
|
|
color: var(--min-text-secondary);
|
|
|
|
|
font-size: 9px;
|
|
|
|
|
|
|
|
|
|
strong {
|
|
|
|
|
color: var(--min-primary);
|
|
|
|
|
font-size: 11px;
|
|
|
|
|
font-weight: 600;
|
|
|
|
|
}
|
2026-07-28 16:26:07 +08:00
|
|
|
}
|
2026-08-28 10:25:05 +08:00
|
|
|
|
|
|
|
|
.form-heading {
|
|
|
|
|
margin-bottom: 40px;
|
|
|
|
|
|
|
|
|
|
span {
|
|
|
|
|
color: var(--min-primary);
|
|
|
|
|
font-size: 10px;
|
|
|
|
|
font-weight: 600;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
h2 {
|
|
|
|
|
margin: 8px 0 0;
|
|
|
|
|
color: var(--min-text-primary);
|
|
|
|
|
font-size: 28px;
|
|
|
|
|
line-height: 1.25;
|
|
|
|
|
font-weight: 600;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-07-28 16:26:07 +08:00
|
|
|
.title {
|
2026-08-27 15:40:05 +08:00
|
|
|
margin: 0 0 32px;
|
|
|
|
|
color: var(--min-text-primary);
|
|
|
|
|
font-size: 20px;
|
|
|
|
|
font-weight: 600;
|
|
|
|
|
text-align: left;
|
2026-07-28 16:26:07 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.login-form {
|
2026-08-28 10:25:05 +08:00
|
|
|
width: 100%;
|
|
|
|
|
max-width: 440px;
|
|
|
|
|
margin: 0 auto;
|
2026-07-28 16:26:07 +08:00
|
|
|
.el-input {
|
|
|
|
|
height: 40px;
|
|
|
|
|
input {
|
|
|
|
|
height: 40px;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
.input-icon {
|
|
|
|
|
height: 39px;
|
|
|
|
|
width: 14px;
|
|
|
|
|
margin-left: 0px;
|
|
|
|
|
}
|
|
|
|
|
}
|
2026-08-28 10:25:05 +08:00
|
|
|
|
|
|
|
|
.form-options {
|
|
|
|
|
min-height: 48px;
|
|
|
|
|
margin-top: 4px;
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: flex-start;
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.submit-row {
|
|
|
|
|
margin-bottom: 0;
|
|
|
|
|
|
|
|
|
|
:deep(.el-form-item__content),
|
|
|
|
|
:deep(.el-button) {
|
|
|
|
|
width: 100%;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
:deep(.el-button) {
|
|
|
|
|
height: 44px;
|
|
|
|
|
}
|
|
|
|
|
}
|
2026-07-28 16:26:07 +08:00
|
|
|
.login-tip {
|
|
|
|
|
font-size: 13px;
|
|
|
|
|
text-align: center;
|
2026-08-27 15:40:05 +08:00
|
|
|
color: var(--min-text-secondary);
|
2026-07-28 16:26:07 +08:00
|
|
|
}
|
|
|
|
|
.login-code {
|
|
|
|
|
width: 33%;
|
|
|
|
|
height: 40px;
|
|
|
|
|
float: right;
|
|
|
|
|
img {
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
vertical-align: middle;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
.el-login-footer {
|
2026-08-28 10:25:05 +08:00
|
|
|
position: absolute;
|
|
|
|
|
right: 0;
|
|
|
|
|
bottom: 24px;
|
|
|
|
|
left: 0;
|
2026-07-28 16:26:07 +08:00
|
|
|
text-align: center;
|
2026-08-27 15:40:05 +08:00
|
|
|
color: var(--min-text-secondary);
|
|
|
|
|
font-family: var(--min-font-family);
|
2026-07-28 16:26:07 +08:00
|
|
|
font-size: 12px;
|
2026-08-27 15:40:05 +08:00
|
|
|
letter-spacing: 0;
|
2026-07-28 16:26:07 +08:00
|
|
|
}
|
|
|
|
|
.login-code-img {
|
|
|
|
|
height: 40px;
|
|
|
|
|
padding-left: 12px;
|
|
|
|
|
}
|
2026-08-27 15:40:05 +08:00
|
|
|
|
|
|
|
|
@media (max-width: 520px) {
|
2026-08-28 10:25:05 +08:00
|
|
|
.login {
|
|
|
|
|
grid-template-columns: 1fr;
|
|
|
|
|
grid-template-rows: 220px minmax(0, 1fr);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.login-visual {
|
|
|
|
|
padding: 24px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.visual-brand strong,
|
|
|
|
|
.visual-modules {
|
|
|
|
|
display: none;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.visual-copy h1 {
|
|
|
|
|
margin: 8px 0 0;
|
|
|
|
|
font-size: 28px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.login-access {
|
|
|
|
|
padding: 54px 24px 48px;
|
|
|
|
|
justify-content: flex-start;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.form-heading {
|
|
|
|
|
margin-bottom: 28px;
|
|
|
|
|
|
|
|
|
|
h2 {
|
|
|
|
|
font-size: 24px;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.access-index {
|
|
|
|
|
top: 18px;
|
|
|
|
|
right: 24px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.el-login-footer {
|
|
|
|
|
position: static;
|
|
|
|
|
margin-top: auto;
|
|
|
|
|
padding-top: 24px;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@media (max-width: 900px) and (min-width: 521px) {
|
|
|
|
|
.login {
|
|
|
|
|
grid-template-columns: minmax(0, 1fr) 440px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.login-visual {
|
|
|
|
|
padding: 32px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.visual-copy h1 {
|
|
|
|
|
font-size: 36px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.visual-modules {
|
|
|
|
|
display: none;
|
2026-08-27 15:40:05 +08:00
|
|
|
}
|
|
|
|
|
}
|
2026-07-28 16:26:07 +08:00
|
|
|
</style>
|