| <!DOCTYPE html>
|
| <html lang="zh-CN">
|
| <head>
|
| <meta charset="UTF-8">
|
| <meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| <title>VvvebJs Editor</title>
|
| <style>
|
| body {
|
| background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
| min-height: 100vh;
|
| display: flex;
|
| align-items: center;
|
| justify-content: center;
|
| margin: 0;
|
| font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
| }
|
| .login-container {
|
| background: white;
|
| border-radius: 15px;
|
| box-shadow: 0 15px 35px rgba(0,0,0,0.1);
|
| padding: 40px;
|
| width: 400px;
|
| max-width: 90vw;
|
| }
|
| .header {
|
| text-align: center;
|
| margin-bottom: 30px;
|
| padding: 20px;
|
| border: 2px solid #dc3545;
|
| border-radius: 8px;
|
| }
|
| .logo {
|
| font-size: 24px;
|
| font-weight: bold;
|
| color: #333;
|
| margin-bottom: 10px;
|
| }
|
| .logo::before {
|
| content: "🎨 ";
|
| }
|
| .subtitle {
|
| color: #666;
|
| font-size: 14px;
|
| }
|
| .form-group {
|
| margin-bottom: 20px;
|
| }
|
| .form-group label {
|
| display: block;
|
| margin-bottom: 8px;
|
| color: #333;
|
| font-weight: 500;
|
| }
|
| .form-control {
|
| width: 100%;
|
| padding: 12px 15px;
|
| border: 1px solid #ddd;
|
| border-radius: 6px;
|
| font-size: 14px;
|
| box-sizing: border-box;
|
| }
|
| .form-control:focus {
|
| outline: none;
|
| border-color: #667eea;
|
| box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
|
| }
|
| .btn-login {
|
| width: 100%;
|
| padding: 12px;
|
| background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
| color: white;
|
| border: none;
|
| border-radius: 6px;
|
| font-size: 16px;
|
| font-weight: 500;
|
| cursor: pointer;
|
| transition: all 0.3s;
|
| }
|
| .btn-login:hover {
|
| background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
|
| transform: translateY(-1px);
|
| box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
|
| }
|
| .message {
|
| margin-top: 15px;
|
| padding: 10px;
|
| border-radius: 4px;
|
| display: none;
|
| }
|
| .message.error {
|
| background: #f8d7da;
|
| color: #721c24;
|
| border: 1px solid #f5c6cb;
|
| }
|
| .message.success {
|
| background: #d4edda;
|
| color: #155724;
|
| border: 1px solid #c3e6cb;
|
| }
|
| </style>
|
| </head>
|
| <body>
|
| <div class="login-container">
|
| <div class="header">
|
| <div class="logo">VvvebJs Editor</div>
|
| <div class="subtitle">请登录以继续使用可视化网站编辑器</div>
|
| </div>
|
|
|
| <form id="loginForm">
|
| <div class="form-group">
|
| <label for="username">用户名</label>
|
| <input type="text" id="username" name="username" class="form-control" placeholder="请输入用户名" required>
|
| </div>
|
|
|
| <div class="form-group">
|
| <label for="password">密码</label>
|
| <input type="password" id="password" name="password" class="form-control" placeholder="请输入密码" required>
|
| </div>
|
|
|
| <button type="submit" class="btn-login">登录</button>
|
| </form>
|
|
|
| <div id="message" class="message"></div>
|
| </div>
|
|
|
| <script>
|
| document.getElementById('loginForm').addEventListener('submit', async function(e) {
|
| e.preventDefault();
|
|
|
| const formData = new FormData(this);
|
| formData.append('action', 'login');
|
|
|
| const messageDiv = document.getElementById('message');
|
|
|
| try {
|
| const response = await fetch('user-manager.php', {
|
| method: 'POST',
|
| body: formData
|
| });
|
|
|
| const data = await response.json();
|
|
|
| if (data.success) {
|
| messageDiv.textContent = '登录成功,正在跳转...';
|
| messageDiv.className = 'message success';
|
| messageDiv.style.display = 'block';
|
|
|
| setTimeout(() => {
|
| window.location.href = 'editor.html';
|
| }, 1000);
|
| } else {
|
| messageDiv.textContent = data.message || '登录失败';
|
| messageDiv.className = 'message error';
|
| messageDiv.style.display = 'block';
|
| }
|
| } catch (error) {
|
| messageDiv.textContent = '网络错误,请重试';
|
| messageDiv.className = 'message error';
|
| messageDiv.style.display = 'block';
|
| }
|
| });
|
|
|
|
|
| fetch('user-manager.php', {
|
| method: 'POST',
|
| body: new URLSearchParams({action: 'check_login'})
|
| })
|
| .then(response => response.json())
|
| .then(data => {
|
| if (data.logged_in) {
|
| window.location.href = 'editor.html';
|
| }
|
| })
|
| .catch(error => {
|
| console.log('登录状态检查失败:', error);
|
| });
|
| </script>
|
| </body>
|
| </html> |