初版:上传接口(从线上实例导出,适配容器端口)
This commit is contained in:
@@ -0,0 +1,194 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN" class="light">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
|
||||
<title>登录 - 表单管理系统</title>
|
||||
|
||||
<!-- Tailwind CSS -->
|
||||
<script src="https://cdn.tailwindcss.com"></script>
|
||||
<script>
|
||||
tailwind.config = {
|
||||
darkMode: 'class',
|
||||
theme: {
|
||||
extend: {
|
||||
fontFamily: {
|
||||
sans: ['Inter', 'sans-serif'],
|
||||
serif: ['Playfair Display', 'serif'],
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<!-- GSAP -->
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.12.2/gsap.min.js"></script>
|
||||
|
||||
<!-- Particles -->
|
||||
<script src="/static/js/particles.js"></script>
|
||||
|
||||
<!-- Toast -->
|
||||
<script src="/static/js/toast.js"></script>
|
||||
<link rel="stylesheet" href="/static/css/toast.css">
|
||||
|
||||
<!-- Basic & Common Styles -->
|
||||
<link rel="stylesheet" href="/static/css/basic.css">
|
||||
<link rel="stylesheet" href="/static/css/common.css">
|
||||
<!-- Common JS (theme init, utils) -->
|
||||
<script src="/static/js/common.js"></script>
|
||||
|
||||
<style>
|
||||
/* ── login 页面专属样式 ── */
|
||||
.input-wrapper {
|
||||
position: relative;
|
||||
background-color: var(--input-bg);
|
||||
border: 2px solid var(--input-border);
|
||||
border-radius: 12px;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
.input-wrapper:focus-within {
|
||||
border-color: var(--text-primary);
|
||||
box-shadow: 0 0 0 3px var(--shadow-color);
|
||||
}
|
||||
|
||||
.input-field {
|
||||
background: transparent;
|
||||
border: none;
|
||||
color: var(--input-text);
|
||||
width: 100%;
|
||||
padding: 14px 16px;
|
||||
font-size: 15px;
|
||||
font-weight: 500;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.input-field::placeholder {
|
||||
color: var(--text-muted);
|
||||
opacity: 0.8;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body class="antialiased min-h-screen flex items-center justify-center relative">
|
||||
|
||||
|
||||
<!-- Main Content -->
|
||||
<main class="relative z-10 w-full max-w-md mx-auto px-6 py-12">
|
||||
<div id="loginCard" class="glass rounded-3xl p-8 md:p-10 shadow-2xl opacity-0 transform translate-y-8">
|
||||
|
||||
<div class="text-center mb-10">
|
||||
<h1 class="font-serif text-3xl font-semibold tracking-tight mb-2" style="color: var(--text-primary);">
|
||||
Form Admin
|
||||
</h1>
|
||||
<p class="text-xs tracking-[0.2em] uppercase font-medium" style="color: var(--text-muted);">
|
||||
Secure Login
|
||||
</p>
|
||||
<div class="w-16 h-[2px] mx-auto mt-4" style="background-color: var(--border-color);"></div>
|
||||
</div>
|
||||
|
||||
<form id="loginForm" class="space-y-6">
|
||||
<div class="space-y-2">
|
||||
<label class="block text-xs font-semibold tracking-wide uppercase"
|
||||
style="color: var(--text-secondary);">
|
||||
用户名
|
||||
</label>
|
||||
<div class="input-wrapper">
|
||||
<input type="text" id="username" placeholder="请输入用户名" required autofocus class="input-field"
|
||||
autocomplete="username">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="space-y-2">
|
||||
<label class="block text-xs font-semibold tracking-wide uppercase"
|
||||
style="color: var(--text-secondary);">
|
||||
密码
|
||||
</label>
|
||||
<div class="input-wrapper">
|
||||
<input type="password" id="password" placeholder="请输入密码" required class="input-field"
|
||||
autocomplete="current-password">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex items-center justify-between text-xs pt-2">
|
||||
<label class="flex items-center cursor-pointer">
|
||||
<input type="checkbox" id="remember" class="mr-2 accent-gray-900 dark:accent-white">
|
||||
<span style="color: var(--text-secondary);">记住我</span>
|
||||
</label>
|
||||
<button type="button" onclick="showToast('请联系管理员重置密码', 'error')"
|
||||
class="font-medium hover:opacity-70 transition-opacity text-xs"
|
||||
style="color: var(--text-muted);">
|
||||
忘记密码?
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<button type="submit" id="loginBtn"
|
||||
class="btn-primary w-full py-4 rounded-xl text-sm font-semibold tracking-wide uppercase flex items-center justify-center mt-8">
|
||||
<span id="btnText">登录</span>
|
||||
</button>
|
||||
</form>
|
||||
|
||||
<div class="mt-8 pt-6 border-t text-center" style="border-color: var(--border-color);">
|
||||
<div class="flex items-center justify-center gap-2 text-[10px] tracking-[0.2em] uppercase font-medium"
|
||||
style="color: var(--text-muted);">
|
||||
<span>Secure Admin Panel</span>
|
||||
<span>•</span>
|
||||
<span id="clock">00:00</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<script>
|
||||
// Clock
|
||||
setInterval(() => {
|
||||
document.getElementById('clock').textContent =
|
||||
new Date().toLocaleTimeString('zh-CN', { hour: '2-digit', minute: '2-digit', hour12: false });
|
||||
}, 1000);
|
||||
|
||||
// GSAP
|
||||
window.addEventListener('load', () => {
|
||||
gsap.to("#loginCard", { opacity: 1, y: 0, duration: 0.8, ease: "power2.out", delay: 0.2 });
|
||||
});
|
||||
|
||||
|
||||
// Form
|
||||
document.getElementById('loginForm').addEventListener('submit', async (e) => {
|
||||
e.preventDefault();
|
||||
const btn = document.getElementById('loginBtn');
|
||||
const btnText = document.getElementById('btnText');
|
||||
|
||||
btn.disabled = true;
|
||||
btnText.innerHTML = '登录中<span class="loading-spinner"></span>';
|
||||
|
||||
try {
|
||||
const res = await fetch('/api/login', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
username: document.getElementById('username').value.trim(),
|
||||
password: document.getElementById('password').value,
|
||||
remember: document.getElementById('remember').checked
|
||||
})
|
||||
});
|
||||
const data = await res.json();
|
||||
|
||||
if (data.success) {
|
||||
showToast('登录成功', 'success');
|
||||
setTimeout(() => location.href = data.redirect || '/admin', 500);
|
||||
} else {
|
||||
showToast(data.message, 'error');
|
||||
btn.disabled = false;
|
||||
btnText.textContent = '重新登录';
|
||||
}
|
||||
} catch {
|
||||
showToast('网络错误', 'error');
|
||||
btn.disabled = false;
|
||||
btnText.textContent = '重新登录';
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
Reference in New Issue
Block a user