aea3399d
liufangjia
feat: 代码提交
|
1
2
3
|
<template>
<div class="page-content" v-loading="queryLoading">
<div class="page-title">
|
b754316f
刘有才luck
wip: bug修复
|
4
5
6
7
8
9
10
|
<span class="default-title"
>错题组卷
<span class="font-weight size" style="color: #666666"
>(暂仅包含即时测内使用"导入的试卷"测验后产生的错题,不包含授课端截屏保存的错题)</span
></span
>
|
aea3399d
liufangjia
feat: 代码提交
|
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
<div>
<el-select
v-model="formData.grade"
placeholder=""
style="width: 100px"
@change="changeGrade"
>
<el-option
v-for="item in gradeList"
:key="item.grade"
:label="item.gradeName"
:value="item.grade"
>
</el-option>
</el-select>
<el-select
@change="changeSubject"
v-model="formData.subjectName"
placeholder=""
|
7f6131ad
刘有才luck
wip: bug修复
|
30
|
style="width: 120px; margin-left: 10px"
|
aea3399d
liufangjia
feat: 代码提交
|
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
|
>
<el-option
v-for="(item, index) in subjectList"
:key="index"
:label="item.toString()"
:value="item"
>
</el-option>
</el-select>
</div>
</div>
<div class="info">
<div class="box-search page-padding">
<el-row :gutter="20">
<el-col class="col-margin" :span="24"
><span style="font-weight: 600">班级:</span>
<div
@click="handleClass(item.classId)"
class="select-box"
:class="item.classId === formData.classId ? 'Selected' : ''"
v-for="(item, index) in classList"
:key="index"
>
{{ item.className }}
</div>
</el-col>
<el-col class="col-margin" :span="12">
|
98163298
刘有才luck
wip: bug修复
|
58
|
<span style="font-weight: 600; white-space: nowrap">时间:</span>
|
aea3399d
liufangjia
feat: 代码提交
|
59
|
<el-date-picker
|
048689ea
liufangjia
feat: 代码提交
|
60
|
:clearable="false"
|
aea3399d
liufangjia
feat: 代码提交
|
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
value-format="yyyy-MM-dd"
class="filter-datePicker"
v-model="formData.dateRange"
type="daterange"
range-separator="-"
>
</el-date-picker>
<div
@click="handleDate(item.type)"
class="select-box"
:class="item.type === formData.type ? 'Selected' : ''"
v-for="(item, index) in dateList"
:key="index"
>
{{ item.name }}
</div>
</el-col>
<el-col class="col-margin" :span="8">
<span style="font-weight: 600">得分率:</span>
|
2b8ad65b
刘有才luck
feat: 代码提交
|
80
|
<div style="font-size: 16px !important">
|
aea3399d
liufangjia
feat: 代码提交
|
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
|
<el-input
v-model="formData.startScoreRate"
type="number"
:min="minValue"
:max="maxValue"
@change="startValidateInput(formData.startScoreRate)"
placeholder="请输入一个数字"
style="width: 70px; margin-right: 4px"
></el-input
>% ~
<el-input
v-model="formData.endScoreRate"
type="number"
:min="minValue"
:max="maxValue"
@change="endValidateInput(formData.endScoreRate)"
placeholder="请输入一个数字"
style="width: 70px; margin-right: 4px"
></el-input>
%
</div>
</el-col>
|
7f6131ad
刘有才luck
wip: bug修复
|
103
104
|
<el-col class="col-margin" :span="7"
><span style="font-weight: 600; white-space: nowrap">题型:</span>
|
aea3399d
liufangjia
feat: 代码提交
|
105
106
107
108
109
110
111
112
113
114
|
<div
@click="handleQuestion(item.value)"
class="select-box"
:class="item.value === formData.questionType ? 'Selected' : ''"
v-for="(item, index) in questionList"
:key="index"
>
{{ item.label }}
</div></el-col
>
|
98163298
刘有才luck
wip: bug修复
|
115
|
<el-col class="col-margin" :span="2"
|
aea3399d
liufangjia
feat: 代码提交
|
116
117
118
119
|
><el-button
@click="handleSearch"
style="background: #6b73f5"
type="primary"
|
aea3399d
liufangjia
feat: 代码提交
|
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
|
>筛选错题</el-button
></el-col
>
</el-row>
</div>
<div class="box-info">
<div class="box-info-title">
错题列表
<span
>(共<span style="color: #000000; padding: 0 3px">{{
this.listPage.total
}}</span
>道题)</span
>
</div>
|
2b8ad65b
刘有才luck
feat: 代码提交
|
135
136
137
138
139
140
|
<div
style="text-align: center; line-height: 400px"
v-if="topicList.length < 1"
>
筛选条件下,暂无题目
</div>
|
aea3399d
liufangjia
feat: 代码提交
|
141
142
143
144
|
<div class="topic" v-for="(item, index) in topicList" :key="index">
<div class="topic-title">
<div style="display: flex">
<div style="display: flex; align-items: center">
|
2b8ad65b
刘有才luck
feat: 代码提交
|
145
146
147
|
<span class="size font-weight">
第 {{ item.questionIndex }} 题
</span>
|
aea3399d
liufangjia
feat: 代码提交
|
148
|
<div
|
2b8ad65b
刘有才luck
feat: 代码提交
|
149
|
class="select-box Selected size font-weight"
|
aea3399d
liufangjia
feat: 代码提交
|
150
151
152
153
154
155
156
157
158
159
160
|
style="padding: 3px 5px; margin-right: 20px"
>
{{
questionList.find(
(subItem) => subItem.value == item.questionType
).label
}}
</div>
</div>
<div>
<span class="color size"> 得分率: </span>
|
78ff4d94
刘有才luck
wip: bug修复
|
161
162
163
|
<span class="score-color size"
>{{ formatNumber(item.scoreRate) }}%</span
>
|
2b8ad65b
刘有才luck
feat: 代码提交
|
164
165
166
|
<span class="size font-weight"
>({{ item.joinClassNames }})</span
>
|
aea3399d
liufangjia
feat: 代码提交
|
167
168
169
|
</div>
</div>
<div>
|
2b8ad65b
刘有才luck
feat: 代码提交
|
170
171
172
|
<span class="color size font-weight">来自试卷:</span
><span class="size font-weight">{{ item.paperName }}</span>
<span class="color size font-weight" style="margin-left: 20px"
|
aea3399d
liufangjia
feat: 代码提交
|
173
|
>测试时间:</span
|
2b8ad65b
刘有才luck
feat: 代码提交
|
174
|
><span class="size font-weight">{{ item.testTime }}</span>
|
aea3399d
liufangjia
feat: 代码提交
|
175
176
177
178
|
</div>
</div>
<iframe
|
aea3399d
liufangjia
feat: 代码提交
|
179
|
:src="item.screenshot"
|
02917cfa
liufangjia
feat: 新增错题组卷
|
180
|
:ref="'iframe' + index"
|
7f6131ad
刘有才luck
wip: bug修复
|
181
|
style="width: 100%; border: none; padding: 0 0 0 10px"
|
02917cfa
liufangjia
feat: 新增错题组卷
|
182
|
@load="onIFrameLoad(index)"
|
aea3399d
liufangjia
feat: 代码提交
|
183
184
185
|
/>
<!-- <div class="topic-info" v-html="item.modifiedHtml"></div> -->
<div class="topic-bottom">
|
2b8ad65b
刘有才luck
feat: 代码提交
|
186
|
<div style="padding-left: 20px">
|
f3d1c4ce
liufangjia
feat: 查看解析
|
187
188
|
<span
v-if="item.answerScreenshot"
|
2b8ad65b
刘有才luck
feat: 代码提交
|
189
|
class="knowledge size font-weight"
|
f3d1c4ce
liufangjia
feat: 查看解析
|
190
|
@click="handleAnalysis(item.answerScreenshot)"
|
aea3399d
liufangjia
feat: 代码提交
|
191
192
|
><i class="el-icon-key"></i>查看解析</span
>
|
2b8ad65b
刘有才luck
feat: 代码提交
|
193
194
195
196
197
|
<span class="color size font-weight">知识点:</span>
<span v-if="item.knowledge" class="size">{{
item.knowledge
}}</span>
<span v-else class="size color font-weight">未标注</span>
|
aea3399d
liufangjia
feat: 代码提交
|
198
199
|
</div>
<el-button
|
2b8ad65b
刘有才luck
feat: 代码提交
|
200
|
style="margin-right: 20px"
|
02917cfa
liufangjia
feat: 新增错题组卷
|
201
|
v-if="!questions.some((obj) => item.id === obj.id)"
|
aea3399d
liufangjia
feat: 代码提交
|
202
203
204
205
206
207
208
209
|
class="button"
type="primary"
@click="handleAddTest(item)"
>加入试卷</el-button
>
<el-button
v-else
plain
|
2b8ad65b
刘有才luck
feat: 代码提交
|
210
|
style="padding: 5px 10px; margin-right: 20px"
|
aea3399d
liufangjia
feat: 代码提交
|
211
|
@click="handleDel(item)"
|
b754316f
刘有才luck
wip: bug修复
|
212
|
>移出试卷</el-button
|
aea3399d
liufangjia
feat: 代码提交
|
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
|
>
</div>
</div>
</div>
</div>
<div class="paging">
<div></div>
<el-pagination
@current-change="pageSizeChange"
background
layout="prev, pager, next"
:page-size="listPage.size"
:current-page="listPage.page"
:total="listPage.total"
>
</el-pagination>
<el-button
class="button button-size"
type="primary"
v-if="
!arraysEqual(
topicList.map((item) => item.id),
|
02917cfa
liufangjia
feat: 新增错题组卷
|
236
|
questions.map((item) => item.id)
|
aea3399d
liufangjia
feat: 代码提交
|
237
238
|
)
"
|
2b8ad65b
刘有才luck
feat: 代码提交
|
239
|
style="margin-right: 20px"
|
aea3399d
liufangjia
feat: 代码提交
|
240
241
242
243
244
245
246
247
|
@click="handleAllTest()"
>全选本页</el-button
>
<el-button
@click="handleDelTest()"
class="button-size"
v-else
plain
|
2b8ad65b
刘有才luck
feat: 代码提交
|
248
|
style="padding: 5px 10px; margin-right: 20px"
|
b754316f
刘有才luck
wip: bug修复
|
249
|
>移出本页</el-button
|
aea3399d
liufangjia
feat: 代码提交
|
250
251
252
253
|
>
</div>
<div class="shopping" @click="handleShop">
<div class="shopping-select">{{ questions.length }}</div>
|
df2979bc
刘有才luck
wip: 细节修改
|
254
255
256
257
|
<i
class="el-icon-shopping-cart-full"
style="font-size: 18px !important"
></i>
|
aea3399d
liufangjia
feat: 代码提交
|
258
259
260
261
262
263
264
265
|
<div>
<div class="size">试</div>
<div class="size">题</div>
<div class="size">篮</div>
</div>
</div>
<wrongQuestionDialog
:visible.sync="visible"
|
02917cfa
liufangjia
feat: 新增错题组卷
|
266
|
:list="questions"
|
aea3399d
liufangjia
feat: 代码提交
|
267
|
:subjectName="formData.subjectName"
|
02917cfa
liufangjia
feat: 新增错题组卷
|
268
269
270
|
:sectionId="formData.sectionId"
:gradeId="formData.grade"
@setQuestions="setQuestions"
|
c412d95d
刘有才luck
wip: 代码提交
|
271
|
:userId="userId"
|
aea3399d
liufangjia
feat: 代码提交
|
272
|
/>
|
f3d1c4ce
liufangjia
feat: 查看解析
|
273
274
275
276
|
<analysisDialog
:visible.sync="analysisVisible"
:analysisUrl="analysisUrl"
/>
|
aea3399d
liufangjia
feat: 代码提交
|
277
278
|
</div>
</template>
|
343a33c6
刘有才luck
feat: 代码提交
|
279
280
|
<script>
|
a1adf9e8
刘有才luck
wip: bug修复
|
281
|
import { setDateRules, getKnowledge } from "@/utils";
|
aea3399d
liufangjia
feat: 代码提交
|
282
|
import wrongQuestionDialog from "./components/wrongQuestionDialog.vue";
|
f3d1c4ce
liufangjia
feat: 查看解析
|
283
|
import analysisDialog from "./components/analysisDialog.vue";
|
a1adf9e8
刘有才luck
wip: bug修复
|
284
|
|
aea3399d
liufangjia
feat: 代码提交
|
285
286
287
|
export default {
components: {
wrongQuestionDialog,
|
f3d1c4ce
liufangjia
feat: 查看解析
|
288
|
analysisDialog,
|
aea3399d
liufangjia
feat: 代码提交
|
289
290
291
292
293
294
295
296
|
},
data() {
return {
loading: false,
minValue: 0, // 最小值
maxValue: 100, // 最大值
visible: false, // 购物车弹框控制
queryLoading: false, //loading
|
f3d1c4ce
liufangjia
feat: 查看解析
|
297
298
|
analysisUrl: null, // 解析url
analysisVisible: false, // 解析弹框
|
aea3399d
liufangjia
feat: 代码提交
|
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
|
// 分页
listPage: {
page: 1,
size: 10,
total: 0,
},
// 科目搜索
subjectList: [],
// 年级
gradeList: [],
// 班级选择
classList: [],
// 时间选择
dateList: [
|
aea3399d
liufangjia
feat: 代码提交
|
314
|
{ type: "onWeek", name: "本周" },
|
2b8ad65b
刘有才luck
feat: 代码提交
|
315
|
{ type: "onMonth", name: "本月" },
|
aea3399d
liufangjia
feat: 代码提交
|
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
|
{ type: "term", name: "本学期" },
],
// 题型选择
questionList: [
{ label: "全部", value: null },
{ label: "单选", value: 2 },
{ label: "多选", value: 3 },
{ label: "判断", value: 4 },
{ label: "主观", value: 5 },
],
// 题目列表
topicList: [],
// 搜索内容
formData: {
classId: 1, // 班级选中
// type: "onDay", // 时间类型
|
2b8ad65b
刘有才luck
feat: 代码提交
|
332
|
type: "onWeek", // 时间类型
|
aea3399d
liufangjia
feat: 代码提交
|
333
334
|
dateRange: ["2022-03-01", "2023-05-01"], // 开始结束时间
startScoreRate: 0, // 开始区间
|
d34c8975
刘有才luck
wip: bug修复
|
335
|
endScoreRate: 60, // 结束区间
|
aea3399d
liufangjia
feat: 代码提交
|
336
337
338
339
340
|
questionType: null, // 题型
subjectName: null, // 科目
grade: null, // 年级
gradeName: null, // 年级名称
},
|
c412d95d
刘有才luck
wip: 代码提交
|
341
|
userId: "",
|
02917cfa
liufangjia
feat: 新增错题组卷
|
342
|
questions: [],
|
aea3399d
liufangjia
feat: 代码提交
|
343
344
345
|
};
},
created() {
|
c412d95d
刘有才luck
wip: 代码提交
|
346
347
|
let user = JSON.parse(localStorage.getItem("info"));
this.userId = user.uid;
|
aea3399d
liufangjia
feat: 代码提交
|
348
349
350
|
this.handleDate(this.formData.type);
this.queryLoading = true;
this.getGradeList();
|
c412d95d
刘有才luck
wip: 代码提交
|
351
352
353
354
355
|
if (!localStorage.getItem(this.userId + "testlist")) {
localStorage.setItem(
this.userId + "testlist",
JSON.stringify(this.questions)
);
|
02917cfa
liufangjia
feat: 新增错题组卷
|
356
|
} else {
|
c412d95d
刘有才luck
wip: 代码提交
|
357
358
359
|
this.questions = JSON.parse(
localStorage.getItem(this.userId + "testlist")
);
|
02917cfa
liufangjia
feat: 新增错题组卷
|
360
|
}
|
aea3399d
liufangjia
feat: 代码提交
|
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
|
},
methods: {
async loadAndModifyHTML(array) {
let list = array;
for (let item of list) {
try {
// 使用 fetch 获取 HTML 内容
const response = await fetch(item.screenshot);
const htmlContent = await response.text();
// 创建一个临时的 DOM 节点,方便操作 HTML 内容
const parser = new DOMParser();
const doc = parser.parseFromString(htmlContent, "text/html");
// // 修改 HTML 内容,例如删除第一个 <p> 标签
const firstP = doc.querySelector("p");
// if (firstP) {
// firstP.remove(); // 删除第一个 <p> 标签
// }
// 或者修改第一个 < p > 标签的内容;
// if (firstP) {
// // console.log(firstP.innerHTML);
// let a = this.processString(firstP.innerHTML);
// firstP.innerHTML = a;
// // console.log(firstP.textContent);
// }
// 更新列表中的对象,保存修改后的 HTML
item.modifiedHtml = doc.documentElement.outerHTML; // 或者将 doc.body.innerHTML 保存到 item 中
} catch (error) {
console.error(
`Error fetching or modifying HTML for item ${item.id}:`,
error
);
}
}
return list;
},
// 获取列表
|
d34c8975
刘有才luck
wip: bug修复
|
402
403
404
405
|
async getList(type) {
if (type) {
this.listPage.page = 1;
}
|
aea3399d
liufangjia
feat: 代码提交
|
406
407
408
|
let param = {
...this.listPage,
...this.formData,
|
a1adf9e8
刘有才luck
wip: bug修复
|
409
410
|
startScoreRate: this.formData.startScoreRate.toString(),
endScoreRate: this.formData.endScoreRate.toString(),
|
aea3399d
liufangjia
feat: 代码提交
|
411
412
413
414
415
|
startDate: this.formData.dateRange[0],
endDate: this.formData.dateRange[1],
};
let data = await this.$request.getWrongQuestionList(param);
this.queryLoading = false;
|
a1adf9e8
刘有才luck
wip: bug修复
|
416
417
418
|
this.topicList = data.data.records.map((item) => {
return { ...item, knowledge: getKnowledge(item.knowledge) };
});
|
aea3399d
liufangjia
feat: 代码提交
|
419
420
421
422
423
|
this.listPage.total = data.data.total;
// this.topicList = await this.loadAndModifyHTML(data.data.records);
},
pageSizeChange(value) {
this.listPage.page = value;
|
d34c8975
刘有才luck
wip: bug修复
|
424
|
this.getList();
|
aea3399d
liufangjia
feat: 代码提交
|
425
426
|
},
|
aea3399d
liufangjia
feat: 代码提交
|
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
|
// 班级选中
handleClass(id) {
this.formData.classId = id;
},
// 题型选中
handleQuestion(id) {
this.formData.questionType = id;
},
// 时间选中
handleDate(type) {
this.formData.type = type;
let params = setDateRules(type);
this.formData.dateRange = [params.startDay, params.endDay];
},
// 输入不超过100
startValidateInput(value) {
if (value < this.minValue) {
this.formData.startScoreRate = this.minValue; // 修正值
}
|
aea3399d
liufangjia
feat: 代码提交
|
449
450
451
|
if (value > this.formData.endScoreRate) {
this.formData.startScoreRate = this.formData.endScoreRate;
}
|
6483d769
刘有才luck
feat: 代码提交
|
452
|
|
a1adf9e8
刘有才luck
wip: bug修复
|
453
454
455
|
if (!value) {
this.formData.startScoreRate = 0;
}
|
aea3399d
liufangjia
feat: 代码提交
|
456
457
458
459
460
461
|
},
// 输入不超过100
endValidateInput(value) {
if (value < this.minValue) {
this.formData.endScoreRate = this.minValue; // 修正值
}
|
6483d769
刘有才luck
feat: 代码提交
|
462
|
|
aea3399d
liufangjia
feat: 代码提交
|
463
464
465
|
if (value < this.formData.startScoreRate) {
this.formData.endScoreRate = this.formData.startScoreRate;
}
|
6483d769
刘有才luck
feat: 代码提交
|
466
467
468
|
if (value > this.maxValue) {
this.formData.endScoreRate = this.maxValue; // 修正值
}
|
a1adf9e8
刘有才luck
wip: bug修复
|
469
470
471
|
if (!value) {
this.formData.endScoreRate = 0;
}
|
aea3399d
liufangjia
feat: 代码提交
|
472
473
474
475
476
|
},
// 搜索按钮
handleSearch() {
this.queryLoading = true;
|
d34c8975
刘有才luck
wip: bug修复
|
477
|
this.getList("type");
|
aea3399d
liufangjia
feat: 代码提交
|
478
479
480
481
|
},
// 加入试卷
handleAddTest(item) {
|
02917cfa
liufangjia
feat: 新增错题组卷
|
482
483
|
// if (this.questions.includes(item.id)) return;
if (this.questions.some((obj) => obj.id === item.id)) return;
|
c412d95d
刘有才luck
wip: 代码提交
|
484
485
|
this.questions =
JSON.parse(localStorage.getItem(this.userId + "testlist")) || [];
|
02917cfa
liufangjia
feat: 新增错题组卷
|
486
|
this.questions.push(item);
|
c412d95d
刘有才luck
wip: 代码提交
|
487
488
489
490
|
localStorage.setItem(
this.userId + "testlist",
JSON.stringify(this.questions)
);
|
aea3399d
liufangjia
feat: 代码提交
|
491
492
493
|
},
// 移除试卷
handleDel(item) {
|
02917cfa
liufangjia
feat: 新增错题组卷
|
494
|
let _index = this.questions.findIndex((obj) => obj.id === item.id);
|
aea3399d
liufangjia
feat: 代码提交
|
495
496
|
if (_index !== -1) {
this.questions.splice(_index, 1); // 从索引位置删除一个元素
|
c412d95d
刘有才luck
wip: 代码提交
|
497
498
499
500
|
localStorage.setItem(
this.userId + "testlist",
JSON.stringify(this.questions)
);
|
aea3399d
liufangjia
feat: 代码提交
|
501
502
503
504
505
|
}
},
// 全部选中
handleAllTest() {
// 获取原来的localStorage
|
c412d95d
刘有才luck
wip: 代码提交
|
506
507
|
let list =
JSON.parse(localStorage.getItem(this.userId + "testlist")) || [];
|
aea3399d
liufangjia
feat: 代码提交
|
508
509
|
let ids = this.topicList.map((item) => {
|
02917cfa
liufangjia
feat: 新增错题组卷
|
510
|
return item;
|
aea3399d
liufangjia
feat: 代码提交
|
511
|
});
|
aea3399d
liufangjia
feat: 代码提交
|
512
|
this.questions = this.removeDuplicates([...ids, ...list]);
|
c412d95d
刘有才luck
wip: 代码提交
|
513
514
515
516
|
localStorage.setItem(
this.userId + "testlist",
JSON.stringify(this.questions)
);
|
aea3399d
liufangjia
feat: 代码提交
|
517
518
519
|
},
// 全部删除
handleDelTest() {
|
03105460
刘有才luck
feat: bug修复
|
520
|
let list = this.removeMatchingValues(this.topicList, this.questions);
|
aea3399d
liufangjia
feat: 代码提交
|
521
|
this.questions = list;
|
c412d95d
刘有才luck
wip: 代码提交
|
522
523
524
525
|
localStorage.setItem(
this.userId + "testlist",
JSON.stringify(this.questions)
);
|
aea3399d
liufangjia
feat: 代码提交
|
526
527
528
529
|
},
// 重置 去除locastorage 以及 questions
handleRest() {
this.questions = [];
|
c412d95d
刘有才luck
wip: 代码提交
|
530
531
532
533
|
localStorage.setItem(
this.userId + "testlist",
JSON.stringify(this.questions)
);
|
aea3399d
liufangjia
feat: 代码提交
|
534
535
536
|
},
// 去重
removeDuplicates(arr) {
|
02917cfa
liufangjia
feat: 新增错题组卷
|
537
538
539
540
541
542
543
544
|
const seen = new Set();
return arr.filter((item) => {
if (!seen.has(item.id)) {
seen.add(item.id);
return true;
}
return false;
});
|
aea3399d
liufangjia
feat: 代码提交
|
545
546
547
|
},
// 去除第二数组中存在第一数组中的值
removeMatchingValues(arr1, arr2) {
|
03105460
刘有才luck
feat: bug修复
|
548
549
|
const arr1Ids = arr1.map((item) => item.id);
const res = arr2.filter((item) => !arr1Ids.includes(item.id));
|
aea3399d
liufangjia
feat: 代码提交
|
550
|
|
03105460
刘有才luck
feat: bug修复
|
551
|
return res;
|
aea3399d
liufangjia
feat: 代码提交
|
552
553
554
555
556
557
558
559
560
561
562
563
564
|
},
// 判断第一个数组在第二个种是否全部存在
arraysEqual(arr1, arr2) {
// 将第二个数组转为 Set
const valuesSet = new Set(arr2);
// 判断第一个数组中的值是否都在 Set 中
return arr1.every((value) => valuesSet.has(value));
},
// 购物车触发弹框
handleShop() {
|
343a33c6
刘有才luck
feat: 代码提交
|
565
|
this.visible = true;
|
aea3399d
liufangjia
feat: 代码提交
|
566
567
568
569
|
},
// 获取科目列表
async getSubject(params) {
|
aea3399d
liufangjia
feat: 代码提交
|
570
|
let data = await this.$request.getSubjectList(params);
|
aea3399d
liufangjia
feat: 代码提交
|
571
|
this.subjectList = data.data.subjectNames;
|
aea3399d
liufangjia
feat: 代码提交
|
572
573
574
575
576
577
|
this.formData.subjectName = this.subjectList[0];
this.getClassList();
},
// 获取年级列表
async getGradeList() {
let data = await this.$request.getClassList();
|
aea3399d
liufangjia
feat: 代码提交
|
578
|
this.gradeList = Array.from(
|
47e91913
liufangjia
feat: 代码提交
|
579
|
new Map(data.data.list.map((item) => [item.grade, item])).values()
|
aea3399d
liufangjia
feat: 代码提交
|
580
|
);
|
aea3399d
liufangjia
feat: 代码提交
|
581
|
this.formData.grade = this.gradeList[0].grade;
|
47e91913
liufangjia
feat: 代码提交
|
582
|
this.formData.sectionId = this.gradeList[0].section;
|
aea3399d
liufangjia
feat: 代码提交
|
583
584
585
586
587
588
589
|
this.formData.gradeName = this.gradeList.find(
(itme) => itme.grade == this.formData.grade
).gradeName;
this.getSubject({ gradeName: this.formData.gradeName });
},
// 获取班级信息
async getClassList() {
|
03105460
刘有才luck
feat: bug修复
|
590
|
let data = await this.$request.getGradeList({
|
aea3399d
liufangjia
feat: 代码提交
|
591
592
593
594
595
|
grade: this.formData.grade,
subjectName: this.formData.subjectName,
});
this.classList = [
{ className: "全部", classId: null },
|
03105460
刘有才luck
feat: bug修复
|
596
597
598
|
...data.data.map((item) => {
return { className: item.className, classId: item.id };
}),
|
aea3399d
liufangjia
feat: 代码提交
|
599
600
|
];
this.formData.classId = null;
|
d34c8975
刘有才luck
wip: bug修复
|
601
|
this.getList("type");
|
aea3399d
liufangjia
feat: 代码提交
|
602
603
604
|
},
// 年级改变
|
47e91913
liufangjia
feat: 代码提交
|
605
606
607
608
|
changeGrade(value) {
let item = this.gradeList.find((subItem) => subItem.grade == value);
this.formData.sectionId = item.section;
this.formData.gradeName = item.gradeName;
|
aea3399d
liufangjia
feat: 代码提交
|
609
|
this.queryLoading = true;
|
47e91913
liufangjia
feat: 代码提交
|
610
|
this.getSubject({ gradeName: this.formData.gradeName });
|
aea3399d
liufangjia
feat: 代码提交
|
611
612
613
614
615
616
617
|
},
// 科目改变
changeSubject() {
this.queryLoading = true;
this.getClassList();
},
processString(input) {
|
98163298
刘有才luck
wip: bug修复
|
618
619
620
621
|
const match = input.match(/^(\d{1,3})/);
if (match) {
const matchLength = match[0].length;
input = input.substring(matchLength + 1).trim();
|
adea2553
刘有才luck
feat: 正则修改
|
622
|
}
|
98163298
刘有才luck
wip: bug修复
|
623
|
// 使用正则表达式匹配并处理输入字符串
|
7f6131ad
刘有才luck
wip: bug修复
|
624
|
input = input.replace(/[0-9]+[.).]/, "");
|
98163298
刘有才luck
wip: bug修复
|
625
626
|
input = input.replace(/(\d+(\.\d+)?分)/g, "");
return input.trim();
|
aea3399d
liufangjia
feat: 代码提交
|
627
|
},
|
02917cfa
liufangjia
feat: 新增错题组卷
|
628
629
630
|
// 获取ref
onIFrameLoad(index) {
|
7feaa4bf
刘有才luck
feat: 代码提交
|
631
632
633
|
const iframeRef = this.$refs["iframe" + index][0]; // 获取对应的 iframe
const doc = iframeRef.contentDocument || iframeRef.contentWindow.document;
const body = iframeRef.contentWindow.document.body;
|
df2979bc
刘有才luck
wip: 细节修改
|
634
|
body.style.overflow = "hidden"; // 不允许出现横向滚动条
|
7feaa4bf
刘有才luck
feat: 代码提交
|
635
636
637
638
|
const height = body.offsetHeight; // 获取内容的高度
// console.log("body.offsetHeight:", body.offsetHeight);
// console.log("body.clientHeight:", body.clientHeight);
// console.log("body.scrollHeight:", body.scrollHeight);
|
0b9ef2ed
刘有才luck
feat: bug修复
|
639
|
iframeRef.style.height = `${height + 40}px`; // 设置 iframe 的高度
|
df2979bc
刘有才luck
wip: 细节修改
|
640
|
iframeRef.style.overflow = "hidden"; // 设置 iframe 的高度
|
7feaa4bf
刘有才luck
feat: 代码提交
|
641
642
643
644
645
646
647
|
// 获取第一个P标签
const firstP = doc.getElementsByTagName("p")[0];
// 或者修改第一个 < p > 标签的内容;
if (firstP) {
let a = this.processString(firstP.innerHTML);
firstP.innerHTML = a;
}
|
02917cfa
liufangjia
feat: 新增错题组卷
|
648
649
650
651
|
},
// 子集删除后 父级需要更新
setQuestions() {
|
c412d95d
刘有才luck
wip: 代码提交
|
652
653
|
this.questions =
JSON.parse(localStorage.getItem(this.userId + "testlist")) || [];
|
02917cfa
liufangjia
feat: 新增错题组卷
|
654
|
},
|
f3d1c4ce
liufangjia
feat: 查看解析
|
655
656
657
658
659
660
|
// 查看解析
handleAnalysis(url) {
this.analysisUrl = url;
this.analysisVisible = true;
},
|
78ff4d94
刘有才luck
wip: bug修复
|
661
662
663
664
665
666
667
668
669
670
671
672
|
// 保留两位小数
formatNumber(num) {
// 检查是否是数字
if (typeof num !== "number") {
throw new Error("输入必须是数字");
}
// 检查小数位数
const parts = num.toString().split(".");
if (parts.length === 2 && parts[1].length > 2) {
// 如果小数部分超过两位,保留两位小数
|
78d84757
刘有才luck
wip: bug修复
|
673
|
return Math.round(num * 100) / 100;
|
78ff4d94
刘有才luck
wip: bug修复
|
674
675
676
677
678
|
} else {
// 否则返回原数据
return num;
}
},
|
aea3399d
liufangjia
feat: 代码提交
|
679
680
681
|
},
};
</script>
|
343a33c6
刘有才luck
feat: 代码提交
|
682
683
|
<style lang="scss" scoped>
|
aea3399d
liufangjia
feat: 代码提交
|
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
|
.page-content {
box-sizing: border-box;
padding: 0 20px;
height: 100%;
display: flex;
flex-direction: column;
background-color: #f5f6fa;
font-size: 14px;
color: #000000;
position: relative;
.page-title {
padding: 20px 0;
display: flex;
justify-content: space-between;
}
.info {
flex: 1;
overflow: auto;
display: flex;
flex-direction: column;
.box-search {
background: #ffffff;
border-radius: 5px;
}
.box-info {
margin-top: 15px;
background: #ffffff;
flex: 1;
padding: 10px 20px;
.box-info-title {
|
df2979bc
刘有才luck
wip: 细节修改
|
714
|
font-size: 17px !important;
|
aea3399d
liufangjia
feat: 代码提交
|
715
716
717
|
font-weight: 600;
color: #000000;
span {
|
df2979bc
刘有才luck
wip: 细节修改
|
718
|
font-size: 16px !important;
|
aea3399d
liufangjia
feat: 代码提交
|
719
720
721
722
|
color: #999999;
}
}
.topic {
|
aea3399d
liufangjia
feat: 代码提交
|
723
724
725
|
margin-top: 15px;
display: flex;
flex-direction: column;
|
2b8ad65b
刘有才luck
feat: 代码提交
|
726
|
box-shadow: 0px 0px 9px 0px #cfcfcf;
|
aea3399d
liufangjia
feat: 代码提交
|
727
728
729
730
731
732
733
734
735
736
737
|
border-radius: 5px;
.topic-title {
height: 45px;
background: rgb(243, 243, 243);
display: flex;
justify-content: space-between;
align-items: center;
font-weight: 600;
padding: 0 20px;
border-radius: 5px 5px 0 0;
}
|
aea3399d
liufangjia
feat: 代码提交
|
738
739
740
741
742
|
.topic-bottom {
height: 45px;
display: flex;
align-items: center;
justify-content: space-between;
|
aea3399d
liufangjia
feat: 代码提交
|
743
744
|
font-weight: 600;
box-sizing: border-box;
|
fc3b987b
刘有才luck
wip: ui修复
|
745
|
border-top: 1px dashed #e0dbdb;
|
aea3399d
liufangjia
feat: 代码提交
|
746
747
748
749
750
751
752
753
754
755
756
757
758
|
.knowledge {
color: rgb(105, 134, 205);
margin-right: 30px;
cursor: pointer;
}
}
}
}
}
.paging {
display: flex;
justify-content: space-between;
align-items: center;
|
2b8ad65b
刘有才luck
feat: 代码提交
|
759
|
border-top: 1px solid #cfcfcf;
|
aea3399d
liufangjia
feat: 代码提交
|
760
|
background: #ffffff;
|
aea3399d
liufangjia
feat: 代码提交
|
761
762
763
764
|
padding: 5px 20px 0 20px;
}
.shopping {
|
2b8ad65b
刘有才luck
feat: 代码提交
|
765
|
width: 50px;
|
df2979bc
刘有才luck
wip: 细节修改
|
766
|
height: 140px;
|
aea3399d
liufangjia
feat: 代码提交
|
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
|
position: fixed;
top: 30%;
right: 0;
background: #6b73f5;
border-radius: 10px 0 0 10px;
color: #ffffff;
font-size: 12px !important;
font-weight: 600;
display: flex;
flex-direction: column;
align-items: center;
justify-content: space-around;
box-sizing: border-box;
padding: 10px 0;
text-align: center;
cursor: pointer;
.shopping-select {
|
2b8ad65b
刘有才luck
feat: 代码提交
|
784
785
|
width: 25px;
height: 25px;
|
aea3399d
liufangjia
feat: 代码提交
|
786
|
border-radius: 50%;
|
2b8ad65b
刘有才luck
feat: 代码提交
|
787
788
|
background: #eb5151;
color: #ffffff;
|
aea3399d
liufangjia
feat: 代码提交
|
789
|
font-size: 12px !important;
|
2b8ad65b
刘有才luck
feat: 代码提交
|
790
|
line-height: 25px;
|
aea3399d
liufangjia
feat: 代码提交
|
791
792
|
}
.size {
|
df2979bc
刘有才luck
wip: 细节修改
|
793
|
font-size: 16px !important;
|
aea3399d
liufangjia
feat: 代码提交
|
794
795
796
797
798
799
800
801
802
803
804
805
|
}
}
}
.page-padding {
box-sizing: border-box;
padding: 14px 20px;
}
.col-margin {
margin: 10px 0;
display: flex;
align-items: center;
|
2b8ad65b
刘有才luck
feat: 代码提交
|
806
|
font-size: 16px !important;
|
aea3399d
liufangjia
feat: 代码提交
|
807
808
809
810
811
812
813
814
815
|
}
.button {
background: #6b73f5;
padding: 5px 10px;
}
.select-box {
padding: 5px 10px;
border-radius: 5px;
margin: 0 8px;
|
2b8ad65b
刘有才luck
feat: 代码提交
|
816
|
font-size: 16px !important;
|
aea3399d
liufangjia
feat: 代码提交
|
817
|
cursor: pointer;
|
2fd57d1f
liufangjia
wip: 代码提交
|
818
819
|
white-space: nowrap;
width: fit-content;
|
aea3399d
liufangjia
feat: 代码提交
|
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
|
}
.Selected {
background: rgba(223, 229, 253, 1);
color: rgb(105, 134, 205);
cursor: pointer;
}
.color {
color: #999999;
}
.score-color {
color: rgb(234, 160, 73);
margin-right: 10px;
}
.size {
|
df2979bc
刘有才luck
wip: 细节修改
|
835
|
font-size: 16px !important;
|
aea3399d
liufangjia
feat: 代码提交
|
836
|
}
|
2b8ad65b
刘有才luck
feat: 代码提交
|
837
838
839
840
841
842
843
844
845
846
847
|
.font-weight {
font-weight: 400;
}
.filter-datePicker {
font-size: 16px !important;
}
::v-deep .el-button {
span {
font-size: 16px !important;
}
}
|
343a33c6
刘有才luck
feat: 代码提交
|
848
|
</style>
|