Blame view

src/views/standard/examinationPaper/add.vue 61.5 KB
4c4f7640   梁保满   路由表,路由前端文件
1
  <template>
ca39cc52   阿宝   飞书问题处理
2
    <div ref="content" class="content-box">
13b58a42   梁保满   备题组卷部分前端页面基本完成
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
      <back-box>
        <template slot="title">
          <span>{{ "创建答题卡" }}</span>
        </template>
      </back-box>
      <div class="content">
        <el-steps
          :active="step"
          finish-status="success"
          simple
          style="margin: 20px 0"
        >
          <el-step title="基础信息" icon="el-icon-edit"></el-step>
          <el-step title="题目编辑" icon="el-icon-tickets"></el-step>
          <el-step title="设置答案" icon="el-icon-edit-outline"></el-step>
        </el-steps>
        <div v-show="step == 0">
          <el-form
            ref="forms"
            :model="form"
            :rules="formRules"
            label-width="140px"
          >
            <el-form-item label="答题卡名称:" prop="title">
ca39cc52   阿宝   飞书问题处理
27
              <el-input
255e2506   梁保满   飞书bug及优化
28
                class="sel2"
ca39cc52   阿宝   飞书问题处理
29
30
31
32
33
34
35
36
                type="text"
                placeholder="请输入答题卡名称"
                v-model.trim="form.title"
                maxlength="30"
                size="45"
                show-word-limit
              >
              </el-input>
13b58a42   梁保满   备题组卷部分前端页面基本完成
37
38
            </el-form-item>
            <el-form-item label="测验类型:">
ee6e7628   梁保满   备题组卷借口数据对接调整
39
              <el-select v-model="form.tagId" placeholder="选择测验类型">
255e2506   梁保满   飞书bug及优化
40
                <el-option label="--" value=""> </el-option>
13b58a42   梁保满   备题组卷部分前端页面基本完成
41
42
43
44
45
46
47
48
49
50
51
52
53
                <el-option
                  v-for="item in answerTypeList"
                  :key="item.id"
                  :label="item.typeName"
                  :value="item.id"
                  >{{ item.typeName }}</el-option
                >
              </el-select>
              <el-button
                class="ml-20"
                type="primary"
                round
                circle
818e50d7   梁保满   标签删除,修改
54
55
                icon="el-icon-edit"
                @click="openTagDia"
13b58a42   梁保满   备题组卷部分前端页面基本完成
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
              ></el-button>
            </el-form-item>
            <el-form-item label="年级:" prop="gradeName">
              <el-select
                class="sel"
                v-model="form.gradeName"
                placeholder=""
                @change="changeGrade"
              >
                <el-option
                  v-for="item in gradeList"
                  :key="item"
                  :label="item"
                  :value="item"
                >
                </el-option>
              </el-select>
            </el-form-item>
ee6e7628   梁保满   备题组卷借口数据对接调整
74
75
            <el-form-item label="科目:" prop="subjectName">
              <el-select class="sel" v-model="form.subjectName" placeholder="">
13b58a42   梁保满   备题组卷部分前端页面基本完成
76
77
78
79
80
                <el-option
                  v-for="item in subjectList"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"
8f573b82   阿宝   组卷接口联调
81
                  >{{ item.label }}
13b58a42   梁保满   备题组卷部分前端页面基本完成
82
83
84
                </el-option>
              </el-select>
            </el-form-item>
255e2506   梁保满   飞书bug及优化
85
            <el-form-item label="考试时长:">
13b58a42   梁保满   备题组卷部分前端页面基本完成
86
87
88
              <el-input-number
                size="medium"
                :min="1"
f26ecfa4   阿宝   测试bug
89
90
91
                :max="140"
                :step-strictly="true"
                :step="1"
13b58a42   梁保满   备题组卷部分前端页面基本完成
92
93
94
95
                v-model="form.examsDuration"
                label="考试时长"
              ></el-input-number>
            </el-form-item>
ee6e7628   梁保满   备题组卷借口数据对接调整
96
97
            <el-form-item label="分享范围:" prop="sharingType">
              <el-radio-group v-model="form.sharingType">
f356590c   阿宝   即时测列表,分析页面
98
99
                <el-radio :label="0">任课班级分享</el-radio>
                <el-radio :label="1">全年级分享</el-radio>
13b58a42   梁保满   备题组卷部分前端页面基本完成
100
101
102
103
104
105
106
107
108
109
              </el-radio-group>
            </el-form-item>
          </el-form>
          <div class="btn-box">
            <el-button type="danger" plain round @click="linkBack"
              >取消</el-button
            >
            <el-button type="primary" round @click="setStep1">下一步</el-button>
          </div>
          <el-dialog
818e50d7   梁保满   标签删除,修改
110
            title="设置测验类型"
13b58a42   梁保满   备题组卷部分前端页面基本完成
111
112
113
114
            :visible.sync="dialogVisible"
            width="500px"
          >
            <div class="dia-content">
818e50d7   梁保满   标签删除,修改
115
116
117
              <p class="add-type" v-for="item in tagList" :key="item.id">
                <el-row :gutter="10">
                  <el-col :span="18"
11a4e518   梁保满   背题组卷修改答案设置,即使测随堂问...
118
119
120
121
122
                    ><el-input
                      v-model="item.typeName"
                      :maxlength="10"
                      placeholder="请输入答题卡类型名称"
                    ></el-input
818e50d7   梁保满   标签删除,修改
123
124
                  ></el-col>
                  <el-col :span="6">
5ab73359   梁保满   优化
125
                    <el-tooltip effect="dark" content="保存" placement="top">
818e50d7   梁保满   标签删除,修改
126
127
128
129
130
131
                      <el-button
                        class="js-set"
                        type="primary"
                        size="small"
                        round
                        circle
5ab73359   梁保满   优化
132
                        icon="el-icon-check"
818e50d7   梁保满   标签删除,修改
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
                        @click="editTypeName(item)"
                      ></el-button>
                    </el-tooltip>
                    <el-tooltip effect="dark" content="删除" placement="right">
                      <el-popconfirm
                        title="确定删除这道大题吗?"
                        @confirm="removeTypeName(item)"
                      >
                        <el-button
                          class="js-set"
                          type="danger"
                          size="small"
                          round
                          circle
                          icon="el-icon-delete"
                          slot="reference"
                        ></el-button>
                      </el-popconfirm>
                    </el-tooltip>
                  </el-col>
                </el-row>
              </p>
13b58a42   梁保满   备题组卷部分前端页面基本完成
155
              <p class="add-type">
818e50d7   梁保满   标签删除,修改
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
                <el-row :gutter="10">
                  <el-col :span="18">
                    <el-input
                      type="text"
                      placeholder="请输入答题卡类型名称"
                      v-model.trim="answerTypeName"
                      :maxlength="10"
                    >
                    </el-input>
                  </el-col>
                  <el-col :span="6">
                    <el-tooltip effect="dark" content="添加" placement="right">
                      <el-button
                        class="js-set"
                        type="primary"
                        size="small"
                        round
                        circle
                        icon="el-icon-plus"
                        @click="addPaperType"
                      ></el-button>
                    </el-tooltip>
                  </el-col>
                </el-row>
13b58a42   梁保满   备题组卷部分前端页面基本完成
180
181
182
              </p>
            </div>
            <div class="" slot="footer">
818e50d7   梁保满   标签删除,修改
183
              <el-button @click="dialogVisible = false">关 闭</el-button>
13b58a42   梁保满   备题组卷部分前端页面基本完成
184
185
186
187
            </div>
          </el-dialog>
        </div>
        <div v-show="step == 1">
3ba60a63   梁保满   发卡补卡,设备状态上传下载接口联调
188
189
190
191
192
          <div
            class="question-box"
            v-for="(question, index) in form.questionList"
            :key="index"
          >
13b58a42   梁保满   备题组卷部分前端页面基本完成
193
            <p class="question-title">
f5729396   梁保满   批量设置答案
194
195
196
197
198
              <el-tooltip
                effect="dark"
                :content="question.show ? '收起' : '展开'"
                placement="left"
              >
3ba60a63   梁保满   发卡补卡,设备状态上传下载接口联调
199
200
201
202
203
204
                <i
                  class="el-icon-caret-right"
                  :class="question.show ? 'active' : ''"
                  @click="question.show = !question.show"
                ></i>
              </el-tooltip>
13b58a42   梁保满   备题组卷部分前端页面基本完成
205
206
207
208
              <span>{{ setBigNum(index) }}、</span>
              <el-input
                class="ipt"
                v-model.trim="question.questionTitle"
75a5cc20   阿宝   测试用逻辑删除
209
                maxlength="30"
13b58a42   梁保满   备题组卷部分前端页面基本完成
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
                placeholder="填写大题名称"
              ></el-input>
              <el-popconfirm
                title="确定删除这道大题吗?"
                @confirm="form.questionList.splice(index, 1)"
              >
                <el-button
                  slot="reference"
                  class="delete"
                  type="danger"
                  size="mini"
                  circle
                  icon="el-icon-delete"
                ></el-button>
              </el-popconfirm>
98f6a547   梁保满   创建答题卡,统计答题信息
225
226
227
228
229
230
231
              <template v-if="equalScore(question)">
                <span class="m20"
                  >每题{{
                    question.subQuestions && question.subQuestions[0].score
                  }}分</span
                >
              </template>
d32e461c   梁保满   备题组卷
232
              <span class="m20">共:{{ question.subQuestions.length }}题</span>
98f6a547   梁保满   创建答题卡,统计答题信息
233
              <span class="m20">共:{{ setScore(question) }}分</span>
13b58a42   梁保满   备题组卷部分前端页面基本完成
234
            </p>
3ba60a63   梁保满   发卡补卡,设备状态上传下载接口联调
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
            <transition name="el-zoom-in-top">
              <ul v-show="question.show" 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">选项设置</div>
                  <div class="qs-set">操作</div>
                </li>
                <li
                  class="sub-questions"
                  v-for="(subQuestions, indexs) in question.subQuestions"
                  :key="indexs"
                >
                  <div class="qs-num">{{ setNum(index, indexs) }}</div>
                  <div class="qs-type">
                    <el-select
                      v-model="subQuestions.questionType"
                      placeholder="选择题目类型"
                      @change="changeSubQuestions($event, subQuestions)"
13b58a42   梁保满   备题组卷部分前端页面基本完成
256
                    >
3ba60a63   梁保满   发卡补卡,设备状态上传下载接口联调
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
                      <el-option label="单选题" :value="2"></el-option>
                      <el-option label="多选题" :value="3"></el-option>
                      <el-option label="判断题" :value="4"></el-option>
                      <el-option label="主观题" :value="5"></el-option>
                    </el-select>
                  </div>
                  <div class="qs-score">
                    <el-input-number
                      class="number-ipt"
                      size="medium"
                      :min="1"
                      :max="200"
                      :precision="2"
                      :step="1"
                      v-model="subQuestions.score"
                      label="单题分值"
                    ></el-input-number>
                  </div>
                  <div class="qs-partScore">
                    <p v-if="subQuestions.questionType != 3">--</p>
                    <el-input-number
                      class="number-ipt"
                      v-else
                      size="medium"
                      :min="0"
                      :precision="2"
                      :max="subQuestions.score"
                      :step="0.5"
                      v-model="subQuestions.partScore"
                      label="漏选得分"
                    ></el-input-number>
                  </div>
                  <div class="qs-options">
                    <p v-if="subQuestions.questionType == 5">--</p>
f5729396   梁保满   批量设置答案
291
                    <p v-if="subQuestions.questionType == 4" class="answer-box">
3ba60a63   梁保满   发卡补卡,设备状态上传下载接口联调
292
293
294
                      <span
                        class="answer-s"
                        :class="subQuestions.correctAnswer == 1 ? 'active' : ''"
f5729396   梁保满   批量设置答案
295
                        @click="subQuestions.correctAnswer = 1"
3ba60a63   梁保满   发卡补卡,设备状态上传下载接口联调
296
297
298
299
300
                        >✓</span
                      >
                      <span
                        class="answer-s"
                        :class="subQuestions.correctAnswer == 2 ? 'active' : ''"
f5729396   梁保满   批量设置答案
301
                        @click="subQuestions.correctAnswer = 2"
3ba60a63   梁保满   发卡补卡,设备状态上传下载接口联调
302
303
304
                        >✗</span
                      >
                    </p>
f5729396   梁保满   批量设置答案
305
                    <p v-if="subQuestions.questionType == 3" class="answer-box">
3ba60a63   梁保满   发卡补卡,设备状态上传下载接口联调
306
307
308
                      <span
                        class="answer-s"
                        v-for="option in subQuestions.answerOptions.split(',')"
3ba60a63   梁保满   发卡补卡,设备状态上传下载接口联调
309
310
311
312
313
                        :class="
                          subQuestions.correctAnswer?.includes(option)
                            ? 'active'
                            : ''
                        "
f5729396   梁保满   批量设置答案
314
315
316
317
318
319
320
321
322
323
324
325
326
327
                        :key="option"
                        @click="changAnswer(subQuestions, option)"
                        >{{ option }}</span
                      >
                    </p>
                    <p v-if="subQuestions.questionType == 2" class="answer-box">
                      <span
                        class="answer-s"
                        v-for="option in subQuestions.answerOptions.split(',')"
                        :class="
                          subQuestions.correctAnswer == option ? 'active' : ''
                        "
                        :key="option"
                        @click="subQuestions.correctAnswer = option"
3ba60a63   梁保满   发卡补卡,设备状态上传下载接口联调
328
329
                        >{{ option }}</span
                      >
f5729396   梁保满   批量设置答案
330
                    </p>
98f6a547   梁保满   创建答题卡,统计答题信息
331
332
333
334
335
336
337
                    <p
                      v-if="
                        subQuestions.questionType == 3 ||
                        subQuestions.questionType == 2
                      "
                      class="answer-box"
                    >
3ba60a63   梁保满   发卡补卡,设备状态上传下载接口联调
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
                      <el-button
                        size="mini"
                        type="primary"
                        icon="el-icon-plus"
                        circle
                        @click="addOptions(subQuestions)"
                      ></el-button>
                      <el-button
                        size="mini"
                        type="primary"
                        icon="el-icon-minus"
                        round
                        circle
                        @click="removeOptions(subQuestions)"
                      ></el-button>
                    </p>
                  </div>
                  <div class="qs-set">
                    <el-popconfirm
                      title="确定删除这道题吗?"
                      @confirm="delTabData(indexs, index)"
                    >
                      <el-button
                        slot="reference"
                        class="delete"
                        type="danger"
                        size="mini"
                        circle
                        icon="el-icon-delete"
                      ></el-button>
                    </el-popconfirm>
                  </div>
                </li>
                <li class="sub-questions">
                  <div class="qs-num">添加</div>
                  <div class="qs-type">
                    <el-select
                      v-model="addSubQuestionsType"
                      placeholder="选择题目类型"
                      @change="changeAddSubQuestions($event, question)"
                    >
                      <el-option label="单选题" :value="2"></el-option>
                      <el-option label="多选题" :value="3"></el-option>
                      <el-option label="判断题" :value="4"></el-option>
                      <el-option label="主观题" :value="5"></el-option>
                    </el-select>
                  </div>
                  <div class="qs-score"></div>
                  <div class="qs-partScore"></div>
                  <div class="qs-options"></div>
                  <div class="qs-set"></div>
                </li>
              </ul>
            </transition>
13b58a42   梁保满   备题组卷部分前端页面基本完成
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
          </div>
          <div class="add-box">
            <p class="add-question" @click="openQuestion">
              <el-button
                size="mini"
                type="primary"
                icon="el-icon-plus"
                circle
              ></el-button>
              <span class="s1">添加大题</span>
            </p>
          </div>
          <div class="btn-box">
            <el-button type="danger" plain round @click="linkBack"
              >取消</el-button
            >
            <el-button round @click="step = 0">上一步</el-button>
f26ecfa4   阿宝   测试bug
409
410
411
412
413
414
            <el-button
              :type="form.questionList.length == 0 ? 'info' : 'primary'"
              round
              @click="setStep2"
              >下一步</el-button
            >
13b58a42   梁保满   备题组卷部分前端页面基本完成
415
416
417
418
          </div>
          <el-dialog
            title="添加大题"
            :visible.sync="addQuestionVisible"
1365ef5e   梁保满   优化
419
            :close-on-click-modal="false"
13b58a42   梁保满   备题组卷部分前端页面基本完成
420
421
422
423
            width="600px"
          >
            <div class="dia-content">
              <el-form
503b6063   梁保满   判断题答案选项
424
                ref="form"
13b58a42   梁保满   备题组卷部分前端页面基本完成
425
426
427
428
                :model="questionForm"
                :rules="questionFormRules"
                label-width="100px"
              >
533a17d8   梁保满   备题组卷添加批量设置答案
429
                <el-form-item label="标题:">
ca39cc52   阿宝   飞书问题处理
430
                  <el-col :span="20">
13b58a42   梁保满   备题组卷部分前端页面基本完成
431
432
433
434
435
436
437
438
                    <el-input
                      v-model.trim="questionForm.questionTitle"
                      maxlength="30"
                      placeholder="输入大题名称"
                    ></el-input>
                  </el-col>
                </el-form-item>
                <el-form-item label="选择题型:">
3ba60a63   梁保满   发卡补卡,设备状态上传下载接口联调
439
440
441
442
443
                  <el-select
                    v-model="questionForm.questionType"
                    placeholder=""
                    @change="setQuestionForm"
                  >
13b58a42   梁保满   备题组卷部分前端页面基本完成
444
445
446
447
448
449
450
                    <el-option
                      v-for="item in questionOptions"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    >
                    </el-option>
d32e461c   梁保满   备题组卷
451
                    <el-option label="混合题" :value="6"> </el-option>
13b58a42   梁保满   备题组卷部分前端页面基本完成
452
453
                  </el-select>
                </el-form-item>
d32e461c   梁保满   备题组卷
454
                <el-form-item label="题数:">
13b58a42   梁保满   备题组卷部分前端页面基本完成
455
456
                  <el-input-number
                    v-model="questionForm.number"
3ba60a63   梁保满   发卡补卡,设备状态上传下载接口联调
457
                    @change="changeQesNum"
13b58a42   梁保满   备题组卷部分前端页面基本完成
458
                    :min="1"
f26ecfa4   阿宝   测试bug
459
460
461
                    :max="100"
                    :step-strictly="true"
                    :step="1"
13b58a42   梁保满   备题组卷部分前端页面基本完成
462
463
464
                    label="label"
                  ></el-input-number>
                </el-form-item>
255e2506   梁保满   飞书bug及优化
465
                <el-form-item
d32e461c   梁保满   备题组卷
466
                  label="选项个数:"
255e2506   梁保满   飞书bug及优化
467
                  v-show="
533a17d8   梁保满   备题组卷添加批量设置答案
468
                    questionForm.questionType != 4 &&
255e2506   梁保满   飞书bug及优化
469
470
471
472
473
474
475
476
477
478
479
480
                    questionForm.questionType != 5
                  "
                >
                  <el-input-number
                    v-model="questionForm.selectNum"
                    :min="3"
                    :max="7"
                    :step-strictly="true"
                    :step="1"
                    label="label"
                  ></el-input-number>
                </el-form-item>
d32e461c   梁保满   备题组卷
481
                <el-form-item label="单题分数:">
255e2506   梁保满   飞书bug及优化
482
483
484
                  <el-input-number
                    v-model="questionForm.score"
                    :min="1"
236b1f0e   梁保满   周末-飞书bug
485
                    :max="200"
533a17d8   梁保满   备题组卷添加批量设置答案
486
                    :precision="2"
255e2506   梁保满   飞书bug及优化
487
488
489
490
                    :step="1"
                    label="label"
                  ></el-input-number>
                </el-form-item>
533a17d8   梁保满   备题组卷添加批量设置答案
491
492
493
494
495
496
497
498
499
500
501
502
503
                <el-form-item
                  label="漏选得分:"
                  v-if="questionForm.questionType == 3"
                >
                  <el-input-number
                    v-model="questionForm.partScore"
                    :min="0"
                    :max="questionForm.score"
                    :precision="2"
                    :step="0.5"
                    label="label"
                  ></el-input-number>
                </el-form-item>
3ba60a63   梁保满   发卡补卡,设备状态上传下载接口联调
504
505
506
507
508
509
510
511
512
513
514
515
                <el-form-item
                  label="设置答案:"
                  v-show="questionForm.questionType != 5"
                >
                  <div class="qs-options">
                    <p class="ipt">
                      <el-input
                        v-if="
                          questionForm.questionType == 2 ||
                          questionForm.questionType == 3 ||
                          questionForm.questionType == 6
                        "
def690b2   梁保满   批量设置答案
516
                        ref="formAnsIpt2"
3ba60a63   梁保满   发卡补卡,设备状态上传下载接口联调
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
544
545
546
547
548
549
550
551
552
553
554
555
556
557
                        v-model="questionForm.answerList"
                        @keydown.native="
                          keydownAnswer($event, questionForm.questionType, 1)
                        "
                        @input="
                          setAllAnswer($event, questionForm.questionType, 1)
                        "
                      ></el-input>
                      <el-input
                        v-if="questionForm.questionType == 4"
                        v-model="questionForm.answerList"
                        readonly=""
                      ></el-input>
                    </p>
                    <p class="answer-box">
                      <template v-if="questionForm.questionType == 4">
                        <span
                          class="answer-s active"
                          @click="
                            questionForm.answerList.length < questionForm.number
                              ? (questionForm.answerList += '✓')
                              : ''
                          "
                          >✓</span
                        >
                        <span
                          class="answer-s active"
                          @click="
                            questionForm.answerList.length < questionForm.number
                              ? (questionForm.answerList += '✗')
                              : ''
                          "
                          >✗</span
                        >
                      </template>
                      <template v-if="questionForm.questionType == 3">
                        <template v-for="(option, opIdx) in rightOptions">
                          <span
                            v-if="opIdx < questionForm.selectNum"
                            class="answer-s active"
                            :key="option"
def690b2   梁保满   批量设置答案
558
                            @click="setMultiple(questionForm, option, 1)"
3ba60a63   梁保满   发卡补卡,设备状态上传下载接口联调
559
560
561
562
563
                            >{{ option }}</span
                          >
                        </template>
                        <span
                          class="answer-s active"
def690b2   梁保满   批量设置答案
564
                          @click="setMultiple(questionForm, ',', 1)"
3ba60a63   梁保满   发卡补卡,设备状态上传下载接口联调
565
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
600
601
602
603
604
605
606
                          >,</span
                        >
                      </template>
                      <template
                        v-if="
                          questionForm.questionType == 2 ||
                          questionForm.questionType == 6
                        "
                        class="answer-box"
                      >
                        <template v-for="(option, opIdx) in rightOptions">
                          <span
                            v-if="opIdx < questionForm.selectNum"
                            class="answer-s active"
                            :key="option"
                            @click="
                              questionForm.answerList.length < questionForm.number
                                ? (questionForm.answerList += option)
                                : ''
                            "
                            >{{ option }}</span
                          >
                        </template>
                      </template>
                      <span
                        class="answer-s delButton"
                        @click="
                          questionForm.answerList = questionForm.answerList.slice(
                            0,
                            -1
                          )
                        "
                        >x</span
                      >
                      <span
                        class="answer-s ac"
                        @click="questionForm.answerList = ''"
                        >ac</span
                      >
                    </p>
                  </div>
                </el-form-item>
13b58a42   梁保满   备题组卷部分前端页面基本完成
607
608
609
610
611
612
613
614
615
              </el-form>
            </div>
            <div class="dialog-footer" slot="footer">
              <el-button type="primary" @click="addQuestion">确 定</el-button>
              <el-button @click="addQuestionVisible = false">取 消</el-button>
            </div>
          </el-dialog>
        </div>
        <div v-show="step == 2">
f26ecfa4   阿宝   测试bug
616
617
618
619
          <div class="answer-title">
            <p class="name">{{ form.title }}</p>
            <p class="totals">卷面总分:{{ allScore }}分</p>
          </div>
3ba60a63   梁保满   发卡补卡,设备状态上传下载接口联调
620
621
622
623
624
          <div
            class="question-box"
            v-for="(question, index) in form.questionList"
            :key="index"
          >
13b58a42   梁保满   备题组卷部分前端页面基本完成
625
626
627
            <p class="question-title">
              <span>{{ setBigNum(index) }}、</span>
              <span class="title-txt">{{ question.questionTitle }}</span>
0e46bc25   梁保满   优化
628
              <span class="m20">共:{{ setNums(question.subQuestions) }}题</span>
98f6a547   梁保满   创建答题卡,统计答题信息
629
              <span class="m20">共:{{ setScore(question) }} 分</span>
13b58a42   梁保满   备题组卷部分前端页面基本完成
630
            </p>
f5729396   梁保满   批量设置答案
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
            <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
                  "
533a17d8   梁保满   备题组卷添加批量设置答案
650
                >
f5729396   梁保满   批量设置答案
651
652
                  <el-button type="primary" @click="setFormAns(indexs, index)"
                    >批量设置答案</el-button
533a17d8   梁保满   备题组卷添加批量设置答案
653
                  >
f5729396   梁保满   批量设置答案
654
655
656
657
                </p>
                <div v-else class="sub-questions">
                  <div class="qs-num">
                    {{ setNum(index, indexs, subQuestions) }}
3ba60a63   梁保满   发卡补卡,设备状态上传下载接口联调
658
                  </div>
f5729396   梁保满   批量设置答案
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
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
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
                  <div class="qs-type">
                    {{ setSubPro(subQuestions.questionType) }}
                  </div>
                  <div class="qs-score">
                    <el-input-number
                      class="number-ipt"
                      size="medium"
                      :min="1"
                      :max="200"
                      :precision="2"
                      v-model="subQuestions.score"
                      label="单题分值"
                    ></el-input-number>
                  </div>
                  <div class="qs-partScore">
                    <p v-if="subQuestions.questionType != 3">--</p>
                    <el-input-number
                      class="number-ipt"
                      v-else
                      size="medium"
                      :min="0"
                      :precision="2"
                      :max="subQuestions.score"
                      :step="0.5"
                      v-model="subQuestions.partScore"
                      label="漏选得分"
                    ></el-input-number>
                  </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">
                      <span
                        class="answer-s"
                        v-for="option in subQuestions.answerOptions.split(',')"
                        :class="
                          subQuestions.correctAnswer?.includes(option)
                            ? 'active'
                            : ''
                        "
                        :key="option"
                        @click="changAnswer(subQuestions, option)"
                        >{{ option }}</span
                      >
                    </p>
                    <p v-if="subQuestions.questionType == 2" class="answer-box">
                      <span
                        class="answer-s"
                        v-for="option in subQuestions.answerOptions.split(',')"
                        :class="
                          subQuestions.correctAnswer == option ? 'active' : ''
                        "
                        :key="option"
                        @click="subQuestions.correctAnswer = option"
                        >{{ option }}</span
                      >
                    </p>
                  </div>
                </div>
              </li>
            </ul>
3ba60a63   梁保满   发卡补卡,设备状态上传下载接口联调
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
          </div>
          <el-dialog
            title="批量设置答案"
            :visible.sync="diaSetAns"
            :close-on-click-modal="false"
            width="400"
            :modal-append-to-body="false"
          >
            <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-if="formAns.qusType == 2 || formAns.qusType == 3"
f5729396   梁保满   批量设置答案
749
                  ref="formAnsIpt"
3ba60a63   梁保满   发卡补卡,设备状态上传下载接口联调
750
751
752
753
754
755
756
757
758
759
760
761
                  v-model="formAns.answerList"
                  @keydown.native="keydownAnswer($event, formAns.qusType)"
                  @input="setAllAnswer($event, formAns.qusType)"
                ></el-input>
                <el-input
                  v-if="formAns.qusType == 4"
                  v-model="formAns.answerList"
                  readonly=""
                ></el-input>
              </p>
              <p class="answer-box">
                <template v-if="formAns.qusType == 4">
533a17d8   梁保满   备题组卷添加批量设置答案
762
                  <span
3ba60a63   梁保满   发卡补卡,设备状态上传下载接口联调
763
764
765
766
767
768
769
                    class="answer-s active"
                    @click="
                      formAns.answerList.length < formAns.subNum
                        ? (formAns.answerList += '✓')
                        : ''
                    "
                    >✓</span
533a17d8   梁保满   备题组卷添加批量设置答案
770
                  >
3ba60a63   梁保满   发卡补卡,设备状态上传下载接口联调
771
772
773
774
775
776
777
778
                  <span
                    class="answer-s active"
                    @click="
                      formAns.answerList.length < formAns.subNum
                        ? (formAns.answerList += '✗')
                        : ''
                    "
                    >✗</span
11a4e518   梁保满   背题组卷修改答案设置,即使测随堂问...
779
                  >
3ba60a63   梁保满   发卡补卡,设备状态上传下载接口联调
780
781
782
783
784
785
                </template>
                <template v-if="formAns.qusType == 3">
                  <span
                    class="answer-s active"
                    v-for="option in formAns.answerOptions.split(',')"
                    :key="option"
def690b2   梁保满   批量设置答案
786
                    @click="setMultiple(formAns, option, 2)"
3ba60a63   梁保满   发卡补卡,设备状态上传下载接口联调
787
788
789
790
                    >{{ option }}</span
                  >
                  <span
                    class="answer-s active"
def690b2   梁保满   批量设置答案
791
                    @click="setMultiple(formAns, ',', 2)"
3ba60a63   梁保满   发卡补卡,设备状态上传下载接口联调
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
                    >,</span
                  >
                </template>
                <template v-if="formAns.qusType == 2" class="answer-box">
                  <span
                    class="answer-s active"
                    v-for="option in formAns.answerOptions.split(',')"
                    :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
                >
                <span class="answer-s ac" @click="formAns.answerList = ''"
                  >ac</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>
13b58a42   梁保满   备题组卷部分前端页面基本完成
823
824
825
826
          <div class="btn-box">
            <el-button type="danger" plain round @click="linkBack"
              >取消</el-button
            >
533a17d8   梁保满   备题组卷添加批量设置答案
827
            <el-button round @click="backStep1">上一步</el-button>
13b58a42   梁保满   备题组卷部分前端页面基本完成
828
829
830
831
832
            <el-button type="primary" round @click="save">保存</el-button>
          </div>
        </div>
      </div>
    </div>
4c4f7640   梁保满   路由表,路由前端文件
833
834
835
  </template>
  
  <script>
533a17d8   梁保满   备题组卷添加批量设置答案
836
  import { deepClone, checkAnswer } from "utils";
13b58a42   梁保满   备题组卷部分前端页面基本完成
837
838
839
840
  const questionForm = {
    questionTitle: "",
    questionType: 2,
    number: 10,
255e2506   梁保满   飞书bug及优化
841
842
    selectNum: 4,
    score: 1,
533a17d8   梁保满   备题组卷添加批量设置答案
843
    partScore: 0,
3ba60a63   梁保满   发卡补卡,设备状态上传下载接口联调
844
    answerList: "",
13b58a42   梁保满   备题组卷部分前端页面基本完成
845
846
847
848
849
850
  };
  const subQuesOptions = {
    questionType: 2,
    score: 1,
    partScore: 0,
    selectNum: 4,
ee6e7628   梁保满   备题组卷借口数据对接调整
851
    answerOptions: "A,B,C,D",
13b58a42   梁保满   备题组卷部分前端页面基本完成
852
853
    correctAnswer: "",
  };
4c4f7640   梁保满   路由表,路由前端文件
854
  export default {
f26ecfa4   阿宝   测试bug
855
856
857
858
859
    computed: {
      allScore: function () {
        let score = 0;
        this.form.questionList.map((item) => {
          score += item.subQuestions.reduce((a, b) => {
533a17d8   梁保满   备题组卷添加批量设置答案
860
            return a + Number(b.score ? b.score : 0);
f26ecfa4   阿宝   测试bug
861
862
863
864
865
          }, 0);
        }, 0);
        return Number(score).toFixed(2);
      },
    },
255e2506   梁保满   飞书bug及优化
866
867
868
869
870
871
    watch: {
      step: function () {
        this.$nextTick(function () {
          this.$refs.content.scrollTop = 0;
        });
      },
ca39cc52   阿宝   飞书问题处理
872
    },
13b58a42   梁保满   备题组卷部分前端页面基本完成
873
874
875
876
877
878
879
880
    data() {
      return {
        type: 1, //1-创建,2-复制答题卡
        dialogVisible: false, //测验类型设置弹窗
        addQuestionVisible: false, //添加大题弹窗
        questionForm: { ...questionForm },
        questionFormRules: {
          questionTitle: [
f26ecfa4   阿宝   测试bug
881
            { required: true, message: "请输入大题名称", trigger: "blur" },
13b58a42   梁保满   备题组卷部分前端页面基本完成
882
883
884
885
886
887
888
889
890
891
892
893
894
895
            {
              min: 1,
              max: 30,
              message: "长度在 1 到 30 个字符",
              trigger: "blur",
            },
          ],
        },
        questionOptions: [
          { label: "单选题", value: 2 },
          { label: "多选题", value: 3 },
          { label: "判断题", value: 4 },
          { label: "主观题", value: 5 },
        ],
8f573b82   阿宝   组卷接口联调
896
        rightOptions: ["A", "B", "C", "D", "E", "F", "G"],
13b58a42   梁保满   备题组卷部分前端页面基本完成
897
898
899
900
901
        addSubQuestionsType: "",
        step: 0, //步骤
        gradeList: [], //年级
        subjectList: [], //科目
        answerTypeList: [], //测验类型
4ad1ef07   阿宝   类型添加验证
902
        answerTypeName: "", //测验类型名称
13b58a42   梁保满   备题组卷部分前端页面基本完成
903
904
905
        form: {
          //答题卡详情
          title: "",
ee6e7628   梁保满   备题组卷借口数据对接调整
906
          tagId: "",
13b58a42   梁保满   备题组卷部分前端页面基本完成
907
          gradeName: "",
ee6e7628   梁保满   备题组卷借口数据对接调整
908
          subjectName: "",
f26ecfa4   阿宝   测试bug
909
          examsDuration: 90,
aeac66d4   阿宝   飞书测试bug
910
          sharingType: 0,
13b58a42   梁保满   备题组卷部分前端页面基本完成
911
912
913
914
915
916
917
918
919
920
921
922
923
924
          questionList: [],
        },
        formRules: {
          //答题卡验证
          title: [
            { required: true, message: "请输入答题卡名称", trigger: "blur" },
            {
              min: 1,
              max: 30,
              message: "长度在 1 到 30 个字符",
              trigger: "blur",
            },
          ],
          gradeName: [{ required: true, message: "请选择年级", trigger: "blur" }],
ee6e7628   梁保满   备题组卷借口数据对接调整
925
926
927
          subjectName: [
            { required: true, message: "请选择科目", trigger: "blur" },
          ],
13b58a42   梁保满   备题组卷部分前端页面基本完成
928
929
930
931
          examsDuration: [
            { required: true, message: "请设置考试时长", trigger: "blur" },
          ],
        },
818e50d7   梁保满   标签删除,修改
932
        tagList: [],
533a17d8   梁保满   备题组卷添加批量设置答案
933
934
935
936
        diaSetAns: false,
        formAns: {
          listIndex: 0, //大题位置
          endIndex: 0, //相同题目最后一位题目的questionIndex
98f6a547   梁保满   创建答题卡,统计答题信息
937
          index: 0, //相同题目最后一位题目的位置
533a17d8   梁保满   备题组卷添加批量设置答案
938
939
940
941
942
          qusType: "", //题目类型
          subNum: 0, //数量
          answerOptions: [], //答案选项
          answerList: "", //答案列表-字符串
        },
13b58a42   梁保满   备题组卷部分前端页面基本完成
943
944
      };
    },
5424ef82   梁保满   接口调整
945
    async created() {
f26ecfa4   阿宝   测试bug
946
      this.type = this.$route.query.type ? this.$route.query.type : 1;
8f573b82   阿宝   组卷接口联调
947
948
949
      await this._GradeList();
      await this._QuerySubjectList(this.gradeList[0]);
      await this._TypeList();
13b58a42   梁保满   备题组卷部分前端页面基本完成
950
      if (this.type == 2) {
ee6e7628   梁保满   备题组卷借口数据对接调整
951
        this._QueryDetail();
13b58a42   梁保满   备题组卷部分前端页面基本完成
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
      }
    },
    methods: {
      linkBack() {
        this.$confirm(
          (this.type == 2 ? "修改复制的" : "组建的") +
            "答题卡未保存,确认退出吗?",
          "提示",
          {
            confirmButtonText: "取消",
            cancelButtonText: "确定",
            confirmButtonClass: "el-button--danger1",
            cancelButtonClass: "el-button--primary",
            showClose: false,
            roundButton: true,
            center: true,
            type: "warning",
          }
        )
          .then(() => {})
          .catch(() => {
            this.$router.push({
              path: "/examinationPaper",
            });
          });
      },
      setSubPro(type) {
        let tit;
        switch (type) {
          case 2:
            tit = "单选题";
            break;
          case 3:
            tit = "多选题";
            break;
          case 4:
            tit = "判断题";
            break;
          case 5:
            tit = "主观题";
            break;
        }
        return tit;
      },
533a17d8   梁保满   备题组卷添加批量设置答案
996
      setNum(index, indexs, sub) {
13b58a42   梁保满   备题组卷部分前端页面基本完成
997
        let lengths = 0;
533a17d8   梁保满   备题组卷添加批量设置答案
998
        let subIndex = 0;
13b58a42   梁保满   备题组卷部分前端页面基本完成
999
        for (let i = 0; i < index; i++) {
533a17d8   梁保满   备题组卷添加批量设置答案
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
          let subArr = this.form.questionList[i].subQuestions.filter((item) => {
            return !!item.questionType;
          });
          lengths += subArr.length;
        }
  
        for (let i = 0; i < indexs; i++) {
          if (!!this.form.questionList[index].subQuestions[i].questionType) {
            subIndex += 1;
          }
13b58a42   梁保满   备题组卷部分前端页面基本完成
1010
        }
533a17d8   梁保满   备题组卷添加批量设置答案
1011
        return lengths + subIndex + 1;
13b58a42   梁保满   备题组卷部分前端页面基本完成
1012
      },
0e46bc25   梁保满   优化
1013
1014
1015
1016
1017
1018
      setNums(ques) {
        let lengths = 0;
        let subArr = ques.filter((item) => {
          return !!item.questionType;
        });
        lengths = subArr.length;
818e50d7   梁保满   标签删除,修改
1019
        return lengths;
0e46bc25   梁保满   优化
1020
      },
13b58a42   梁保满   备题组卷部分前端页面基本完成
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
      setBigNum(num) {
        let txt = "";
        let bigNum = [
          "一",
          "二",
          "三",
          "四",
          "五",
          "六",
          "七",
          "八",
          "九",
          "十",
          "十一",
          "十二",
          "十三",
          "十四",
          "十五",
          "十六",
          "十七",
          "十八",
          "十九",
          "二十",
        ];
        txt = bigNum[num];
4c4f7640   梁保满   路由表,路由前端文件
1046
  
13b58a42   梁保满   备题组卷部分前端页面基本完成
1047
1048
        return txt;
      },
3ba60a63   梁保满   发卡补卡,设备状态上传下载接口联调
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
      setQuestionForm(val) {
        //切换题型清空答案
        this.questionForm.answerList = "";
      },
      changeQesNum(val) {
        //减少题数设置答案
        if (
          this.questionForm.questionType == 2 ||
          this.questionForm.questionType == 4
        ) {
          this.questionForm.answerList = this.questionForm.answerList.substring(
            0,
            val
          );
        } else {
          console.log(this.questionForm.answerList.split(","));
          this.questionForm.answerList = this.questionForm.answerList
            .split(",")
            .splice(0, val)
            .join(",");
        }
      },
533a17d8   梁保满   备题组卷添加批量设置答案
1071
1072
1073
1074
      setFormAns(indexs, index) {
        //初始化要修改的答案
        this.formAns = { ...this.form.questionList[index].subQuestions[indexs] };
        this.formAns.listIndex = index;
98f6a547   梁保满   创建答题卡,统计答题信息
1075
        let startIndex = this.formAns.index + 1 - this.formAns.subNum; //批量设置大难开始位置
11a4e518   梁保满   背题组卷修改答案设置,即使测随堂问...
1076
1077
1078
        this.formAns.answerList = [];
        let answerList = "";
        this.form.questionList[index].subQuestions.map((item, subIdx) => {
f5729396   梁保满   批量设置答案
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
          if (subIdx >= startIndex) {
            answerList += this.setAnswer(item.questionType, item.correctAnswer);
            if (subIdx != indexs) {
              if (!!item.qusType) {
                answerList = "";
              }
            } else {
              if (item.qusType == 3) {
                answerList = answerList.slice(0, -1);
              }
              this.formAns.answerList = answerList;
11a4e518   梁保满   背题组卷修改答案设置,即使测随堂问...
1090
            }
11a4e518   梁保满   背题组卷修改答案设置,即使测随堂问...
1091
1092
1093
          }
        });
  
533a17d8   梁保满   备题组卷添加批量设置答案
1094
1095
        this.diaSetAns = true;
      },
def690b2   梁保满   批量设置答案
1096
      insertTxtAndSetcursor(element, answerList, str) {
f5729396   梁保满   批量设置答案
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
        let startPos = element.selectionStart; // 获取光标开始的位置
        if (startPos === undefined) {
          // 如果没有光标位置 不操作
          return answerList;
        } else {
          return {
            text:
              answerList.substring(0, startPos) +
              str +
              answerList.substring(startPos), // 将文本插入
            startPos: startPos + str.length,
          };
        }
      },
def690b2   梁保满   批量设置答案
1111
      setMultiple(obj, answer, type) {
533a17d8   梁保满   备题组卷添加批量设置答案
1112
        //多选答案设置
def690b2   梁保满   批量设置答案
1113
1114
1115
1116
1117
1118
1119
1120
1121
        let elements =
          type == 1
            ? this.$refs["formAnsIpt2"].$el.children[0]
            : this.$refs["formAnsIpt"].$el.children[0];
        let resault = this.insertTxtAndSetcursor(
          elements,
          obj.answerList || "",
          answer
        );
f5729396   梁保满   批量设置答案
1122
        obj.answerList = resault.text;
533a17d8   梁保满   备题组卷添加批量设置答案
1123
        let str = obj.answerList;
3ba60a63   梁保满   发卡补卡,设备状态上传下载接口联调
1124
1125
1126
1127
1128
1129
        let str2;
        if (!!obj.answerOptions) {
          str2 = checkAnswer(
            str,
            3,
            obj.answerOptions.split(",").length,
b2d3d803   梁保满   批量设置答案优化
1130
            obj.subNum
3ba60a63   梁保满   发卡补卡,设备状态上传下载接口联调
1131
1132
          );
        } else {
b2d3d803   梁保满   批量设置答案优化
1133
          str2 = checkAnswer(str, 3, obj.selectNum, obj.number);
3ba60a63   梁保满   发卡补卡,设备状态上传下载接口联调
1134
        }
533a17d8   梁保满   备题组卷添加批量设置答案
1135
        obj.answerList = str2;
def690b2   梁保满   批量设置答案
1136
1137
        elements.focus();
        elements.selectionStart = resault.startPos;
533a17d8   梁保满   备题组卷添加批量设置答案
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
      },
      saveFormAns() {
        //批量修改答案
        let EndIndex;
        let subNum = this.formAns.subNum - 1;
        this.form.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) {
f5729396   梁保满   批量设置答案
1155
            correctAnswer = this.formAns.answerList[subNum - i] || "";
533a17d8   梁保满   备题组卷添加批量设置答案
1156
          } else if (this.formAns.qusType == 3) {
f5729396   梁保满   批量设置答案
1157
            correctAnswer = this.formAns.answerList.split(",")[subNum - i] || "";
533a17d8   梁保满   备题组卷添加批量设置答案
1158
          } else if (this.formAns.qusType == 4) {
503b6063   梁保满   判断题答案选项
1159
1160
1161
1162
1163
1164
            correctAnswer =
              this.formAns.answerList[subNum - i] == "✓"
                ? 1
                : this.formAns.answerList[subNum - i] == "✗"
                ? 2
                : "";
533a17d8   梁保满   备题组卷添加批量设置答案
1165
1166
1167
1168
1169
1170
1171
          }
          this.form.questionList[this.formAns.listIndex].subQuestions[
            EndIndex - i
          ].correctAnswer = correctAnswer;
        }
        this.diaSetAns = false;
      },
813d4d64   梁保满   批量设置答案添加输入
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
      // 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 = "";
      //   }
      // },
3ba60a63   梁保满   发卡补卡,设备状态上传下载接口联调
1194
      keydownAnswer(event, type, isAddBig) {
813d4d64   梁保满   批量设置答案添加输入
1195
1196
        let answerA = "ABCDEFG";
        let answer_a = "abcdefg";
3ba60a63   梁保满   发卡补卡,设备状态上传下载接口联调
1197
1198
1199
1200
1201
1202
1203
        if (isAddBig) {
          answerA = answerA.substring(0, this.questionForm.selectNum);
          answer_a = answer_a.substring(0, this.questionForm.selectNum);
        } else {
          answerA = answerA.substring(0, this.formAns.subNum);
          answer_a = answer_a.substring(0, this.formAns.subNum);
        }
813d4d64   梁保满   批量设置答案添加输入
1204
1205
        answerA += answer_a;
        answerA = type == 2 ? answerA : answerA + ",";
533a17d8   梁保满   备题组卷添加批量设置答案
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
        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"
813d4d64   梁保满   批量设置答案添加输入
1220
        )
533a17d8   梁保满   备题组卷添加批量设置答案
1221
          return;
813d4d64   梁保满   批量设置答案添加输入
1222
        if (!answerA.includes(event.key)) {
533a17d8   梁保满   备题组卷添加批量设置答案
1223
1224
1225
          event.returnValue = "";
        }
      },
3ba60a63   梁保满   发卡补卡,设备状态上传下载接口联调
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
      setAllAnswer(event, type, isAddBig) {
        if (isAddBig) {
          let str = this.questionForm.answerList;
          let str2 = checkAnswer(
            str,
            type,
            this.questionForm.selectNum,
            this.questionForm.number
          );
          this.questionForm.answerList = str2;
        } else {
          let str = this.formAns.answerList;
          let str2 = checkAnswer(
            str,
            type,
            this.formAns.answerOptions.split(",").length,
            this.formAns.subNum
          );
          this.formAns.answerList = str2;
        }
813d4d64   梁保满   批量设置答案添加输入
1246
      },
533a17d8   梁保满   备题组卷添加批量设置答案
1247
1248
1249
1250
1251
1252
1253
      setAnswer(type, ans) {
        let txt = "";
        if (type == 2) {
          txt = ans;
        } else if (type == 3) {
          txt = ans + ",";
        } else if (type == 4) {
d32e461c   梁保满   备题组卷
1254
          txt = ans == 1 ? "✓" : ans == 2 ? "✗" : "";
533a17d8   梁保满   备题组卷添加批量设置答案
1255
1256
1257
1258
1259
1260
1261
        }
        return txt;
      },
      backStep1() {
        this.formatQuestionList();
        this.step = 1;
      },
13b58a42   梁保满   备题组卷部分前端页面基本完成
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
      setStep1() {
        this.$refs["forms"].validate((valid) => {
          // 验证通过:保存
          if (valid) {
            this.step = 1;
          } else {
            this.$message.error("数据有误,请检查!");
            return false;
          }
        });
      },
      setStep2() {
f26ecfa4   阿宝   测试bug
1274
1275
1276
1277
        if (!this.form.questionList.length) {
          this.$message.warning("请添加题目!");
          return;
        }
533a17d8   梁保满   备题组卷添加批量设置答案
1278
1279
1280
1281
1282
1283
1284
        // let valid = "";
        // this.form.questionList.map((item, index) => {
        //   if (!item.questionTitle) {
        //     valid += index + 1 + "、";
        //   }
        // });
        // if (!valid) {
d32e461c   梁保满   备题组卷
1285
1286
1287
1288
1289
1290
        //添加题目ID、序号
        this.form.questionList.map((item, index) => {
          item.questionType = 0;
          item.subQuestions.map((items, indexs) => {
            items.questionId = this.setNum(index, indexs);
            items.questionIndex = this.setNum(index, indexs);
533a17d8   梁保满   备题组卷添加批量设置答案
1291
          });
d32e461c   梁保满   备题组卷
1292
1293
1294
1295
1296
1297
        });
        //整理问题
        this.form.questionList?.map((item) => {
          let types = [{}];
          let addndex = 0;
          item.subQuestions.map((sub, index) => {
76693d69   梁保满   批量设置答案按钮位置
1298
            if (!!sub.questionType) {
98f6a547   梁保满   创建答题卡,统计答题信息
1299
1300
1301
1302
              if (
                sub.questionType == types[addndex].qusType &&
                sub.questionType != 5
              ) {
d32e461c   梁保满   备题组卷
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
                //同类型批量答案+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
                // );
                types[addndex].answerList = "";
                if (index == item.subQuestions.length - 1) {
                  //循环最后类型数量大于等于5,保存批量答案
533a17d8   梁保满   备题组卷添加批量设置答案
1318
                  if (types[addndex].subNum && types[addndex].subNum >= 5) {
d32e461c   梁保满   备题组卷
1319
1320
                    types[addndex].endIndex = sub.questionIndex;
                    types[addndex].index = index;
533a17d8   梁保满   备题组卷添加批量设置答案
1321
                  }
533a17d8   梁保满   备题组卷添加批量设置答案
1322
                }
d32e461c   梁保满   备题组卷
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
              } else {
                if (types[addndex].subNum && types[addndex].subNum >= 5) {
                  //不同类型时如果原有类型数量大于等于5,保存批量答案
                  types[addndex].endIndex =
                    item.subQuestions[index - 1].questionIndex;
                  types[addndex].index = index - 1;
                  addndex += 1;
                  types[addndex] = {};
                }
                //不同类型初始化批量答案
                types[addndex].qusType = sub.questionType;
                types[addndex].subNum = 1;
                types[addndex].answerOptions = sub.answerOptions;
503b6063   梁保满   判断题答案选项
1336
                types[addndex].answerList = "";
533a17d8   梁保满   备题组卷添加批量设置答案
1337
1338
              }
            }
533a17d8   梁保满   备题组卷添加批量设置答案
1339
          });
d32e461c   梁保满   备题组卷
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
          for (let i = 0; i < types.length; i++) {
            if (types[i].subNum >= 5) {
              item.subQuestions.splice(
                types[i].index + i + 1,
                0,
                deepClone(types[i])
              );
            }
          }
          console.log(types);
        });
        this.step = 2;
        return;
533a17d8   梁保满   备题组卷添加批量设置答案
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
        // } else {
        //   this.$message.error(
        //     `大题名称不能为空,请检查第${valid.slice(0, -1)}大题!`
        //   );
        // }
      },
      formatQuestionList() {
        for (let i = 0; i < this.form.questionList.length; i++) {
          for (
            let j = 0;
            j < this.form.questionList[i].subQuestions.length;
            j++
          ) {
            if (this.form.questionList[i].subQuestions[j].qusType) {
              this.form.questionList[i].subQuestions.splice(j, 1);
            }
          }
13b58a42   梁保满   备题组卷部分前端页面基本完成
1370
1371
1372
1373
1374
1375
1376
        }
      },
      openQuestion() {
        this.questionForm = { ...questionForm };
        this.addQuestionVisible = true;
      },
      addQuestion() {
3ba60a63   梁保满   发卡补卡,设备状态上传下载接口联调
1377
        //添加大题
13b58a42   梁保满   备题组卷部分前端页面基本完成
1378
1379
1380
        let subQuestions = [];
        let questionsOptions = {
          ...subQuesOptions,
255e2506   梁保满   飞书bug及优化
1381
1382
          selectNum: this.questionForm.selectNum,
          score: this.questionForm.score,
533a17d8   梁保满   备题组卷添加批量设置答案
1383
          partScore: this.questionForm.partScore,
255e2506   梁保满   飞书bug及优化
1384
1385
1386
1387
          questionType:
            this.questionForm.questionType == 6
              ? 2
              : this.questionForm.questionType,
13b58a42   梁保满   备题组卷部分前端页面基本完成
1388
1389
1390
        };
        switch (questionsOptions.questionType) {
          case 2:
8f573b82   阿宝   组卷接口联调
1391
1392
1393
            questionsOptions.answerOptions = this.rightOptions
              .slice(0, questionsOptions.selectNum)
              .join(",");
13b58a42   梁保满   备题组卷部分前端页面基本完成
1394
1395
            break;
          case 3:
8f573b82   阿宝   组卷接口联调
1396
1397
1398
            questionsOptions.answerOptions = this.rightOptions
              .slice(0, questionsOptions.selectNum)
              .join(",");
13b58a42   梁保满   备题组卷部分前端页面基本完成
1399
1400
            break;
          case 4:
503b6063   梁保满   判断题答案选项
1401
1402
1403
            questionsOptions.selectNum = 0;
            questionsOptions.answerOptions = "1,2";
            break;
13b58a42   梁保满   备题组卷部分前端页面基本完成
1404
1405
1406
1407
1408
          case 5:
            questionsOptions.selectNum = 0;
            break;
        }
        for (let i = 0; i < this.questionForm.number; i++) {
3ba60a63   梁保满   发卡补卡,设备状态上传下载接口联调
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
          let answer = "";
          if (questionsOptions.questionType == 4) {
            answer =
              this.questionForm.answerList[i] == "✓"
                ? 1
                : this.questionForm.answerList[i] == "✗"
                ? 2
                : "";
          } else if (questionsOptions.questionType == 3) {
            answer = this.questionForm.answerList.split(",")[i] || "";
          } else if (questionsOptions.questionType == 2) {
            answer = this.questionForm.answerList[i] || "";
          }
          questionsOptions.correctAnswer = answer;
13b58a42   梁保满   备题组卷部分前端页面基本完成
1423
1424
1425
1426
1427
1428
1429
          subQuestions.push({ ...questionsOptions });
        }
        this.form.questionList.push({
          questionTitle: this.questionForm.questionTitle,
          number: this.questionForm.number,
          source: 10,
          subQuestions: [...subQuestions],
3ba60a63   梁保满   发卡补卡,设备状态上传下载接口联调
1430
          show: false,
13b58a42   梁保满   备题组卷部分前端页面基本完成
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
        });
        this.addQuestionVisible = false;
      },
      delTabData(subIndex, index) {
        //删除小题
        console.log(subIndex);
        console.log(index);
        this.form.questionList[index].subQuestions.splice(subIndex, 1);
      },
      setScore(question) {
        let score = question.subQuestions.reduce((a, b) => {
533a17d8   梁保满   备题组卷添加批量设置答案
1442
          return a + (b.score ? b.score : 0);
13b58a42   梁保满   备题组卷部分前端页面基本完成
1443
        }, 0);
ee6e7628   梁保满   备题组卷借口数据对接调整
1444
        return Number(score).toFixed(2);
13b58a42   梁保满   备题组卷部分前端页面基本完成
1445
      },
98f6a547   梁保满   创建答题卡,统计答题信息
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
      equalScore(question) {
        let score = 0;
        let bools = true;
        for (let i = 0; i < question.subQuestions.length; i++) {
          if (i == 0) {
            score = question.subQuestions[i].score;
          } else {
            if (score != question.subQuestions[i].score) {
              bools = false;
              break;
            }
          }
        }
        return bools;
      },
13b58a42   梁保满   备题组卷部分前端页面基本完成
1461
1462
1463
1464
1465
1466
1467
1468
      changeAddSubQuestions(val, question) {
        if (val) {
          let questionsOptions = {
            ...subQuesOptions,
            questionType: val,
          };
          switch (questionsOptions.questionType) {
            case 2:
8f573b82   阿宝   组卷接口联调
1469
1470
1471
              questionsOptions.answerOptions = this.rightOptions
                .slice(0, questionsOptions.selectNum)
                .join(",");
13b58a42   梁保满   备题组卷部分前端页面基本完成
1472
1473
              break;
            case 3:
8f573b82   阿宝   组卷接口联调
1474
1475
1476
              questionsOptions.answerOptions = this.rightOptions
                .slice(0, questionsOptions.selectNum)
                .join(",");
f26ecfa4   阿宝   测试bug
1477
              questionsOptions.partScore = 0;
13b58a42   梁保满   备题组卷部分前端页面基本完成
1478
1479
              break;
            case 4:
503b6063   梁保满   判断题答案选项
1480
1481
1482
              questionsOptions.selectNum = 0;
              questionsOptions.answerOptions = "1,2";
              break;
13b58a42   梁保满   备题组卷部分前端页面基本完成
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
            case 5:
              questionsOptions.selectNum = 0;
              break;
          }
          question.subQuestions.push(questionsOptions);
          this.addSubQuestionsType = "";
        }
      },
      changeSubQuestions(val, subQuestions) {
        //切换多题型-小题题型
        const that = this;
        subQuestions.score = 1;
        subQuestions.partScore = 0;
        subQuestions.correctAnswer = "";
        subQuestions.selectNum = 4;
        switch (val) {
          case 2:
8f573b82   阿宝   组卷接口联调
1500
1501
1502
            subQuestions.answerOptions = that.rightOptions
              .slice(0, subQuestions.selectNum)
              .join(",");
13b58a42   梁保满   备题组卷部分前端页面基本完成
1503
1504
            break;
          case 3:
8f573b82   阿宝   组卷接口联调
1505
1506
1507
            subQuestions.answerOptions = that.rightOptions
              .slice(0, subQuestions.selectNum)
              .join(",");
13b58a42   梁保满   备题组卷部分前端页面基本完成
1508
1509
            break;
          case 4:
503b6063   梁保满   判断题答案选项
1510
1511
1512
            subQuestions.selectNum = 0;
            subQuestions.answerOptions = "1,2";
            break;
13b58a42   梁保满   备题组卷部分前端页面基本完成
1513
1514
1515
1516
1517
1518
1519
          case 5:
            subQuestions.selectNum = 0;
            break;
        }
      },
      addOptions(subQuestions) {
        //添加选项
8f573b82   阿宝   组卷接口联调
1520
        let length = subQuestions.answerOptions.split(",").length;
13b58a42   梁保满   备题组卷部分前端页面基本完成
1521
1522
        if (length > 6) return;
        subQuestions.selectNum = length + 1;
8f573b82   阿宝   组卷接口联调
1523
1524
1525
        subQuestions.answerOptions = this.rightOptions
          .slice(0, subQuestions.selectNum)
          .join(",");
13b58a42   梁保满   备题组卷部分前端页面基本完成
1526
1527
1528
      },
      removeOptions(subQuestions) {
        //删除选项
8f573b82   阿宝   组卷接口联调
1529
        let length = subQuestions.answerOptions.split(",").length;
f26ecfa4   阿宝   测试bug
1530
        if (length < 3) return;
13b58a42   梁保满   备题组卷部分前端页面基本完成
1531
        subQuestions.selectNum = length - 1;
8f573b82   阿宝   组卷接口联调
1532
1533
1534
        subQuestions.answerOptions = this.rightOptions
          .slice(0, subQuestions.selectNum)
          .join(",");
98f6a547   梁保满   创建答题卡,统计答题信息
1535
1536
1537
1538
        subQuestions.correctAnswer = subQuestions.correctAnswer.slice(
          0,
          subQuestions.selectNum
        );
13b58a42   梁保满   备题组卷部分前端页面基本完成
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
      },
      changAnswer(sub, option) {
        //设置多选答案
        let str = new RegExp(option, "g");
        if (sub.correctAnswer?.includes(option)) {
          sub.correctAnswer = sub.correctAnswer.replace(str, "");
        } else {
          let arrs = (sub.correctAnswer && sub.correctAnswer.split("")) || [];
          arrs.push(option);
          sub.correctAnswer = arrs.sort().join("");
        }
      },
818e50d7   梁保满   标签删除,修改
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
      openTagDia() {
        this.tagList = deepClone(this.answerTypeList);
        this.dialogVisible = true;
      },
      async editTypeName(obj) {
        let isRepeat = false;
        this.answerTypeList.map((item) => {
          if (item.typeName == obj.typeName) {
            isRepeat = true;
          }
        });
        if (isRepeat) {
          this.$message.error("类型已存在请重新填写!");
          return;
        }
        //修改测验类型
        const { data, status, info } = await this.$request.editPaperType({
          tagId: obj.id,
          tag: obj.typeName,
        });
        if (status == 0) {
          await this._TypeList();
          this.tagList = deepClone(this.answerTypeList);
          this.$message.success("修改成功");
        } else {
          this.$message.error(info);
        }
      },
      async removeTypeName(obj) {
        //删除测验类型
        const { data, status, info } = await this.$request.delPaperType({
          tagId: obj.id,
        });
        if (status == 0) {
          await this._TypeList();
          this.tagList = deepClone(this.answerTypeList);
          this.$message.success("删除成功");
        } else {
          this.$message.error(info);
        }
      },
ee6e7628   梁保满   备题组卷借口数据对接调整
1592
      async addPaperType() {
13b58a42   梁保满   备题组卷部分前端页面基本完成
1593
1594
1595
1596
1597
        //保存测验类型
        if (!this.answerTypeName) {
          this.$message.error("请填写测验名称!");
          return;
        }
ca39cc52   阿宝   飞书问题处理
1598
1599
1600
1601
        let isRepeat = false;
        this.answerTypeList.map((item) => {
          if (item.typeName == this.answerTypeName) {
            isRepeat = true;
4ad1ef07   阿宝   类型添加验证
1602
          }
ca39cc52   阿宝   飞书问题处理
1603
1604
        });
        if (isRepeat) {
4ad1ef07   阿宝   类型添加验证
1605
1606
1607
          this.$message.error("类型已存在请重新填写!");
          return;
        }
13b58a42   梁保满   备题组卷部分前端页面基本完成
1608
        //添加测验类型
6fffbd55   阿宝   组卷接口调整
1609
        const { data, status, info } = await this.$request.addPaperType({
8f573b82   阿宝   组卷接口联调
1610
          tag: this.answerTypeName,
13b58a42   梁保满   备题组卷部分前端页面基本完成
1611
        });
ee6e7628   梁保满   备题组卷借口数据对接调整
1612
        if (status == 0) {
aeac66d4   阿宝   飞书测试bug
1613
          await this._TypeList();
818e50d7   梁保满   标签删除,修改
1614
          this.tagList = deepClone(this.answerTypeList);
aeac66d4   阿宝   飞书测试bug
1615
          this.form.tagId = data || "";
13b58a42   梁保满   备题组卷部分前端页面基本完成
1616
1617
1618
          this.answerTypeName = "";
          this.$message.success("添加成功");
        } else {
6fffbd55   阿宝   组卷接口调整
1619
          this.$message.error(info);
13b58a42   梁保满   备题组卷部分前端页面基本完成
1620
1621
1622
        }
      },
      async save() {
8f573b82   阿宝   组卷接口联调
1623
1624
        if (this.saveLoading) return;
        this.saveLoading = true;
533a17d8   梁保满   备题组卷添加批量设置答案
1625
        this.formatQuestionList();
f5729396   梁保满   批量设置答案
1626
        let formDatas = deepClone(this.form);
3ba60a63   梁保满   发卡补卡,设备状态上传下载接口联调
1627
        for (let i = 0; i < formDatas.questionList.length; i++) {
f5729396   梁保满   批量设置答案
1628
          delete formDatas.questionList[i].show;
3ba60a63   梁保满   发卡补卡,设备状态上传下载接口联调
1629
        }
6fffbd55   阿宝   组卷接口调整
1630
        const { data, status, info } = await this.$request.addPaper({
3ba60a63   梁保满   发卡补卡,设备状态上传下载接口联调
1631
          ...formDatas,
13b58a42   梁保满   备题组卷部分前端页面基本完成
1632
        });
8f573b82   阿宝   组卷接口联调
1633
        this.saveLoading = false;
ee6e7628   梁保满   备题组卷借口数据对接调整
1634
        if (status == 0) {
13b58a42   梁保满   备题组卷部分前端页面基本完成
1635
          this.$router.push({
ee6e7628   梁保满   备题组卷借口数据对接调整
1636
1637
            path: "/examinationPaper",
          });
13b58a42   梁保满   备题组卷部分前端页面基本完成
1638
        } else {
6fffbd55   阿宝   组卷接口调整
1639
          this.$message.error(info);
13b58a42   梁保满   备题组卷部分前端页面基本完成
1640
1641
1642
1643
1644
1645
        }
      },
      async changeGrade() {
        //切换年级查询科目
        this._QuerySubjectList(this.form.gradeName);
      },
8f573b82   阿宝   组卷接口联调
1646
      async _TypeList() {
13b58a42   梁保满   备题组卷部分前端页面基本完成
1647
        //测验类型查询
8f573b82   阿宝   组卷接口联调
1648
1649
1650
1651
        const { data, status, info } = await this.$request.fetchTypeNames({
          gradeName: this.form.gradeName,
          type: 1,
        });
ee6e7628   梁保满   备题组卷借口数据对接调整
1652
        if (status == 0) {
8f573b82   阿宝   组卷接口联调
1653
          this.answerTypeList =
d5987f6a   阿宝   组件修改答案
1654
            data.list?.map((item) => {
8f573b82   阿宝   组卷接口联调
1655
1656
1657
1658
1659
              return {
                typeName: item.tag,
                id: item.tagId,
              };
            }) || [];
13b58a42   梁保满   备题组卷部分前端页面基本完成
1660
          if (this.type != 2) {
aeac66d4   阿宝   飞书测试bug
1661
            this.form.tagId = this.answerTypeList[0]?.id || "";
13b58a42   梁保满   备题组卷部分前端页面基本完成
1662
1663
          }
        } else {
6fffbd55   阿宝   组卷接口调整
1664
          this.$message.error(info);
13b58a42   梁保满   备题组卷部分前端页面基本完成
1665
1666
1667
1668
        }
      },
      async _GradeList() {
        //查询年级列表
6fffbd55   阿宝   组卷接口调整
1669
        const { data, status, info } = await this.$request.fetchGradeList();
ee6e7628   梁保满   备题组卷借口数据对接调整
1670
        if (status == 0) {
f26ecfa4   阿宝   测试bug
1671
          this.gradeList = (data.gradeNames && [...data.gradeNames]) || [];
13b58a42   梁保满   备题组卷部分前端页面基本完成
1672
1673
1674
          if (this.type != 2) {
            this.form.gradeName = this.gradeList[0];
          }
13b58a42   梁保满   备题组卷部分前端页面基本完成
1675
        } else {
6fffbd55   阿宝   组卷接口调整
1676
          this.$message.error(info);
13b58a42   梁保满   备题组卷部分前端页面基本完成
1677
1678
        }
      },
5424ef82   梁保满   接口调整
1679
      async _QuerySubjectList(grade) {
13b58a42   梁保满   备题组卷部分前端页面基本完成
1680
        //查询科目列表
8f573b82   阿宝   组卷接口联调
1681
1682
1683
        const { data, status, info } = await this.$request.fetchSubjectList({
          gradeName: grade,
        });
ee6e7628   梁保满   备题组卷借口数据对接调整
1684
        if (status === 0) {
f26ecfa4   阿宝   测试bug
1685
1686
1687
1688
1689
1690
1691
          this.subjectList =
            data.subjectNames?.map((item) => {
              return {
                value: item,
                label: item,
              };
            }) || [];
8f573b82   阿宝   组卷接口联调
1692
          console.log(this.subjectList);
ee6e7628   梁保满   备题组卷借口数据对接调整
1693
1694
          if (this.subjectList.length) {
            this.form.subjectName = this.subjectList[0].value;
13b58a42   梁保满   备题组卷部分前端页面基本完成
1695
          }
8f573b82   阿宝   组卷接口联调
1696
          console.log(this.form);
13b58a42   梁保满   备题组卷部分前端页面基本完成
1697
        } else {
6fffbd55   阿宝   组卷接口调整
1698
          this.$message.error(info);
13b58a42   梁保满   备题组卷部分前端页面基本完成
1699
1700
        }
      },
ee6e7628   梁保满   备题组卷借口数据对接调整
1701
      async _QueryDetail() {
03bce046   梁保满   个人版调整
1702
        //查询答题卡详情
6fffbd55   阿宝   组卷接口调整
1703
        const { data, status, info } = await this.$request.fetchPaperDetail({
ee6e7628   梁保满   备题组卷借口数据对接调整
1704
1705
1706
          paperId: this.$route.query.paperId,
        });
        if (status == 0) {
f26ecfa4   阿宝   测试bug
1707
          this.form.title = data.title + "_副本";
ca39cc52   阿宝   飞书问题处理
1708
          this.form.tagId = data.tagId === 0 ? "" : data.tagId;
ee6e7628   梁保满   备题组卷借口数据对接调整
1709
          this.form.subjectName = data.subjectName;
8f573b82   阿宝   组卷接口联调
1710
          this.form.gradeName = data.gradeName;
ee6e7628   梁保满   备题组卷借口数据对接调整
1711
1712
1713
1714
1715
1716
1717
1718
1719
          this.form.examsDuration = data.examsDuration;
          this.form.sharingType = data.sharingType;
          this.form.questionList = data.questionList?.map((item) => {
            let subQuestions =
              item.subQuestions?.map((items) => {
                return {
                  questionType: items.questionType,
                  score: items.score,
                  partScore: items.partScore,
8f573b82   阿宝   组卷接口联调
1720
1721
                  selectNum: items.answerOptions.split(",").length,
                  answerOptions: items.answerOptions || "A,B,C,D",
ee6e7628   梁保满   备题组卷借口数据对接调整
1722
1723
1724
1725
1726
1727
                  correctAnswer: items.correctAnswer,
                };
              }) || [];
            return {
              questionTitle: item.questionTitle,
              subQuestions: subQuestions,
98f6a547   梁保满   创建答题卡,统计答题信息
1728
              show: false,
ee6e7628   梁保满   备题组卷借口数据对接调整
1729
1730
1731
            };
          });
        } else {
6fffbd55   阿宝   组卷接口调整
1732
          this.$message.error(info);
ee6e7628   梁保满   备题组卷借口数据对接调整
1733
1734
        }
      },
13b58a42   梁保满   备题组卷部分前端页面基本完成
1735
1736
1737
    },
  };
  </script>
4c4f7640   梁保满   路由表,路由前端文件
1738
  
13b58a42   梁保满   备题组卷部分前端页面基本完成
1739
1740
1741
1742
  <style lang="scss" scoped>
  .red {
    color: #f30;
  }
533a17d8   梁保满   备题组卷添加批量设置答案
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
  .qs-options {
    flex: 1;
    .ipt {
      margin-bottom: 5px;
    }
    .answer-box {
      .answer-s {
        cursor: pointer;
        user-select: none;
        &:first-of-type {
          margin-left: 0;
        }
      }
    }
    .delButton {
      text-indent: -9999999px;
      border-color: #ff6868;
77ebf04d   梁保满   个人版
1760
      background: #ff6868 url("../../../assets/images/arrow.png") no-repeat center;
533a17d8   梁保满   备题组卷添加批量设置答案
1761
1762
1763
      background-size: 19px;
      color: transparent;
    }
3ba60a63   梁保满   发卡补卡,设备状态上传下载接口联调
1764
1765
    .answer-s.ac {
      border: none;
11a4e518   梁保满   背题组卷修改答案设置,即使测随堂问...
1766
    }
533a17d8   梁保满   备题组卷添加批量设置答案
1767
1768
1769
    .ac {
      border-color: #ff6868;
      background: #ff6868;
3ba60a63   梁保满   发卡补卡,设备状态上传下载接口联调
1770
      color: #fff !important;
533a17d8   梁保满   备题组卷添加批量设置答案
1771
1772
1773
    }
  }
  
255e2506   梁保满   飞书bug及优化
1774
1775
  .sel2 {
    width: 480px;
e5ff81a1   阿宝   集团管理员接口
1776
  }
533a17d8   梁保满   备题组卷添加批量设置答案
1777
1778
1779
1780
1781
1782
1783
  .set-ans-btn {
    width: 100%;
    padding: 10px 0 10px 630px;
    box-sizing: border-box;
    border-right: 1px solid #e2e2e2;
    border-bottom: 1px solid #e2e2e2;
  }
255e2506   梁保满   飞书bug及优化
1784
1785
1786
  .content-box {
    width: 100%;
    height: 100%;
ca39cc52   阿宝   飞书问题处理
1787
1788
    overflow-y: auto;
  }
13b58a42   梁保满   备题组卷部分前端页面基本完成
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
  .content {
    width: 100%;
    box-sizing: border-box;
    padding: 0 50px;
    .ml-20 {
      margin-left: 20px;
    }
    .btn-box {
      text-align: right;
      margin-left: 140px;
    }
  }
  .dia-content {
    .dia-tit {
      font-size: 20px;
      color: #333;
      font-weight: 700;
      text-align: center;
    }
    .add-type {
818e50d7   梁保满   标签删除,修改
1809
1810
1811
1812
1813
1814
      width: 100%;
      margin-bottom: 10px;
      .js-set {
        margin: 2.5px 10px 0 0;
        font-size: 14px;
      }
13b58a42   梁保满   备题组卷部分前端页面基本完成
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
    }
    .add-btn {
      margin-left: 20px;
    }
  }
  .el-message-box {
    :deep(.el-button--default) {
      color: #fff;
    }
  }
  .add-box {
    display: flex;
    justify-content: center;
    align-items: center;
    .add-question {
      display: flex;
      justify-content: center;
      align-items: center;
      font-size: 16px;
      font-weight: bolder;
      padding: 2px;
      cursor: pointer;
      .s1 {
        margin-left: 6px;
      }
      :deep(.el-icon-plus) {
        font-size: 24px;
        font-weight: 900;
      }
      :deep(.el-button--mini.is-circle) {
        padding: 3px;
      }
    }
  }
  .dialog-footer {
    text-align: center;
    :deep(.el-button) {
      border-radius: 20px;
      padding: 8px 20px 7px;
      margin: 0 12px;
    }
  }
3ba60a63   梁保满   发卡补卡,设备状态上传下载接口联调
1857
1858
1859
  .question-box {
    margin-bottom: 20px;
  }
13b58a42   梁保满   备题组卷部分前端页面基本完成
1860
1861
  .question-title {
    line-height: 40px;
3ba60a63   梁保满   发卡补卡,设备状态上传下载接口联调
1862
1863
1864
    display: flex;
    align-items: center;
    margin-bottom: 12px;
503b6063   梁保满   判断题答案选项
1865
    .m20 {
98f6a547   梁保满   创建答题卡,统计答题信息
1866
      margin-left: 20px;
d32e461c   梁保满   备题组卷
1867
    }
13b58a42   梁保满   备题组卷部分前端页面基本完成
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
    .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;
    }
3ba60a63   梁保满   发卡补卡,设备状态上传下载接口联调
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
    .el-icon-caret-right {
      font-size: 24px;
      color: #888;
      transition: all 0.4s;
      margin-right: 12px;
      cursor: pointer;
      &.active {
        transform: rotate(90deg);
      }
    }
  }
  .questions-ul {
    border-left: 1px solid #e2e2e2;
    border-top: 1px solid #e2e2e2;
13b58a42   梁保满   备题组卷部分前端页面基本完成
1899
1900
1901
1902
  }
  .el-input-number {
    width: 140px;
  }
f26ecfa4   阿宝   测试bug
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
  .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;
    }
  }
13b58a42   梁保满   备题组卷部分前端页面基本完成
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
  .answer-box {
    .answer-s {
      display: inline-block;
      width: 30px;
      height: 30px;
      border: 1px solid #e2e2e2;
      border-radius: 3px;
      margin: 0 6px;
      font-size: 16px;
      color: #333;
      text-align: center;
      line-height: 30px;
      &.active {
        background: #5e78fa;
        border-color: #5e78fa;
        color: #fff;
      }
    }
  }
255e2506   梁保满   飞书bug及优化
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
  .qs-options {
    .answer-s {
      display: inline-block;
      width: 30px;
      height: 30px;
      border: 1px solid #e2e2e2;
      border-radius: 3px;
      margin: 0 6px;
      font-size: 16px;
      color: #333;
      text-align: center;
      line-height: 30px;
      cursor: pointer;
      &.active {
        background: #5e78fa;
        border-color: #5e78fa;
        color: #fff;
      }
    }
  }
13b58a42   梁保满   备题组卷部分前端页面基本完成
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
  .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;
      }
    }
  }
4c4f7640   梁保满   路由表,路由前端文件
2005
  </style>