File size: 5,911 Bytes
4aaaa07
5186047
4aaaa07
5186047
 
bcc9a86
4aaaa07
676a3be
 
 
 
 
5186047
bcc9a86
 
676a3be
5186047
bcc9a86
 
 
676a3be
bcc9a86
 
676a3be
bcc9a86
5186047
 
bcc9a86
 
 
676a3be
bcc9a86
 
 
5186047
 
676a3be
bcc9a86
 
 
 
5186047
bcc9a86
676a3be
bcc9a86
5186047
676a3be
bcc9a86
 
 
 
 
 
 
 
 
 
 
 
 
 
5186047
bcc9a86
5186047
bcc9a86
676a3be
5186047
bcc9a86
5186047
bcc9a86
5186047
bcc9a86
 
 
 
 
 
676a3be
5186047
bcc9a86
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4aaaa07
 
 
 
5186047
bcc9a86
 
 
5186047
4aaaa07
5186047
 
bcc9a86
 
676a3be
5186047
 
bcc9a86
 
676a3be
5186047
bcc9a86
5186047
 
bcc9a86
4aaaa07
5186047
 
 
 
 
bcc9a86
 
5186047
bcc9a86
5186047
 
 
 
bcc9a86
5186047
 
bcc9a86
5186047
bcc9a86
 
 
 
 
5186047
 
 
 
bcc9a86
 
 
5186047
 
bcc9a86
 
 
5186047
 
 
bcc9a86
 
 
 
 
 
 
 
 
5186047
bcc9a86
 
 
5186047
 
4aaaa07
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
<!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>