奥兰系统打分

奥兰系统一键打分

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
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
// ==UserScript==
// @name 综合测评一键打满分助手
// @namespace https://tampermonkey.net/
// @version 1.0
// @description 在综合测评页面添加图形化面板,一键填写所有同学满分
// @author yanyuhua
// @match *://wxstu.cwxu.edu.cn/*
// @grant none
// ==/UserScript==

(function () {
'use strict';

/**
* 默认分数配置
* cp1: 思想道德修养,总分6分
* cp2: 人生规划,总分6分
* cp3: 学习态度,总分6分
* cp4: 科学人文素养,总分6分
* cp5: 身心健康,总分6分
* cp6: 创新意识及社会工作/社会实践活动表现,总分5分
*/
const defaultScores = {
cp1: 6,
cp2: 6,
cp3: 6,
cp4: 6,
cp5: 6,
cp6: 5
};

function triggerEvents(el) {
const events = ['input', 'change', 'keyup', 'blur'];
events.forEach(type => {
el.dispatchEvent(new Event(type, { bubbles: true }));
});
}

function getScoreConfig() {
return {
cp1: document.querySelector('#tm_score_cp1')?.value || defaultScores.cp1,
cp2: document.querySelector('#tm_score_cp2')?.value || defaultScores.cp2,
cp3: document.querySelector('#tm_score_cp3')?.value || defaultScores.cp3,
cp4: document.querySelector('#tm_score_cp4')?.value || defaultScores.cp4,
cp5: document.querySelector('#tm_score_cp5')?.value || defaultScores.cp5,
cp6: document.querySelector('#tm_score_cp6')?.value || defaultScores.cp6
};
}

function fillScores() {
const scores = getScoreConfig();

let count = 0;

const inputs = document.querySelectorAll('input[id^="MyDataGrid__ctl"][id*="_cp"][id$="_2"]');

inputs.forEach(input => {
const match = input.id.match(/_cp([1-6])_2$/);
if (!match) return;

const cpKey = `cp${match[1]}`;
input.value = scores[cpKey];
triggerEvents(input);
count++;
});

updateStatus(`已填写 ${count} 个评分框`);
}

function clearScores() {
const inputs = document.querySelectorAll('input[id^="MyDataGrid__ctl"][id*="_cp"][id$="_2"]');

inputs.forEach(input => {
input.value = '';
triggerEvents(input);
});

updateStatus(`已清空 ${inputs.length} 个评分框`);
}

function countStudents() {
const students = document.querySelectorAll('span[id^="MyDataGrid__ctl"][id$="_txxm"]');
return students.length;
}

function countInputs() {
return document.querySelectorAll('input[id^="MyDataGrid__ctl"][id*="_cp"][id$="_2"]').length;
}

function updateStatus(text) {
const status = document.querySelector('#tm_score_status');
if (status) {
status.textContent = text;
}
}

function createPanel() {
const panel = document.createElement('div');
panel.id = 'tm_score_panel';

panel.innerHTML = `
<div id="tm_score_header">综合测评打分助手</div>

<div class="tm-row">
<span>思想道德修养</span>
<input id="tm_score_cp1" type="number" value="${defaultScores.cp1}" step="0.1">
</div>

<div class="tm-row">
<span>人生规划</span>
<input id="tm_score_cp2" type="number" value="${defaultScores.cp2}" step="0.1">
</div>

<div class="tm-row">
<span>学习态度</span>
<input id="tm_score_cp3" type="number" value="${defaultScores.cp3}" step="0.1">
</div>

<div class="tm-row">
<span>科学人文素养</span>
<input id="tm_score_cp4" type="number" value="${defaultScores.cp4}" step="0.1">
</div>

<div class="tm-row">
<span>身心健康</span>
<input id="tm_score_cp5" type="number" value="${defaultScores.cp5}" step="0.1">
</div>

<div class="tm-row">
<span>创新/社会实践</span>
<input id="tm_score_cp6" type="number" value="${defaultScores.cp6}" step="0.1">
</div>

<div class="tm-info">
检测到同学:<b id="tm_student_count">${countStudents()}</b> 人<br>
检测到评分框:<b id="tm_input_count">${countInputs()}</b> 个
</div>

<button id="tm_fill_full">一键填写</button>
<button id="tm_clear_scores">清空评分</button>

<div id="tm_score_status">等待操作</div>
`;

const style = document.createElement('style');
style.textContent = `
#tm_score_panel {
position: fixed;
right: 20px;
bottom: 20px;
width: 260px;
background: #ffffff;
border: 2px solid #4a90e2;
border-radius: 10px;
box-shadow: 0 4px 16px rgba(0,0,0,0.25);
z-index: 999999;
font-size: 14px;
color: #333;
font-family: "Microsoft YaHei", Arial, sans-serif;
overflow: hidden;
}

#tm_score_header {
background: #4a90e2;
color: white;
padding: 10px;
font-size: 16px;
font-weight: bold;
text-align: center;
cursor: move;
user-select: none;
}

#tm_score_panel .tm-row {
display: flex;
align-items: center;
justify-content: space-between;
padding: 6px 10px;
border-bottom: 1px solid #eee;
}

#tm_score_panel .tm-row span {
flex: 1;
}

#tm_score_panel .tm-row input {
width: 60px;
padding: 4px;
text-align: center;
border: 1px solid #aaa;
border-radius: 4px;
}

#tm_score_panel .tm-info {
padding: 8px 10px;
background: #f7f7f7;
line-height: 1.6;
font-size: 13px;
}

#tm_score_panel button {
width: calc(100% - 20px);
margin: 6px 10px;
padding: 8px;
border: none;
border-radius: 5px;
cursor: pointer;
color: white;
font-size: 14px;
}

#tm_fill_full {
background: #28a745;
}

#tm_fill_full:hover {
background: #218838;
}

#tm_clear_scores {
background: #dc3545;
}

#tm_clear_scores:hover {
background: #c82333;
}

#tm_score_status {
padding: 8px 10px 10px;
text-align: center;
color: #666;
font-size: 13px;
}
`;

document.body.appendChild(style);
document.body.appendChild(panel);

document.querySelector('#tm_fill_full').addEventListener('click', fillScores);
document.querySelector('#tm_clear_scores').addEventListener('click', clearScores);

makeDraggable(panel, document.querySelector('#tm_score_header'));
}

function makeDraggable(panel, handle) {
let isDragging = false;
let offsetX = 0;
let offsetY = 0;

handle.addEventListener('mousedown', function (e) {
isDragging = true;
offsetX = e.clientX - panel.offsetLeft;
offsetY = e.clientY - panel.offsetTop;
panel.style.right = 'auto';
panel.style.bottom = 'auto';
document.body.style.userSelect = 'none';
});

document.addEventListener('mousemove', function (e) {
if (!isDragging) return;
panel.style.left = `${e.clientX - offsetX}px`;
panel.style.top = `${e.clientY - offsetY}px`;
});

document.addEventListener('mouseup', function () {
isDragging = false;
document.body.style.userSelect = '';
});
}

function init() {
if (document.querySelector('#tm_score_panel')) return;
createPanel();
}

if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', init);
} else {
init();
}

})();