UI改版测试V0
This commit is contained in:
@@ -3,155 +3,271 @@
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>登录 - A-BOT管理后台</title>
|
||||
<!-- 添加favicon -->
|
||||
<title>登录 - A-BOT 管理后台</title>
|
||||
<link rel="icon" href="/static/favicon.ico" type="image/x-icon">
|
||||
<link rel="shortcut icon" href="/static/favicon.ico" type="image/x-icon">
|
||||
<!-- Element UI CSS -->
|
||||
<link rel="stylesheet" href="/static/css/element-ui/theme-chalk/index.min.css">
|
||||
<!-- 图表库 -->
|
||||
<script src="/static/js/chart.js"></script>
|
||||
<!-- Vue.js -->
|
||||
<script src="/static/js/vue.js"></script>
|
||||
<!-- Element UI JS -->
|
||||
<script src="/static/js/element-ui/index.min.js"></script>
|
||||
<!-- Axios -->
|
||||
<script src="/static/js/axios.min.js"></script>
|
||||
<style>
|
||||
:root {
|
||||
--bg: #f4f7fb;
|
||||
--text: #0f172a;
|
||||
--text-soft: #64748b;
|
||||
--border: rgba(148, 163, 184, 0.18);
|
||||
--primary: #4f46e5;
|
||||
--primary-2: #6366f1;
|
||||
--danger: #ef4444;
|
||||
--shadow: 0 24px 48px rgba(15, 23, 42, 0.10);
|
||||
}
|
||||
* { box-sizing: border-box; }
|
||||
html, body { height: 100%; }
|
||||
body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", Arial, sans-serif;
|
||||
background: #fdfcfb;
|
||||
height: 100vh;
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", Arial, sans-serif;
|
||||
color: var(--text);
|
||||
background:
|
||||
radial-gradient(circle at top left, rgba(99, 102, 241, 0.14), transparent 30%),
|
||||
radial-gradient(circle at bottom right, rgba(59, 130, 246, 0.10), transparent 26%),
|
||||
linear-gradient(180deg, #f8fafc 0%, #f3f6fb 100%);
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
overflow: hidden;
|
||||
}
|
||||
.login-container {
|
||||
width: 400px;
|
||||
padding: 40px 36px 32px 36px;
|
||||
background-color: #ffffff;
|
||||
border: 1px solid #e5e0d9;
|
||||
border-radius: 12px;
|
||||
box-shadow: 0 12px 24px rgba(17, 24, 39, 0.08);
|
||||
.login-shell {
|
||||
width: min(1120px, calc(100vw - 48px));
|
||||
min-height: 680px;
|
||||
display: grid;
|
||||
grid-template-columns: 1.1fr 0.9fr;
|
||||
border-radius: 32px;
|
||||
overflow: hidden;
|
||||
background: rgba(255,255,255,0.72);
|
||||
border: 1px solid rgba(148,163,184,0.14);
|
||||
backdrop-filter: blur(18px);
|
||||
-webkit-backdrop-filter: blur(18px);
|
||||
box-shadow: var(--shadow);
|
||||
}
|
||||
.login-showcase {
|
||||
padding: 56px 52px;
|
||||
background: linear-gradient(145deg, rgba(79,70,229,0.96), rgba(59,130,246,0.88));
|
||||
color: #fff;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
position: relative;
|
||||
}
|
||||
.login-showcase::after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
background: radial-gradient(circle at 20% 20%, rgba(255,255,255,0.18), transparent 22%), radial-gradient(circle at 80% 70%, rgba(255,255,255,0.08), transparent 24%);
|
||||
pointer-events: none;
|
||||
}
|
||||
.showcase-top, .showcase-bottom { position: relative; z-index: 1; }
|
||||
.brand {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
animation: fadeIn 0.8s;
|
||||
gap: 12px;
|
||||
padding: 10px 14px;
|
||||
border-radius: 999px;
|
||||
background: rgba(255,255,255,0.12);
|
||||
border: 1px solid rgba(255,255,255,0.12);
|
||||
width: fit-content;
|
||||
}
|
||||
@keyframes fadeIn {
|
||||
from { opacity: 0; transform: translateY(-30px);}
|
||||
to { opacity: 1; transform: translateY(0);}
|
||||
}
|
||||
.login-title {
|
||||
text-align: center;
|
||||
margin-bottom: 32px;
|
||||
color: #f97316;
|
||||
font-size: 28px;
|
||||
font-weight: 700;
|
||||
letter-spacing: 2px;
|
||||
}
|
||||
.login-form {
|
||||
width: 100%;
|
||||
margin-top: 10px;
|
||||
}
|
||||
.el-input__inner {
|
||||
border-radius: 6px;
|
||||
border: 1.5px solid #e5e0d9;
|
||||
background: #fcfaf8;
|
||||
color: #111827;
|
||||
transition: border-color 0.2s;
|
||||
}
|
||||
.el-input__inner:focus {
|
||||
border-color: #f97316;
|
||||
box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2);
|
||||
}
|
||||
.el-form-item__content {
|
||||
margin-left: 0 !important;
|
||||
}
|
||||
.login-button {
|
||||
width: 100%;
|
||||
margin-top: 10px;
|
||||
background: #f97316;
|
||||
border: none;
|
||||
color: #ffffff;
|
||||
font-weight: 600;
|
||||
border-radius: 6px;
|
||||
box-shadow: 0 8px 16px rgba(17, 24, 39, 0.12);
|
||||
transition: background 0.2s;
|
||||
}
|
||||
.login-button:hover, .login-button:focus {
|
||||
background: #f59e0b;
|
||||
}
|
||||
.error-message {
|
||||
color: #ef4444;
|
||||
margin-top: 18px;
|
||||
text-align: center;
|
||||
font-size: 15px;
|
||||
}
|
||||
.login-logo {
|
||||
width: 60px;
|
||||
height: 60px;
|
||||
margin-bottom: 18px;
|
||||
border-radius: 50%;
|
||||
box-shadow: 0 6px 14px rgba(17, 24, 39, 0.12);
|
||||
background: #fcfaf8;
|
||||
border: 1px solid #e5e0d9;
|
||||
display: flex;
|
||||
.brand-logo {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
border-radius: 14px;
|
||||
background: rgba(255,255,255,0.18);
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.login-footer {
|
||||
margin-top: 28px;
|
||||
.brand-logo img { width: 26px; height: 26px; }
|
||||
.brand-copy { display: flex; flex-direction: column; gap: 2px; }
|
||||
.brand-copy strong { font-size: 15px; }
|
||||
.brand-copy span { font-size: 12px; color: rgba(255,255,255,0.78); }
|
||||
.hero-copy { margin-top: 36px; }
|
||||
.hero-eyebrow {
|
||||
font-size: 12px; text-transform: uppercase; letter-spacing: .12em; color: rgba(255,255,255,0.74); margin-bottom: 16px;
|
||||
}
|
||||
.hero-title {
|
||||
font-size: 46px; line-height: 1.08; font-weight: 800; letter-spacing: -0.03em; margin-bottom: 16px;
|
||||
}
|
||||
.hero-desc {
|
||||
max-width: 460px; font-size: 16px; line-height: 1.75; color: rgba(255,255,255,0.86);
|
||||
}
|
||||
.showcase-metrics {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||
gap: 14px;
|
||||
}
|
||||
.metric-item {
|
||||
padding: 16px 18px;
|
||||
border-radius: 20px;
|
||||
background: rgba(255,255,255,0.12);
|
||||
border: 1px solid rgba(255,255,255,0.12);
|
||||
}
|
||||
.metric-label { font-size: 12px; color: rgba(255,255,255,0.72); margin-bottom: 10px; }
|
||||
.metric-value { font-size: 24px; font-weight: 700; color: #fff; }
|
||||
.login-panel {
|
||||
padding: 48px 42px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: linear-gradient(180deg, rgba(255,255,255,0.78), rgba(248,250,252,0.96));
|
||||
}
|
||||
.login-card {
|
||||
width: 100%;
|
||||
max-width: 420px;
|
||||
}
|
||||
.panel-eyebrow {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
padding: 8px 12px;
|
||||
border-radius: 999px;
|
||||
background: rgba(79,70,229,0.08);
|
||||
color: var(--primary);
|
||||
font-size: 12px;
|
||||
font-weight: 700;
|
||||
letter-spacing: .08em;
|
||||
text-transform: uppercase;
|
||||
margin-bottom: 18px;
|
||||
}
|
||||
.panel-title { font-size: 30px; font-weight: 800; color: var(--text); margin-bottom: 10px; }
|
||||
.panel-desc { color: var(--text-soft); line-height: 1.7; font-size: 14px; margin-bottom: 24px; }
|
||||
.login-form { width: 100%; }
|
||||
.el-form-item { margin-bottom: 18px; }
|
||||
.el-input__inner {
|
||||
height: 48px;
|
||||
border-radius: 14px;
|
||||
border: 1px solid rgba(148,163,184,0.22);
|
||||
background: rgba(248,250,252,0.94);
|
||||
color: var(--text);
|
||||
transition: all .18s ease;
|
||||
}
|
||||
.el-input__inner:focus {
|
||||
border-color: rgba(99,102,241,0.42);
|
||||
box-shadow: 0 0 0 4px rgba(99,102,241,0.10);
|
||||
background: #fff;
|
||||
}
|
||||
.el-form-item__content { margin-left: 0 !important; }
|
||||
.login-button {
|
||||
width: 100%;
|
||||
height: 48px;
|
||||
border: none;
|
||||
border-radius: 14px;
|
||||
background: linear-gradient(135deg, var(--primary), var(--primary-2));
|
||||
color: #fff;
|
||||
font-weight: 700;
|
||||
font-size: 15px;
|
||||
box-shadow: 0 14px 28px rgba(79,70,229,0.20);
|
||||
}
|
||||
.login-button:hover, .login-button:focus {
|
||||
opacity: .96;
|
||||
transform: translateY(-1px);
|
||||
}
|
||||
.error-message {
|
||||
margin-top: 16px;
|
||||
padding: 12px 14px;
|
||||
border-radius: 14px;
|
||||
background: rgba(239,68,68,0.08);
|
||||
border: 1px solid rgba(239,68,68,0.12);
|
||||
color: var(--danger);
|
||||
font-size: 14px;
|
||||
text-align: center;
|
||||
color: #6b7280;
|
||||
}
|
||||
.panel-footer {
|
||||
margin-top: 24px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
color: var(--text-soft);
|
||||
font-size: 13px;
|
||||
letter-spacing: 1px;
|
||||
}
|
||||
.panel-footer .status {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
.panel-footer .dot {
|
||||
width: 8px; height: 8px; border-radius: 50%; background: #10b981; box-shadow: 0 0 0 4px rgba(16,185,129,0.12);
|
||||
}
|
||||
@media (max-width: 960px) {
|
||||
.login-shell { grid-template-columns: 1fr; min-height: auto; }
|
||||
.login-showcase { padding: 34px 28px; }
|
||||
.hero-title { font-size: 34px; }
|
||||
.showcase-metrics { grid-template-columns: 1fr; }
|
||||
.login-panel { padding: 32px 24px; }
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app">
|
||||
<div class="login-container">
|
||||
<div class="login-logo">
|
||||
<img src="/static/logo.png" alt="Logo" style="width:38px;height:38px;">
|
||||
</div>
|
||||
<h2 class="login-title">A-BOT管理后台</h2>
|
||||
<el-form class="login-form" ref="loginForm" :model="loginForm" :rules="rules" label-width="0px">
|
||||
<el-form-item prop="username">
|
||||
<el-input v-model="loginForm.username" prefix-icon="el-icon-user" placeholder="用户名" size="large"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="password">
|
||||
<el-input v-model="loginForm.password" prefix-icon="el-icon-lock" placeholder="密码" type="password" size="large" @keyup.enter.native="submitForm"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" class="login-button" @click="submitForm" :loading="loading" size="large">登录</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div class="error-message" v-if="errorMessage">{{ errorMessage }}</div>
|
||||
<div class="login-footer">
|
||||
© 2025 ABOT | 智能机器人管理平台
|
||||
</div>
|
||||
<div class="login-shell">
|
||||
<section class="login-showcase">
|
||||
<div class="showcase-top">
|
||||
<div class="brand">
|
||||
<div class="brand-logo"><img src="/static/logo.png" alt="Logo"></div>
|
||||
<div class="brand-copy">
|
||||
<strong>A-BOT 控制台</strong>
|
||||
<span>Modern Operations Dashboard</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="hero-copy">
|
||||
<div class="hero-eyebrow">Welcome back</div>
|
||||
<div class="hero-title">统一管理机器人、消息、插件与系统状态</div>
|
||||
<div class="hero-desc">这不是传统后台的样子了。登录后你会进入一套更现代、更清晰的机器人运营控制台。</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="showcase-bottom">
|
||||
<div class="showcase-metrics">
|
||||
<div class="metric-item"><div class="metric-label">Workspace</div><div class="metric-value">ABOT</div></div>
|
||||
<div class="metric-item"><div class="metric-label">Focus</div><div class="metric-value">消息 / 群组</div></div>
|
||||
<div class="metric-item"><div class="metric-label">Style</div><div class="metric-value">Modern UI</div></div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<section class="login-panel">
|
||||
<div class="login-card">
|
||||
<div class="panel-eyebrow">Sign In</div>
|
||||
<div class="panel-title">登录后台</div>
|
||||
<div class="panel-desc">输入管理员账号信息,进入新版控制台继续处理机器人运营、统计与系统管理工作。</div>
|
||||
<el-form class="login-form" ref="loginForm" :model="loginForm" :rules="rules" label-width="0px">
|
||||
<el-form-item prop="username">
|
||||
<el-input v-model="loginForm.username" prefix-icon="el-icon-user" placeholder="用户名" size="large"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="password">
|
||||
<el-input v-model="loginForm.password" prefix-icon="el-icon-lock" placeholder="密码" type="password" size="large" @keyup.enter.native="submitForm"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" class="login-button" @click="submitForm" :loading="loading" size="large">登录进入控制台</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div class="error-message" v-if="errorMessage">{{ errorMessage }}</div>
|
||||
<div class="panel-footer">
|
||||
<span>© 2026 ABOT</span>
|
||||
<span class="status"><span class="dot"></span> 安全连接已就绪</span>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
new Vue({
|
||||
el: '#app',
|
||||
data() {
|
||||
return {
|
||||
loginForm: {
|
||||
username: '',
|
||||
password: ''
|
||||
},
|
||||
loginForm: { username: '', password: '' },
|
||||
rules: {
|
||||
username: [
|
||||
{ required: true, message: '请输入用户名', trigger: 'blur' }
|
||||
],
|
||||
password: [
|
||||
{ required: true, message: '请输入密码', trigger: 'blur' }
|
||||
]
|
||||
username: [{ required: true, message: '请输入用户名', trigger: 'blur' }],
|
||||
password: [{ required: true, message: '请输入密码', trigger: 'blur' }]
|
||||
},
|
||||
loading: false,
|
||||
errorMessage: ''
|
||||
@@ -162,35 +278,28 @@
|
||||
this.$refs.loginForm.validate((valid) => {
|
||||
if (valid) {
|
||||
this.loading = true;
|
||||
// 创建表单数据
|
||||
const formData = new FormData();
|
||||
formData.append('username', this.loginForm.username);
|
||||
formData.append('password', this.loginForm.password);
|
||||
|
||||
// 发送POST请求
|
||||
fetch('/login', {
|
||||
method: 'POST',
|
||||
body: formData
|
||||
})
|
||||
.then(response => {
|
||||
if (response.redirected) {
|
||||
window.location.href = response.url;
|
||||
} else {
|
||||
return response.text();
|
||||
}
|
||||
})
|
||||
.then(html => {
|
||||
if (html) {
|
||||
// 如果返回HTML,说明登录失败
|
||||
this.errorMessage = '用户名或密码错误';
|
||||
fetch('/login', { method: 'POST', body: formData })
|
||||
.then(response => {
|
||||
if (response.redirected) {
|
||||
window.location.href = response.url;
|
||||
} else {
|
||||
return response.text();
|
||||
}
|
||||
})
|
||||
.then(html => {
|
||||
if (html) {
|
||||
this.errorMessage = '用户名或密码错误';
|
||||
this.loading = false;
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('登录出错:', error);
|
||||
this.errorMessage = '登录请求失败,请稍后重试';
|
||||
this.loading = false;
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('登录出错:', error);
|
||||
this.errorMessage = '登录请求失败,请稍后重试';
|
||||
this.loading = false;
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user