Browse Source

demo

master
imp 2 years ago
parent
commit
d702bc4e8d
  1. 64
      index.css
  2. 30
      index.html
  3. 20
      index.js
  4. 2773
      paper/paper_1.js
  5. 0
      paper/paper_2.js
  6. 0
      readme.md

64
index.css

@ -0,0 +1,64 @@
body{
display: flex;
flex-direction: column;
align-items: center;
}
#header {
width: 75%;
margin-top: 30px;
}
#select-text {
width: 100px;
float: left;
line-height:36px;
}
#select {
height: 36px;
line-height:36px;
}
#select-elem {
height: 25px;
width: 100px;
}
#console {
margin-top: 30px;
height: 300px;
width: 75%;
border: 2px solid #2D86EB;
}
#upload-container{
width: 75%;
margin-top: 20px;
height: 50px;
display: flex;
align-items: center;
justify-content: left;
flex-direction: row;
}
#upload-container button{
padding: 10px 25px;
margin-right: 20px;
font-size: 18px;
font-weight: 500;
border: none;
outline: none;
background: #2D86EB;
color: #fff;
border-radius: 5px;
cursor: pointer;
}
#total {
width: 75%;
text-align: left;
font-size: 18px;
font-weight: 500;
margin-top: 30px;
}

30
index.html

@ -4,17 +4,31 @@
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<title>评分系统</title>
<link rel='stylesheet' type='text/css' href="./index.css" />
</head>
<body>
<div id="container">
<label>
<span class="form-label">choose a zip file</span>
<button id="file-input-button">Open...</button>
<input type="file" id="file-input" accept="application/zip" hidden>
</label>
</div>
<div id="header">
<dl>
<dt id="select-text">请选择试卷: </dt>
<dd id="select">
<select id="select-elem">
<option value=1>试题1</option>
<option value=2>试题2</option>
</select>
</dd>
</dl>
</div>
<div id="upload-container">
<button id="file-input-button">上传文件</button>
<input type="file" id="file-input" accept="application/zip" hidden>
<button id="start-score">开始评分</button>
</div>
<div id="console"></div>
<div id="total">
<span>总分:</span>
<span id="total-score">0分</span>
</div>
<!-- zip解压 -->
<script src="./third/zip-no-worker-inflate.min.js"></script>
<!-- 核心代码 -->

20
index.js

@ -1,6 +1,4 @@
(() => {
window.BIScore = window.BIScore || {};
const model = (() => {
return {
@ -23,12 +21,28 @@
zip.configure({
useWebWorkers: false,
});
let report;
const fileInput = document.getElementById("file-input");
const fileInputButton = document.getElementById("file-input-button");
const select = document.getElementById("select-elem");
const startButton = document.getElementById("start-score");
let entries;
let selectedFile;
fileInput.onchange = selectFile;
fileInputButton.onclick = clickInputButton;
startButton.onclick = function () {
const val = select.value;
let total_score = 0;
switch(val) {
case "1":
total_score = new Paper_1(report).score();
break;
case "2":
total_score = new Paper_2(report).score();
break;
}
document.getElementById("total-score").innerText = total_score + "分";
}
function clickInputButton() {
fileInput.dispatchEvent(new MouseEvent("click"))
@ -69,7 +83,7 @@
}
model.getContent(reportEntries[0]).then((content) => {
console.log(JSON.parse(content));
report = JSON.parse(content);
});
}

2773
paper/paper_1.js

File diff suppressed because it is too large Load Diff

0
paper/paper_2.js

Loading…
Cancel
Save