-
Notifications
You must be signed in to change notification settings - Fork 29
/
error.html
374 lines (340 loc) · 11.5 KB
/
error.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
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
<link
rel="stylesheet"
href="/static/scripts/lib/bootstrap/css/bootstrap.min.css"
/>
<link
rel="stylesheet"
href="/static/scripts/lib/bootstrap-icons/font/bootstrap-icons.css"
/>
<div class="container mt-3">
<h2 class="text-center text-danger">哎呀,出错了</h2>
<p class="text-center text-danger">
网站运行时发生了意外错误,网页内容无法正常显示。
</p>
<hr />
<p>
这样的错误可能是服务器故障导致的,也可能是因为网站在前辈的电脑中缓存的代码或者数据发生了意外。为了解决问题,前辈可以依次尝试使用下面的办法:
</p>
<hr />
<p>首先,请尝试<strong>强制刷新网页</strong>,具体的方法是:</p>
<ul>
<li>
在 Windows 或者 Linux 电脑上,同时按下 <kbd>Ctrl + Shift + R</kbd> 或者
<kbd>Ctrl + F5</kbd> 快捷键;
</li>
<li>
在 MacOS 电脑上,同时按下 <kbd>Command + Shift + R</kbd> 或者
<kbd>Command + F5</kbd> 快捷键;
</li>
</ul>
<hr />
<p>
如果强制刷新网页没有解决问题,请尝试<strong>清空本地缓存</strong>,单击下面的按钮可以进入操作页面:
</p>
<div><a class="btn btn-primary" href="/reset">立即清空本地缓存</a></div>
<hr />
<p>
如果这两个办法都不能解决问题,请前辈单击下面的按钮向 CC98
技术支持团队发送邮件,或者用其它方式和管理员取得联系,并通过截图和文字说明详细描述遇到的具体状况。
</p>
<div>
<button
type="button"
class="btn btn-primary"
data-bs-toggle="modal"
data-bs-target="#send-mail-dialog"
>
向技术支持团队发送邮件
</button>
</div>
<hr />
<div class="accordion">
<div class="accordion-item">
<h2 class="accordion-header" id="error-detail-header">
<button
class="accordion-button"
type="button"
data-bs-toggle="collapse"
data-bs-target="#error-detail-panel"
aria-expanded="true"
aria-controls="error-detail-panel"
>
错误详细信息
</button>
</h2>
<div
id="error-detail-panel"
class="accordion-collapse collapse show"
aria-labelledby="error-detail-header"
data-bs-parent="#error-detail-header"
>
<div class="accordion-body">
<div class="alert alert-info">
这里列出的是网站运行的代码遇到的错误详情,如果有需要,前辈可以将这里的内容提供给
CC98
技术团队,以便于他们更好地分析错误。如果前辈是有一定经验的开发人员,也可以尝试通过这些信息找到错误原因并解决问题。
</div>
<dl>
<dt>错误消息</dt>
<dd><code id="error-text"></code></dd>
<dt>错误来源</dt>
<dd><code id="source-text"></code></dd>
<dt>错误堆栈</dt>
<dd><code id="stack-text"></code></dd>
</dl>
</div>
</div>
</div>
</div>
<br />
<br />
</div>
<form action="#" onsubmit="return onFormSubmit(event);">
<div id="send-mail-dialog" class="modal modal-lg fade" tabindex="-1">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">向 CC98 技术支持团队发送邮件</h5>
<button
type="button"
class="btn-close"
data-bs-dismiss="modal"
aria-label="关闭"
></button>
</div>
<div class="modal-body">
<div class="alert alert-info">
为了增加沟通效率,我们提供了一份错误信息的汇总模板。请前辈完善下面的表格,并随后单击<q>生成邮件并发送</q>按钮。前辈填写的内容以及这次错误和详细信息将会一并发送至
<a class="alert-link" href="mailto:[email protected]"
>。
</div>
<div class="mb-3">
<label for="os-input">你使用的电脑的操作系统</label>
<input
id="os-input"
type="text"
class="form-control"
list="os-data-list"
required="required"
placeholder="选择下拉项或者输入自定义内容"
/>
</div>
<div class="mb-3">
<label for="browser-input">你访问 CC98 使用的浏览器</label>
<input
id="browser-input"
type="text"
class="form-control"
list="browser-data-list"
required="required"
placeholder="选择下拉项或者输入自定义内容"
/>
</div>
<div class="mb-3">
<label for="network-input">你访问 CC98 使用的网络环境</label>
<input
id="network-input"
type="text"
class="form-control"
list="network-data-list"
required="required"
placeholder="选择下拉项或者输入自定义内容"
/>
</div>
<div class="mb-3">
<label for="user-name-input">你的 CC98 用户名</label>
<input
id="user-name-input"
type="text"
class="form-control"
required="required"
placeholder=""
/>
<div class="form-text">
如果你是匿名访问或者根本无法登录,请填写<q>未登录</q>。
</div>
</div>
<div class="mb-3">
<label for="step-input">错误发生过程</label>
<textarea
id="step-input"
rows="5"
class="form-control"
required="required"
placeholder="请在这里详细描述错误产生前你在网站中进行了哪些操作。"
></textarea>
</div>
<div class="mb-3">
<label for="remark-input">备注</label>
<textarea
id="remark-input"
rows="3"
class="form-control"
placeholder="你可以在这里面补充其它你认为需要说明的情况。"
></textarea>
</div>
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-primary">生成邮件并发送</button>
<button
type="button"
class="btn btn-secondary"
data-bs-dismiss="modal"
>
关闭
</button>
</div>
</div>
</div>
</div>
</form>
<datalist id="os-data-list">
<option value="Windows"></option>
<option value="Mac OS"></option>
<option value="Linux"></option>
<option value="iOS"></option>
<option value="Android"></option>
</datalist>
<datalist id="browser-data-list">
<option value="Google Chrome"></option>
<option value="Microsoft Edge"></option>
<option value="Mozilla FireFox"></option>
<option value="Safari"></option>
</datalist>
<datalist id="network-data-list">
<option value="校园有线网络"></option>
<option value="校园无线网络"></option>
<option value="RVPN"></option>
<option value="WebVPN"></option>
<option value="5G 校园安全专网"></option>
</datalist>
<script
type="text/javascript"
src="/static/scripts/lib/bootstrap/js/bootstrap.bundle.min.js"
></script>
<script
type="text/javascript"
src="/static/scripts/lib/frowser/es5.js"
onload="return onFrowserLoad(event);"
></script>
<script type="text/javascript">
function init() {
// 未发生错误时跳转回到主页
if (!errorInfo) {
location.href = "/";
} else {
console.log(errorInfo);
}
document.title = "CC98 论坛 - 错误";
document.querySelector("#error-text").innerText = errorInfo.event;
document.querySelector(
"#source-text"
).innerText = `${errorInfo.source} (${errorInfo.line}, ${errorInfo.col})`;
document.querySelector("#stack-text").innerText = `${
(errorInfo.error && errorInfo.error.stack) || "无"
}`;
delete errorInfo;
}
function fallbackCopyTextToClipboard(text) {
const textArea = document.createElement("textarea");
textArea.value = text;
textArea.style.top = "-999";
textArea.style.left = "-999";
textArea.style.width = "1";
textArea.style.height = "1";
textArea.style.position = "fixed";
document.body.appendChild(textArea);
textArea.focus();
textArea.select();
const successful = document.execCommand("copy");
let result;
try {
const successful = document.execCommand("copy");
result = Promise.resolve();
} catch (err) {
result = Promise.reject();
} finally {
document.body.removeChild(textArea);
return result;
}
}
function copyTextToClipboard(text) {
if (!navigator.clipboard) {
return fallbackCopyTextToClipboard(text);
}
return navigator.clipboard.writeText(text);
}
function onFrowserLoad(e) {
// 解析浏览器与操作系统信息
const systemInfo = frowser.parse(window.navigator.userAgent);
// 自动填充部分信息
document.getElementById("os-input").value ||= `${
systemInfo.os.name || ""
} ${systemInfo.os.versionName || systemInfo.os.version || ""}`.trim();
document.getElementById("browser-input").value ||= `${
systemInfo.browser.name || ""
} ${systemInfo.browser.version || ""}`.trim();
}
function onFormSubmit(e) {
// 停止默认提交操作
e.preventDefault();
// 快捷方法
function getValue(selector) {
return (
document.querySelector(selector).value ||
document.querySelector(selector).innerText
);
}
const emailTitle = "CC98 网页发生错误";
const emailBody = [
"CC98 技术支持团队你们好:",
"",
`我的 CC98 用户名是:${getValue("#user-name-input")}`,
`我使用的操作系统是:${getValue("#os-input")}`,
`我使用的浏览器是:${getValue("#browser-input")}`,
`我的网络环境是:${getValue("#network-input")}`,
"",
"我在访问 CC98 网页端时遇到了这个错误,截图如下:",
"",
"",
"错误消息:",
getValue("#error-text"),
"",
"错误来源:",
getValue("#source-text"),
"",
"错误堆栈:",
getValue("#stack-text"),
"",
`发生错误时正在访问的页面:${window.location.href}`,
"",
"我在发生错误前进行了如下操作:",
`${getValue("#step-input")}`,
"",
`其它需要说明的信息:${getValue("#remark-input")}`,
"",
"我已经尝试了页面上给出的所有解决方案,都未能解决这个问题,请问下一步我该如何操作?",
"",
"祝好!",
"",
].join("\n");
let link = `mailto:[email protected]?subject=${encodeURIComponent(
emailTitle
)}&body=${encodeURIComponent(emailBody)}`;
if (link.length < 2000) {
window.location.href = link;
} else {
const illustrativeContent =
"邮件内容模板已复制到剪贴板,请粘贴替换这段文字,并作必要的补充。\n";
link = `mailto:[email protected]?subject=${encodeURIComponent(
emailTitle
)}&body=${encodeURIComponent(illustrativeContent)}`;
copyTextToClipboard(emailBody).then(() => {
window.location.href = link;
});
}
return false;
}
init();
</script>