Spaces:
Running

magic / index.html
EchoPixel's picture
Add 2 files
67b9043 verified
Raw History Blame Contribute Delete
13.2 kB
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>欢迎登录 | 您的网站</title>
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<style>
.gradient-bg {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}
.input-focus:focus {
box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3);
}
.shake {
animation: shake 0.5s;
}
@keyframes shake {
0%, 100% { transform: translateX(0); }
20%, 60% { transform: translateX(-5px); }
40%, 80% { transform: translateX(5px); }
}
.floating {
animation: floating 3s ease-in-out infinite;
}
@keyframes floating {
0% { transform: translateY(0px); }
50% { transform: translateY(-10px); }
100% { transform: translateY(0px); }
}
</style>
</head>
<body class="font-sans bg-gray-50">
<div class="min-h-screen flex flex-col md:flex-row">
<!-- 左侧背景图 -->
<div class="md:w-1/2 gradient-bg flex items-center justify-center p-10 text-white relative overflow-hidden">
<div class="absolute inset-0 bg-black opacity-10"></div>
<div class="relative z-10 text-center max-w-md">
<div class="floating mb-8">
<i class="fas fa-user-shield text-6xl"></i>
</div>
<h1 class="text-4xl font-bold mb-4">欢迎回来</h1>
<p class="text-xl mb-6">登录您的账户,探索更多精彩内容</p>
<div class="flex justify-center space-x-4">
<button class="bg-white text-indigo-700 px-6 py-2 rounded-full font-medium hover:bg-gray-100 transition">
了解更多
</button>
</div>
</div>
<div class="absolute bottom-4 left-0 right-0 text-center text-white text-sm opacity-80">
© 2023 您的公司. 保留所有权利.
</div>
</div>
<!-- 右侧登录表单 -->
<div class="md:w-1/2 flex items-center justify-center p-10">
<div class="w-full max-w-md">
<div class="text-center mb-10">
<h2 class="text-3xl font-bold text-gray-800">登录账户</h2>
<p class="text-gray-600 mt-2">请输入您的凭据以继续</p>
</div>
<form id="loginForm" class="space-y-6">
<div>
<label for="email" class="block text-sm font-medium text-gray-700 mb-1">电子邮箱</label>
<div class="relative">
<div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
<i class="fas fa-envelope text-gray-400"></i>
</div>
<input type="email" id="email" name="email"
class="pl-10 w-full px-4 py-3 rounded-lg border border-gray-300 focus:outline-none focus:border-indigo-500 input-focus transition"
placeholder="your@email.com" required>
</div>
<p id="emailError" class="mt-1 text-sm text-red-600 hidden"></p>
</div>
<div>
<label for="password" class="block text-sm font-medium text-gray-700 mb-1">密码</label>
<div class="relative">
<div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
<i class="fas fa-lock text-gray-400"></i>
</div>
<input type="password" id="password" name="password"
class="pl-10 w-full px-4 py-3 rounded-lg border border-gray-300 focus:outline-none focus:border-indigo-500 input-focus transition"
placeholder="••••••••" required>
<button type="button" id="togglePassword" class="absolute inset-y-0 right-0 pr-3 flex items-center">
<i class="fas fa-eye text-gray-400 hover:text-gray-600 cursor-pointer"></i>
</button>
</div>
<p id="passwordError" class="mt-1 text-sm text-red-600 hidden"></p>
</div>
<div class="flex items-center justify-between">
<div class="flex items-center">
<input id="remember" name="remember" type="checkbox"
class="h-4 w-4 text-indigo-600 focus:ring-indigo-500 border-gray-300 rounded">
<label for="remember" class="ml-2 block text-sm text-gray-700">
记住我
</label>
</div>
<div class="text-sm">
<a href="#" class="font-medium text-indigo-600 hover:text-indigo-500">
忘记密码?
</a>
</div>
</div>
<div>
<button type="submit"
class="w-full flex justify-center py-3 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 transition">
登录
</button>
</div>
</form>
<div class="mt-6">
<div class="relative">
<div class="absolute inset-0 flex items-center">
<div class="w-full border-t border-gray-300"></div>
</div>
<div class="relative flex justify-center text-sm">
<span class="px-2 bg-white text-gray-500">
或者使用社交账号登录
</span>
</div>
</div>
<div class="mt-6 grid grid-cols-3 gap-3">
<button type="button" class="w-full inline-flex justify-center py-2 px-4 border border-gray-300 rounded-md shadow-sm bg-white text-sm font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 transition">
<i class="fab fa-google text-red-500"></i>
</button>
<button type="button" class="w-full inline-flex justify-center py-2 px-4 border border-gray-300 rounded-md shadow-sm bg-white text-sm font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 transition">
<i class="fab fa-facebook-f text-blue-600"></i>
</button>
<button type="button" class="w-full inline-flex justify-center py-2 px-4 border border-gray-300 rounded-md shadow-sm bg-white text-sm font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 transition">
<i class="fab fa-twitter text-blue-400"></i>
</button>
</div>
</div>
<div class="mt-6 text-center text-sm text-gray-600">
还没有账户?
<a href="#" class="font-medium text-indigo-600 hover:text-indigo-500">
立即注册
</a>
</div>
</div>
</div>
</div>
<script>
document.addEventListener('DOMContentLoaded', function() {
const loginForm = document.getElementById('loginForm');
const emailInput = document.getElementById('email');
const passwordInput = document.getElementById('password');
const togglePassword = document.getElementById('togglePassword');
const emailError = document.getElementById('emailError');
const passwordError = document.getElementById('passwordError');
let isPasswordVisible = false;
// 切换密码可见性
togglePassword.addEventListener('click', function() {
isPasswordVisible = !isPasswordVisible;
passwordInput.type = isPasswordVisible ? 'text' : 'password';
togglePassword.innerHTML = isPasswordVisible
? '<i class="fas fa-eye-slash text-gray-400 hover:text-gray-600 cursor-pointer"></i>'
: '<i class="fas fa-eye text-gray-400 hover:text-gray-600 cursor-pointer"></i>';
});
// 表单验证
loginForm.addEventListener('submit', function(e) {
e.preventDefault();
let isValid = true;
// 重置错误状态
emailError.classList.add('hidden');
passwordError.classList.add('hidden');
emailInput.classList.remove('border-red-500');
passwordInput.classList.remove('border-red-500');
// 验证邮箱
if (!emailInput.value) {
emailError.textContent = '请输入电子邮箱';
emailError.classList.remove('hidden');
emailInput.classList.add('border-red-500', 'shake');
isValid = false;
} else if (!/\S+@\S+\.\S+/.test(emailInput.value)) {
emailError.textContent = '请输入有效的电子邮箱';
emailError.classList.remove('hidden');
emailInput.classList.add('border-red-500', 'shake');
isValid = false;
}
// 验证密码
if (!passwordInput.value) {
passwordError.textContent = '请输入密码';
passwordError.classList.remove('hidden');
passwordInput.classList.add('border-red-500', 'shake');
isValid = false;
} else if (passwordInput.value.length < 6) {
passwordError.textContent = '密码至少需要6个字符';
passwordError.classList.remove('hidden');
passwordInput.classList.add('border-red-500', 'shake');
isValid = false;
}
// 移除抖动动画
setTimeout(() => {
emailInput.classList.remove('shake');
passwordInput.classList.remove('shake');
}, 500);
// 如果验证通过,模拟登录
if (isValid) {
// 这里可以添加实际的登录逻辑
console.log('登录信息:', {
email: emailInput.value,
password: passwordInput.value,
remember: document.getElementById('remember').checked
});
// 显示成功消息
alert('登录成功! 即将跳转到首页...');
// window.location.href = '/dashboard'; // 实际应用中跳转到仪表盘
}
});
// 输入时实时验证
emailInput.addEventListener('input', function() {
if (this.value && /\S+@\S+\.\S+/.test(this.value)) {
this.classList.remove('border-red-500');
emailError.classList.add('hidden');
}
});
passwordInput.addEventListener('input', function() {
if (this.value && this.value.length >= 6) {
this.classList.remove('border-red-500');
passwordError.classList.add('hidden');
}
});
});
</script>
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=EchoPixel/magic" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html>