screen/src/main/resources/templates/login.html
2025-12-21 14:24:38 +08:00

277 lines
8.1 KiB
HTML

<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<link rel="icon" type="image/x-icon" href="/favicon.ico">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>系统登录 - 私人相册</title>
<style>
:root {
--primary-color: #007bff;
--primary-hover: #0056b3;
--bg-gradient: linear-gradient(135deg, #1a2a6c 0%, #b21f1f 50%, #fdbb2d 100%);
--glass-bg: rgba(255, 255, 255, 0.85);
}
body, html {
margin: 0;
padding: 0;
width: 100%;
height: 100%;
overflow: hidden;
font-family: 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
}
/* 粒子画布样式 */
#particle-canvas {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: var(--bg-gradient);
z-index: 1;
}
.login-wrapper {
position: relative;
z-index: 2;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}
.login-container {
background: var(--glass-bg);
padding: 50px 40px;
border-radius: 20px;
box-shadow: 0 20px 50px rgba(0,0,0,0.3);
width: 380px;
text-align: center;
backdrop-filter: blur(15px);
border: 1px solid rgba(255,255,255,0.4);
transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.login-container:hover {
transform: translateY(-8px);
box-shadow: 0 30px 60px rgba(0,0,0,0.4);
}
h2 {
color: #1a2a6c;
margin: 0 0 10px 0;
font-size: 26px;
font-weight: 700;
}
.subtitle {
color: #555;
font-size: 14px;
margin-bottom: 30px;
}
.input-group {
margin-bottom: 25px;
}
input[type="password"] {
width: 100%;
padding: 15px 18px;
border: 2px solid rgba(0,0,0,0.05);
border-radius: 12px;
box-sizing: border-box;
outline: none;
font-size: 16px;
transition: all 0.3s ease;
background: rgba(255,255,255,0.8);
}
input[type="password"]:focus {
border-color: var(--primary-color);
background: #fff;
box-shadow: 0 0 15px rgba(0, 123, 255, 0.2);
}
button {
width: 100%;
padding: 15px;
background: var(--primary-color);
border: none;
border-radius: 12px;
color: white;
font-size: 17px;
font-weight: 600;
cursor: pointer;
transition: all 0.3s ease;
box-shadow: 0 8px 20px rgba(0, 123, 255, 0.3);
}
button:hover {
background: var(--primary-hover);
transform: scale(1.03);
box-shadow: 0 12px 25px rgba(0, 123, 255, 0.4);
}
#message {
color: #d63031;
margin-top: 20px;
font-size: 14px;
font-weight: 600;
min-height: 20px;
}
.provider-tag {
margin-top: 40px;
padding-top: 20px;
border-top: 1px solid rgba(0,0,0,0.05);
color: #777;
font-size: 12px;
letter-spacing: 1px;
}
.provider-tag strong {
color: #1a2a6c;
font-weight: 600;
}
</style>
</head>
<body>
<canvas id="particle-canvas"></canvas>
<div class="login-wrapper">
<div class="login-container">
<div class="logo-area">
<h2>模板图片挑选服务</h2>
<div class="subtitle">Secure Access Management</div>
</div>
<div class="input-group">
<input type="password" id="password" placeholder="请输入授权码" onkeydown="if(event.keyCode==13) doLogin()" value="WANG+li648438">
</div>
<button onclick="doLogin()">立即验证并进入</button>
<div id="message"></div>
<div class="provider-tag">
服务提供商:<strong>《林城友善的地椒》</strong>
</div>
</div>
</div>
<script>
// --- 粒子动画脚本 ---
const canvas = document.getElementById('particle-canvas');
const ctx = canvas.getContext('2d');
let particles = [];
const mouse = { x: null, y: null, radius: 150 };
window.addEventListener('mousemove', (e) => {
mouse.x = e.x;
mouse.y = e.y;
});
function resizeCanvas() {
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
initParticles();
}
class Particle {
constructor() {
this.x = Math.random() * canvas.width;
this.y = Math.random() * canvas.height;
this.size = Math.random() * 2 + 1;
this.speedX = Math.random() * 1 - 0.5;
this.speedY = Math.random() * 1 - 0.5;
}
update() {
this.x += this.speedX;
this.y += this.speedY;
if (this.x > canvas.width) this.x = 0;
else if (this.x < 0) this.x = canvas.width;
if (this.y > canvas.height) this.y = 0;
else if (this.y < 0) this.y = canvas.height;
// 鼠标交互
let dx = mouse.x - this.x;
let dy = mouse.y - this.y;
let distance = Math.sqrt(dx * dx + dy * dy);
if (distance < mouse.radius) {
this.x -= dx / 20;
this.y -= dy / 20;
}
}
draw() {
ctx.fillStyle = 'rgba(255, 255, 255, 0.5)';
ctx.beginPath();
ctx.arc(this.x, this.y, this.size, 0, Math.PI * 2);
ctx.fill();
}
}
function initParticles() {
particles = [];
const count = (canvas.width * canvas.height) / 9000;
for (let i = 0; i < count; i++) {
particles.push(new Particle());
}
}
function animate() {
ctx.clearRect(0, 0, canvas.width, canvas.height);
particles.forEach(p => {
p.update();
p.draw();
});
requestAnimationFrame(animate);
}
window.addEventListener('resize', resizeCanvas);
resizeCanvas();
animate();
// --- 登录逻辑 ---
async function doLogin() {
const pwd = document.getElementById('password').value;
const message = document.getElementById('message');
const btn = document.querySelector('button');
if (!pwd) {
message.innerText = "请输入密码";
return;
}
btn.disabled = true;
btn.innerText = "正在安全验证...";
message.innerText = "";
const formData = new FormData();
formData.append('password', pwd);
try {
const response = await fetch('/doLogin', {
method: 'POST',
body: formData
});
const result = await response.text();
if (result === 'ok') {
window.location.href = '/';
} else {
message.innerText = result;
btn.disabled = false;
btn.innerText = "立即验证并进入";
}
} catch (error) {
message.innerText = "连接服务器失败";
btn.disabled = false;
btn.innerText = "立即验证并进入";
}
}
</script>
</body>
</html>