-
Notifications
You must be signed in to change notification settings - Fork 19
/
index.html
194 lines (174 loc) · 5.52 KB
/
index.html
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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<title>管理员登录</title>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0">
<link rel="shortcut icon" href="statics/images/favicon.ico">
<link rel="stylesheet" href="statics/css/site.css">
<script src="statics/web.js"></script>
<script src="statics/lib/jquery.min.js"></script>
<script src="statics/lib/layui/layui.all.js"></script>
<style>
html, body {
height: 100%;
margin: 0;
background: #f0f2f5;
background: #ecedf0 url("statics/images/bj.png") fixed;
background-repeat: repeat;
display: flex;
justify-content: center;
align-items: center;
}
.login-container {
display: flex;
width: 900px;
height: 500px;
background: rgba(255, 255, 255, 0.95);
border-radius: 20px;
box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
overflow: hidden;
}
.login-left {
flex: 1;
padding: 40px;
background: linear-gradient(135deg, #4C84FF 0%, #3b6ee8 100%);
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
color: white;
}
.login-left h1 {
font-size: 36px;
margin-bottom: 20px;
}
.login-left p {
font-size: 16px;
text-align: center;
line-height: 1.6;
opacity: 0.9;
}
.login-right {
flex: 1;
padding: 40px;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.login-right h2 {
font-size: 28px;
color: #333;
margin-bottom: 30px;
}
.scan-tip {
display: flex;
align-items: center;
margin-bottom: 30px;
font-size: 18px;
color: #666;
}
.scan-tip img {
width: 45px;
height: 45px;
margin-left: 10px;
}
.qr-code {
width: 240px;
height: 240px;
padding: 15px;
background: white;
border-radius: 12px;
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}
@media screen and (max-width: 768px) {
.login-container {
width: 90%;
max-width: 400px;
height: auto;
flex-direction: column;
}
.login-left {
padding: 30px 20px;
}
.login-left h1 {
font-size: 28px;
}
.login-right {
padding: 30px 20px;
}
.qr-code {
width: 180px;
height: 180px;
}
}
body{cursor:url('statics/images/XSSB-1.cur'), auto;}
a{cursor:url('statics/images/XSSB-2.cur'), auto;}
</style>
</head>
<body>
<div class="login-container">
<div class="login-left">
<h1 id="greetingText"></h1>
<p>请使用管理员微信扫一扫登录,登录成功后将自动挤掉其它端登录状态</p>
</div>
<div class="login-right">
<h2>微信扫码登录</h2>
<div class="scan-tip">
请使用微信扫一扫
<img src="statics/images/img-4.gif" alt="Scan Icon"/>
</div>
<img class="qr-code" src="" alt="登录二维码加载中..."/>
</div>
</div>
<script>
// 根据时间设置问候语
function setGreeting() {
const hour = new Date().getHours();
let greeting;
if (hour >= 6 && hour < 12) {
greeting = "早上好 🌅";
} else if (hour >= 12 && hour < 13) {
greeting = "中午好 ☀️";
} else if (hour >= 13 && hour < 18) {
greeting = "下午好 🌞";
} else if (hour >= 18 && hour < 23) {
greeting = "晚上好 🌙";
} else {
greeting = "夜深了,注意休息 😴";
}
document.getElementById("greetingText").innerText = greeting;
}
setGreeting();
var token = localStorage.getItem('token');
if(token!=null && token!='null'){
console.log(token);
location.href = "user/index.html";
}
$.get(domain + "admin/login", {}, function(data) {
if (data.code == 200) {
$('.qr-code').attr('src', data.data.pic);
startCheckLogin(data.data.code); // 开始检查登录状态
} else {
layer.msg("二维码获取失败,请刷新重试");
}
});
function startCheckLogin(code) {
const interval = setInterval(function() {
$.get(domain + "admin/checkLogin", {code:code}, function(data) {
if (data.code == 200) {
clearInterval(interval);
localStorage.setItem('token', data.data);
layer.msg("登录成功,正在跳转中...", {time: 1500}, function(){
location.href = "user/index.html";
});
}
});
}, 1000);
}
</script>
</body>
</html>