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:
2026-04-29 00:50:19 +08:00
parent 31f1ef35b4
commit f8b918b9cd
4 changed files with 449 additions and 314 deletions
+147 -314
View File
@@ -1,72 +1,71 @@
<template>
<div class="ops-login-container">
<!-- Left Side: Visual / Brand Area -->
<div class="ops-login-visual">
<div class="visual-content">
<div class="brand-logo">
<div class="logo-icon"></div>
<span class="logo-text">省心推</span>
</div>
<h1 class="visual-title">构建下一代<br />智能内容引擎</h1>
<p class="visual-desc">
赋能创作者与运营团队提供从灵感发现到全网分发的一站式智能解决方案
</p>
<div class="page">
<div class="left" :style="{ background: `linear-gradient(135deg, ${primaryColor}e6, ${primaryColor}, ${primaryColor}cc)` }">
<div class="brand">
<div class="brand-icon"><StarOutlined :style="{ fontSize: '16px' }" /></div>
<span>省心推运营控制台</span>
</div>
<!-- Abstract Background Decorations -->
<div class="decoration-circle circle-1"></div>
<div class="decoration-circle circle-2"></div>
<div class="glass-overlay"></div>
<div class="characters-area">
<AnimatedCharacters
:is-typing="isTyping"
:has-secret="!!formState.password"
: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>
<!-- Right Side: Login Form Area -->
<div class="ops-login-form-wrapper">
<div class="ops-login-form-inner">
<div class="form-header">
<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 class="right">
<div class="form-wrapper">
<div class="mobile-brand">
<div class="brand-icon"><StarOutlined :style="{ fontSize: '16px' }" /></div>
<span>省心推运营控制台</span>
</div>
<a-form layout="vertical" :model="form" @submit.prevent="onSubmit" class="custom-form">
<a-form-item label="账号" class="custom-form-item">
<a-input
v-model:value="form.username"
placeholder="请输入管理员账号"
autocomplete="username"
size="large"
class="custom-input"
/>
</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 class="header">
<h1>欢迎回来</h1>
<p>运营管理系统 · 仅限授权人员登录</p>
</div>
<form @submit.prevent="handleSubmit" class="form">
<div class="field">
<label for="login-username">管理员账号</label>
<input id="login-username" type="text" placeholder="请输入管理员账号" v-model="formState.username"
autocomplete="off" @focus="isTyping = true" @blur="isTyping = false" required />
</div>
</a-form>
<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 class="field">
<label for="login-password">密码</label>
<div class="password-wrap">
<input id="login-password" :type="showPassword ? 'text' : 'password'"
placeholder="请输入密码" v-model="formState.password" required />
<button type="button" class="eye-btn" @click="showPassword = !showPassword">
<EyeInvisibleOutlined v-if="showPassword" />
<EyeOutlined v-else />
</button>
</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>
@@ -75,33 +74,46 @@
<script setup lang="ts">
import { reactive, ref } from "vue";
import { useRoute, useRouter } from "vue-router";
import { StarOutlined, EyeOutlined, EyeInvisibleOutlined } from "@ant-design/icons-vue";
import { OpsApiError } from "@/lib/http";
import { useAuthStore } from "@/stores/auth";
import AnimatedCharacters from "@/components/login-animation/AnimatedCharacters.vue";
const authStore = useAuthStore();
const router = useRouter();
const route = useRoute();
const auth = useAuthStore();
const form = reactive({ username: "", password: "" });
const loading = ref(false);
const primaryColor = ref('#4f46e5');
const submitting = ref(false);
const showPassword = ref(false);
const isTyping = ref(false);
const remember = ref(false);
const errorMessage = ref<string | null>(null);
async function onSubmit() {
if (loading.value) return;
const formState = reactive({
username: "",
password: "",
});
async function handleSubmit(): Promise<void> {
if (submitting.value) {
return;
}
errorMessage.value = null;
if (!form.username.trim() || !form.password) {
if (!formState.username.trim() || !formState.password) {
errorMessage.value = "请输入账号和密码";
return;
}
loading.value = true;
submitting.value = true;
try {
await auth.login(form.username.trim(), form.password);
const redirect =
typeof route.query.redirect === "string" ? route.query.redirect : "/admin-users";
void router.replace(redirect);
await authStore.login(formState.username.trim(), formState.password);
const redirect = typeof route.query.redirect === "string" ? route.query.redirect : "/admin-users";
await router.replace(redirect);
} catch (error) {
if (error instanceof OpsApiError) {
errorMessage.value = error.detail || error.message;
@@ -111,259 +123,68 @@ async function onSubmit() {
errorMessage.value = "登录失败,请稍后重试";
}
} finally {
loading.value = false;
submitting.value = false;
}
}
</script>
<style scoped>
/* =========================================================
Enterprise-Grade Split Screen Layout
========================================================= */
.ops-login-container {
display: flex;
min-height: 100vh;
.page {
display: grid;
grid-template-columns: 1fr 1fr;
min-height: 100vh;
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;
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) {
.ops-login-visual {
display: flex;
}
.left {
position: relative; display: flex; flex-direction: column; justify-content: space-between;
padding: 48px; color: white; overflow: hidden;
}
.visual-content {
position: relative;
z-index: 10;
max-width: 480px;
padding: 0 40px;
.brand { position: relative; z-index: 20; display: flex; align-items: center; gap: 8px; font-size: 18px; font-weight: 600; }
.brand-icon {
width: 32px; height: 32px; border-radius: 8px; background: rgba(255,255,255,0.1);
backdrop-filter: blur(8px); display: flex; align-items: center; justify-content: center;
}
.brand-logo {
display: flex;
align-items: center;
gap: 12px;
margin-bottom: 64px;
.characters-area { position: relative; z-index: 20; display: flex; align-items: flex-end; justify-content: center; height: 500px; transform: scale(0.95); }
.footer-links { position: relative; z-index: 20; display: flex; gap: 32px; font-size: 14px; }
.footer-links a { color: rgba(255,255,255,0.6); transition: color 0.2s; }
.footer-links a:hover { color: white; }
.deco-grid {
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;
}
.logo-icon {
width: 32px;
height: 32px;
background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
border-radius: 8px;
box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
.deco-circle { position: absolute; border-radius: 50%; filter: blur(48px); }
.deco-circle-1 { top: 25%; right: 25%; width: 256px; height: 256px; background: rgba(255,255,255,0.1); }
.deco-circle-2 { bottom: 25%; left: 25%; width: 384px; height: 384px; background: rgba(255,255,255,0.05); }
.right { display: flex; align-items: center; justify-content: center; padding: 32px; background: #fff; }
.form-wrapper { width: 100%; max-width: 420px; }
.mobile-brand { display: none; }
.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;
}
.logo-text {
font-size: 24px;
font-weight: 700;
letter-spacing: 0.5px;
.field input:focus { border-color: #4f46e5; box-shadow: 0 0 0 2px rgba(79,70,229,0.2); }
.password-wrap { position: relative; }
.password-wrap input { width: 100%; padding-right: 40px; box-sizing: border-box; }
.eye-btn {
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 {
display: flex;
align-items: center;
@@ -375,6 +196,7 @@ async function onSubmit() {
color: #b91c1c;
font-size: 14px;
font-weight: 500;
margin-top: 8px;
}
.error-icon {
@@ -382,15 +204,26 @@ async function onSubmit() {
height: 18px;
}
/* Transitions */
.fade-enter-active,
.fade-leave-active {
transition: opacity 0.3s ease, transform 0.3s ease;
}
.fade-enter-from,
.fade-leave-to {
opacity: 0;
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>