Files
37duAutomation/desktop/webhost/frontend/src/components/LoginPage.vue
T

725 lines
15 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<div class="login">
<!-- 巨大 37:节点阵列 -->
<div class="ghost" aria-hidden="true">37</div>
<!-- 基线管道:流程节点 -->
<div class="pipeline" aria-hidden="true">
<i></i><i></i><i></i>
</div>
<!-- 顶部:品牌 + 系统状态 -->
<header class="topbar">
<div class="brand">
<span class="mark">37</span>
<span class="name">{{ appName || '37du 自动化工作台' }}</span>
</div>
<div class="sys">
<span class="dot" aria-hidden="true"></span>
<span>引擎运行中</span>
</div>
</header>
<!-- 中央:接入终端 -->
<main class="panel">
<span class="core-mark">37 CORE · AUTOMATION</span>
<h1>自动化工作台</h1>
<p class="sub">使用统一账号或钉钉扫码,进入你的流程中心</p>
<el-form label-position="top" class="form" @submit.prevent="doLogin">
<el-form-item label="员工账号">
<el-input v-model="account" placeholder="请输入账号" autocomplete="username" size="large" clearable
@keyup.enter="doLogin" />
</el-form-item>
<el-form-item label="密码">
<el-input v-model="password" type="password" placeholder="请输入密码" autocomplete="current-password" size="large"
show-password @keyup.enter="doLogin" />
</el-form-item>
<el-button type="primary" size="large" class="primary" :loading="busy" @click="doLogin">
{{ busy ? '进 入 中 …' : '进 入 工 作 台' }}
</el-button>
</el-form>
<div class="divider"><span>或</span></div>
<el-button size="large" class="dingtalk" :loading="dingBusy" :icon="ChatDotRound" @click="openDing">
钉钉扫码接入
</el-button>
</main>
<!-- 底部:流程状态 -->
<footer class="footbar">
<div class="flows">
<span>接入终端就绪</span>
<span class="f-blocks" aria-hidden="true">
<i></i><i></i><i></i><i></i><i></i>
</span>
</div>
<span class="copyright">© 37du 自动化工作台</span>
</footer>
</div>
</template>
<script setup>
import { ref } from 'vue'
import { ElMessage } from 'element-plus'
import { ChatDotRound } from '@element-plus/icons-vue'
import { adminLogin, authDingtalk } from '../api'
defineProps({ appName: { type: String, default: '' } })
const emit = defineEmits(['ok'])
const account = ref('')
const password = ref('')
const busy = ref(false)
const dingBusy = ref(false)
async function doLogin() {
if (busy.value) return
if (!account.value.trim() || !password.value) { ElMessage.warning('请输入账号和密码'); return }
busy.value = true
try {
const r = await adminLogin(account.value, password.value)
ElMessage.success('登录成功')
emit('ok', {
account: account.value.trim(),
dept: r.dept || '',
must_change_pwd: !!r.must_change_pwd,
nickname: r.nickname || '',
avatar: r.avatar || ''
})
} catch (e) {
ElMessage.error('登录失败:' + (e.message || e))
} finally {
busy.value = false
}
}
// 钉钉扫码登录:壳后端直接生成授权 URL,当前窗口跳转钉钉;扫码后浏览器自动跳回 /auth/done
async function openDing() {
if (dingBusy.value) return
dingBusy.value = true
try {
const r = await authDingtalk()
if (r && r.url) {
window.location.href = r.url
return
}
ElMessage.error('钉钉登录未配置,请联系管理员')
} catch (e) {
ElMessage.error('钉钉登录不可用:' + (e.message || e))
}
dingBusy.value = false
}
</script>
<style scoped>
/* ============================================================
暖米画布 + 工程网格 + 点阵 37 + 接入终端
- 精密感来自网格与节点,不来自阴影
- 体温红只出现在:port 聚焦、主按钮、管线节点、状态点
============================================================ */
/* ---------- 画布 ---------- */
.login {
position: relative;
min-height: 100vh;
min-height: 100dvh;
box-sizing: border-box;
display: flex;
align-items: center;
justify-content: center;
padding: 110px 24px 170px;
overflow: hidden;
background: #EDE7DB;
color: #1C1712;
font-family: var(--font-body, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', sans-serif);
}
/* 工程网格:边缘径向淡出 */
.login::before {
content: '';
position: absolute;
inset: 0;
z-index: 0;
background-image:
linear-gradient(rgba(28, 23, 18, .045) 1px, transparent 1px),
linear-gradient(90deg, rgba(28, 23, 18, .045) 1px, transparent 1px);
background-size: 44px 44px;
-webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 45%, #000 20%, transparent 78%);
mask-image: radial-gradient(ellipse 70% 60% at 50% 45%, #000 20%, transparent 78%);
pointer-events: none;
}
/* 顶部暖辉光 */
.login::after {
content: '';
position: absolute;
inset: 0;
z-index: 0;
background: radial-gradient(660px 480px at 50% 38%, rgba(209, 74, 43, .06), transparent 68%);
pointer-events: none;
}
/* ---------- 巨大 37:节点阵列 ---------- */
.ghost {
position: absolute;
left: 50%;
bottom: -0.12em;
transform: translateX(-50%);
font-family: 'Helvetica Neue', 'Arial Narrow', Arial, sans-serif;
font-size: clamp(280px, 74vw, 640px);
font-weight: 800;
line-height: .72;
letter-spacing: -.08em;
white-space: nowrap;
pointer-events: none;
user-select: none;
z-index: 1;
color: rgba(28, 23, 18, .05);
/* 兜底 */
animation: breathe 7s ease-in-out infinite;
}
@keyframes breathe {
0%,
100% {
opacity: .8;
}
50% {
opacity: 1;
}
}
@supports ((-webkit-background-clip: text) or (background-clip: text)) {
.ghost {
color: transparent;
background-image: radial-gradient(circle at 1px 1px,
rgba(28, 23, 18, .16) 1px, transparent 1.9px);
background-size: 9px 9px;
-webkit-background-clip: text;
background-clip: text;
}
}
/* ---------- 基线管道 ---------- */
.pipeline {
position: absolute;
left: 50%;
bottom: 0;
transform: translateX(-50%);
width: min(920px, 92vw);
height: 1px;
background: linear-gradient(90deg,
transparent, rgba(28, 23, 18, .14) 18%,
rgba(28, 23, 18, .14) 82%, transparent);
z-index: 1;
pointer-events: none;
}
.pipeline i {
position: absolute;
top: -2px;
width: 5px;
height: 5px;
border-radius: 50%;
background: #D14A2B;
box-shadow: 0 0 0 3px rgba(209, 74, 43, .10);
}
.pipeline i:nth-child(1) {
left: 22%;
}
.pipeline i:nth-child(2) {
left: 50%;
animation: blip 3.6s ease-in-out infinite;
}
.pipeline i:nth-child(3) {
left: 78%;
}
@keyframes blip {
0%,
100% {
opacity: .35;
transform: scale(.85);
}
50% {
opacity: 1;
transform: scale(1.1);
}
}
/* ---------- 顶部栏 ---------- */
.topbar {
position: absolute;
top: 40px;
left: 48px;
right: 48px;
display: flex;
align-items: center;
justify-content: space-between;
z-index: 3;
}
.brand {
display: flex;
align-items: center;
gap: 10px;
}
.mark {
width: 28px;
height: 28px;
flex: none;
display: grid;
place-items: center;
border-radius: 8px;
background: #D14A2B;
color: #F7F2E8;
font-size: 11px;
font-weight: 800;
letter-spacing: .01em;
font-family: 'Helvetica Neue', Arial, sans-serif;
}
.name {
font-size: 12.5px;
font-weight: 500;
letter-spacing: .04em;
color: #6B6155;
}
.sys {
display: flex;
align-items: center;
gap: 8px;
font-size: 10.5px;
letter-spacing: .12em;
color: #6F6659;
}
.dot {
width: 6px;
height: 6px;
border-radius: 50%;
background: #D14A2B;
animation: pulse 2.4s ease-out infinite;
}
@keyframes pulse {
0% {
box-shadow: 0 0 0 0 rgba(209, 74, 43, .4);
}
70% {
box-shadow: 0 0 0 7px rgba(209, 74, 43, 0);
}
100% {
box-shadow: 0 0 0 0 rgba(209, 74, 43, 0);
}
}
.sep {
color: #C4BBA8;
}
/* ---------- 中央:接入终端 ---------- */
.panel {
position: relative;
z-index: 2;
width: 100%;
max-width: 360px;
padding: 40px 36px 36px;
background: #F8F4EC;
border: 1px solid #DDD4C2;
border-radius: 14px;
box-shadow:
0 1px 0 rgba(255, 255, 255, .9) inset,
0 24px 48px -28px rgba(28, 23, 18, .30);
animation: rise .45s cubic-bezier(.22, 1, .36, 1) both;
}
@keyframes rise {
from {
opacity: 0;
transform: translateY(10px);
}
to {
opacity: 1;
transform: none;
}
}
/* 卡片内元素依次点亮:终端端口逐个上电 */
@keyframes seq {
from {
opacity: 0;
transform: translateY(7px);
}
to {
opacity: 1;
transform: none;
}
}
.core-mark {
animation: seq .5s .05s both;
}
.panel h1 {
animation: seq .5s .10s both;
}
.panel .sub {
animation: seq .5s .15s both;
}
.form {
animation: seq .55s .20s both;
}
.divider {
animation: seq .5s .26s both;
}
.dingtalk {
animation: seq .5s .32s both;
}
/* 底部金手指纹理 */
.panel::after {
content: '';
position: absolute;
left: 36px;
right: 36px;
bottom: 0;
height: 3px;
background-image: repeating-linear-gradient(to right,
rgba(201, 191, 171, .65) 0 8px,
transparent 8px 12px);
pointer-events: none;
}
.core-mark {
display: block;
margin-bottom: 20px;
font-family: 'Helvetica Neue', Arial, sans-serif;
font-size: 10px;
font-weight: 700;
letter-spacing: .18em;
color: #D14A2B;
}
.panel h1 {
margin: 0 0 8px;
font-size: 26px;
font-weight: 700;
line-height: 1.2;
letter-spacing: -.01em;
color: #1C1712;
}
.panel .sub {
margin: 0 0 34px;
font-size: 13px;
line-height: 1.6;
color: #635A4D;
}
/* ---------- 表单:接口式输入 ---------- */
.form :deep(.el-form-item) {
position: relative;
padding-left: 16px;
margin-bottom: 26px;
}
.form :deep(.el-form-item__content) {
position: relative;
line-height: normal;
}
/* 左侧接口指示灯 */
.form :deep(.el-form-item__content)::before {
content: '';
position: absolute;
left: -16px;
top: 50%;
transform: translateY(-50%);
width: 6px;
height: 6px;
border-radius: 1px;
background: #C9BFAB;
transition: background .2s, box-shadow .2s;
}
.form :deep(.el-form-item:focus-within .el-form-item__content)::before {
background: #D14A2B;
box-shadow: 0 0 0 3px rgba(209, 74, 43, .12);
}
.form :deep(.el-form-item__label) {
padding-bottom: 6px;
font-size: 12px;
font-weight: 500;
letter-spacing: .02em;
line-height: 1.4;
color: #635A4D;
}
/* 底线式输入 */
.form :deep(.el-input__wrapper) {
padding: 0;
background: transparent;
border-radius: 0;
box-shadow: none !important;
border-bottom: 1px solid #D8D0BC;
transition: border-color .2s;
}
.form :deep(.el-input__wrapper:hover) {
border-bottom-color: #BCB29A;
}
.form :deep(.el-input__wrapper.is-focus) {
border-bottom-color: #D14A2B;
}
.form :deep(.el-input__inner) {
height: 44px;
padding: 0;
font-size: 15px;
color: #1C1712;
caret-color: #D14A2B;
}
.form :deep(.el-input__inner::placeholder) {
color: #9A8F7A;
}
.form :deep(.el-input__suffix),
.form :deep(.el-input__prefix),
.form :deep(.el-input__suffix-inner) {
color: #9A8F7A;
}
.form :deep(.el-input__suffix-inner .el-input__icon:hover) {
color: #635A4D;
}
/* ---------- 主按钮 ---------- */
.primary.el-button {
width: 100%;
height: 48px;
margin-top: 6px;
border: none;
border-radius: 8px;
background: #D14A2B;
color: #FFF8F2;
font-size: 14px;
font-weight: 600;
letter-spacing: .12em;
box-shadow: 0 12px 28px -14px rgba(209, 74, 43, .7);
transition: background-color .15s, opacity .15s, transform .12s ease, box-shadow .15s ease;
}
.primary.el-button:hover,
.primary.el-button:focus {
background: #BB3F21;
color: #FFF8F2;
transform: translateY(-1px);
box-shadow: 0 15px 30px -14px rgba(209, 74, 43, .78);
}
.primary.el-button:active {
background: #A53517;
transform: translateY(1px) scale(.99);
box-shadow: 0 6px 16px -12px rgba(209, 74, 43, .8);
}
.primary.el-button.is-disabled,
.primary.el-button.is-loading {
background: #D14A2B;
opacity: .55;
}
/* ---------- 分隔线 ---------- */
.divider {
display: flex;
align-items: center;
gap: 14px;
margin: 28px 0 16px;
font-size: 11.5px;
letter-spacing: .04em;
color: #8D8476;
}
.divider::before,
.divider::after {
content: '';
flex: 1;
height: 1px;
background: #E0D9C6;
}
/* ---------- 钉钉按钮 ---------- */
.dingtalk.el-button {
width: 100%;
height: 48px;
border-radius: 8px;
border: 1px solid #DED6C2;
background: #FDFBF6;
color: #1C1712;
font-size: 14px;
font-weight: 500;
letter-spacing: .02em;
transition: border-color .15s, background-color .15s, transform .12s ease, box-shadow .15s ease;
}
.dingtalk.el-button:hover,
.dingtalk.el-button:focus {
border-color: #C4BBA8;
background: #FFFFFF;
color: #1C1712;
transform: translateY(-1px);
box-shadow: 0 8px 20px -14px rgba(28, 23, 18, .28);
}
.dingtalk.el-button:active {
transform: translateY(0) scale(.99);
}
.dingtalk.el-button :deep(.el-icon) {
color: #1491F0;
}
/* ---------- 键盘可达 ---------- */
.primary.el-button:focus-visible,
.dingtalk.el-button:focus-visible {
outline: 2px solid #D14A2B;
outline-offset: 3px;
}
/* ---------- 底部:流程状态 ---------- */
.footbar {
position: absolute;
bottom: 40px;
left: 48px;
right: 48px;
display: flex;
align-items: center;
justify-content: space-between;
z-index: 3;
}
.flows {
display: flex;
align-items: center;
gap: 10px;
font-size: 10.5px;
letter-spacing: .12em;
color: #6F6659;
}
.f-blocks {
display: flex;
gap: 3px;
}
.f-blocks i {
width: 12px;
height: 4px;
border-radius: 1px;
background: #C9BEAA;
}
.copyright {
font-size: 10.5px;
letter-spacing: .1em;
color: #9A8F7C;
}
/* ---------- 自适应 ---------- */
@media (max-width: 720px) {
.login {
padding: 96px 20px 140px;
}
.topbar {
top: 24px;
left: 24px;
right: 24px;
}
.footbar {
bottom: 24px;
left: 24px;
right: 24px;
}
.panel {
padding: 32px 24px 30px;
}
.panel h1 {
font-size: 23px;
}
.panel::after {
left: 24px;
right: 24px;
}
.copyright {
display: none;
}
}
@media (max-height: 680px) {
.login {
align-items: flex-start;
overflow-x: hidden;
overflow-y: auto;
padding: 80px 24px 120px;
}
.footbar {
display: none;
}
}
@media (prefers-reduced-motion: reduce) {
.dot,
.pipeline i,
.ghost {
animation: none;
}
.panel {
animation: none;
}
.core-mark,
.panel h1,
.panel .sub,
.form,
.divider,
.dingtalk {
animation: none;
}
* {
transition-duration: .01ms !important;
}
}
</style>