Blame view

src/views/basic/askTestQuestion/components/wrongQuestionDialog.vue 23.4 KB
aea3399d   liufangjia   feat: 代码提交
1
  <template>
77fa942a   LH_PC   feat:修改打印对接
2
    <el-dialog :visible.sync="visible" width="70%" :before-close="handleClose" :modal-append-to-body="false">
aea3399d   liufangjia   feat: 代码提交
3
4
      <div class="test-box" v-if="groups">
        <div class="test">
02917cfa   liufangjia   feat: 新增错题组卷
5
          <div class="test-title" @click="enableEditing">
77fa942a   LH_PC   feat:修改打印对接
6
7
            <div class="test-title" v-if="!isEditing" @mouseenter="handleMouseEnter" @mouseleave="handleMouseLeave"
              :class="isHovered ? 'hover' : ''">
aea3399d   liufangjia   feat: 代码提交
8
9
              {{ inputValue }}
            </div>
77fa942a   LH_PC   feat:修改打印对接
10
11
12
13
            <div v-if="isHovered" class="tooltip" :style="{
              top: tooltipPosition.y + 'px',
              left: tooltipPosition.x + 'px',
            }">
02917cfa   liufangjia   feat: 新增错题组卷
14
              单击设置试卷标题
aea3399d   liufangjia   feat: 代码提交
15
            </div>
77fa942a   LH_PC   feat:修改打印对接
16
17
            <el-input class="test-title" ref="editInput" v-if="isEditing" v-model="inputValue" @blur="save"
              @keyup.enter.native="save" style="padding: 0 200px" />
aea3399d   liufangjia   feat: 代码提交
18
19
          </div>
          <div class="test-group">
77fa942a   LH_PC   feat:修改打印对接
20
21
22
23
24
            <div class="outer-item" v-for="(group, index) in groups" :key="group.questionType" :class="{
              border: selectedIndex === group.questionType,
            }" @mouseenter="handleGroupMouseEnter(group.questionType, 'all')" @mouseleave="handleGroupMouseLeave">
              <div v-if="selectedIndex == group.questionType" class="border-del"
                @click="handleDel(group.questionType, 'all')">
aea3399d   liufangjia   feat: 代码提交
25
26
27
                删除
              </div>
              <!-- 每个组的标题 -->
77fa942a   LH_PC   feat:修改打印对接
28
29
30
              <div class="test-group-title" :class="{
                border: selectedIndex == group.questionType,
              }" @mouseenter="handleGroupMouseEnter(group.questionType, 'all')">
aea3399d   liufangjia   feat: 代码提交
31
32
                <div class="size-16" style="font-weight: 600">
                  {{ index + 1 }}、
77fa942a   LH_PC   feat:修改打印对接
33
34
35
36
37
38
39
40
41
42
43
                  <span @mouseenter="(event) => handleItemMouseEnter(event, group.questionType)
                    " @mouseleave="handleItemMouseLeave" :class="isItemHovered == group.questionType ? 'hover' : ''"
                    class="size-16" @click="groupEditing(index)" v-show="!group.input">{{ group.questionTitle }}</span>
  
                  <el-input :ref="'refInput' + index" class="size-16" size="mini" v-show="group.input"
                    v-model="group.questionTitle" @blur="groupSave(index)" @keyup.enter.native="groupSave(index)"
                    style="width: fit-content" />
                  <div v-if="isItemHovered == group.questionType" class="tooltip" :style="{
                    top: tooltipPosition.y + 'px',
                    left: tooltipPosition.x + 'px',
                  }">
02917cfa   liufangjia   feat: 新增错题组卷
44
45
46
                    单击设置试卷标题
                  </div>
  
77fa942a   LH_PC   feat:修改打印对接
47
48
                  <span v-if="group.subQuestionIds" class="size-16" style="margin-left: 10px">(共{{
                    group.subQuestionIds.length }}题 / 共{{
aea3399d   liufangjia   feat: 代码提交
49
                      group.questionScore * group.subQuestionIds.length
77fa942a   LH_PC   feat:修改打印对接
50
                    }}分)</span>
aea3399d   liufangjia   feat: 代码提交
51
52
53
54
                </div>
              </div>
  
              <!-- 内部的题目列表,允许组内排序 -->
77fa942a   LH_PC   feat:修改打印对接
55
56
57
58
59
60
              <div style="display: flex" v-for="question in group.subQuestionIds" :key="question.id" :class="{
                border: selectedItemIndex === question.id,
              }" @mouseenter="handleGroupMouseEnter(question.id, 'number')" @mouseleave="handleGroupMouseLeave"
                class="inner-item">
                <div v-if="selectedItemIndex === question.id" class="border-del"
                  @click="handleDel(question.id, group.questionType)">
aea3399d   liufangjia   feat: 代码提交
61
62
                  删除
                </div>
02917cfa   liufangjia   feat: 新增错题组卷
63
                <div class="size color" style="margin-top: 20px">
77fa942a   LH_PC   feat:修改打印对接
64
                  <div style="max-width: 100px; white-space: nowrap; /* 不换行 */">
02917cfa   liufangjia   feat: 新增错题组卷
65
66
67
                    {{ question.globalIndex }}、
                  </div>
                </div>
aea3399d   liufangjia   feat: 代码提交
68
  
77fa942a   LH_PC   feat:修改打印对接
69
                <iframe :src="question.screenshot" :ref="'iframe' + question.id" @load="onIFrameLoad(question.id)" style="
02917cfa   liufangjia   feat: 新增错题组卷
70
71
72
                    width: 100%;
                    pointer-events: none;
                    border: none; /* 启用点击穿透 */
77fa942a   LH_PC   feat:修改打印对接
73
                  "></iframe>
aea3399d   liufangjia   feat: 代码提交
74
75
76
77
78
              </div>
            </div>
          </div>
        </div>
        <div class="edit">
02917cfa   liufangjia   feat: 新增错题组卷
79
80
          <div class="edit-title">
            <div class="edit-title-info">
77fa942a   LH_PC   feat:修改打印对接
81
              共<span>{{ list.length }}</span>小题,卷面分<span>{{ sumValues() }}</span>分
02917cfa   liufangjia   feat: 新增错题组卷
82
83
            </div>
            <div class="edit-button">
77fa942a   LH_PC   feat:修改打印对接
84
85
86
87
              <el-button class="button-width" type="primary" @click="handleSava">保存试卷</el-button>
              <el-button class="button-width" plain @click="handleSava('print')">保存并打印</el-button>
              <el-button class="button-width" type="danger" plain @click="handleClear">清空题目</el-button>
              <el-button class="button-width" plain @click="handleSelect">继续选题</el-button>
02917cfa   liufangjia   feat: 新增错题组卷
88
89
            </div>
          </div>
aea3399d   liufangjia   feat: 代码提交
90
91
92
          <div class="edit-info">
            <div class="title size color" style="padding: 15px 0 0 10px">
              题目排序
77fa942a   LH_PC   feat:修改打印对接
93
              <span class="title size" style="color: #999999">(拖拽题号可拖拽排序)</span>
aea3399d   liufangjia   feat: 代码提交
94
95
96
            </div>
            <!-- 外层容器,允许拖拽整个组 -->
            <draggable v-model="groups" group="groups" @end="onEnd">
77fa942a   LH_PC   feat:修改打印对接
97
              <div v-for="(group, index) in groups" :key="group.id" class="group-item">
aea3399d   liufangjia   feat: 代码提交
98
99
100
101
102
103
104
                <!-- 每个组的标题 -->
                <div class="group-title">
                  <div class="size" style="font-weight: 600">
                    {{ index + 1 }}、{{ group.questionTitle }}
                  </div>
                  <div class="size">
                    单题分值:
77fa942a   LH_PC   feat:修改打印对接
105
106
                    <el-input-number size="mini" v-model="group.questionScore" :min="1" :max="30"
                      style="width: 100px"></el-input-number>
aea3399d   liufangjia   feat: 代码提交
107
108
109
110
                  </div>
                </div>
  
                <!-- 内部的题目列表,允许组内排序 -->
77fa942a   LH_PC   feat:修改打印对接
111
112
                <draggable class="questions" v-model="group.subQuestionIds" group="questions" @end="onItemEnd(group)">
                  <div v-for="question in group.subQuestionIds" :key="question.id" class="question-item">
aea3399d   liufangjia   feat: 代码提交
113
114
115
116
117
118
119
120
121
122
123
124
125
                    {{ question.globalIndex }}
                  </div>
                </draggable>
              </div>
            </draggable>
          </div>
        </div>
      </div>
  
      <span slot="title" class="title"> 试卷预览 </span>
    </el-dialog>
  </template>
  <script>
02917cfa   liufangjia   feat: 新增错题组卷
126
  import { number } from "echarts";
aea3399d   liufangjia   feat: 代码提交
127
  import draggable from "vuedraggable";
77fa942a   LH_PC   feat:修改打印对接
128
  import { paperPrint } from "@/utils";
aea3399d   liufangjia   feat: 代码提交
129
130
131
132
133
134
135
136
137
138
  export default {
    components: { draggable },
    name: "wrongQuestionDialog",
    props: {
      visible: {
        type: Boolean,
        default() {
          return false;
        },
      },
02917cfa   liufangjia   feat: 新增错题组卷
139
      list: {
aea3399d   liufangjia   feat: 代码提交
140
141
142
143
144
145
146
147
148
149
150
151
152
        // 用于请求详情接口
        type: Array,
        default() {
          return [];
        },
      },
      subjectName: {
        // 科目
        type: String,
        default() {
          return null;
        },
      },
02917cfa   liufangjia   feat: 新增错题组卷
153
154
155
156
157
158
159
      gradeId: {
        // 科目
        type: [String, Number],
        default() {
          return null;
        },
      },
aea3399d   liufangjia   feat: 代码提交
160
161
162
163
164
165
166
167
168
    },
    data() {
      return {
        score: 0, // 分数
        inputValue: " 2024年11月11日数学-错题复习", // 标题
        isEditing: false, // 用于判断是否处于编辑模式
        selectedIndex: null, // 当前选中的外层对象的索引
        selectedItemIndex: null, // 当前选中的内层对象的索引
        isHovered: false, // 用于控制边框和提示文字的显示
02917cfa   liufangjia   feat: 新增错题组卷
169
        isItemHovered: false, // 用于控制边框和提示文字的显示
aea3399d   liufangjia   feat: 代码提交
170
171
        tooltipPosition: { x: 0, y: 0 }, // 提示文字的位置
        time: "",
02917cfa   liufangjia   feat: 新增错题组卷
172
        testData: [], // 存一份list
aea3399d   liufangjia   feat: 代码提交
173
174
175
176
177
178
179
        questionList: [
          { label: "全部", value: null },
          { label: "单选题", value: 2 },
          { label: "多选题", value: 3 },
          { label: "判断题", value: 4 },
          { label: "主观题", value: 5 },
        ],
02917cfa   liufangjia   feat: 新增错题组卷
180
        groups: [],
aea3399d   liufangjia   feat: 代码提交
181
182
183
184
185
186
      };
    },
  
    watch: {
      visible(val) {
        if (val) {
02917cfa   liufangjia   feat: 新增错题组卷
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
          // 上面数据测试
          this.testData = JSON.parse(localStorage.getItem("testData")) || [];
          this.groups = JSON.parse(localStorage.getItem("question")) || [];
          // 如果都没有直接return 执行初始化
          if (this.groups.length == 0) {
            this.init();
            return;
          }
          // 如果一致 就直接赋值
          if (
            this.arraysHaveSameIds(this.testData, this.list) &&
            JSON.parse(localStorage.getItem("question"))
          ) {
            return;
          } else {
            let data = this.findMissingIds(this.testData, this.list);
            this.testAddDel(this.groups, data.addArr, data.delArr);
          }
aea3399d   liufangjia   feat: 代码提交
205
        } else {
02917cfa   liufangjia   feat: 新增错题组卷
206
          this.testDataFun();
aea3399d   liufangjia   feat: 代码提交
207
208
209
210
211
        }
      },
    },
    methods: {
      // 初始化
02917cfa   liufangjia   feat: 新增错题组卷
212
213
      init() {
        console.log("初始化");
aea3399d   liufangjia   feat: 代码提交
214
215
        this.time = this.getFormattedDate();
        this.inputValue = this.time + this.subjectName + "--错题复习";
02917cfa   liufangjia   feat: 新增错题组卷
216
217
218
219
220
221
222
223
224
225
226
227
228
229
        this.groups = this.classifyByType(
          this.list.map((item, index) => {
            return { ...item, globalIndex: index + 1 };
          })
        );
        this.updateGlobalIndexes();
      },
      // 随时保存testData
      testDataFun() {
        this.testData =
          this.groups.reduce((accumulator, current) => {
            return accumulator.concat(current.subQuestionIds);
          }, []) || [];
        localStorage.setItem("testData", JSON.stringify(this.testData));
aea3399d   liufangjia   feat: 代码提交
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
      },
      /** 按钮 - 取消 */
      handleClose() {
        this.$emit("update:visible", false);
      },
      onEnd(event) {
        // 拖拽结束时,更新所有项目的 globalIndex
        this.updateGlobalIndexes();
      },
      onItemEnd() {
        // 每次组内排序结束时,更新所有项目的 globalIndex
        this.updateGlobalIndexes();
      },
      updateGlobalIndexes() {
        if (!this.groups) return;
        // 获取所有组的所有项目
        let allItems = [];
        this.groups.forEach((group) => {
          allItems = allItems.concat(group.subQuestionIds);
        });
        allItems.forEach((item, index) => {
          item.globalIndex = index + 1;
        });
02917cfa   liufangjia   feat: 新增错题组卷
253
        localStorage.setItem("question", JSON.stringify(this.groups));
aea3399d   liufangjia   feat: 代码提交
254
255
256
257
258
259
260
261
262
263
264
265
266
      },
      classifyByType(arr) {
        const result = {};
        arr.forEach((item) => {
          const type = item.questionType;
          if (!result[type]) {
            result[type] = [];
          }
          result[type].push(item);
        });
  
        // 将结果对象转换为数组
        return Object.keys(result).map((type) => ({
02917cfa   liufangjia   feat: 新增错题组卷
267
268
          questionType: type,
          input: false,
aea3399d   liufangjia   feat: 代码提交
269
270
271
272
273
274
          questionTitle: this.questionList.find((item) => item.value == type)
            .label,
          questionScore: 1,
          subQuestionIds: result[type],
        }));
      },
02917cfa   liufangjia   feat: 新增错题组卷
275
276
      onIFrameLoad(id) {
        const iframeRef = this.$refs["iframe" + id][0]; // 获取对应的 iframe
4f72e6da   liufangjia   feat: 代码提交
277
278
279
280
281
282
283
284
285
286
287
288
        const doc = iframeRef.contentDocument || iframeRef.contentWindow.document;
        const body = iframeRef.contentWindow.document.body;
        const height = body.scrollHeight; // 获取内容的高度
        console.log(height, "body高度");
        iframeRef.style.height = `${height}px`; // 设置 iframe 的高度
        // 获取第一个P标签
        const firstP = doc.getElementsByTagName("p")[0];
        // 或者修改第一个 < p > 标签的内容;
        if (firstP) {
          let a = this.processString(firstP.innerHTML);
          firstP.innerHTML = a;
        }
aea3399d   liufangjia   feat: 代码提交
289
290
291
292
293
294
295
296
297
      },
  
      // 启动编辑模式
      enableEditing() {
        this.isEditing = true;
        this.isHovered = false;
        this.$nextTick(() => {
          // 在 DOM 更新完成后让输入框获取焦点
          this.$refs.editInput.focus();
aea3399d   liufangjia   feat: 代码提交
298
299
300
301
302
        });
      },
  
      // 保存修改后的内容,回车或失去焦点时触发
      save() {
aea3399d   liufangjia   feat: 代码提交
303
        this.isEditing = false;
02917cfa   liufangjia   feat: 新增错题组卷
304
        localStorage.setItem("question", JSON.stringify(this.groups));
aea3399d   liufangjia   feat: 代码提交
305
306
307
308
      },
  
      // 单题title修改
      groupEditing(index) {
02917cfa   liufangjia   feat: 新增错题组卷
309
        this.isItemHovered = null;
aea3399d   liufangjia   feat: 代码提交
310
311
312
313
314
315
316
317
318
319
320
        this.$set(this.groups[index], "input", true);
  
        // DOM 更新完成后让对应的输入框获取焦点
        this.$nextTick(() => {
          const refName = `refInput${index}`;
          this.$refs[refName][0].focus(); // 通过动态 ref 获取元素
        });
      },
      // 单体title保存
      groupSave(index) {
        this.$set(this.groups[index], "input", false);
02917cfa   liufangjia   feat: 新增错题组卷
321
        localStorage.setItem("question", JSON.stringify(this.groups));
aea3399d   liufangjia   feat: 代码提交
322
323
324
325
326
327
328
329
330
331
332
333
334
335
      },
      // 高亮
      selectItem(id, type) {
        if (type == "all") {
          this.selectedIndex = id;
          this.selectedItemIndex = null;
        } else {
          this.selectedItemIndex = id;
          this.selectedIndex = null;
        }
      },
      // 删除题目
      handleDel(id, type) {
        if (type == "all") {
02917cfa   liufangjia   feat: 新增错题组卷
336
337
338
339
340
341
342
343
344
          let _index = this.groups.findIndex((item) => item.questionType == id);
          if (_index != -1) {
            this.groups.splice(_index, 1);
            localStorage.setItem("question", JSON.stringify(this.groups));
            this.updateGlobalIndexes();
            this.testDataFun();
            localStorage.setItem("testlist", JSON.stringify(this.testData));
            this.$emit("setQuestions");
          }
aea3399d   liufangjia   feat: 代码提交
345
        } else {
02917cfa   liufangjia   feat: 新增错题组卷
346
347
348
349
350
351
352
353
354
355
356
357
          this.groups.forEach((item) => {
            if (type == item.questionType) {
              item.subQuestionIds = item.subQuestionIds.filter(
                (item) => item.id !== id
              );
            }
          });
          localStorage.setItem("question", JSON.stringify(this.groups));
          this.updateGlobalIndexes();
          this.testDataFun();
          localStorage.setItem("testlist", JSON.stringify(this.testData));
          this.$emit("setQuestions");
aea3399d   liufangjia   feat: 代码提交
358
359
360
        }
      },
      handleMouseEnter(event) {
aea3399d   liufangjia   feat: 代码提交
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
        this.isHovered = true;
        // 计算提示文字位置 (鼠标右下角)
        this.tooltipPosition = {
          x: event.clientX / 2 + 30,
          y: event.clientY / 2 + 30,
        };
        this.selectedIndex = null;
        this.selectedItemIndex = null;
      },
      handleMouseLeave() {
        this.isHovered = false;
      },
  
      getFormattedDate() {
        const today = new Date();
        const year = today.getFullYear(); // 获取年份
        const month = today.getMonth() + 1; // 获取月份(0-11,需要+1)
        const day = today.getDate(); // 获取日期
        return `${year}年${month}月${day}日`;
      },
02917cfa   liufangjia   feat: 新增错题组卷
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
  
      // 接收两个参数
      arraysHaveSameIds(arr1, arr2) {
        // 检查两个数组长度是否相同
        if (arr1.length !== arr2.length) {
          return false;
        }
        // 提取两个数组中所有的 id
        const ids1 = arr1.map((item) => item.id);
        const ids2 = arr2.map((item) => item.id);
        // 将 id 数组排序
        ids1.sort();
        ids2.sort();
        // 比较两个 id 数组是否一致
        for (let i = 0; i < ids1.length; i++) {
          if (ids1[i] !== ids2[i]) {
            return false;
          }
        }
        return true;
      },
      // 接收两个参数
      arrContrast(arr1, arr2) {
        // 如果两个数组的长度不同,直接返回 true
        if (arr1.length !== arr2.length) {
          return true;
        }
  
        // 创建一个 id 集合来存放 arr1 中的 id
        const idsSet1 = new Set(arr1.map((obj) => obj.id));
        // 创建一个 id 集合来存放 arr2 中的 id
        const idsSet2 = new Set(arr2.map((obj) => obj.id));
  
        // 比较两个集合的大小,如果不同,返回 true
        if (idsSet1.size !== idsSet2.size) {
          return true;
        }
  
        // 比较两个集合的内容
        for (const id of idsSet1) {
          if (!idsSet2.has(id)) {
            return true;
          }
        }
  
        // 如果所有的 id 都一致,返回 false
        return false;
      },
      processString(input) {
        // 正则表达式:匹配最多三位数字
        const regex = /^(\d{1,3})/;
  
        // 测试字符串是否以数字开头
        const match = input.match(regex);
  
        if (match) {
          // 如果匹配,去掉开头的数字并返回剩余部分
          return input.substring(match[0].length + 1).trim();
        }
  
        // 如果没有匹配,直接返回原字符串
        return input;
      },
  
      // 接受两个参数,返回需要删除的数据以及需要添加的数据
      findMissingIds(array1, array2) {
        // 找出第一个数组中存在但第二个数组中不存在的 id
        const delArr = array1.filter(
          (item1) => !array2.some((item2) => item2.id === item1.id)
        );
        // 找出第二个数组中存在但第一个数组中不存在的 id
        const addArr = array2.filter(
          (item2) => !array1.some((item1) => item1.id === item2.id)
        );
  
        return {
          delArr,
          addArr,
        };
      },
  
      // 添加,删除
      // 需要的数据,添加的数据,删除的数据
      testAddDel(arr1, arr2, arr3) {
        console.log(arr1, arr3);
        if (arr2 && arr2.length > 0) {
          // 添加数据,如果没有type重新创建一个type
          arr2.forEach((item2) => {
            const typeMatch = arr1.find(
              (item1) => item1.questionType == item2.questionType
            );
            if (typeMatch) {
              typeMatch.subQuestionIds.push(item2);
            } else {
              arr1.push({
                questionType: item2.questionType,
                subQuestionIds: [item2],
                questionTitle: this.questionList.find(
                  (item) => item.value == item2.questionType
                ).label,
                input: false,
                questionScore: 1,
              });
            }
          });
        }
        if (arr3 && arr3.length > 0) {
          // 删除数据
          arr3.forEach((item3) => {
            // 在 array1 中找到匹配的 type
            let matchedArray1Item = arr1.find(
              (item1) => item1.questionType == item3.questionType
            );
            if (matchedArray1Item) {
              // 如果找到了匹配的 type,遍历 matchedArray1Item 的 items
              let _index = matchedArray1Item.subQuestionIds.findIndex(
                (item) => item.id === item3.id
              );
              console.log("_index");
  
              if (_index != -1) {
                matchedArray1Item.subQuestionIds.splice(_index, 1);
              }
            } else {
              return;
            }
          });
        }
  
        this.updateGlobalIndexes();
      },
  
      // 鼠标移入
      handleGroupMouseEnter(id, type) {
        if (type == "all") {
          this.selectedIndex = id;
          this.selectedItemIndex = null;
        } else {
          this.selectedItemIndex = id;
          this.selectedIndex = null;
        }
      },
      // 鼠标离开
      handleGroupMouseLeave() {
        this.selectedIndex = null;
        this.selectedItemIndex = null;
      },
  
      // 小标题移入
      handleItemMouseEnter(event, type) {
        this.tooltipPosition = {
          x: 50,
          y: 40,
        };
  
        this.isItemHovered = type;
      },
      // 小标题移除
      handleItemMouseLeave() {
        this.isItemHovered = null;
      },
  
      // 保存
048689ea   liufangjia   feat: 代码提交
544
      handleSava(type) {
02917cfa   liufangjia   feat: 新增错题组卷
545
546
547
548
549
550
551
552
553
554
        let param = {
          paperTitle: this.inputValue,
          subjectName: this.subjectName,
          gradeId: this.gradeId,
          questions: this.groups.filter((item) => item.subQuestionIds.length > 0),
        };
        this.$request.getWrongQuestionSave(param).then((res) => {
          if (res.status == 0) {
            this.groups = [];
            this.testData = [];
048689ea   liufangjia   feat: 代码提交
555
            localStorage.setItem("testlist", JSON.stringify(this.testData));
02917cfa   liufangjia   feat: 新增错题组卷
556
557
            localStorage.setItem("question", JSON.stringify(this.groups));
            this.$emit("setQuestions");
02917cfa   liufangjia   feat: 新增错题组卷
558
            this.handleClose();
048689ea   liufangjia   feat: 代码提交
559
            if (type) {
77fa942a   LH_PC   feat:修改打印对接
560
561
562
563
564
              this.$request.tPaperDetail({
                paperId: res.data
              }).then(detail => {
                paperPrint(detail.data);
              }); 
048689ea   liufangjia   feat: 代码提交
565
            }
02917cfa   liufangjia   feat: 新增错题组卷
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
          }
        });
      },
  
      // 清空
      handleClear() {
        this.$confirm("确定要清空试题篮内的全部题目吗?", "提示", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning",
        })
          .then(() => {
            this.groups = [];
            this.testDataFun();
            localStorage.setItem("question", JSON.stringify(this.groups));
            localStorage.setItem("testlist", JSON.stringify(this.testData));
            this.$emit("setQuestions");
            this.handleClose();
          })
          .catch(() => {
            console.log("取消");
          });
      },
      // 继续选题
      handleSelect() {
        this.handleClose();
      },
  
      // 计算总分
      sumValues() {
        return this.groups.reduce((sum, item) => {
          return sum + Number(item.questionScore) * item.subQuestionIds.length;
        }, 0);
      },
aea3399d   liufangjia   feat: 代码提交
600
601
602
603
604
605
606
    },
  };
  </script>
  <style lang="scss" scoped>
  .title {
    font-weight: 600;
  }
77fa942a   LH_PC   feat:修改打印对接
607
  
aea3399d   liufangjia   feat: 代码提交
608
609
  .test-box {
    display: flex;
02917cfa   liufangjia   feat: 新增错题组卷
610
    min-height: 742px;
77fa942a   LH_PC   feat:修改打印对接
611
  
aea3399d   liufangjia   feat: 代码提交
612
613
614
    .test {
      flex: 1;
      height: fit-content;
02917cfa   liufangjia   feat: 新增错题组卷
615
      max-height: 742px;
aea3399d   liufangjia   feat: 代码提交
616
617
618
      overflow-y: auto;
      box-shadow: 0 0 10px 0 #999999;
      margin-right: 20px;
02917cfa   liufangjia   feat: 新增错题组卷
619
620
      box-sizing: border-box;
      padding: 0 20px;
77fa942a   LH_PC   feat:修改打印对接
621
  
aea3399d   liufangjia   feat: 代码提交
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
      .test-title {
        font-size: 20px !important;
        font-weight: 700;
        text-align: center;
        color: #000000;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 10px;
      }
  
      .test-name-input {
        padding: 25px 80px 0 80px;
        display: flex;
        justify-content: space-around;
        align-items: center;
      }
77fa942a   LH_PC   feat:修改打印对接
639
  
aea3399d   liufangjia   feat: 代码提交
640
641
      .test-group {
        .test-group-title {
02917cfa   liufangjia   feat: 新增错题组卷
642
643
644
645
          position: relative;
          height: 40px;
          line-height: 30px;
          padding: 10px 0 0 0;
aea3399d   liufangjia   feat: 代码提交
646
647
648
        }
      }
    }
77fa942a   LH_PC   feat:修改打印对接
649
  
aea3399d   liufangjia   feat: 代码提交
650
651
652
653
    .edit {
      width: 400px;
      display: flex;
      flex-direction: column;
77fa942a   LH_PC   feat:修改打印对接
654
  
aea3399d   liufangjia   feat: 代码提交
655
656
657
658
      .edit-title {
        width: 100%;
        height: 200px;
        border: 1px solid #999999;
77fa942a   LH_PC   feat:修改打印对接
659
  
02917cfa   liufangjia   feat: 新增错题组卷
660
661
662
663
664
665
666
667
        .edit-title-info {
          height: 60px;
          width: 100%;
          text-align: center;
          font-weight: 600;
          font-size: 16px !important;
          line-height: 60px;
          color: #000000;
77fa942a   LH_PC   feat:修改打印对接
668
  
02917cfa   liufangjia   feat: 新增错题组卷
669
670
671
672
          span {
            color: rgb(234, 163, 73);
          }
        }
77fa942a   LH_PC   feat:修改打印对接
673
  
02917cfa   liufangjia   feat: 新增错题组卷
674
675
676
677
678
679
        .edit-button {
          box-sizing: border-box;
          padding: 0 20px;
          display: flex;
          flex-wrap: wrap;
          justify-content: space-around;
77fa942a   LH_PC   feat:修改打印对接
680
  
02917cfa   liufangjia   feat: 新增错题组卷
681
682
683
684
685
          .button-width {
            width: 160px !important;
            margin: 10px 0;
          }
        }
aea3399d   liufangjia   feat: 代码提交
686
      }
77fa942a   LH_PC   feat:修改打印对接
687
  
aea3399d   liufangjia   feat: 代码提交
688
689
690
691
      .edit-info {
        flex: 1;
        border: 1px solid #999999;
        margin-top: 20px;
02917cfa   liufangjia   feat: 新增错题组卷
692
        max-height: 500px;
aea3399d   liufangjia   feat: 代码提交
693
694
        padding: 10px;
        overflow: auto;
77fa942a   LH_PC   feat:修改打印对接
695
  
aea3399d   liufangjia   feat: 代码提交
696
        .group-item {
aea3399d   liufangjia   feat: 代码提交
697
698
699
          margin: 10px;
          background: rgba(243, 243, 243, 0.6);
          border-radius: 5px;
77fa942a   LH_PC   feat:修改打印对接
700
  
aea3399d   liufangjia   feat: 代码提交
701
702
703
704
705
706
707
708
          .group-title {
            display: flex;
            align-items: center;
            height: 40px;
            justify-content: space-between;
            cursor: pointer;
          }
        }
77fa942a   LH_PC   feat:修改打印对接
709
  
aea3399d   liufangjia   feat: 代码提交
710
711
712
        .questions {
          display: flex;
          flex-wrap: wrap;
77fa942a   LH_PC   feat:修改打印对接
713
  
aea3399d   liufangjia   feat: 代码提交
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
          .question-item {
            width: 35px;
            height: 35px;
            border: 1px solid rgb(172, 188, 249);
            border-radius: 4px;
            cursor: grab;
            margin: 5px 8px;
            line-height: 35px;
            text-align: center;
            font-size: 16px !important;
          }
        }
  
        .question-item:active {
          cursor: grabbing;
        }
      }
    }
  }
77fa942a   LH_PC   feat:修改打印对接
733
  
aea3399d   liufangjia   feat: 代码提交
734
735
736
  .size {
    font-size: 14px !important;
  }
77fa942a   LH_PC   feat:修改打印对接
737
  
aea3399d   liufangjia   feat: 代码提交
738
739
740
  .color {
    color: #000000;
  }
77fa942a   LH_PC   feat:修改打印对接
741
  
aea3399d   liufangjia   feat: 代码提交
742
743
744
745
746
  .size-16 {
    font-size: 16px !important;
    font-weight: 600;
    color: #333333;
  }
77fa942a   LH_PC   feat:修改打印对接
747
  
aea3399d   liufangjia   feat: 代码提交
748
749
750
751
752
  ::v-deep {
    .el-dialog {
      margin-top: 10vh !important;
    }
  }
77fa942a   LH_PC   feat:修改打印对接
753
  
aea3399d   liufangjia   feat: 代码提交
754
755
756
  .border {
    border: 1px solid rgb(173, 190, 250);
    position: relative;
77fa942a   LH_PC   feat:修改打印对接
757
  
aea3399d   liufangjia   feat: 代码提交
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
    .border-del {
      position: absolute;
      top: -30px;
      right: -1px;
      height: 28px;
      width: fit-content;
      border: 1px solid rgb(173, 190, 250);
      padding: 0 8px;
      color: rgb(67, 141, 255);
      font-size: 14px !important;
      line-height: 28px;
      font-weight: 600;
      cursor: pointer;
    }
  }
77fa942a   LH_PC   feat:修改打印对接
773
  
aea3399d   liufangjia   feat: 代码提交
774
775
776
  .outer-item,
  .inner-item {
    height: fit-content;
02917cfa   liufangjia   feat: 新增错题组卷
777
    margin-bottom: 20px;
aea3399d   liufangjia   feat: 代码提交
778
  }
77fa942a   LH_PC   feat:修改打印对接
779
  
aea3399d   liufangjia   feat: 代码提交
780
781
782
783
784
785
786
787
  .tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 12px !important;
  }
77fa942a   LH_PC   feat:修改打印对接
788
  
aea3399d   liufangjia   feat: 代码提交
789
790
791
  .hover {
    border: 1px solid rgb(115, 142, 246);
    background: rgb(233, 237, 253);
02917cfa   liufangjia   feat: 新增错题组卷
792
793
    width: fit-content;
  }
77fa942a   LH_PC   feat:修改打印对接
794
  
02917cfa   liufangjia   feat: 新增错题组卷
795
796
797
  .title-bg {
    background: rgb(115, 142, 246);
    border-bottom: 1px solid rgb(115, 142, 246);
aea3399d   liufangjia   feat: 代码提交
798
799
  }
  </style>