-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
247 lines (237 loc) · 8.99 KB
/
index.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title> UIC 综合评价分数计算器 </title>
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
<style>
html {
position: relative;
min-height: 100%;
}
body {
margin-bottom: 60px; /* Margin bottom by footer height */
}
.scoreCard{
margin: 50px;
}
.noneDisplay{
display: none;
}
.yesDisplay{
display: block;
}
.footer {
position: absolute;
bottom: 0;
width: 100%;
height: 60px; /* Set the fixed height of the footer here */
line-height: 60px; /* Vertically center the text there */
background-color: #f5f5f5;
}
.container {
width: auto;
max-width: 680px;
padding: 0 15px;
}
</style>
</head>
<body>
<div class="container">
<h1 class="mt-5">UIC 综合评价分数计算器</h1>
<small id="emailHelp" class="form-text text-muted">功能非官方提供,本页面不会记录任何信息。</small>
<br>
<form>
<div class="form-group">
<label for="CEEScoreInput">高考成绩<small id="CEEScoreInputLabel" style="color: #ff2843;"></small></label>
<input type="number" max="750" class="form-control" id="CEEScoreInput" aria-describedby="CEEScore" placeholder="请输入高考成绩(不需要换算)" onblur="numericValidate(id)">
</div>
<div class="form-group">
<label for="CEAScoreInput">自主招生面试成绩<small id="CEAScoreInputLabel" style="color: #ff2843;"></small></label>
<input type="text" class="form-control" id="CEAScoreInput" aria-describedby="CEAScore" placeholder="请输入自主招生面试成绩" onblur="numericValidate(id)">
</div>
<div class="form-group">
<label for="ALScore">高二学业水平测等级<small id="ALScoreLabel" style="color: #ff2843;"></small></label>
<input type="text" class="form-control" id="ALScore" aria-describedby="ALScore" placeholder="高二学业水平测等级(如:AAAABB)" onblur="letterValidate(id)">
</div>
<div class="form-check">
<label for="subjectRadio">首选科目</label>
<div>
<input class="form-check-input" style="margin-left: 0rem;" type="radio" name="subjectRadio" id="RadioPhy" value="物理" checked>
<label class="form-check-label" for="RadioPhy">
物理
</label>
</div>
<div class="form-check">
<input class="form-check-input" style="margin-left: 0rem;" type="radio" name="subjectRadio" id="RadioHis" value="历史">
<label class="form-check-label" for="RadioHis">
历史
</label>
</div>
</div>
</form>
<button class="btn btn-primary mt-2" onclick="clickToCal()">计算</button>
<div id="SDC" class="noneDisplay">
<div class="card text-center scoreCard">
<div class="card-block">
<p class="card-text">你的 UIC 综合评价录取成绩为:</p>
<h1 class="card-title" id="scorePlaceholder"></h1>
<div class="progress">
<div class="progress-bar" role="progressbar" id="ceeP" style="width: 15%" aria-valuenow="15" aria-valuemin="0" aria-valuemax="100"></div>
<div class="progress-bar bg-success" role="progressbar" id="ceaP" style="width: 30%" aria-valuenow="30" aria-valuemin="0" aria-valuemax="100"></div>
<div class="progress-bar bg-info" role="progressbar" id="alP" style="width: 20%" aria-valuenow="20" aria-valuemin="0" aria-valuemax="100"></div>
</div>
</div>
</div>
</div>
</div>
<footer class="footer">
<div class="container">
<span class="text-muted">© 2017-2022 UIC HCC Computer Society</span>
<a href="https://admission.uic.edu.cn/undergraduate/zhpj.htm" style="padding-left: 1rem;">计算方法</a>
</div>
</footer>
</body>
<!-- <script src="js/cal.js"></script> -->
<script src="//cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<script>
const cea_bar_1 = 200
const cea_bar_2 = 188
const cee_phy_bar_1 = 508
const cee_phy_bar_2 = 538
const cee_his_bar_1 = 502
const cee_his_bar_2 = 532
function ALFormToScore(){
var levelText = document.getElementById('ALScore').value;
var levelArray = levelText.split("");
var levelScore = 0;
for (var i = 0; i < levelArray.length; i += 1){
if (levelArray[i] === "A"){
levelScore += 75;
}else if (levelArray[i] === "B"){
levelScore += 64;
}else if (levelArray[i] === "C"){
levelScore += 41;
}else if (levelArray[i] === "D"){
levelScore += 19;
}
}
return levelScore / levelArray.length;
}
function numericValidate(element){
var elementText = document.getElementById(element).value;
var labelName = element + "Label";
var score = 750;
if (element === "CEAScoreInput"){
score = 225;
}
if (parseInt(elementText) <= score){
document.getElementById(labelName).innerHTML = "";
}
else {
document.getElementById(element).focus();
document.getElementById(labelName).innerHTML = " 输入有误,请重试";
return -1;
}
}
function letterValidate(element){
let elementText = document.getElementById(element).value;
let labelName = element + "Label";
let status = {'input': true, 'fullfill': true}
const valid_letter = ['A', 'B', 'C', 'D']
if (elementText.length == 6){
for (let i = 0; i < elementText.length; i++){
if (valid_letter.indexOf(elementText[i]) < 0){
status['fullfill'] = false
}
}
} else {
status['input'] = false
}
if (status['input']) {
if (!status['fullfill']) {
document.getElementById(element).focus();
document.getElementById(labelName).innerHTML = " 报考需要学业水平测试成绩在 D 以上(包含D)";
return -1;
} else {
document.getElementById(labelName).innerHTML = "";
}
} else {
document.getElementById(element).focus();
document.getElementById(labelName).innerHTML = " 输入有误,请重试";
return -1;
}
}
function clickToCal(){
let CEAScore = parseInt(document.getElementById("CEAScoreInput").value);
let CEEScore = parseInt(document.getElementById("CEEScoreInput").value);
let ALScore = ALFormToScore();
let finalScore = CEAScore + CEEScore * 0.6 + ALScore;
let radioButtons = document.querySelectorAll('input[name="subjectRadio"]');
let selectedSize;
for (const radioButton of radioButtons) {
if (radioButton.checked) {
selectedSize = radioButton.value;
break;
}
}
if (selectedSize === '物理'){
if (CEAScore >= cea_bar_1){
if (CEEScore >= cee_phy_bar_1){
console.log('OK')
} else {
notAvailableAlert()
return 0
}
} else if (CEAScore >= cea_bar_2 && CEAScore <= cea_bar_1 - 1){
if (CEEScore >= cee_phy_bar_2){
console.log('OK')
} else {
notAvailableAlert()
return 0
}
} else {
notAvailableAlert()
return 0
}
} else {
if (CEAScore >= cea_bar_1){
if (CEEScore >= cee_his_bar_1){
console.log('OK')
} else {
notAvailableAlert()
return 0
}
} else if (CEAScore >= cea_bar_2 && CEAScore <= cea_bar_1 - 1){
if (CEEScore >= cee_his_bar_2){
console.log('OK')
} else {
notAvailableAlert()
return 0
}
} else {
notAvailableAlert()
return 0
}
}
document.getElementById("scorePlaceholder").innerHTML = finalScore.toFixed(1);
barChange("ceeP", CEEScore * 0.6);
barChange("ceaP", CEAScore);
barChange("alP", ALScore);
document.getElementById("SDC").className = "yesDisplay";
}
function barChange(id, score){
document.getElementById(id).style.width = score / 750 * 100 + '%';
}
function notAvailableAlert(){
Swal.fire({
icon: 'info',
title: '抱歉',
text: '您的分数不符合招生要求',
footer: '<a href="https://admission.uic.edu.cn">前往 UIC 招生网</a>'
})
document.getElementById("SDC").classList.remove("yesDisplay");
}
</script>
</html>