zhangdocs 1.1.2 → 1.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/theme/handbook/layout.ejs +77 -8
package/package.json
CHANGED
|
@@ -14,24 +14,93 @@
|
|
|
14
14
|
</div>
|
|
15
15
|
</div>
|
|
16
16
|
|
|
17
|
+
<!-- Token输入弹窗 -->
|
|
18
|
+
<div id="token-modal"
|
|
19
|
+
style="position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.8); z-index: 9999; display: flex; justify-content: center; align-items: center;">
|
|
20
|
+
<div
|
|
21
|
+
style="background: white; padding: 30px; border-radius: 10px; box-shadow: 0 4px 20px rgba(0,0,0,0.3); max-width: 400px; width: 90%;">
|
|
22
|
+
<h2 style="margin: 0 0 20px 0; text-align: center; color: #333;">访问验证</h2>
|
|
23
|
+
<p style="margin: 0 0 15px 0; color: #666; text-align: center;">请输入访问令牌</p>
|
|
24
|
+
<input type="password" id="token-input" placeholder="请输入token"
|
|
25
|
+
style="width: 100%; padding: 12px; border: 1px solid #ddd; border-radius: 5px; font-size: 16px; margin-bottom: 15px; box-sizing: border-box;">
|
|
26
|
+
<div style="text-align: center;">
|
|
27
|
+
<button id="token-submit"
|
|
28
|
+
style="background: #007bff; color: white; border: none; padding: 12px 30px; border-radius: 5px; font-size: 16px; cursor: pointer; margin-right: 10px;">验证</button>
|
|
29
|
+
<button id="token-cancel"
|
|
30
|
+
style="background: #6c757d; color: white; border: none; padding: 12px 30px; border-radius: 5px; font-size: 16px; cursor: pointer;">取消</button>
|
|
31
|
+
</div>
|
|
32
|
+
<div id="error-message" style="color: red; text-align: center; margin-top: 10px; display: none;">Token不正确,请重新输入
|
|
33
|
+
</div>
|
|
34
|
+
</div>
|
|
35
|
+
</div>
|
|
36
|
+
|
|
17
37
|
<script>
|
|
18
38
|
document.addEventListener('DOMContentLoaded', function () {
|
|
19
|
-
|
|
20
|
-
const token = localStorage.getItem('token');
|
|
21
|
-
const expectedToken = 'A3F78D1E4C9B2A5F0E6D7C8B5A4F3E2D1C0B9A8F7E6D5C4B3A2F1E0D9C8B7A6F5E4';
|
|
22
|
-
|
|
39
|
+
const expectedToken = 'rstech5202';
|
|
23
40
|
const mainContainer = document.getElementById('main-container');
|
|
24
41
|
const navElement = document.querySelector('.nav');
|
|
42
|
+
const tokenModal = document.getElementById('token-modal');
|
|
43
|
+
const tokenInput = document.getElementById('token-input');
|
|
44
|
+
const tokenSubmit = document.getElementById('token-submit');
|
|
45
|
+
const tokenCancel = document.getElementById('token-cancel');
|
|
46
|
+
const errorMessage = document.getElementById('error-message');
|
|
47
|
+
|
|
48
|
+
// 检查是否已有正确的token
|
|
49
|
+
const existingToken = localStorage.getItem('token');
|
|
50
|
+
if (existingToken === expectedToken) {
|
|
51
|
+
showContent();
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// 显示token输入弹窗
|
|
56
|
+
tokenModal.style.display = 'flex';
|
|
25
57
|
|
|
26
|
-
|
|
27
|
-
|
|
58
|
+
// 验证token
|
|
59
|
+
function verifyToken() {
|
|
60
|
+
const inputToken = tokenInput.value.trim();
|
|
61
|
+
if (inputToken === expectedToken) {
|
|
62
|
+
localStorage.setItem('token', inputToken);
|
|
63
|
+
showContent();
|
|
64
|
+
tokenModal.style.display = 'none';
|
|
65
|
+
} else {
|
|
66
|
+
errorMessage.style.display = 'block';
|
|
67
|
+
tokenInput.value = '';
|
|
68
|
+
tokenInput.focus();
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// 显示内容
|
|
73
|
+
function showContent() {
|
|
28
74
|
mainContainer.style.display = 'block';
|
|
29
75
|
if (navElement) navElement.style.display = 'block';
|
|
30
|
-
}
|
|
31
|
-
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// 隐藏内容
|
|
79
|
+
function hideContent() {
|
|
32
80
|
mainContainer.style.display = 'none';
|
|
33
81
|
if (navElement) navElement.style.display = 'none';
|
|
34
82
|
}
|
|
83
|
+
|
|
84
|
+
// 事件监听
|
|
85
|
+
tokenSubmit.addEventListener('click', verifyToken);
|
|
86
|
+
tokenCancel.addEventListener('click', function () {
|
|
87
|
+
hideContent();
|
|
88
|
+
tokenModal.style.display = 'none';
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
tokenInput.addEventListener('keypress', function (e) {
|
|
92
|
+
if (e.key === 'Enter') {
|
|
93
|
+
verifyToken();
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
// 点击弹窗外部关闭
|
|
98
|
+
tokenModal.addEventListener('click', function (e) {
|
|
99
|
+
if (e.target === tokenModal) {
|
|
100
|
+
hideContent();
|
|
101
|
+
tokenModal.style.display = 'none';
|
|
102
|
+
}
|
|
103
|
+
});
|
|
35
104
|
});
|
|
36
105
|
</script>
|
|
37
106
|
|