Blame view

src/views/test/index.vue 35.5 KB
4c4f7640   梁保满   路由表,路由前端文件
1
  <template>
aed43d3a   阿宝   即时测修改答案
2
    <div class="page-container">
f356590c   阿宝   即时测列表,分析页面
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
      <back-box>
        <template slot="title">
          <span>即时测-数据报表</span>
        </template>
      </back-box>
      <div class="answer-header">
        <div class="sel-box">
          <el-select
            class="sel"
            v-model="query.classId"
            placeholder="选择班级"
            @change="changClazz"
          >
            <el-option
              v-for="item in classList"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            >
            </el-option>
          </el-select>
          <el-select
            v-if="role == 'ROLE_BANZHUREN'"
            class="sel"
            multiple
            collapse-tags
            v-model="query.subjectId"
45504a95   阿宝   即时测页面,以及小题修改答案
30
            placeholder="选择科目"
f356590c   阿宝   即时测列表,分析页面
31
32
33
34
35
36
37
38
39
40
41
42
43
44
            @change="_QueryData"
          >
            <el-option
              v-for="item in subjectList"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            >
            </el-option>
          </el-select>
          <el-select
            v-else
            class="sel"
            v-model="query.subjectId"
45504a95   阿宝   即时测页面,以及小题修改答案
45
            placeholder="选择科目"
f356590c   阿宝   即时测列表,分析页面
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
            @change="_QueryData"
          >
            <el-option
              v-for="item in subjectList"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            >
            </el-option>
          </el-select>
          <div class="d1">
            <el-date-picker
              v-model="query.startDay"
              type="date"
              @change="handleChangeTimeStart"
              placeholder="选择日期时间"
              value-format="yyyy-MM-dd"
            >
            </el-date-picker>
            ~
            <el-date-picker
              v-model="query.endDay"
              type="date"
              placeholder="选择日期时间"
              @change="handleChangeTimeEnd"
              value-format="yyyy-MM-dd"
            >
            </el-date-picker>
          </div>
          <p class="p1">
            <span @click="setDate(1)" :class="[date == 1 ? 'active' : '', 's1']"
              >今天</span
            >
            <span @click="setDate(2)" :class="[date == 2 ? 'active' : '', 's1']"
              >本周</span
            >
            <span @click="setDate(3)" :class="[date == 3 ? 'active' : '', 's1']"
              >本月</span
            >
            <span @click="setDate(4)" :class="[date == 4 ? 'active' : '', 's1']"
              >本季度</span
            >
          </p>
          <el-button type="primary" round @click="_QueryData()">筛选</el-button>
        </div>
      </div>
      <div class="table-box">
        <el-radio-group v-model="tabIndex" style="margin-bottom: 20px">
          <el-radio-button :label="1">单卷测练报表</el-radio-button>
          <el-radio-button :label="2">阶段测练报表</el-radio-button>
        </el-radio-group>
        <div v-if="tabIndex == 1">
          <el-table
            :data="tableData"
            border
            style="width: 100%"
            :default-sort="{ prop: '', order: 'descending' }"
          >
            <el-table-column
              prop="title"
              label="试卷名称"
              align="center"
            ></el-table-column>
            <el-table-column
              prop="totalScore"
              label="卷面分"
              align="center"
              width="100"
            ></el-table-column>
            <el-table-column
              prop="ceyan"
              label="测验人数"
              align="center"
            ></el-table-column>
            <el-table-column
              prop="shijian"
              label="测验时间"
              align="center"
            ></el-table-column>
            <el-table-column
              prop="pingjun"
              label="班平均分"
              align="center"
            ></el-table-column>
            <el-table-column
              prop="zuigao"
              label="班最高分"
              align="center"
            ></el-table-column>
            <el-table-column
              prop="zuidi"
              label="班最低分"
              align="center"
            ></el-table-column>
            <el-table-column
              prop="youxiu"
              label="优秀数(率)"
              sortable
              align="center"
              ><template slot-scope="scoped"
                >{{ scoped.row.youxiu }}%</template
              ></el-table-column
            >
            <el-table-column
              prop="lianghao"
              label="良好数(率)"
              sortable
              align="center"
              ><template slot-scope="scoped"
                >{{ scoped.row.lianghao }}%</template
              ></el-table-column
            >
            <el-table-column
              prop="jige"
              label="及格数(率)"
              sortable
              align="center"
              ><template slot-scope="scoped"
                >{{ scoped.row.jige }}%</template
              ></el-table-column
            >
            <el-table-column
              prop="bujige"
              label="不及格数(率)"
              sortable
              align="center"
              ><template slot-scope="scoped"
                >{{ scoped.row.bujige }}%</template
              ></el-table-column
            >
            <el-table-column label="操作" align="center">
              <template slot-scope="scoped">
45504a95   阿宝   即时测页面,以及小题修改答案
178
                <el-tooltip effect="dark" content="详情" placement="top">
f356590c   阿宝   即时测列表,分析页面
179
180
181
182
183
184
185
186
                  <el-button
                    type="primary"
                    circle
                    size="mini"
                    icon="fa fa-arrow-right"
                    @click="linkTo(scoped.row)"
                  ></el-button>
                </el-tooltip>
45504a95   阿宝   即时测页面,以及小题修改答案
187
                <el-tooltip effect="dark" content="修改答案" placement="top">
f356590c   阿宝   即时测列表,分析页面
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
                  <el-button
                    type="primary"
                    circle
                    size="mini"
                    icon="fa fa-file-text"
                    @click="edit(scoped.row)"
                  ></el-button>
                </el-tooltip>
              </template>
            </el-table-column>
          </el-table>
        </div>
        <div v-if="tabIndex == 2">
          <el-table
            :data="tableStage"
            border
            style="width: 100%"
            :default-sort="{ prop: '', order: 'descending' }"
          >
            <el-table-column
              prop="xuehao"
              label="学号"
              align="center"
              fixed
            ></el-table-column>
            <el-table-column
              prop="xingming"
              label="姓名"
              fixed
              align="center"
            ></el-table-column>
            <el-table-column label="阶段汇总" align="center">
              <el-table-column
                prop="totalScore"
                label="总分"
                align="center"
              ></el-table-column>
              <el-table-column
                prop="rank"
                label="排名"
                align="center"
              ></el-table-column>
            </el-table-column>
            <el-table-column
              align="center"
              v-for="(item, index) in answerList"
              :key="index"
              :label="item.title"
            >
              <el-table-column
                :prop="item.title + 'totalScore'"
                label="成绩"
                align="center"
              ></el-table-column>
              <el-table-column
                :prop="item.title + 'rank'"
                label="班名"
                align="center"
              ></el-table-column>
            </el-table-column>
          </el-table>
        </div>
        <p class="down" v-if="tabIndex == 2">
          <el-button type="info" plain round icon="fa fa-cloud-download"
            >导出报表</el-button
          >
        </p>
      </div>
aed43d3a   阿宝   即时测修改答案
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
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
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
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
      <div class="edit-dia" v-show="dialogVisible" height="100%">
        <div class="back">
          <div class="back-l" @click="dialogVisible = false">
            <i class="fa fa-mail-reply-all"></i>
            <p>修改答案</p>
          </div>
        </div>
        <div class="form-box">
          <div class="answer-title">
            <p class="name">{{ form.title }}</p>
            <p class="totals">卷面总分:{{ form.score }}分</p>
          </div>
          <div v-if="questionList && questionList.length">
            <div v-for="(question, index) in questionList" :key="index">
              <p class="question-title">
                <span>{{ setBigNum(index) }}、</span>
                <span class="title-txt">{{ question.questionTitle }}</span>
                <span>共 {{ question.score }} 分</span>
              </p>
              <ul class="questions-ul">
                <li class="sub-questions">
                  <div class="qs-num">题号</div>
                  <div class="qs-type">题型</div>
                  <div class="qs-score">分数</div>
                  <div class="qs-partScore">漏选得分</div>
                  <div class="qs-options qs-options2">选项设置</div>
                </li>
                <li
                  v-for="(subQuestions, indexs) in question.subQuestions"
                  :key="indexs"
                >
                  <p
                    class="set-ans-btn"
                    v-if="
                      subQuestions.qusType &&
                      subQuestions.subNum &&
                      subQuestions.subNum > 4
                    "
                  >
                    <el-button type="primary" @click="setFormAns(index, indexs)"
                      >批量设置答案</el-button
                    >
                  </p>
                  <div v-else class="sub-questions">
                    <div class="qs-num">{{ subQuestions.questionIndex }}</div>
                    <div class="qs-type">
                      {{ setSubPro(subQuestions.questionType) }}
                    </div>
                    <div class="qs-score">
                      {{ subQuestions.score }}
                    </div>
                    <div class="qs-partScore">
                      <p v-if="subQuestions.questionType != 3">--</p>
                      <p v-else>{{ subQuestions.partScore }}</p>
                    </div>
                    <div class="qs-options qs-options2">
                      <p v-if="subQuestions.questionType == 5">--</p>
                      <p v-if="subQuestions.questionType == 4" class="answer-box">
                        <span
                          class="answer-s"
                          :class="subQuestions.correctAnswer == 1 ? 'active' : ''"
                          @click="subQuestions.correctAnswer = 1"
                          >✓</span
                        >
                        <span
                          class="answer-s"
                          :class="subQuestions.correctAnswer == 2 ? 'active' : ''"
                          @click="subQuestions.correctAnswer = 2"
                          >✗</span
                        >
                      </p>
                      <p v-if="subQuestions.questionType == 3" class="answer-box">
                        <template
                          v-for="option in subQuestions.answerOptions.split(',')"
                        >
                          <span
                            v-if="option"
                            class="answer-s"
                            :class="
                              subQuestions.correctAnswer.includes(option)
                                ? 'active'
                                : ''
                            "
                            :key="option"
                            @click="changAnswer(subQuestions, option)"
                            >{{ option }}</span
                          >
                        </template>
                      </p>
                      <p v-if="subQuestions.questionType == 2" class="answer-box">
                        <template
                          v-for="option in subQuestions.answerOptions.split(',')"
                        >
                          <span
                            class="answer-s"
                            v-if="option"
                            :class="
                              subQuestions.correctAnswer == option ? 'active' : ''
                            "
                            :key="option"
                            @click="subQuestions.correctAnswer = option"
                            >{{ option }}</span
                          >
                        </template>
                      </p>
                    </div>
                  </div>
                </li>
              </ul>
            </div>
          </div>
          <div class="btn-box">
            <el-button type="danger" plain round @click="dialogVisible = false"
              >取消</el-button
            >
            <el-button type="primary" round @click="saveAnswer">保存</el-button>
          </div>
        </div>
      </div>
      <el-dialog title="批量设置答案" :visible.sync="diaSetAns" width="400">
        <div class="qs-options">
          <p class="dia-tips">
            请点击选项按钮设置答案,多选题题目之间用“,”隔开,若添加5道题:“AC,AD,BD,AC,CD”
          </p>
          <p>{{ setSubPro(formAns.qusType) }}:</p>
          <p class="ipt">
            <el-input
              v-model="formAns.answerList"
              @keydown.native="keydownAnswer($event)"
            ></el-input>
          </p>
          <p class="answer-box">
            <template v-if="formAns.qusType == 4">
              <span
                class="answer-s active"
                @click="
                  formAns.answerList.length < formAns.subNum
                    ? (formAns.answerList += '✓')
                    : ''
                "
                >✓</span
              >
              <span
                class="answer-s active"
                @click="
                  formAns.answerList.length < formAns.subNum
                    ? (formAns.answerList += '✗')
                    : ''
                "
                >✗</span
              >
            </template>
            <template v-if="formAns.qusType == 3">
              <span
                class="answer-s active"
                v-for="option in formAns.answerOptions"
                :key="option"
                @click="setMultiple(formAns, option)"
                >{{ option }}</span
              >
              <span
                class="answer-s active"
                @click="
                  formAns.answerList.split(',').length < formAns.subNum
                    ? (formAns.answerList += ',')
                    : ''
                "
                >,</span
              >
            </template>
            <template v-if="formAns.qusType == 2" class="answer-box">
              <span
                class="answer-s active"
                v-for="option in formAns.answerOptions"
                :key="option"
                @click="
                  formAns.answerList.length < formAns.subNum
                    ? (formAns.answerList += option)
                    : ''
                "
                >{{ option }}</span
              >
            </template>
            <span
              class="answer-s delButton"
              @click="formAns.answerList = formAns.answerList.slice(0, -1)"
              >x</span
            >
          </p>
        </div>
        <div class="dialog-footer" slot="footer">
          <el-button @click="saveFormAns">确 定</el-button>
          <el-button @click="diaSetAns = false">取 消</el-button>
        </div>
      </el-dialog>
4c4f7640   梁保满   路由表,路由前端文件
451
452
453
454
    </div>
  </template>
  
  <script>
f356590c   阿宝   即时测列表,分析页面
455
  import { formatDate, deepClone, checkAnswer } from "utils";
4c4f7640   梁保满   路由表,路由前端文件
456
  export default {
f356590c   阿宝   即时测列表,分析页面
457
458
459
460
461
    data() {
      return {
        role: "",
        loading: false,
        dialogVisible: false,
aed43d3a   阿宝   即时测修改答案
462
463
464
465
466
467
468
469
470
471
472
        diaSetAns: false,
        form: {},
        questionList: [],
        formAns: {
          listIndex: 0, //大题位置
          endIndex: 0, //相同题目最后一位题目的questionIndex
          qusType: "", //题目类型
          subNum: 0, //数量
          answerOptions: [], //答案选项
          answerList: "", //答案列表-字符串
        },
f356590c   阿宝   即时测列表,分析页面
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
        date: "", //今天-昨天-本周
        query: {
          //搜索条件
          classId: "",
          subjectId: "",
          startDay: "",
          endDay: "",
          day: "",
        },
        classList: [], //班级
        subjectList: [], //科目
        tabIndex: 1, //选项卡
        tableData: [
          {
            title: "试卷一",
            totalScore: 10,
            ceyan: "40/50",
            shijian: "2022-11-9 21:30至22:30",
            pingjun: 60,
            zuigao: 90,
            zuidi: 50,
            youxiu: 50,
            lianghao: 40,
            jige: 30,
            bujige: 20,
dd5150c5   阿宝   数据同步
498
499
500
501
502
503
504
505
506
507
508
            questionList: [
              {
                questionTitle: "f",
                score: 1,
                subQuestions: [
                  {
                    questionIndex: 1,
                    questionType: 2,
                    score: 1,
                    partScore: 0,
                    selectNum: 4,
aed43d3a   阿宝   即时测修改答案
509
                    answerOptions: "A, B, C, D",
dd5150c5   阿宝   数据同步
510
511
512
513
514
515
516
517
                    correctAnswer: "B",
                  },
                  {
                    questionIndex: 2,
                    questionType: 2,
                    score: 1,
                    partScore: 0,
                    selectNum: 4,
aed43d3a   阿宝   即时测修改答案
518
                    answerOptions: "A, B, C, D,E,F",
dd5150c5   阿宝   数据同步
519
520
521
                    correctAnswer: "A",
                  },
                  {
aed43d3a   阿宝   即时测修改答案
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
                    questionIndex: 3,
                    questionType: 2,
                    score: 1,
                    partScore: 0,
                    selectNum: 4,
                    answerOptions: "A, B, C, D,E,F",
                    correctAnswer: "A",
                  },
                  {
                    questionIndex: 4,
                    questionType: 2,
                    score: 1,
                    partScore: 0,
                    selectNum: 4,
                    answerOptions: "A, B, C, D,E,F",
                    correctAnswer: "A",
                  },
                  {
                    questionIndex: 5,
                    questionType: 2,
                    score: 1,
                    partScore: 0,
                    selectNum: 4,
                    answerOptions: "A, B, C, D,E,F",
                    correctAnswer: "A",
                  },
                  {
                    questionIndex: 6,
dd5150c5   阿宝   数据同步
550
551
552
553
                    questionType: 3,
                    score: 1,
                    partScore: 0,
                    selectNum: 4,
aed43d3a   阿宝   即时测修改答案
554
                    answerOptions: "A, B, C, D,E,F",
dd5150c5   阿宝   数据同步
555
556
557
                    correctAnswer: "AB",
                  },
                  {
aed43d3a   阿宝   即时测修改答案
558
559
560
561
562
563
564
565
566
567
                    questionIndex: 7,
                    questionType: 4,
                    score: 1,
                    partScore: 0,
                    selectNum: 0,
                    answerOptions: [],
                    correctAnswer: "1",
                  },
                  {
                    questionIndex: 8,
dd5150c5   阿宝   数据同步
568
569
570
571
                    questionType: 3,
                    score: 1,
                    partScore: 0,
                    selectNum: 4,
aed43d3a   阿宝   即时测修改答案
572
                    answerOptions: "A, B, C, D,E,F",
dd5150c5   阿宝   数据同步
573
574
575
                    correctAnswer: "AB",
                  },
                  {
aed43d3a   阿宝   即时测修改答案
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
                    questionIndex: 9,
                    questionType: 3,
                    score: 1,
                    partScore: 0,
                    selectNum: 4,
                    answerOptions: "A, B, C, D,E,F",
                    correctAnswer: "AB",
                  },
                  {
                    questionIndex: 10,
                    questionType: 3,
                    score: 1,
                    partScore: 0,
                    selectNum: 4,
                    answerOptions: "A, B, C, D,E,F",
                    correctAnswer: "AB",
                  },
                  {
                    questionIndex: 11,
                    questionType: 3,
                    score: 1,
                    partScore: 0,
                    selectNum: 4,
                    answerOptions: "A, B, C, D,E,F",
                    correctAnswer: "AB",
                  },
                  {
                    questionIndex: 12,
                    questionType: 3,
                    score: 1,
                    partScore: 0,
                    selectNum: 4,
                    answerOptions: "A, B, C, D,E,F",
                    correctAnswer: "AB",
                  },
                  {
                    questionIndex: 13,
dd5150c5   阿宝   数据同步
613
614
615
616
617
618
619
620
621
622
                    questionType: 4,
                    score: 1,
                    partScore: 0,
                    selectNum: 0,
                    answerOptions: [],
                    correctAnswer: "1",
                  },
                ],
              },
            ],
f356590c   阿宝   即时测列表,分析页面
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
          },
          {
            title: "试卷二",
            totalScore: 20,
            ceyan: "30/50",
            shijian: "2022-11-9 21:30至22:30",
            pingjun: 80,
            zuigao: 92,
            zuidi: 53,
            youxiu: 45,
            lianghao: 56,
            jige: 20,
            bujige: 30,
          },
        ],
        tableStage: [
          {
            xuehao: 1,
            xingming: "丁芳菲",
            totalScore: 5,
            rank: 1,
45504a95   阿宝   即时测页面,以及小题修改答案
644
645
646
647
648
649
650
651
            周测卷20221130totalScore: 10,
            周测卷20221130rank: 0,
            周测卷20221131totalScore: 11,
            周测卷20221131rank: 1,
            周测卷20221132totalScore: 12,
            周测卷20221132rank: 2,
            周测卷20221132totalScore: 13,
            周测卷20221132rank: 3,
f356590c   阿宝   即时测列表,分析页面
652
653
654
655
656
657
          },
          {
            xuehao: 2,
            xingming: "丁芳",
            totalScore: 4,
            rank: 2,
45504a95   阿宝   即时测页面,以及小题修改答案
658
659
660
661
662
663
664
665
            周测卷20221130totalScore: 20,
            周测卷20221130rank: 3,
            周测卷20221131totalScore: 21,
            周测卷20221131rank: 4,
            周测卷20221132totalScore: 22,
            周测卷20221132rank: 5,
            周测卷20221132totalScore: 22,
            周测卷20221132rank: 5,
f356590c   阿宝   即时测列表,分析页面
666
667
          },
        ],
45504a95   阿宝   即时测页面,以及小题修改答案
668
        answerList: [
aed43d3a   阿宝   即时测修改答案
669
          //设置多卷内容供tableStage表格数据用
f356590c   阿宝   即时测列表,分析页面
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
          {
            title: "周测卷20221130",
            totalScore: 6,
            rank: 2,
          },
          {
            title: "周测卷20221131",
            totalScore: 7,
            rank: 3,
          },
          {
            title: "周测卷20221132",
            totalScore: 8,
            rank: 4,
          },
        ],
      };
    },
    async created() {
45504a95   阿宝   即时测页面,以及小题修改答案
689
690
691
      this.role = this.$store.getters.info.permissions.find(
        (item) => item.roleName == this.$store.getters.info.showRoleName
      )?.role;
f356590c   阿宝   即时测列表,分析页面
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
      await this._QueryClassList();
      await this._QuerySubjectList();
      // await this.setDate(1);
      let startDay = this.query?.startDay;
      if (!startDay) {
        this.query.startDay = new Date();
        this.query.endDay = new Date();
      }
    },
    methods: {
      linkTo(obj) {
        //去详情
        this.$router.push({
          path: "/testAnalysis",
          query: {
            id: obj.id,
          },
        });
      },
aed43d3a   阿宝   即时测修改答案
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
      setSubPro(type) {
        let tit;
        switch (type) {
          case 2:
            tit = "单选题";
            break;
          case 3:
            tit = "多选题";
            break;
          case 4:
            tit = "判断题";
            break;
          case 5:
            tit = "主观题";
            break;
        }
        return tit;
      },
      setBigNum(num) {
        let txt = "";
        let bigNum = [
          "一",
          "二",
          "三",
          "四",
          "五",
          "六",
          "七",
          "八",
          "九",
          "十",
          "十一",
          "十二",
          "十三",
          "十四",
          "十五",
          "十六",
          "十七",
          "十八",
          "十九",
          "二十",
        ];
        txt = bigNum[num];
4c4f7640   梁保满   路由表,路由前端文件
754
  
aed43d3a   阿宝   即时测修改答案
755
756
        return txt;
      },
f356590c   阿宝   即时测列表,分析页面
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
      setDate(index) {
        const that = this;
        this.date = index == this.date ? "" : index;
        let aYear = new Date().getFullYear();
        let aMonth = new Date().getMonth() + 1;
        that.query.day = "";
        that.query.startDay = "";
        that.query.endDay = "";
        switch (index) {
          case 1:
            that.query.day = formatDate(new Date(), "yyyy-MM-dd");
            that.query.startDay = that.query.day;
            that.query.endDay = that.query.day;
            break;
          case 2:
            let day = new Date().getDay();
            if (day == 0) {
              //中国式星期天是一周的最后一天
              day = 7;
            }
            let aTime = new Date().getTime() - 24 * 60 * 60 * 1000 * day;
            that.query.startDay = formatDate(new Date(aTime), "yyyy-MM-dd");
            that.query.endDay = formatDate(new Date(), "yyyy-MM-dd");
            break;
          case 3:
            aMonth = aMonth < 10 ? "0" + aMonth : aMonth;
            that.query.startDay = `${aYear}-${aMonth}-01`;
            that.query.endDay = formatDate(new Date(), "yyyy-MM-dd");
            break;
          case 4:
            if (aMonth > 1 && aMonth < 4) {
              aMonth = "01";
            } else if (aMonth > 3 && aMonth < 7) {
              aMonth = "04";
            } else if (aMonth > 6 && aMonth < 10) {
              aMonth = "07";
            } else {
              aMonth = "10";
            }
  
            aMonth = aMonth < 10 ? "0" + aMonth : aMonth;
            that.query.startDay = `${aYear}-${aMonth}-01`;
            that.query.endDay = formatDate(new Date(), "yyyy-MM-dd");
            break;
        }
        this.page = 1;
        this._QueryData();
      },
      handleChangeTimeStart(val) {
        this.query.day = "";
        this.date = "";
        if (this.query.endDay) {
          if (new Date(val).getTime() > new Date(this.query.endDay).getTime()) {
            this.$message.error("任务结束时间不能任务开始时间前面,请重新设置");
            this.query.startDay = "";
          }
        }
      },
      handleChangeTimeEnd(val) {
        this.query.day = "";
        this.date = "";
        if (this.query.startDay) {
          if (new Date(val).getTime() < new Date(this.query.startDay).getTime()) {
            this.$message.error("任务结束时间不能任务开始时间前面,请重新设置");
            this.query.endDay = "";
          }
        }
      },
aed43d3a   阿宝   即时测修改答案
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
      keydownAnswer(event) {
        //快速答案设置禁止输入
        if (
          event.key == "Meta" ||
          event.key == "CapsLock" ||
          event.key == "Shift" ||
          event.key == "Enter" ||
          event.key == "Alt" ||
          event.key == "Backspace" ||
          event.key == "Delete" ||
          event.key == "ArrowUp" ||
          event.key == "ArrowDown" ||
          event.key == "ArrowLeft" ||
          event.key == "v" ||
          event.key == "V" ||
          event.key == "ArrowRight"
        ) {
          return;
        } else {
          event.returnValue = "";
        }
      },
      setAnswer(type, ans) {
        let txt = "";
        if (type == 2) {
          txt = ans;
        } else if (type == 3) {
          txt = ans + ",";
        } else if (type == 4) {
          txt = ans == 1 ? "✓" : "✗";
        }
        return txt;
      },
      setMultiple(obj, answer) {
        //多选答案设置
        obj.answerList += answer;
        let str = obj.answerList;
        let str2 = checkAnswer(
          str,
          3,
          obj.answerOptions.split(",").length,
          obj.answerList.length
        );
        obj.answerList = str2;
      },
f356590c   阿宝   即时测列表,分析页面
870
      edit(item) {
aed43d3a   阿宝   即时测修改答案
871
        //修改答案
f356590c   阿宝   即时测列表,分析页面
872
        this.form = deepClone(item);
aed43d3a   阿宝   即时测修改答案
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
        this.questionList = deepClone(item?.questionList || []);
        this.questionList?.map((item) => {
          let types = [{}];
          let addndex = 0;
          item.subQuestions.map((sub, index) => {
            if (!!sub.questionType) {
              if (sub.questionType == types[addndex].qusType) {
                //同类型批量答案+1
                types[addndex].subNum += 1;
                if (
                  types[addndex].answerOptions.length < sub.answerOptions.length
                ) {
                  types[addndex].answerOptions = sub.answerOptions;
                }
                types[addndex].answerList += this.setAnswer(
                  sub.questionType,
                  sub.correctAnswer
                );
                if (index == item.subQuestions.length - 1) {
                  //循环最后类型数量大于等于5,保存批量答案
                  if (types[addndex].subNum && types[addndex].subNum >= 5) {
                    types[addndex].endIndex = sub.questionIndex;
                    types[addndex].index = index;
                  }
                }
              } else {
                if (types[addndex].subNum && types[addndex].subNum >= 5) {
                  //不同类型时如果原有类型数量大于等于5,保存批量答案
                  types[addndex].endIndex =
                    item.subQuestions[index - 1].questionIndex;
                  types[addndex].index = index;
                  addndex += 1;
                  types[addndex] = {};
                }
                //不同类型初始化批量答案
                types[addndex].qusType = sub.questionType;
                types[addndex].subNum = 1;
                types[addndex].answerOptions = sub.answerOptions;
                types[addndex].answerList = this.setAnswer(
                  sub.questionType,
                  sub.correctAnswer
                );
              }
            }
          });
          for (let i = 0; i < types.length; i++) {
            if (types[i].qusType == 3) {
              types[i].answerList = types[i].answerList.slice(0, -1);
            }
            if (types[i].subNum >= 5) {
              item.subQuestions.splice(
                types[i].index + i,
                0,
                deepClone(types[i])
              );
            }
          }
        });
f356590c   阿宝   即时测列表,分析页面
931
932
        this.dialogVisible = true;
      },
aed43d3a   阿宝   即时测修改答案
933
934
935
936
937
      setFormAns(index, indexs) {
        //初始化要修改的答案
        this.formAns = { ...this.questionList[index].subQuestions[indexs] };
        this.formAns.listIndex = index;
        this.diaSetAns = true;
f356590c   阿宝   即时测列表,分析页面
938
      },
aed43d3a   阿宝   即时测修改答案
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
      saveFormAns() {
        //批量修改答案
        let EndIndex;
        let subNum = this.formAns.subNum - 1;
        this.questionList[this.formAns.listIndex].subQuestions.some(
          (item, index) => {
            if (this.formAns.endIndex == item.questionIndex) {
              EndIndex = index;
              return;
            }
          }
        );
        for (let i = 0; i <= subNum; i++) {
          let correctAnswer = "";
          if (this.formAns.qusType == 2) {
            correctAnswer = this.formAns.answerList[subNum - i];
          } else if (this.formAns.qusType == 3) {
            correctAnswer = this.formAns.answerList.split(",")[subNum - i];
  
            console.log(this.formAns.answerList.split(",")[subNum - i]);
          } else if (this.formAns.qusType == 4) {
            correctAnswer = this.formAns.answerList[subNum - i] == "✓" ? 1 : 2;
          }
          this.questionList[this.formAns.listIndex].subQuestions[
            EndIndex - i
          ].correctAnswer = correctAnswer;
        }
        this.diaSetAns = false;
f356590c   阿宝   即时测列表,分析页面
967
      },
aed43d3a   阿宝   即时测修改答案
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
      async saveAnswer() {
        //保存答案
        for (let i = 0; i < this.questionList.length; i++) {
          for (let j = 0; j < this.questionList[i].subQuestions.length; j++) {
            if (this.questionList[i].subQuestions[j].qusType) {
              this.questionList[i].subQuestions.splice(j, 1);
            }
          }
        }
        const { data, status, message } = await this.$request.modifyPaper({
          paperId: this.form.id,
          questionList: [...this.questionList],
        });
        if (status == 0) {
          this._QueryData();
        } else {
          this.$message.error(message);
        }
      },
  
f356590c   阿宝   即时测列表,分析页面
988
989
990
991
992
993
994
995
996
997
      async changClazz() {
        await this._QuerySubjectList();
        await this.setDate(1);
      },
      async _QueryClassList() {
        const { data, status, info } = await this.$request.fetchClassList();
        if (status === 0) {
          this.classList = data.list.map((item) => {
            return {
              value: item.classId,
45504a95   阿宝   即时测页面,以及小题修改答案
998
              label: item.className,
f356590c   阿宝   即时测列表,分析页面
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
            };
          });
          this.query.classId = this.classList[0]?.value;
        } else {
          this.$message.error(info);
        }
      },
      async _QuerySubjectList() {
        const { data, status, info } = await this.$request.fetchSubjectList({
          classId: this.query.classId,
        });
        if (status === 0) {
          this.subjectList =
45504a95   阿宝   即时测页面,以及小题修改答案
1012
            data.subjectNames?.map((item) => {
f356590c   阿宝   即时测列表,分析页面
1013
              return {
45504a95   阿宝   即时测页面,以及小题修改答案
1014
1015
                value: item,
                label: item,
f356590c   阿宝   即时测列表,分析页面
1016
1017
              };
            }) || [];
aed43d3a   阿宝   即时测修改答案
1018
          if (this.role == "ROLE_BANZHUREN") {
f356590c   阿宝   即时测列表,分析页面
1019
1020
1021
1022
            this.subjectList.unshift({
              value: "",
              label: "全部",
            });
45504a95   阿宝   即时测页面,以及小题修改答案
1023
            this.query.subjectId = [this.subjectList[0]?.value];
aed43d3a   阿宝   即时测修改答案
1024
          } else {
45504a95   阿宝   即时测页面,以及小题修改答案
1025
            this.query.subjectId = this.subjectList[0]?.value;
f356590c   阿宝   即时测列表,分析页面
1026
          }
f356590c   阿宝   即时测列表,分析页面
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
        } else {
          this.$message.error(info);
        }
      },
      async _QueryData() {
        this.loading = true;
        //多课时对比
        let query = {};
        for (let key in this.query) {
          if (this.query[key] != "") {
            query[key] = this.query[key];
          }
        }
        const { data, status, info } = await this.$request.fetchQuizList({
          ...query,
        });
        this.loading = false;
        if (status === 0) {
        } else {
          this.$message.error(info);
        }
      },
    },
  };
4c4f7640   梁保满   路由表,路由前端文件
1051
1052
  </script>
  
f356590c   阿宝   即时测列表,分析页面
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
  <style lang="scss" scoped>
  .table-box {
    margin: 0 20px;
    padding: 16px;
    background: #f8f8f8;
    border-radius: 5px;
    :deep(.fa-arrow-right) {
      padding-left: 2px;
    }
    :deep(.fa-file-text) {
      padding-left: 2px;
    }
  }
4c4f7640   梁保满   路由表,路由前端文件
1066
  
f356590c   阿宝   即时测列表,分析页面
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
  .fa-exchange {
    color: #667ffd;
    cursor: pointer;
    font-size: 16px;
    margin-left: 10px;
  }
  .dia-btn {
    border-radius: 20px;
    margin: 0 20px;
    padding: 10px 20px;
  }
  .dia-tips {
    padding-bottom: 10px;
  }
aed43d3a   阿宝   即时测修改答案
1081
1082
1083
1084
1085
  .answer-s {
    width: 32px;
    height: 28px;
    cursor: pointer;
    user-select: none;
f356590c   阿宝   即时测列表,分析页面
1086
1087
1088
1089
1090
1091
1092
1093
1094
  }
  .set-questions {
    display: flex;
    margin-bottom: 12px;
    width: 100%;
    .qs-num {
      flex-shrink: 0;
      margin-right: 10px;
    }
aed43d3a   阿宝   即时测修改答案
1095
1096
1097
1098
1099
  }
  .qs-options {
    flex: 1;
    .ipt {
      margin-bottom: 5px;
f356590c   阿宝   即时测列表,分析页面
1100
1101
1102
1103
1104
    }
    .delButton {
      border-color: #ff6868;
      background: #ff6868 url("../../assets/images/arrow.png") no-repeat center;
      background-size: 19px;
aed43d3a   阿宝   即时测修改答案
1105
      cursor: pointer;
f356590c   阿宝   即时测列表,分析页面
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
      color: transparent;
    }
    .ac {
      border-color: #ff6868;
      background: #ff6868;
      color: #fff;
    }
  }
  .down {
    padding-top: 16px;
  }
aed43d3a   阿宝   即时测修改答案
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
  .page-container {
    position: relative;
  }
  .edit-dia {
    position: absolute;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: calc(100vh - 80px);
    background: #fff;
    overflow-y: auto;
    z-index: 10;
    .back {
      width: 100%;
      height: 56px;
      border-bottom: 1px solid #e2e2e2;
      display: flex;
      align-items: center;
      padding: 0 20px;
      box-sizing: border-box;
      .back-l {
        display: flex;
        align-items: center;
        cursor: pointer;
        flex-shrink: 0;
        font-size: 18px;
        font-weight: 500;
      }
      .fa-mail-reply-all {
        font-size: 28px;
        color: #b3b3b3;
        margin-right: 12px;
      }
    }
    .form-box {
      padding: 20px;
    }
    .answer-title {
      text-align: center;
      font-size: 20px;
      color: #333;
      font-weight: 700;
      padding-bottom: 20px;
      .totals {
        font-size: 16px;
        color: #888;
        font-weight: normal;
      }
    }
    .question-title {
      line-height: 40px;
      .ipt {
        width: 300px;
        margin: 0 16px 0 10px;
        :deep(.el-input__inner) {
          border-radius: 20px;
          border-color: #667ffd;
          background: rgba($color: #667ffd, $alpha: 0.05);
        }
      }
      .delete {
        margin-right: 8px;
      }
      .title-txt {
        margin-right: 20px;
        font-size: 16px;
        font-weight: 700;
      }
    }
    .questions-ul {
      border-left: 1px solid #e2e2e2;
      border-top: 1px solid #e2e2e2;
      margin: 12px 0;
    }
    .sub-questions {
      width: 100%;
      display: flex;
      border-bottom: 1px solid #e2e2e2;
      & > div {
        min-height: 40px;
        padding: 5px;
        flex-shrink: 0;
        border-right: 1px solid #e2e2e2;
        display: flex;
        justify-content: center;
        align-items: center;
      }
      .qs-num {
        width: 80px;
      }
      .qs-type {
        width: 160px;
      }
      .qs-score,
      .qs-partScore {
        width: 160px;
      }
      .qs-options {
        flex: 1;
      }
      .qs-set {
        width: 80px;
      }
      .qs-options2 {
        text-align: left;
        justify-content: flex-start;
        padding-left: 20px;
        .answer-s {
          cursor: pointer;
        }
      }
      :deep(.el-select) {
        .el-input__inner {
          border-radius: 20px;
          border-color: #667ffd;
          width: 150px;
          height: 32px;
          line-height: 32px;
          background: rgba($color: #667ffd, $alpha: 0.05);
        }
        .el-input__icon {
          line-height: 32px;
        }
      }
    }
    .set-ans-btn {
      width: 100%;
      padding: 10px 0 10px 630px;
      box-sizing: border-box;
      border-bottom: 1px solid #e2e2e2;
    }
  }
4c4f7640   梁保满   路由表,路由前端文件
1251
  </style>