备案信息添加维护说明 - 离线版

适用于“选择题训练系统 v2.0 在线 H5 扫码版”。

一、当前备案信息

二、涉及文件

三、备案 HTML 内容

ICP备案链接:

<a href="https://beian.miit.gov.cn/" target="_blank" rel="noreferrer">闽ICP备2026023379号</a>

公安备案链接:

<a href="https://beian.mps.gov.cn/#/query/webSearch?code=35012102550517" target="_blank" rel="noreferrer">
  <img src="/beian.png" alt="公安备案图标">
  闽公网安备35012102550517号
</a>

四、推荐实现方式

使用公共脚本 public/beian-footer.js,所有页面只引入:

<script src="/beian-footer.js"></script>

好处:以后备案号、样式、链接变化时,只需要修改一个公共脚本。

五、关键注意事项

不要简单替换第一个 </body>。教师端和学生端页面里有 w.document.write(...</body></html>) 弹窗字符串,错误插入会破坏 JavaScript,导致页面出现 Invalid or unexpected token

正确做法:插入页面最后一个 </body> 前。

idx = s.rfind('</body>')
s = s[:idx] + '<script src="/beian-footer.js"></script>\n' + s[idx:]

六、检查命令

cd /var/www/quiz

ls -lh public/beian.png public/beian-footer.js
file public/beian.png

grep -n "beian-footer.js" public/login.html public/teacher.html public/student.html public/help.html public/admin-guide.html
grep -n "闽ICP备2026023379号\|闽公网安备35012102550517号" public/beian-footer.js

curl -I http://127.0.0.1:3000/beian.png
curl -s http://127.0.0.1:3000/teacher.html?v=beian-check | tail -20
curl -s http://127.0.0.1:3000/student.html?id=66\&v=beian-check | tail -20

七、测试要求