style(ops-web/login): redesign login with animated mascot and brand panel
Replace the previous split-screen with a brand panel that hosts an animated mascot (eyeballs whose pupils track the focused form field and hide while the password is typed) and decorative grid/circles, plus a mobile brand mark and footer links. Swap Ant Design form controls for native inputs styled to match. The mascot is composed from new AnimatedCharacters / EyeBall / Pupil components. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,209 @@
|
|||||||
|
<template>
|
||||||
|
<div class="characters-container">
|
||||||
|
<!-- Purple -->
|
||||||
|
<div ref="purpleRef" class="char purple" :style="purpleStyle">
|
||||||
|
<div class="eyes" :style="purpleEyesStyle">
|
||||||
|
<EyeBall v-for="i in 2" :key="'p'+i" :size="18" :pupil-size="7" :max-distance="5"
|
||||||
|
eye-color="white" pupil-color="#2D2D2D" :is-blinking="isPurpleBlinking"
|
||||||
|
:force-look-x="purpleLookX" :force-look-y="purpleLookY" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- Black -->
|
||||||
|
<div ref="blackRef" class="char black" :style="blackStyle">
|
||||||
|
<div class="eyes" :style="blackEyesStyle">
|
||||||
|
<EyeBall v-for="i in 2" :key="'b'+i" :size="16" :pupil-size="6" :max-distance="4"
|
||||||
|
eye-color="white" pupil-color="#2D2D2D" :is-blinking="isBlackBlinking"
|
||||||
|
:force-look-x="blackLookX" :force-look-y="blackLookY" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- Orange -->
|
||||||
|
<div ref="orangeRef" class="char orange" :style="orangeStyle">
|
||||||
|
<div class="eyes" :style="orangeEyesStyle">
|
||||||
|
<Pupil v-for="i in 2" :key="'o'+i" :size="12" :max-distance="5" pupil-color="#2D2D2D"
|
||||||
|
:force-look-x="hiding ? -5 : undefined" :force-look-y="hiding ? -4 : undefined" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- Yellow -->
|
||||||
|
<div ref="yellowRef" class="char yellow" :style="yellowStyle">
|
||||||
|
<div class="eyes" :style="yellowEyesStyle">
|
||||||
|
<Pupil v-for="i in 2" :key="'y'+i" :size="12" :max-distance="5" pupil-color="#2D2D2D"
|
||||||
|
:force-look-x="hiding ? -5 : undefined" :force-look-y="hiding ? -4 : undefined" />
|
||||||
|
</div>
|
||||||
|
<div class="mouth" :style="yellowMouthStyle" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { ref, reactive, computed, watch, onMounted, onUnmounted } from 'vue'
|
||||||
|
import EyeBall from './EyeBall.vue'
|
||||||
|
import Pupil from './Pupil.vue'
|
||||||
|
|
||||||
|
const props = withDefaults(defineProps<{
|
||||||
|
/** Whether the user is currently typing in an input */
|
||||||
|
isTyping?: boolean
|
||||||
|
/** Whether a secret field has content */
|
||||||
|
hasSecret?: boolean
|
||||||
|
/** Whether the secret is currently visible (e.g. password shown) */
|
||||||
|
secretVisible?: boolean
|
||||||
|
}>(), {
|
||||||
|
isTyping: false,
|
||||||
|
hasSecret: false,
|
||||||
|
secretVisible: false,
|
||||||
|
})
|
||||||
|
|
||||||
|
const mouseX = ref(0)
|
||||||
|
const mouseY = ref(0)
|
||||||
|
const isPurpleBlinking = ref(false)
|
||||||
|
const isBlackBlinking = ref(false)
|
||||||
|
const isLookingAtEachOther = ref(false)
|
||||||
|
const isPurplePeeking = ref(false)
|
||||||
|
|
||||||
|
const purpleRef = ref<HTMLDivElement | null>(null)
|
||||||
|
const blackRef = ref<HTMLDivElement | null>(null)
|
||||||
|
const yellowRef = ref<HTMLDivElement | null>(null)
|
||||||
|
const orangeRef = ref<HTMLDivElement | null>(null)
|
||||||
|
|
||||||
|
const purplePos = reactive({ faceX: 0, faceY: 0, bodySkew: 0 })
|
||||||
|
const blackPos = reactive({ faceX: 0, faceY: 0, bodySkew: 0 })
|
||||||
|
const yellowPos = reactive({ faceX: 0, faceY: 0, bodySkew: 0 })
|
||||||
|
const orangePos = reactive({ faceX: 0, faceY: 0, bodySkew: 0 })
|
||||||
|
|
||||||
|
// Derived state
|
||||||
|
const hiding = computed(() => props.hasSecret && props.secretVisible)
|
||||||
|
const leaning = computed(() => props.isTyping || (props.hasSecret && !props.secretVisible))
|
||||||
|
|
||||||
|
function calcPos(el: HTMLDivElement | null, target: { faceX: number; faceY: number; bodySkew: number }) {
|
||||||
|
if (!el) return
|
||||||
|
const r = el.getBoundingClientRect()
|
||||||
|
const dx = mouseX.value - (r.left + r.width / 2)
|
||||||
|
const dy = mouseY.value - (r.top + r.height / 3)
|
||||||
|
target.faceX = Math.max(-15, Math.min(15, dx / 20))
|
||||||
|
target.faceY = Math.max(-10, Math.min(10, dy / 30))
|
||||||
|
target.bodySkew = Math.max(-6, Math.min(6, -dx / 120))
|
||||||
|
}
|
||||||
|
|
||||||
|
let rafId = 0
|
||||||
|
function tick() {
|
||||||
|
calcPos(purpleRef.value, purplePos)
|
||||||
|
calcPos(blackRef.value, blackPos)
|
||||||
|
calcPos(yellowRef.value, yellowPos)
|
||||||
|
calcPos(orangeRef.value, orangePos)
|
||||||
|
rafId = requestAnimationFrame(tick)
|
||||||
|
}
|
||||||
|
|
||||||
|
function onMouseMove(e: MouseEvent) { mouseX.value = e.clientX; mouseY.value = e.clientY }
|
||||||
|
|
||||||
|
function setupBlink(target: { value: boolean }) {
|
||||||
|
let t: number
|
||||||
|
const go = () => {
|
||||||
|
t = window.setTimeout(() => {
|
||||||
|
target.value = true
|
||||||
|
window.setTimeout(() => { target.value = false; go() }, 150)
|
||||||
|
}, Math.random() * 4000 + 3000)
|
||||||
|
}
|
||||||
|
go()
|
||||||
|
return () => clearTimeout(t)
|
||||||
|
}
|
||||||
|
|
||||||
|
let stopP: (() => void) | undefined
|
||||||
|
let stopB: (() => void) | undefined
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
window.addEventListener('mousemove', onMouseMove)
|
||||||
|
stopP = setupBlink(isPurpleBlinking)
|
||||||
|
stopB = setupBlink(isBlackBlinking)
|
||||||
|
rafId = requestAnimationFrame(tick)
|
||||||
|
})
|
||||||
|
onUnmounted(() => {
|
||||||
|
window.removeEventListener('mousemove', onMouseMove)
|
||||||
|
cancelAnimationFrame(rafId)
|
||||||
|
stopP?.(); stopB?.()
|
||||||
|
})
|
||||||
|
|
||||||
|
// Look at each other when typing starts
|
||||||
|
watch(() => props.isTyping, (v) => {
|
||||||
|
if (v) {
|
||||||
|
isLookingAtEachOther.value = true
|
||||||
|
setTimeout(() => { isLookingAtEachOther.value = false }, 800)
|
||||||
|
} else {
|
||||||
|
isLookingAtEachOther.value = false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
// Purple peeks when secret is visible
|
||||||
|
let peekT: number | undefined
|
||||||
|
watch([() => props.hasSecret, () => props.secretVisible, isPurplePeeking], () => {
|
||||||
|
clearTimeout(peekT)
|
||||||
|
if (props.hasSecret && props.secretVisible) {
|
||||||
|
peekT = window.setTimeout(() => {
|
||||||
|
isPurplePeeking.value = true
|
||||||
|
setTimeout(() => { isPurplePeeking.value = false }, 800)
|
||||||
|
}, Math.random() * 3000 + 2000)
|
||||||
|
} else {
|
||||||
|
isPurplePeeking.value = false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
// Computed styles
|
||||||
|
const purpleStyle = computed(() => ({
|
||||||
|
height: leaning.value ? '440px' : '400px',
|
||||||
|
transform: hiding.value ? 'skewX(0deg)'
|
||||||
|
: leaning.value ? `skewX(${purplePos.bodySkew - 12}deg) translateX(40px)`
|
||||||
|
: `skewX(${purplePos.bodySkew}deg)`,
|
||||||
|
}))
|
||||||
|
const purpleEyesStyle = computed(() => ({
|
||||||
|
left: hiding.value ? '20px' : isLookingAtEachOther.value ? '55px' : `${45 + purplePos.faceX}px`,
|
||||||
|
top: hiding.value ? '35px' : isLookingAtEachOther.value ? '65px' : `${40 + purplePos.faceY}px`,
|
||||||
|
gap: '32px',
|
||||||
|
}))
|
||||||
|
const purpleLookX = computed(() => hiding.value ? (isPurplePeeking.value ? 4 : -4) : isLookingAtEachOther.value ? 3 : undefined)
|
||||||
|
const purpleLookY = computed(() => hiding.value ? (isPurplePeeking.value ? 5 : -4) : isLookingAtEachOther.value ? 4 : undefined)
|
||||||
|
|
||||||
|
const blackStyle = computed(() => ({
|
||||||
|
transform: hiding.value ? 'skewX(0deg)'
|
||||||
|
: isLookingAtEachOther.value ? `skewX(${blackPos.bodySkew * 1.5 + 10}deg) translateX(20px)`
|
||||||
|
: leaning.value ? `skewX(${blackPos.bodySkew * 1.5}deg)`
|
||||||
|
: `skewX(${blackPos.bodySkew}deg)`,
|
||||||
|
}))
|
||||||
|
const blackEyesStyle = computed(() => ({
|
||||||
|
left: hiding.value ? '10px' : isLookingAtEachOther.value ? '32px' : `${26 + blackPos.faceX}px`,
|
||||||
|
top: hiding.value ? '28px' : isLookingAtEachOther.value ? '12px' : `${32 + blackPos.faceY}px`,
|
||||||
|
gap: '24px',
|
||||||
|
}))
|
||||||
|
const blackLookX = computed(() => hiding.value ? -4 : isLookingAtEachOther.value ? 0 : undefined)
|
||||||
|
const blackLookY = computed(() => hiding.value ? -4 : isLookingAtEachOther.value ? -4 : undefined)
|
||||||
|
|
||||||
|
const orangeStyle = computed(() => ({
|
||||||
|
transform: hiding.value ? 'skewX(0deg)' : `skewX(${orangePos.bodySkew}deg)`,
|
||||||
|
}))
|
||||||
|
const orangeEyesStyle = computed(() => ({
|
||||||
|
left: hiding.value ? '50px' : `${82 + orangePos.faceX}px`,
|
||||||
|
top: hiding.value ? '85px' : `${90 + orangePos.faceY}px`,
|
||||||
|
gap: '32px',
|
||||||
|
}))
|
||||||
|
|
||||||
|
const yellowStyle = computed(() => ({
|
||||||
|
transform: hiding.value ? 'skewX(0deg)' : `skewX(${yellowPos.bodySkew}deg)`,
|
||||||
|
}))
|
||||||
|
const yellowEyesStyle = computed(() => ({
|
||||||
|
left: hiding.value ? '20px' : `${52 + yellowPos.faceX}px`,
|
||||||
|
top: hiding.value ? '35px' : `${40 + yellowPos.faceY}px`,
|
||||||
|
gap: '24px',
|
||||||
|
}))
|
||||||
|
const yellowMouthStyle = computed(() => ({
|
||||||
|
left: hiding.value ? '10px' : `${40 + yellowPos.faceX}px`,
|
||||||
|
top: hiding.value ? '88px' : `${88 + yellowPos.faceY}px`,
|
||||||
|
}))
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.characters-container { position: relative; width: 550px; height: 400px; }
|
||||||
|
.char { position: absolute; bottom: 0; transition: all 0.7s ease-in-out; transform-origin: bottom center; }
|
||||||
|
.purple { left: 70px; width: 180px; background: #6C3FF5; border-radius: 10px 10px 0 0; z-index: 1; }
|
||||||
|
.black { left: 240px; width: 120px; height: 310px; background: #2D2D2D; border-radius: 8px 8px 0 0; z-index: 2; }
|
||||||
|
.orange { left: 0; width: 240px; height: 200px; background: #FF9B6B; border-radius: 120px 120px 0 0; z-index: 3; }
|
||||||
|
.yellow { left: 310px; width: 140px; height: 230px; background: #E8D754; border-radius: 70px 70px 0 0; z-index: 4; }
|
||||||
|
.eyes { position: absolute; display: flex; transition: all 0.7s ease-in-out; }
|
||||||
|
.mouth { position: absolute; width: 80px; height: 4px; background: #2D2D2D; border-radius: 4px; transition: all 0.2s ease-out; }
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,55 @@
|
|||||||
|
<template>
|
||||||
|
<div ref="eyeRef" class="eyeball" :style="{
|
||||||
|
width: size + 'px', height: isBlinking ? '2px' : size + 'px',
|
||||||
|
backgroundColor: eyeColor,
|
||||||
|
}">
|
||||||
|
<div v-if="!isBlinking" class="pupil-inner" :style="{
|
||||||
|
width: pupilSize + 'px', height: pupilSize + 'px',
|
||||||
|
backgroundColor: pupilColor,
|
||||||
|
transform: `translate(${pos.x}px, ${pos.y}px)`,
|
||||||
|
}" />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { ref, computed, onMounted, onUnmounted } from 'vue'
|
||||||
|
|
||||||
|
const props = withDefaults(defineProps<{
|
||||||
|
size?: number; pupilSize?: number; maxDistance?: number
|
||||||
|
eyeColor?: string; pupilColor?: string; isBlinking?: boolean
|
||||||
|
forceLookX?: number; forceLookY?: number
|
||||||
|
}>(), { size: 48, pupilSize: 16, maxDistance: 10, eyeColor: 'white', pupilColor: 'black', isBlinking: false })
|
||||||
|
|
||||||
|
const mx = ref(0), my = ref(0)
|
||||||
|
const eyeRef = ref<HTMLDivElement>()
|
||||||
|
const onMove = (e: MouseEvent) => { mx.value = e.clientX; my.value = e.clientY }
|
||||||
|
onMounted(() => window.addEventListener('mousemove', onMove))
|
||||||
|
onUnmounted(() => window.removeEventListener('mousemove', onMove))
|
||||||
|
|
||||||
|
const pos = computed(() => {
|
||||||
|
if (!eyeRef.value) return { x: 0, y: 0 }
|
||||||
|
if (props.forceLookX !== undefined && props.forceLookY !== undefined)
|
||||||
|
return { x: props.forceLookX, y: props.forceLookY }
|
||||||
|
const r = eyeRef.value.getBoundingClientRect()
|
||||||
|
const dx = mx.value - (r.left + r.width / 2)
|
||||||
|
const dy = my.value - (r.top + r.height / 2)
|
||||||
|
const d = Math.min(Math.sqrt(dx ** 2 + dy ** 2), props.maxDistance)
|
||||||
|
const a = Math.atan2(dy, dx)
|
||||||
|
return { x: Math.cos(a) * d, y: Math.sin(a) * d }
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.eyeball {
|
||||||
|
border-radius: 50%;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
transition: all 0.15s;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
.pupil-inner {
|
||||||
|
border-radius: 50%;
|
||||||
|
transition: transform 0.1s ease-out;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
<template>
|
||||||
|
<div ref="pupilRef" class="pupil" :style="{
|
||||||
|
width: size + 'px', height: size + 'px',
|
||||||
|
backgroundColor: pupilColor,
|
||||||
|
transform: `translate(${pos.x}px, ${pos.y}px)`,
|
||||||
|
}" />
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { ref, computed, onMounted, onUnmounted } from 'vue'
|
||||||
|
|
||||||
|
const props = withDefaults(defineProps<{
|
||||||
|
size?: number; maxDistance?: number; pupilColor?: string
|
||||||
|
forceLookX?: number; forceLookY?: number
|
||||||
|
}>(), { size: 12, maxDistance: 5, pupilColor: 'black' })
|
||||||
|
|
||||||
|
const mx = ref(0), my = ref(0)
|
||||||
|
const pupilRef = ref<HTMLDivElement>()
|
||||||
|
const onMove = (e: MouseEvent) => { mx.value = e.clientX; my.value = e.clientY }
|
||||||
|
onMounted(() => window.addEventListener('mousemove', onMove))
|
||||||
|
onUnmounted(() => window.removeEventListener('mousemove', onMove))
|
||||||
|
|
||||||
|
const pos = computed(() => {
|
||||||
|
if (!pupilRef.value) return { x: 0, y: 0 }
|
||||||
|
if (props.forceLookX !== undefined && props.forceLookY !== undefined)
|
||||||
|
return { x: props.forceLookX, y: props.forceLookY }
|
||||||
|
const r = pupilRef.value.getBoundingClientRect()
|
||||||
|
const dx = mx.value - (r.left + r.width / 2)
|
||||||
|
const dy = my.value - (r.top + r.height / 2)
|
||||||
|
const d = Math.min(Math.sqrt(dx ** 2 + dy ** 2), props.maxDistance)
|
||||||
|
const a = Math.atan2(dy, dx)
|
||||||
|
return { x: Math.cos(a) * d, y: Math.sin(a) * d }
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.pupil { border-radius: 50%; transition: transform 0.1s ease-out; }
|
||||||
|
</style>
|
||||||
@@ -1,72 +1,71 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="ops-login-container">
|
<div class="page">
|
||||||
<!-- Left Side: Visual / Brand Area -->
|
<div class="left" :style="{ background: `linear-gradient(135deg, ${primaryColor}e6, ${primaryColor}, ${primaryColor}cc)` }">
|
||||||
<div class="ops-login-visual">
|
<div class="brand">
|
||||||
<div class="visual-content">
|
<div class="brand-icon"><StarOutlined :style="{ fontSize: '16px' }" /></div>
|
||||||
<div class="brand-logo">
|
<span>省心推运营控制台</span>
|
||||||
<div class="logo-icon"></div>
|
|
||||||
<span class="logo-text">省心推</span>
|
|
||||||
</div>
|
|
||||||
<h1 class="visual-title">构建下一代<br />智能内容引擎</h1>
|
|
||||||
<p class="visual-desc">
|
|
||||||
赋能创作者与运营团队,提供从灵感发现到全网分发的一站式智能解决方案。
|
|
||||||
</p>
|
|
||||||
</div>
|
</div>
|
||||||
|
<div class="characters-area">
|
||||||
<!-- Abstract Background Decorations -->
|
<AnimatedCharacters
|
||||||
<div class="decoration-circle circle-1"></div>
|
:is-typing="isTyping"
|
||||||
<div class="decoration-circle circle-2"></div>
|
:has-secret="!!formState.password"
|
||||||
<div class="glass-overlay"></div>
|
:secret-visible="showPassword"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div class="footer-links">
|
||||||
|
<a href="#">隐私政策</a>
|
||||||
|
<a href="#">服务条款</a>
|
||||||
|
<a href="#">联系我们</a>
|
||||||
|
</div>
|
||||||
|
<div class="deco-grid" />
|
||||||
|
<div class="deco-circle deco-circle-1" />
|
||||||
|
<div class="deco-circle deco-circle-2" />
|
||||||
</div>
|
</div>
|
||||||
|
<div class="right">
|
||||||
<!-- Right Side: Login Form Area -->
|
<div class="form-wrapper">
|
||||||
<div class="ops-login-form-wrapper">
|
<div class="mobile-brand">
|
||||||
<div class="ops-login-form-inner">
|
<div class="brand-icon"><StarOutlined :style="{ fontSize: '16px' }" /></div>
|
||||||
<div class="form-header">
|
<span>省心推运营控制台</span>
|
||||||
<div class="mobile-logo">
|
|
||||||
<div class="logo-icon"></div>
|
|
||||||
<span class="logo-text">省心推</span>
|
|
||||||
</div>
|
|
||||||
<h2 class="form-title">欢迎回来</h2>
|
|
||||||
<p class="form-sub">运营管理控制台 · 仅限授权人员登录</p>
|
|
||||||
</div>
|
</div>
|
||||||
|
<div class="header">
|
||||||
<a-form layout="vertical" :model="form" @submit.prevent="onSubmit" class="custom-form">
|
<h1>欢迎回来</h1>
|
||||||
<a-form-item label="账号" class="custom-form-item">
|
<p>运营管理系统 · 仅限授权人员登录</p>
|
||||||
<a-input
|
</div>
|
||||||
v-model:value="form.username"
|
<form @submit.prevent="handleSubmit" class="form">
|
||||||
placeholder="请输入管理员账号"
|
<div class="field">
|
||||||
autocomplete="username"
|
<label for="login-username">管理员账号</label>
|
||||||
size="large"
|
<input id="login-username" type="text" placeholder="请输入管理员账号" v-model="formState.username"
|
||||||
class="custom-input"
|
autocomplete="off" @focus="isTyping = true" @blur="isTyping = false" required />
|
||||||
/>
|
|
||||||
</a-form-item>
|
|
||||||
|
|
||||||
<a-form-item label="密码" class="custom-form-item">
|
|
||||||
<a-input-password
|
|
||||||
v-model:value="form.password"
|
|
||||||
placeholder="请输入密码"
|
|
||||||
autocomplete="current-password"
|
|
||||||
size="large"
|
|
||||||
class="custom-input"
|
|
||||||
/>
|
|
||||||
</a-form-item>
|
|
||||||
|
|
||||||
<div class="form-actions">
|
|
||||||
<a-button type="primary" html-type="submit" block size="large" :loading="loading" class="submit-btn">
|
|
||||||
登录系统
|
|
||||||
</a-button>
|
|
||||||
</div>
|
</div>
|
||||||
</a-form>
|
<div class="field">
|
||||||
|
<label for="login-password">密码</label>
|
||||||
<transition name="fade">
|
<div class="password-wrap">
|
||||||
<div v-if="errorMessage" class="error-message">
|
<input id="login-password" :type="showPassword ? 'text' : 'password'"
|
||||||
<svg class="error-icon" viewBox="0 0 20 20" fill="currentColor">
|
placeholder="请输入密码" v-model="formState.password" required />
|
||||||
<path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7 4a1 1 0 11-2 0 1 1 0 012 0zm-1-9a1 1 0 00-1 1v4a1 1 0 102 0V6a1 1 0 00-1-1z" clip-rule="evenodd" />
|
<button type="button" class="eye-btn" @click="showPassword = !showPassword">
|
||||||
</svg>
|
<EyeInvisibleOutlined v-if="showPassword" />
|
||||||
{{ errorMessage }}
|
<EyeOutlined v-else />
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</transition>
|
<div class="options">
|
||||||
|
<label class="remember"><input type="checkbox" v-model="remember" /> 记住登录状态</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<transition name="fade">
|
||||||
|
<div v-if="errorMessage" class="error-message">
|
||||||
|
<svg class="error-icon" viewBox="0 0 20 20" fill="currentColor">
|
||||||
|
<path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7 4a1 1 0 11-2 0 1 1 0 012 0zm-1-9a1 1 0 00-1 1v4a1 1 0 102 0V6a1 1 0 00-1-1z" clip-rule="evenodd" />
|
||||||
|
</svg>
|
||||||
|
{{ errorMessage }}
|
||||||
|
</div>
|
||||||
|
</transition>
|
||||||
|
|
||||||
|
<button type="submit" class="btn-primary" :disabled="submitting"
|
||||||
|
:style="{ background: primaryColor }">
|
||||||
|
{{ submitting ? '登录中...' : '登录系统' }}
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -75,33 +74,46 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { reactive, ref } from "vue";
|
import { reactive, ref } from "vue";
|
||||||
import { useRoute, useRouter } from "vue-router";
|
import { useRoute, useRouter } from "vue-router";
|
||||||
|
import { StarOutlined, EyeOutlined, EyeInvisibleOutlined } from "@ant-design/icons-vue";
|
||||||
|
|
||||||
import { OpsApiError } from "@/lib/http";
|
import { OpsApiError } from "@/lib/http";
|
||||||
import { useAuthStore } from "@/stores/auth";
|
import { useAuthStore } from "@/stores/auth";
|
||||||
|
import AnimatedCharacters from "@/components/login-animation/AnimatedCharacters.vue";
|
||||||
|
|
||||||
|
const authStore = useAuthStore();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const auth = useAuthStore();
|
|
||||||
|
|
||||||
const form = reactive({ username: "", password: "" });
|
const primaryColor = ref('#4f46e5');
|
||||||
const loading = ref(false);
|
|
||||||
|
const submitting = ref(false);
|
||||||
|
const showPassword = ref(false);
|
||||||
|
const isTyping = ref(false);
|
||||||
|
const remember = ref(false);
|
||||||
const errorMessage = ref<string | null>(null);
|
const errorMessage = ref<string | null>(null);
|
||||||
|
|
||||||
async function onSubmit() {
|
const formState = reactive({
|
||||||
if (loading.value) return;
|
username: "",
|
||||||
|
password: "",
|
||||||
|
});
|
||||||
|
|
||||||
|
async function handleSubmit(): Promise<void> {
|
||||||
|
if (submitting.value) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
errorMessage.value = null;
|
errorMessage.value = null;
|
||||||
|
|
||||||
if (!form.username.trim() || !form.password) {
|
if (!formState.username.trim() || !formState.password) {
|
||||||
errorMessage.value = "请输入账号和密码";
|
errorMessage.value = "请输入账号和密码";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
loading.value = true;
|
submitting.value = true;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await auth.login(form.username.trim(), form.password);
|
await authStore.login(formState.username.trim(), formState.password);
|
||||||
const redirect =
|
const redirect = typeof route.query.redirect === "string" ? route.query.redirect : "/admin-users";
|
||||||
typeof route.query.redirect === "string" ? route.query.redirect : "/admin-users";
|
await router.replace(redirect);
|
||||||
void router.replace(redirect);
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (error instanceof OpsApiError) {
|
if (error instanceof OpsApiError) {
|
||||||
errorMessage.value = error.detail || error.message;
|
errorMessage.value = error.detail || error.message;
|
||||||
@@ -111,259 +123,68 @@ async function onSubmit() {
|
|||||||
errorMessage.value = "登录失败,请稍后重试";
|
errorMessage.value = "登录失败,请稍后重试";
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
loading.value = false;
|
submitting.value = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
/* =========================================================
|
.page {
|
||||||
Enterprise-Grade Split Screen Layout
|
display: grid;
|
||||||
========================================================= */
|
grid-template-columns: 1fr 1fr;
|
||||||
|
min-height: 100vh;
|
||||||
.ops-login-container {
|
|
||||||
display: flex;
|
|
||||||
min-height: 100vh;
|
|
||||||
width: 100%;
|
width: 100%;
|
||||||
background-color: #ffffff;
|
|
||||||
font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* --- Left Side: Visual Branding --- */
|
|
||||||
.ops-login-visual {
|
|
||||||
flex: 1;
|
flex: 1;
|
||||||
position: relative;
|
|
||||||
background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%);
|
|
||||||
color: #ffffff;
|
|
||||||
display: none;
|
|
||||||
overflow: hidden;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (min-width: 1024px) {
|
.left {
|
||||||
.ops-login-visual {
|
position: relative; display: flex; flex-direction: column; justify-content: space-between;
|
||||||
display: flex;
|
padding: 48px; color: white; overflow: hidden;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
.brand { position: relative; z-index: 20; display: flex; align-items: center; gap: 8px; font-size: 18px; font-weight: 600; }
|
||||||
.visual-content {
|
.brand-icon {
|
||||||
position: relative;
|
width: 32px; height: 32px; border-radius: 8px; background: rgba(255,255,255,0.1);
|
||||||
z-index: 10;
|
backdrop-filter: blur(8px); display: flex; align-items: center; justify-content: center;
|
||||||
max-width: 480px;
|
|
||||||
padding: 0 40px;
|
|
||||||
}
|
}
|
||||||
|
.characters-area { position: relative; z-index: 20; display: flex; align-items: flex-end; justify-content: center; height: 500px; transform: scale(0.95); }
|
||||||
.brand-logo {
|
.footer-links { position: relative; z-index: 20; display: flex; gap: 32px; font-size: 14px; }
|
||||||
display: flex;
|
.footer-links a { color: rgba(255,255,255,0.6); transition: color 0.2s; }
|
||||||
align-items: center;
|
.footer-links a:hover { color: white; }
|
||||||
gap: 12px;
|
.deco-grid {
|
||||||
margin-bottom: 64px;
|
position: absolute; inset: 0;
|
||||||
|
background-image: linear-gradient(to right, rgba(255,255,255,0.05) 1px, transparent 1px),
|
||||||
|
linear-gradient(to bottom, rgba(255,255,255,0.05) 1px, transparent 1px);
|
||||||
|
background-size: 20px 20px;
|
||||||
}
|
}
|
||||||
|
.deco-circle { position: absolute; border-radius: 50%; filter: blur(48px); }
|
||||||
.logo-icon {
|
.deco-circle-1 { top: 25%; right: 25%; width: 256px; height: 256px; background: rgba(255,255,255,0.1); }
|
||||||
width: 32px;
|
.deco-circle-2 { bottom: 25%; left: 25%; width: 384px; height: 384px; background: rgba(255,255,255,0.05); }
|
||||||
height: 32px;
|
.right { display: flex; align-items: center; justify-content: center; padding: 32px; background: #fff; }
|
||||||
background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
|
.form-wrapper { width: 100%; max-width: 420px; }
|
||||||
border-radius: 8px;
|
.mobile-brand { display: none; }
|
||||||
box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
|
.header { text-align: left; margin-bottom: 40px; }
|
||||||
|
.header h1 { font-size: 30px; font-weight: 700; letter-spacing: -0.5px; margin-bottom: 8px; color: #18181b; }
|
||||||
|
.header p { color: #71717a; font-size: 14px; margin: 0; }
|
||||||
|
.form { display: flex; flex-direction: column; gap: 20px; margin-bottom: 32px; }
|
||||||
|
.field { display: flex; flex-direction: column; gap: 8px; }
|
||||||
|
.field label { font-size: 14px; font-weight: 500; color: #18181b; }
|
||||||
|
.field input {
|
||||||
|
height: 48px; padding: 0 12px; border-radius: 6px; border: 1px solid #d4d4d8;
|
||||||
|
font-size: 14px; outline: none; background: #fff; transition: border-color 0.2s; color: #18181b;
|
||||||
}
|
}
|
||||||
|
.field input:focus { border-color: #4f46e5; box-shadow: 0 0 0 2px rgba(79,70,229,0.2); }
|
||||||
.logo-text {
|
.password-wrap { position: relative; }
|
||||||
font-size: 24px;
|
.password-wrap input { width: 100%; padding-right: 40px; box-sizing: border-box; }
|
||||||
font-weight: 700;
|
.eye-btn {
|
||||||
letter-spacing: 0.5px;
|
position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
|
||||||
|
background: none; border: none; color: #a1a1aa; transition: color 0.2s;
|
||||||
|
display: flex; align-items: center; justify-content: center; font-size: 18px; cursor: pointer;
|
||||||
}
|
}
|
||||||
|
.eye-btn:hover { color: #3f3f46; }
|
||||||
|
.options { display: flex; align-items: center; justify-content: space-between; font-size: 14px; }
|
||||||
|
.remember { display: flex; align-items: center; gap: 8px; cursor: pointer; color: #18181b; }
|
||||||
|
.remember input { width: 16px; height: 16px; accent-color: #4f46e5; cursor: pointer; }
|
||||||
|
|
||||||
.visual-title {
|
|
||||||
font-size: 48px;
|
|
||||||
font-weight: 800;
|
|
||||||
line-height: 1.2;
|
|
||||||
margin-bottom: 24px;
|
|
||||||
background: linear-gradient(to right, #ffffff, #a5b4fc);
|
|
||||||
-webkit-background-clip: text;
|
|
||||||
-webkit-text-fill-color: transparent;
|
|
||||||
}
|
|
||||||
|
|
||||||
.visual-desc {
|
|
||||||
font-size: 18px;
|
|
||||||
line-height: 1.6;
|
|
||||||
color: #94a3b8;
|
|
||||||
font-weight: 400;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Abstract Background Shapes */
|
|
||||||
.decoration-circle {
|
|
||||||
position: absolute;
|
|
||||||
border-radius: 50%;
|
|
||||||
filter: blur(80px);
|
|
||||||
z-index: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.circle-1 {
|
|
||||||
width: 500px;
|
|
||||||
height: 500px;
|
|
||||||
background-color: rgba(99, 102, 241, 0.25);
|
|
||||||
top: -100px;
|
|
||||||
left: -100px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.circle-2 {
|
|
||||||
width: 600px;
|
|
||||||
height: 600px;
|
|
||||||
background-color: rgba(139, 92, 246, 0.2);
|
|
||||||
bottom: -200px;
|
|
||||||
right: -100px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.glass-overlay {
|
|
||||||
position: absolute;
|
|
||||||
inset: 0;
|
|
||||||
background: radial-gradient(circle at 50% 50%, rgba(15, 23, 42, 0) 0%, rgba(15, 23, 42, 0.4) 100%);
|
|
||||||
z-index: 2;
|
|
||||||
pointer-events: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* --- Right Side: Login Form --- */
|
|
||||||
.ops-login-form-wrapper {
|
|
||||||
flex: 1;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
padding: 32px;
|
|
||||||
background-color: #ffffff;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (min-width: 1024px) {
|
|
||||||
.ops-login-form-wrapper {
|
|
||||||
flex: 0 0 520px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (min-width: 1280px) {
|
|
||||||
.ops-login-form-wrapper {
|
|
||||||
flex: 0 0 640px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.ops-login-form-inner {
|
|
||||||
width: 100%;
|
|
||||||
max-width: 400px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Mobile Logo (only visible when visual side is hidden) */
|
|
||||||
.mobile-logo {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 10px;
|
|
||||||
margin-bottom: 48px;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (min-width: 1024px) {
|
|
||||||
.mobile-logo {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.mobile-logo .logo-icon {
|
|
||||||
width: 28px;
|
|
||||||
height: 28px;
|
|
||||||
box-shadow: 0 4px 10px rgba(99, 102, 241, 0.2);
|
|
||||||
}
|
|
||||||
|
|
||||||
.mobile-logo .logo-text {
|
|
||||||
font-size: 20px;
|
|
||||||
color: #0f172a;
|
|
||||||
}
|
|
||||||
|
|
||||||
.form-header {
|
|
||||||
margin-bottom: 40px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.form-title {
|
|
||||||
font-size: 32px;
|
|
||||||
font-weight: 700;
|
|
||||||
color: #0f172a;
|
|
||||||
margin-bottom: 8px;
|
|
||||||
letter-spacing: -0.5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.form-sub {
|
|
||||||
font-size: 15px;
|
|
||||||
color: #64748b;
|
|
||||||
font-weight: 400;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Custom Ant Design Form Overrides */
|
|
||||||
.custom-form {
|
|
||||||
margin-bottom: 24px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.custom-form-item {
|
|
||||||
margin-bottom: 24px;
|
|
||||||
}
|
|
||||||
|
|
||||||
:deep(.custom-form-item .ant-form-item-label > label) {
|
|
||||||
font-size: 14px;
|
|
||||||
font-weight: 500;
|
|
||||||
color: #334155;
|
|
||||||
height: auto;
|
|
||||||
margin-bottom: 6px;
|
|
||||||
}
|
|
||||||
|
|
||||||
:deep(.custom-input) {
|
|
||||||
border-radius: 8px;
|
|
||||||
border: 1px solid #e2e8f0;
|
|
||||||
padding: 10px 14px;
|
|
||||||
font-size: 15px;
|
|
||||||
box-shadow: 0 1px 2px rgba(15, 23, 42, 0.02);
|
|
||||||
transition: all 0.2s ease;
|
|
||||||
}
|
|
||||||
|
|
||||||
:deep(.custom-input:hover) {
|
|
||||||
border-color: #cbd5e1;
|
|
||||||
}
|
|
||||||
|
|
||||||
:deep(.custom-input:focus), :deep(.custom-input-focused) {
|
|
||||||
border-color: #6366f1;
|
|
||||||
box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
|
|
||||||
}
|
|
||||||
|
|
||||||
:deep(.ant-input-password-icon) {
|
|
||||||
color: #94a3b8;
|
|
||||||
}
|
|
||||||
|
|
||||||
:deep(.ant-input-password-icon:hover) {
|
|
||||||
color: #6366f1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.form-actions {
|
|
||||||
margin-top: 32px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.submit-btn {
|
|
||||||
height: 48px;
|
|
||||||
border-radius: 8px;
|
|
||||||
font-size: 16px;
|
|
||||||
font-weight: 600;
|
|
||||||
background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
|
|
||||||
border: none;
|
|
||||||
box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
|
|
||||||
transition: all 0.3s ease;
|
|
||||||
}
|
|
||||||
|
|
||||||
.submit-btn:hover {
|
|
||||||
transform: translateY(-1px);
|
|
||||||
box-shadow: 0 6px 16px rgba(79, 70, 229, 0.35);
|
|
||||||
background: linear-gradient(135deg, #4338ca 0%, #4f46e5 100%);
|
|
||||||
}
|
|
||||||
|
|
||||||
.submit-btn:active {
|
|
||||||
transform: translateY(1px);
|
|
||||||
box-shadow: 0 2px 8px rgba(79, 70, 229, 0.25);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Error Message Styling */
|
|
||||||
.error-message {
|
.error-message {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
@@ -375,6 +196,7 @@ async function onSubmit() {
|
|||||||
color: #b91c1c;
|
color: #b91c1c;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
|
margin-top: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.error-icon {
|
.error-icon {
|
||||||
@@ -382,15 +204,26 @@ async function onSubmit() {
|
|||||||
height: 18px;
|
height: 18px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Transitions */
|
|
||||||
.fade-enter-active,
|
.fade-enter-active,
|
||||||
.fade-leave-active {
|
.fade-leave-active {
|
||||||
transition: opacity 0.3s ease, transform 0.3s ease;
|
transition: opacity 0.3s ease, transform 0.3s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
.fade-enter-from,
|
.fade-enter-from,
|
||||||
.fade-leave-to {
|
.fade-leave-to {
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
transform: translateY(-10px);
|
transform: translateY(-10px);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.btn-primary {
|
||||||
|
width: 100%; height: 48px; font-size: 16px; font-weight: 500; border: none; border-radius: 6px;
|
||||||
|
color: white; transition: opacity 0.2s; cursor: pointer; margin-top: 12px;
|
||||||
|
}
|
||||||
|
.btn-primary:hover { opacity: 0.9; }
|
||||||
|
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
|
||||||
|
|
||||||
|
@media (max-width: 1023px) {
|
||||||
|
.page { grid-template-columns: 1fr; }
|
||||||
|
.left { display: none; }
|
||||||
|
.mobile-brand { display: flex; align-items: center; justify-content: flex-start; gap: 8px; font-size: 18px; font-weight: 600; margin-bottom: 48px; color: #18181b; }
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user