Browse Source

demo

master
imp 2 years ago
parent
commit
d702bc4e8d
  1. 64
      index.css
  2. 26
      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;
}

26
index.html

@ -4,16 +4,30 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <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" /> <link rel='stylesheet' type='text/css' href="./index.css" />
</head> </head>
<body> <body>
<div id="container"> <div id="header">
<label> <dl>
<span class="form-label">choose a zip file</span> <dt id="select-text">请选择试卷: </dt>
<button id="file-input-button">Open...</button> <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> <input type="file" id="file-input" accept="application/zip" hidden>
</label> <button id="start-score">开始评分</button>
</div>
<div id="console"></div>
<div id="total">
<span>总分:</span>
<span id="total-score">0分</span>
</div> </div>
<!-- zip解压 --> <!-- zip解压 -->
<script src="./third/zip-no-worker-inflate.min.js"></script> <script src="./third/zip-no-worker-inflate.min.js"></script>

20
index.js

@ -1,6 +1,4 @@
(() => { (() => {
window.BIScore = window.BIScore || {};
const model = (() => { const model = (() => {
return { return {
@ -23,12 +21,28 @@
zip.configure({ zip.configure({
useWebWorkers: false, useWebWorkers: false,
}); });
let report;
const fileInput = document.getElementById("file-input"); const fileInput = document.getElementById("file-input");
const fileInputButton = document.getElementById("file-input-button"); const fileInputButton = document.getElementById("file-input-button");
const select = document.getElementById("select-elem");
const startButton = document.getElementById("start-score");
let entries; let entries;
let selectedFile; let selectedFile;
fileInput.onchange = selectFile; fileInput.onchange = selectFile;
fileInputButton.onclick = clickInputButton; 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() { function clickInputButton() {
fileInput.dispatchEvent(new MouseEvent("click")) fileInput.dispatchEvent(new MouseEvent("click"))
@ -69,7 +83,7 @@
} }
model.getContent(reportEntries[0]).then((content) => { 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