Skip to content

Commit

Permalink
修复
Browse files Browse the repository at this point in the history
  • Loading branch information
SmartHypercube committed Oct 16, 2023
1 parent c3a7fa4 commit 3d592cb
Showing 1 changed file with 34 additions and 23 deletions.
57 changes: 34 additions & 23 deletions frontend/templates/terms.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,34 @@
{% verbatim %}
<div id="app">
<form method="post">
{% endverbatim %}
{% endverbatim %}{% comment %} 用户条款页面支持以下的扩展:
<script id="json-quiz" type="application/json">
{
"questions": [
{
"question": "使用搜索引擎搜索以尝试解题",
"answer": true,
"reason": "使用搜索引擎等通用工具解题是允许的"
},
{
"question": "问做出题目的舍友 flag",
"answer": false,
"reason": "blabla"
},
{
"question": "在群聊中分享自己的解题方法",
"answer": false,
"reason": "blabla"
},
{
"question": "一边听歌一边做题",
"answer": true,
"reason": "blabla"
}
]
}
</script>
{% endcomment %}
{% csrf_token %}
{% for obj in terms %}
<h1>{{ obj.name }}</h1>
Expand Down Expand Up @@ -62,28 +89,12 @@ <h1>{{ obj.name }}</h1>
},
methods: {
init_quiz() {
const quizs = {questions: [
{
question: '使用搜索引擎搜索以尝试解题',
answer: true,
reason: '使用搜索引擎等通用工具解题是允许的',
},
{
question: '问做出题目的舍友 flag',
answer: false,
reason: 'blabla',
},
{
question: '在群聊中分享自己的解题方法',
answer: false,
reason: 'blabla',
},
{
question: '一边听歌一边做题',
answer: true,
reason: 'blabla',
},
]};
const ele = document.getElementById('json-quiz');
if (!ele) {
this.enable_submit = true;
return;
}
const quizs = JSON.parse(ele.textContent);
// comment out this if you don't want to shuffle the quizs.
this.inplace_shuffle(quizs.questions);
this.quizs = quizs;
Expand Down

0 comments on commit 3d592cb

Please sign in to comment.