Blame view

src/views/basic/askTestQuestion/update.vue 49.7 KB
f45b3c05   LH_PC   云平台新UI界面
1
2
3
4
5
6
  <template>
    <el-container class="default-body">
      <el-header>
        <back-box class="detailBack">
          <template slot="title">
            <span class="default-title">
77fa942a   LH_PC   feat:修改打印对接
7
              {{ isViewer && !isWrong ? "详情" : type == 1 ? paperType == 1 ? "修改课件" : "修改试卷" : "修改答案" }}</span>
f45b3c05   LH_PC   云平台新UI界面
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
          </template>
        </back-box>
      </el-header>
      <el-main style="margin-top: 20px !important">
        <div class="content">
          <template v-if="type == 1">
            <p class="tips" v-if="paperModifyLog.modifiedTime">
              <i class="fa fa-bell-o"></i>
              {{
                `${paperModifyLog.modifiedTime} ${paperModifyLog.realName}`
              }}老师修改了答案
            </p>
          </template>
          <div class="answer-title" :class="type == 1 ? 't-left' : ''">
            <p class="name-box">
              <span>试卷名称:</span>
77fa942a   LH_PC   feat:修改打印对接
24
              <el-input :disabled="isViewer && !isWrong" class="ipt-name" v-model="form.title"></el-input>
f45b3c05   LH_PC   云平台新UI界面
25
26
27
            </p>
            <p class="name-box">
              <span>分享范围:</span>
77fa942a   LH_PC   feat:修改打印对接
28
29
30
              <el-radio :disabled="isViewer && !isWrong" class="name-radio" v-model="form.sharingType"
                :label="0">任课班级分享</el-radio>
              <el-radio :disabled="isViewer && !isWrong" class="name-radio" @click.native="_selectClassSharingType"
574f1a90   LH_PC   fix:修改年级组长/任课老师缺少...
31
                v-model="form.sharingType" :label="1">自定义分享班级</el-radio>
f45b3c05   LH_PC   云平台新UI界面
32
33
34
            </p>
          </div>
          <div class="question-box">
6bca489d   LH_PC   云平台二期UI
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
            <div class="question-content">
              <div v-if="paperType == 1" class="courseware-title sub-questions">
                <div class="qs-num">题号</div>
                <div class="qs-stem">题干</div>
                <div class="qs-type">题型</div>
                <div class="qs-score">分数</div>
                <div class="qs-partScore">漏选得分</div>
                <div class="qs-options">选项设置</div>
                <div v-if="!isViewer" class="qs-oprations">操作</div>
              </div>
              <div>
                <div class="question-contents" v-for="(question, index) in questionList">
                  <div :class="paperType != 1 ? 'bigQuestion' : ''">
                    <div class="bigQuestionTitle" v-if="paperType != 1">
                      {{ question.questionTitle }}
                      (共{{ question.subQuestions.filter(subQuestion => subQuestion &&
77fa942a   LH_PC   feat:修改打印对接
51
                        subQuestion.questionIndex && subQuestion.questionType).length }}小题,
6bca489d   LH_PC   云平台二期UI
52
                      共{{ question.score }}分)
f45b3c05   LH_PC   云平台新UI界面
53
                    </div>
6bca489d   LH_PC   云平台二期UI
54
55
56
57
58
59
60
61
                    <div v-if="paperType == 2 && index == 0" class="courseware-title sub-questions">
                      <div class="qs-num">题号</div>
                      <div class="qs-stem">题干</div>
                      <div class="qs-type">题型</div>
                      <div class="qs-score">分数</div>
                      <div class="qs-partScore">漏选得分</div>
                      <div class="qs-options">选项设置</div>
                      <div v-if="!isViewer" class="qs-oprations">操作</div>
f45b3c05   LH_PC   云平台新UI界面
62
                    </div>
6bca489d   LH_PC   云平台二期UI
63
64
  
                    <div class="courseware-content sub-questions" v-if="subQuestion &&
77fa942a   LH_PC   feat:修改打印对接
65
                      subQuestion.questionIndex && subQuestion.questionType && question.subQuestions"
6bca489d   LH_PC   云平台二期UI
66
                      v-for="(subQuestion, subIndex) in question.subQuestions">
ef16e57e   LH_PC   fix:前端版本迭代
67
                      <div class="qs-num">{{ subQuestion.questionIndex }}</div>
6bca489d   LH_PC   云平台二期UI
68
69
70
71
72
73
74
75
76
77
                      <div class="qs-stem">
                        <iframe style="height: 100% !important" class="screenshot" :src="subQuestion.screenshot"></iframe>
                      </div>
                      <div class="qs-type">
                        <el-select :disabled="isViewer" v-model="subQuestion.questionType">
                          <el-option v-for="item in questionOption" :key="item.Key" :label="item.Text"
                            :value="item.Key" />
                        </el-select>
                      </div>
                      <div class="qs-score">
77fa942a   LH_PC   feat:修改打印对接
78
79
                        <el-input-number :disabled="isViewer && !isWrong" class="number-ipt" size="medium" :min="1"
                          :max="200" :precision="2" :step="1" v-model="subQuestion.score" label="单题分值" />
6bca489d   LH_PC   云平台二期UI
80
81
82
                      </div>
                      <div class="qs-partScore">
                        <p v-if="subQuestion.questionType != 3">------</p>
def1d479   LH_PC   fix:漏选得分查看修改
83
                        <el-input-number :disabled="isViewer && !isWrong" class="number-ipt" v-else size="medium" :min="0" :precision="2"
6bca489d   LH_PC   云平台二期UI
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
                          :max="subQuestion.score" :step="0.5" v-model="subQuestion.partScore" label="漏选得分" />
                      </div>
                      <div class="qs-options">
                        <p v-if="subQuestion.questionType == 5">--</p>
                        <p v-if="subQuestion.questionType == 4" class="answer-box">
                          <span class="answer-s" v-if="!isViewer"
                            :class="subQuestion.correctAnswer == 1 ? 'answer-active' : ''"
                            @click="subQuestion.correctAnswer = 1">✓</span>
                          <span class="answer-s" v-if="!isViewer"
                            :class="subQuestion.correctAnswer == 2 ? 'answer-active' : ''"
                            @click="subQuestion.correctAnswer = 2">✗</span>
                          <span class="answer-s" v-if="isViewer"
                            :class="subQuestion.correctAnswer == 1 ? 'answer-active' : ''">✓</span>
                          <span class="answer-s" v-if="isViewer"
                            :class="subQuestion.correctAnswer == 2 ? 'answer-active' : ''">✗</span>
                        </p>
                        <p v-if="subQuestion.questionType == 3" class="answer-box">
                          <template :disabled="isViewer" v-for="option in subQuestion.answerOptions.split(',')">
                            <span v-if="option && !isViewer" class="answer-s"
                              :class="subQuestion.correctAnswer.includes(option) ? 'answer-active' : ''" :key="option"
                              @click="changAnswer(subQuestion, option)">{{ option }}</span>
                            <span v-if="option && isViewer" class="answer-s"
                              :class="subQuestion.correctAnswer.includes(option) ? 'answer-active' : ''" :key="option">{{
77fa942a   LH_PC   feat:修改打印对接
107
                                option }}</span>
6bca489d   LH_PC   云平台二期UI
108
109
110
111
                          </template>
                          <span class="answer-s answer-opration" v-if="!isViewer"
                            @click="openStem(subQuestion, 4, index, subIndex)">+</span>
                          <span class="answer-s answer-opration" v-if="!isViewer"
ef16e57e   LH_PC   fix:前端版本迭代
112
                            @click="openStem(subQuestion, 5, index, subIndex)">-</span>
6bca489d   LH_PC   云平台二期UI
113
114
115
116
117
118
119
120
                        </p>
                        <p v-if="subQuestion.questionType == 2" class="answer-box">
                          <template :disabled="isViewer" v-for="option in subQuestion.answerOptions.split(',')">
                            <span class="answer-s" v-if="option && !isViewer"
                              :class="subQuestion.correctAnswer == option ? 'answer-active' : ''" :key="option"
                              @click="subQuestion.correctAnswer = option">{{ option }}</span>
                            <span v-if="option && isViewer" class="answer-s"
                              :class="subQuestion.correctAnswer.includes(option) ? 'answer-active' : ''" :key="option">{{
77fa942a   LH_PC   feat:修改打印对接
121
                                option }}</span>
6bca489d   LH_PC   云平台二期UI
122
123
124
125
126
127
128
129
130
131
                          </template>
                          <span class="answer-s answer-opration" v-if="!isViewer"
                            @click="openStem(subQuestion, 4, index, subIndex)">+</span>
                          <span class="answer-s answer-opration" v-if="!isViewer"
                            @click="openStem(subQuestion, 5, index, subIndex)">-</span>
                        </p>
                      </div>
                      <div class="qs-oprations" v-if="!isViewer">
                        <div class="qs-set">
                          <el-button class="icon-tickets" type="text"
30db09b4   LH_PC   feat:修改错题的
132
                            @click="openStem(subQuestion, 1, index, subIndex)">题干</el-button>
6bca489d   LH_PC   云平台二期UI
133
134
135
                        </div>
                        <div class="qs-set">
                          <el-button class="icon-tickets" type="text"
30db09b4   LH_PC   feat:修改错题的
136
                            @click="openStem(subQuestion, 2, index, subIndex)">解析</el-button>
6bca489d   LH_PC   云平台二期UI
137
                        </div>
ef16e57e   LH_PC   fix:前端版本迭代
138
                        <div class="qs-set">
30db09b4   LH_PC   feat:修改错题的
139
                          <el-button type="text" @click="openKnowledge(subQuestion, index, subIndex)">知识点</el-button>
6bca489d   LH_PC   云平台二期UI
140
                        </div>
ef16e57e   LH_PC   fix:前端版本迭代
141
                        <div class="qs-set">
6bca489d   LH_PC   云平台二期UI
142
                          <el-popconfirm @confirm="_deleteDetermineQ(subIndex, index)" title="这是一小题确定删除吗?">
ef16e57e   LH_PC   fix:前端版本迭代
143
                            <!-- <el-button style="color:red; " type="text" slot="reference">删除</el-button> -->
6bca489d   LH_PC   云平台二期UI
144
145
146
                          </el-popconfirm>
                        </div>
                      </div>
f45b3c05   LH_PC   云平台新UI界面
147
                    </div>
6bca489d   LH_PC   云平台二期UI
148
                    <div v-if="!question.subQuestions" class="courseware-content sub-questions">
ef16e57e   LH_PC   fix:前端版本迭代
149
                      <div class="qs-num">{{ question.questionIndex }}</div>
6bca489d   LH_PC   云平台二期UI
150
151
152
153
154
155
156
157
158
159
                      <div class="qs-stem">
                        <iframe style="height: 100% !important" class="screenshot" :src="question.screenshot"></iframe>
                      </div>
                      <div class="qs-type">
                        <el-select v-model="question.questionType">
                          <el-option :disabled="isViewer" v-for="item in questionOption" :key="item.Key"
                            :label="item.Text" :value="item.Key" />
                        </el-select>
                      </div>
                      <div class="qs-score">
77fa942a   LH_PC   feat:修改打印对接
160
161
                        <el-input-number :disabled="isViewer && !isWrong" class="number-ipt" size="medium" :min="1"
                          :max="200" :precision="2" :step="1" v-model="question.score" label="单题分值" />
6bca489d   LH_PC   云平台二期UI
162
163
164
                      </div>
                      <div class="qs-partScore">
                        <p v-if="question.questionType != 3">------</p>
def1d479   LH_PC   fix:漏选得分查看修改
165
                        <el-input-number :disabled="isViewer && !isWrong" class="number-ipt" v-else size="medium" :min="0" :precision="2"
6bca489d   LH_PC   云平台二期UI
166
167
168
169
170
171
                          :max="question.score" :step="0.5" v-model="question.partScore" label="漏选得分" />
                      </div>
                      <div class="qs-options">
                        <p v-if="question.questionType == 5">--</p>
                        <p v-if="question.questionType == 4" class="answer-box">
                          <span class="answer-s" :class="question.correctAnswer == 1 ? 'answer-active' : ''
77fa942a   LH_PC   feat:修改打印对接
172
                            " @click="question.correctAnswer = 1">✓</span>
6bca489d   LH_PC   云平台二期UI
173
                          <span class="answer-s" :class="question.correctAnswer == 2 ? 'answer-active' : ''
77fa942a   LH_PC   feat:修改打印对接
174
                            " @click="question.correctAnswer = 2">✗</span>
6bca489d   LH_PC   云平台二期UI
175
176
177
178
                        </p>
                        <p v-if="question.questionType == 3" class="answer-box">
                          <template v-for="option in question.answerOptions.split(',')">
                            <span v-if="option" class="answer-s" :class="question.correctAnswer.includes(option)
77fa942a   LH_PC   feat:修改打印对接
179
180
181
                              ? 'answer-active'
                              : ''
                              " :key="option" @click="changAnswer(question, option)">{{ option }}</span>
6bca489d   LH_PC   云平台二期UI
182
183
184
185
186
187
188
189
190
                          </template>
                          <span class="answer-s answer-opration" v-if="!isViewer"
                            @click="openStem(question, 4, index, 0)">+</span>
                          <span class="answer-s answer-opration" v-if="!isViewer"
                            @click="openStem(question, 4, index, 0)">-</span>
                        </p>
                        <p v-if="question.questionType == 2" class="answer-box">
                          <template v-for="option in question.answerOptions.split(',')">
                            <span class="answer-s" v-if="option" :class="question.correctAnswer == option
77fa942a   LH_PC   feat:修改打印对接
191
192
193
                              ? 'answer-active'
                              : ''
                              " :key="option" @click="question.correctAnswer = option">{{ option }}</span>
6bca489d   LH_PC   云平台二期UI
194
195
196
197
198
199
                          </template>
                          <span class="answer-s answer-opration" v-if="!isViewer"
                            @click="openStem(question, 4, index, 0)">+</span>
                          <span class="answer-s answer-opration" v-if="!isViewer"
                            @click="openStem(question, 5, index, 0)">-</span>
                        </p>
f45b3c05   LH_PC   云平台新UI界面
200
                      </div>
6bca489d   LH_PC   云平台二期UI
201
202
203
                      <div class="qs-oprations">
                        <div class="qs-set">
                          <el-button class="icon-tickets" type="text"
30db09b4   LH_PC   feat:修改错题的
204
                            @click="openStem(question, 1, index, 0)">题干</el-button>
6bca489d   LH_PC   云平台二期UI
205
206
207
                        </div>
                        <div class="qs-set">
                          <el-button class="icon-tickets" type="text"
30db09b4   LH_PC   feat:修改错题的
208
                            @click="openStem(question, 2, index, 0)">解析</el-button>
6bca489d   LH_PC   云平台二期UI
209
                        </div>
ef16e57e   LH_PC   fix:前端版本迭代
210
                        <div class="qs-set">
30db09b4   LH_PC   feat:修改错题的
211
                          <el-button type="text" @click="openKnowledge(question, index, 0)">知识点</el-button>
6bca489d   LH_PC   云平台二期UI
212
                        </div>
ef16e57e   LH_PC   fix:前端版本迭代
213
                        <div class="qs-set">
6bca489d   LH_PC   云平台二期UI
214
215
216
217
                          <el-popconfirm @confirm="_deleteDetermineQ(0, index)" title="这是一小题确定删除吗?">
                            <!-- <el-button style="color:red" type="text" slot="reference">删除</el-button> -->
                          </el-popconfirm>
                        </div>
f45b3c05   LH_PC   云平台新UI界面
218
219
220
221
222
223
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
f45b3c05   LH_PC   云平台新UI界面
224
          </div>
ef16e57e   LH_PC   fix:前端版本迭代
225
226
227
          <el-dialog title="选择班级分享" :visible.sync="classSharingType" width="800" :close-on-click-modal="false"
            :append-to-body="true">
            <div :key="classSharingType">
574f1a90   LH_PC   fix:修改年级组长/任课老师缺少...
228
              <div class="row-subfix">
77fa942a   LH_PC   feat:修改打印对接
229
                <div>
574f1a90   LH_PC   fix:修改年级组长/任课老师缺少...
230
231
232
233
234
235
236
                  <span class="line-subfix">年级:</span>
                  <span class="line-value">{{ gradeName }}</span>
                </div>
              </div>
              <div v-if="gradeClass.length >= 1" class="row-subfix"
                style="margin-top: 20px;margin-bottom: 20px;overflow: auto">
                <span class="line-subfix" style="float: left;">班级:</span>
77fa942a   LH_PC   feat:修改打印对接
237
238
                <div
                  style="float: left;background:rgb(245,247,250);padding:15px 10px;width: calc(100% - 80px);border-radius:5px;">
574f1a90   LH_PC   fix:修改年级组长/任课老师缺少...
239
                  <span class="line-value" style="min-height: 300px;border-radius: 4px; background: rgb(247,247,250);">
77fa942a   LH_PC   feat:修改打印对接
240
                    <el-checkbox v-model="checkAll" @change="handleCheckAllChange">全选</el-checkbox>
574f1a90   LH_PC   fix:修改年级组长/任课老师缺少...
241
242
243
244
245
246
247
248
249
                    <div>
                      <el-checkbox @change="handleCheckedClassChange" v-model="item.isChecked" :key="index"
                        v-for="(item, index) in gradeClass" :label="item.id">
                        {{ item.className }}
                      </el-checkbox>
                    </div>
                  </span>
                </div>
              </div>
6bca489d   LH_PC   云平台二期UI
250
251
252
253
            </div>
            <div slot="footer">
              <el-button type="info" :size="'small'" @click="classSharingType = false">取消</el-button>
              <el-button type="primary" :size="'small'" @click="_checkedClass">确定</el-button>
f45b3c05   LH_PC   云平台新UI界面
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
            </div>
          </el-dialog>
          <el-dialog :close-on-click-modal="false" title="批量设置答案" :visible.sync="diaSetAns" width="400"
            :modal-append-to-body="false" :append-to-body="true">
            <div class="qs-options set-questions">
              <p class="dia-tips">
                请点击选项按钮设置答案,多选题题目之间用“,”隔开,若添加5道题:“AC,AD,BD,AC,CD”
              </p>
              <p>{{ setSubPro(formAns.qusType) }}:</p>
              <p class="ipt">
                <el-input ref="formAnsIpt" v-if="formAns.qusType == 2 || formAns.qusType == 3"
                  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">
                  <span class="answer-s answer-active" @click="
77fa942a   LH_PC   feat:修改打印对接
272
273
274
275
                    formAns.answerList.length < formAns.subNum
                      ? (formAns.answerList += '✓')
                      : ''
                    ">✓</span>
f45b3c05   LH_PC   云平台新UI界面
276
                  <span class="answer-s answer-active" @click="
77fa942a   LH_PC   feat:修改打印对接
277
278
279
280
                    formAns.answerList.length < formAns.subNum
                      ? (formAns.answerList += '✗')
                      : ''
                    ">✗</span>
f45b3c05   LH_PC   云平台新UI界面
281
282
283
284
285
286
287
288
289
                </template>
                <template v-if="formAns.qusType == 3">
                  <span class="answer-s answer-active" v-for="option in formAns.answerOptions.split(',')" :key="option"
                    @click="setMultiple(formAns, option)">{{ option }}</span>
                  <span class="answer-s answer-active" @click="setMultiple(formAns, ',')">,</span>
                </template>
                <template v-if="formAns.qusType == 2">
                  <span class="answer-s answer-active" v-for="option in formAns.answerOptions.split(',')" :key="option"
                    @click="
77fa942a   LH_PC   feat:修改打印对接
290
291
292
293
                      formAns.answerList.length < formAns.subNum
                        ? (formAns.answerList += option)
                        : ''
                      ">{{ option }}</span>
f45b3c05   LH_PC   云平台新UI界面
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
                </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>
          <el-dialog :close-on-click-modal="false" :title="stem.type == 1 ? '上传题干' : '上传题目解析'" :visible.sync="dialogStem"
            v-if="dialogStem" width="800px" :append-to-body="true">
            <div class="upload-box">
              <div v-loading="iframeLoading">
                <template v-if="stem.type == 1">
                  <iframe ref="screenshot" class="screenshot" v-if="stem.screenshot" :src="stem.screenshot"
                    @load="iframeLoading = false"></iframe>
                </template>
                <template v-else>
                  <iframe ref="screenshot" class="screenshot" v-if="stem.answerScreenshot" :src="stem.answerScreenshot"
                    @load="iframeLoading = false"></iframe>
                </template>
              </div>
              <el-upload class="upload-demo" :action="uploadUrl" :limit="1" :on-success="upSuccess" :on-error="upError"
                accept="image/*">
                <el-button size="small" type="primary">选择照片</el-button>
              </el-upload>
            </div>
            <div slot="footer">
              <el-button @click="dialogStem = false">确定</el-button>
            </div>
          </el-dialog>
6bca489d   LH_PC   云平台二期UI
326
          <el-dialog :append-to-body="true" :close-on-click-modal="false" title="知识点" :visible.sync="dialogKnowledge"
ef16e57e   LH_PC   fix:前端版本迭代
327
328
329
            width="60%">
            <knowledgePoints :key="dialogKnowledge" @opration="knowledgeOpration" :sectionName="stem.sectionName"
              :subjectName="stem.subjectName" :knowledges="stem.knowledge" />
f45b3c05   LH_PC   云平台新UI界面
330
331
332
          </el-dialog>
        </div>
        <div class="content-fi">
6bca489d   LH_PC   云平台二期UI
333
          <el-button type="info" @click="linkBack">取消</el-button>
def1d479   LH_PC   fix:漏选得分查看修改
334
          <el-button v-if="!isViewer || isWrong" class="green-el-button" @click="save">保存</el-button>
f45b3c05   LH_PC   云平台新UI界面
335
336
337
338
339
340
341
        </div>
      </el-main>
    </el-container>
  </template>
  
  <script>
  import { deepClone, checkAnswer } from "utils";
ef16e57e   LH_PC   fix:前端版本迭代
342
  import conf from "@/config/index";
f45b3c05   LH_PC   云平台新UI界面
343
344
345
346
347
  export default {
    data() {
      return {
        role: "",
        title: "",
6bca489d   LH_PC   云平台二期UI
348
        classSharingType: false,
f45b3c05   LH_PC   云平台新UI界面
349
350
351
352
        gradeName: "",
        checkAll: false,
        checkedClass: [],
        gradeClass: [],
6bca489d   LH_PC   云平台二期UI
353
354
        subjectName: "",
        isViewer: false,
77fa942a   LH_PC   feat:修改打印对接
355
        isWrong: false,
f45b3c05   LH_PC   云平台新UI界面
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
        isIndeterminate: true,
        type: 1, //1:答题卡 2:即时测报表题目列表 3:课时题目列表
        questionList: [],
        paperType: 1, //1 备题(随堂问) /2 组卷,
        classId: -1,
        //题型选项
        questionOption: [
          { Key: 2, Text: "单选题" },
          { Key: 3, Text: "多选题" },
          { Key: 4, Text: "判断题" },
          { Key: 5, Text: "主观题" },
        ],
        classSharingType: false,
        optionValues: ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J"],
        //答题卡详情
        form: {
          examType: 2, //考试类型:0-未知/1-随堂问/2-即时测/3-xx考
          title: "",
          tag: "",
          subjectId: "",
          examsDuration: 90,
          sharingType: -1,
          sectionName: "",
          gradeName: "",
          share: 1,
          questionList: [],
        },
        paperModifyLog: {
          realName: "",
          modifiedTime: "",
        },
        diaSetAns: false,
        formAns: {
          listIndex: 0, //大题位置
          endIndex: 0, //相同题目最后一位题目的questionIndex
          index: 0,
          qusType: "", //题目类型
          subNum: 0, //数量
          answerOptions: [], //答案选项
          answerList: "", //答案列表-字符串
        },
        //v1.5
        dialogStem: false, //截图开关
        dialogKnowledge: false, //知识点开关
ef16e57e   LH_PC   fix:前端版本迭代
400
        // knowledgeList: { ...knowledgeList },
f45b3c05   LH_PC   云平台新UI界面
401
402
403
404
405
406
407
408
409
410
        classList: [],
        stem: {
          type: 1,
          index: 0, //大题位置
          indexs: 0, //小题位置
          screenshot: "", //题干图片地址
          answerScreenshot: "", //题目解析图片地址
          knowledge: [], //知识点
        },
        gradeClassList: [], //学段列表
ef16e57e   LH_PC   fix:前端版本迭代
411
        // uploadUrl: "/file/uploadImgToHtml",
f45b3c05   LH_PC   云平台新UI界面
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
        iframeLoading: false,
        examType: 2,
      };
    },
    computed: {
      allScore: function () {
        let score = 0;
        this.questionList?.map((item) => {
          if (item.subQuestions) {
            score += item.subQuestions.reduce((a, b) => {
              return a + (Number(b.score) || 0);
            }, 0);
          } else {
            score += item.score || 0;
          }
        }, 0);
        return Number(score).toFixed(2);
      },
ef16e57e   LH_PC   fix:前端版本迭代
430
431
432
433
434
435
436
437
438
      uploadUrl: function () {
        var requestUrl = '';
  
        var ogrinUrl = '/file/uploadImgToHtml';
  
        var baseUrl = conf.baseURL;
  
        if (baseUrl == '/' && ogrinUrl.indexOf('/') == 0) {
          requestUrl = ogrinUrl;
f45b3c05   LH_PC   云平台新UI界面
439
        }
ef16e57e   LH_PC   fix:前端版本迭代
440
441
442
443
444
445
        else {
          requestUrl = baseUrl + ogrinUrl
        }
  
        return requestUrl;
      }
f45b3c05   LH_PC   云平台新UI界面
446
447
448
449
450
451
452
453
    },
    created() {
      this.role =
        this.$store.getters.info.showRole ||
        this.$store.getters.info.permissions[0].role;
      this.type = this.$route.query.type || 1;
      this.examType = this.$route.query.examType || 2;
      this.paperType = this.$route.query.paperType || 2;
6bca489d   LH_PC   云平台二期UI
454
      this.isViewer = this.$route.query.isViewer || false;
f45b3c05   LH_PC   云平台新UI界面
455
456
      this.classId = this.$route.query.classId || -1;
      this.gradeName = this.$route.query.gradeName || "";
6bca489d   LH_PC   云平台二期UI
457
      this.subjectName = this.$route.query.subjectName || "";
f45b3c05   LH_PC   云平台新UI界面
458
459
460
461
462
      this.form.title = this.$route.query.title || "";
      this._QueryDetail();
      this._GradeList();
    },
    methods: {
ef16e57e   LH_PC   fix:前端版本迭代
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
      // 知识点
      openKnowledge(obj, index, indexs) {
        this.stem.index = index;
        this.stem.indexs = indexs;
        this.stem.knowledge = obj.knowledge;
        if (this.form.gradeName && this.form.subjectName) {
          var matchClass = this.gradeClassList.find((item) => {
            if (this.form.gradeName == item.gradeName) {
              return item.sectionName;
            }
          });
          this.stem.sectionName = matchClass?.sectionName ?? "";
          this.stem.subjectName = this.form.subjectName ?? "";
        }
        this.dialogKnowledge = true;
      },
      knowledgeOpration(target) {
        if (target.opration == 'confirm') {
          this.form.questionList[this.stem.index].
            subQuestions[this.stem.indexs].knowledge = target.knowledges.join(",");
          this.dialogKnowledge = false;
        }
        else {
          this.dialogKnowledge = false;
        }
      },
f45b3c05   LH_PC   云平台新UI界面
489
      _checkedClass() {
ef16e57e   LH_PC   fix:前端版本迭代
490
        this.checkedClass = this.gradeClass.filter(item => item.isChecked).map(imap => imap.id);
f45b3c05   LH_PC   云平台新UI界面
491
492
493
        this.classSharingType = false;
      },
      handleCheckAllChange(val) {
ef16e57e   LH_PC   fix:前端版本迭代
494
495
496
        this.gradeClass.forEach(item => {
          item.isChecked = val;
        })
f45b3c05   LH_PC   云平台新UI界面
497
498
        this.isIndeterminate = false;
      },
ef16e57e   LH_PC   fix:前端版本迭代
499
500
      handleCheckedClassChange() {
        var value = this.gradeClass.filter(item => item.isChecked);
f45b3c05   LH_PC   云平台新UI界面
501
        let checkedCount = value.length;
ef16e57e   LH_PC   fix:前端版本迭代
502
503
        this.checkAll = checkedCount === this.gradeClass.length;
        this.isIndeterminate = checkedCount > 0 && checkedCount < this.gradeClass.length;
f45b3c05   LH_PC   云平台新UI界面
504
505
      },
      async _selectClassSharingType() {
6bca489d   LH_PC   云平台二期UI
506
  
77fa942a   LH_PC   feat:修改打印对接
507
        if (this.isViewer && !this.isWrong) return;
6bca489d   LH_PC   云平台二期UI
508
509
510
  
        this.gradeClass = [];
  
f45b3c05   LH_PC   云平台新UI界面
511
        this.classSharingType = true;
6bca489d   LH_PC   云平台二期UI
512
513
  
        var classResponse = await this.$request.tClassFromGrade(this.classId, this.form.subjectName);
f45b3c05   LH_PC   云平台新UI界面
514
515
516
  
        if (classResponse.status != 0) {
          this.$message.error(classResponse.info);
ef16e57e   LH_PC   fix:前端版本迭代
517
          return;
f45b3c05   LH_PC   云平台新UI界面
518
        }
6bca489d   LH_PC   云平台二期UI
519
  
ef16e57e   LH_PC   fix:前端版本迭代
520
521
522
523
524
525
526
        this.gradeClass = [...classResponse.data.map(item => {
          return {
            isChecked: this.checkedClass.includes(item.id),
            id: item.id,
            className: item.className
          }
        })];
574f1a90   LH_PC   fix:修改年级组长/任课老师缺少...
527
  
77fa942a   LH_PC   feat:修改打印对接
528
        this.checkAll = this.checkedClass.length === this.gradeClass.length;
f45b3c05   LH_PC   云平台新UI界面
529
530
531
532
533
534
535
536
537
538
539
540
541
542
      },
      // v1.5
      //上传截图
      openStem(obj, type, index, indexs) {
        this.iframeLoading = true;
        this.stem.type = type;
        this.stem.index = index;
        this.stem.indexs = indexs;
        if (type == 1) {
          if (!obj.screenshot || obj.screenshot == "") {
            this.iframeLoading = false;
          }
          this.stem.screenshot = obj.screenshot || "";
          this.stem.answerScreenshot = "";
6bca489d   LH_PC   云平台二期UI
543
          // return;
f45b3c05   LH_PC   云平台新UI界面
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
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
607
608
609
610
611
612
613
        } else if (type == 3) {
        } else if (type == 4) {
          var current = this.questionList[index].subQuestions[indexs];
          var currentOps = current.answerOptions.split(",");
          if (currentOps.length >= this.optionValues.length) return;
          current.answerOptions += "," + this.optionValues[currentOps.length];
          return;
        } else if (type == 5) {
          var current = this.questionList[index].subQuestions[indexs];
          var currentOps = current.answerOptions.split(",");
          if (currentOps.length < 3) return;
          current.answerOptions = currentOps
            .splice(0, currentOps.length - 1)
            .join(",");
          return;
        } else {
          if (!obj.answerScreenshot || obj.answerScreenshot == "") {
            this.iframeLoading = false;
          }
          this.stem.answerScreenshot = obj.answerScreenshot || "";
          this.stem.screenshot = "";
        }
        this.dialogStem = true;
      },
      //图片上传成功
      upSuccess(res, file) {
        if (res && res.status == 0) {
          if (this.stem.type == 1) {
            this.stem.screenshot = res.data.url;
            if (this.questionList[0]?.subQuestions) {
              this.questionList[this.stem.index].subQuestions[
                this.stem.indexs
              ].screenshot = this.stem.screenshot;
            } else {
              this.questionList[this.stem.index].screenshot =
                this.stem.screenshot;
            }
          } else {
            this.stem.answerScreenshot = res.data.url;
            if (this.questionList[0]?.subQuestions) {
              this.questionList[this.stem.index].subQuestions[
                this.stem.indexs
              ].answerScreenshot = this.stem.answerScreenshot;
            } else {
              this.questionList[this.stem.index].answerScreenshot =
                this.stem.answerScreenshot;
            }
          }
  
          this.$message.success("上传成功");
        } else {
          this.$message.error(res.info);
        }
      },
      async _GradeList() {
        let fetchClassList =
          this.role == "ROLE_PERSONAL"
            ? this.$request.pClassList
            : this.$request.fetchClassList;
  
        const { data, status, info } = await fetchClassList();
        if (status == 0) {
          this.gradeClassList = data.list;
        } else {
          this.$message.error(info);
        }
      },
      upError(res) {
        this.$message.error("上传失败");
      },
ef16e57e   LH_PC   fix:前端版本迭代
614
  
f45b3c05   LH_PC   云平台新UI界面
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
      //end
  
      linkBack() {
        this.$router.go(-1);
      },
      setSubPro(type) {
        let tit;
        switch (type) {
          case 2:
            tit = "单选题";
            break;
          case 3:
            tit = "多选题";
            break;
          case 4:
            tit = "判断题";
            break;
          case 5:
            tit = "主观题";
            break;
        }
        return tit;
      },
6bca489d   LH_PC   云平台二期UI
638
639
640
641
642
643
644
645
646
647
      _deleteDetermineQ(subIndex, index) {
        if (this.questionList[index].subQuestions) {
          this.questionList[index].subQuestions.splice(subIndex, 1);
          if (this.questionList[index].subQuestions?.length == 0) {
            this.questionList.splice(index, 1);
          }
        } else {
          this.questionList.splice(index, 1);
        }
      },
f45b3c05   LH_PC   云平台新UI界面
648
649
650
651
652
653
654
655
656
657
658
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
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
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
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
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
      setBigNum(num) {
        let txt = "";
        let bigNum = [
          "一",
          "二",
          "三",
          "四",
          "五",
          "六",
          "七",
          "八",
          "九",
          "十",
          "十一",
          "十二",
          "十三",
          "十四",
          "十五",
          "十六",
          "十七",
          "十八",
          "十九",
          "二十",
        ];
        txt = bigNum[num];
  
        return txt;
      },
      //计算题号
      setNum(index, indexs, sub) {
        let lengths = 0; //所在大题之前的所有小题数量
        let subIndex = 0; //所在大题的位置
        for (let i = 0; i < index; i++) {
          let subArr = this.questionList[i].subQuestions.filter((item) => {
            return !!item.questionType;
          });
          lengths += subArr.length;
        }
        for (let i = 0; i < indexs; i++) {
          if (!!this.questionList[index].subQuestions[i].questionType) {
            subIndex += 1;
          }
        }
        return lengths + subIndex + 1;
      },
      setScore(question) {
        let score = question.subQuestions.reduce((a, b) => {
          return a + (b.score || 0);
        }, 0);
        return Number(score).toFixed(2);
      },
      //设置多选答案
      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("");
        }
      },
      keydownAnswer(event, type) {
        let answerA = "ABCDEFG";
        let answer_a = "abcdefg";
        answerA = answerA.substring(0, this.formAns.subNum);
        answer_a = answer_a.substring(0, this.formAns.subNum);
        answerA += answer_a;
        answerA = type == 2 ? answerA : answerA + ",";
        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;
        if (!answerA.includes(event.key)) {
          event.returnValue = "";
        }
      },
      setAllAnswer(event, type) {
        let str = this.formAns.answerList;
        let str2 = checkAnswer(
          str,
          type,
          this.formAns.answerOptions.split(",").length,
          this.formAns.subNum
        );
        this.formAns.answerList = str2;
      },
      setAnswer(type, ans) {
        let txt = "";
        if (type == 2) {
          txt = ans;
        } else if (type == 3) {
          txt = ans + ",";
        } else if (type == 4) {
          txt = ans == 1 ? "✓" : ans == 2 ? "✗" : "";
        }
        return txt;
      },
      insertTxtAndSetcursor(answerList, str) {
        let element = this.$refs.formAnsIpt.$el.children[0]; // 获取到指定标签
        let startPos = element.selectionStart; // 获取光标开始的位置
        if (startPos === undefined) {
          // 如果没有光标位置 不操作
          return answerList;
        } else {
          return {
            text:
              answerList.substring(0, startPos) +
              str +
              answerList.substring(startPos), // 将文本插入
            startPos: startPos + str.length,
          };
        }
      },
      //多选答案设置
      setMultiple(obj, answer) {
        let resault = this.insertTxtAndSetcursor(obj.answerList || "", answer);
        obj.answerList = resault.text;
        let str = obj.answerList;
        let str2 = checkAnswer(
          str,
          3,
          obj.answerOptions.split(",").length,
          obj.subNum
        );
        obj.answerList = str2;
        this.$refs.formAnsIpt.$el.children[0].focus();
        this.$refs.formAnsIpt.$el.children[0].selectionStart = resault.startPos;
      },
      //初始化要修改的答案
      setFormAns(indexs, index) {
        let answerList = "";
        if (this.questionList[0]?.subQuestions) {
          this.formAns = { ...this.questionList[index].subQuestions[indexs] };
          this.formAns.listIndex = index;
          let startIndex = indexs - this.formAns.subNum; //批量设置大难开始位置
          this.questionList[index].subQuestions.map((item, subIdx) => {
            if (subIdx >= startIndex && subIdx < indexs) {
              answerList += this.setAnswer(item.questionType, item.correctAnswer);
              if (item.qusType == 3) {
                answerList = answerList.slice(0, -1);
              }
            }
          });
        } else {
          this.formAns = { ...this.questionList[indexs] };
          let startIndex = indexs - this.formAns.subNum; //批量设置开始位置
          this.formAns.answerList = [];
          this.formAns.listIndex = indexs;
          this.questionList.map((item, subIdx) => {
            if (subIdx >= startIndex && subIdx < indexs) {
              answerList += this.setAnswer(item.questionType, item.correctAnswer);
              if (item.qusType == 3) {
                answerList = answerList.slice(0, -1);
              }
            }
          });
        }
        this.formAns.answerList = answerList;
        this.diaSetAns = true;
      },
      saveFormAns() {
        //批量修改答案
        let EndIndex;
        let subNum = this.formAns.subNum - 1;
        if (this.questionList[0]?.subQuestions) {
          this.questionList[this.formAns.listIndex].subQuestions.some(
            (item, index) => {
              if (this.formAns.endIndex == item.questionIndex) {
                EndIndex = index;
              }
              return this.formAns.endIndex == item.questionIndex;
            }
          );
        } else {
          this.questionList.some((item, index) => {
            if (this.formAns.endIndex == item.questionIndex) {
              EndIndex = index;
            }
            return this.formAns.endIndex == item.questionIndex;
          });
        }
  
        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] || "";
          } else if (this.formAns.qusType == 4) {
            correctAnswer =
              this.formAns.answerList[subNum - i] == "✓"
                ? 1
                : this.formAns.answerList[subNum - i] == "✗"
                  ? 2
                  : "";
          }
          if (this.questionList[0]?.subQuestions) {
            this.questionList[this.formAns.listIndex].subQuestions[
              EndIndex - i
            ].correctAnswer = correctAnswer;
          } else {
            this.questionList[EndIndex - i].correctAnswer = correctAnswer;
          }
        }
        this.diaSetAns = false;
      },
      async save() {
  
        for (let i = 0; i < this.questionList.length; i++) {
          if (this.questionList[0]?.subQuestions) {
            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);
              }
            }
          } else {
            if (this.questionList[i].qusType) {
              this.questionList.splice(i, 1);
              i--;
            }
          }
        }
        let questionList = this.questionList.map((item) => {
          item.score = null;
          // item.questionId = "";
          // item.questionIndex = "";
          return item;
        });
        //更新答题卡
        let modifyPaper, params;
f45b3c05   LH_PC   云平台新UI界面
891
892
893
894
        if (this.type == 1) {
          modifyPaper =
            this.role == "ROLE_PERSONAL"
              ? this.$request.pModifyPaper
ef16e57e   LH_PC   fix:前端版本迭代
895
              : this.$request.pModifyPaperNew;
f45b3c05   LH_PC   云平台新UI界面
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
          params = {
            classIds: this.checkedClass,
            sharingType: this.form.sharingType,
            paperId: this.$route.query.paperId,
            questionList: questionList,
          };
          console.log(params)
        } else if (this.type == 2) {
          modifyPaper =
            this.role == "ROLE_PERSONAL"
              ? this.$request.pSetExamAnswer
              : this.$request.setExamAnswer;
          params = {
            examId: this.$route.query.paperId,
            questionList: questionList,
          };
        } else {
          modifyPaper =
            this.role == "ROLE_PERSONAL"
              ? this.$request.pSetPeriodAnswer
              : this.$request.setPeriodAnswer;
          params = {
            periodId: this.$route.query.paperId,
            questionList: questionList,
          };
        }
        const { data, status, info } = await modifyPaper({
          title: this.form.title,
          ...params,
        });
        if (status == 0) {
6bca489d   LH_PC   云平台二期UI
927
928
929
930
931
932
933
934
935
936
          if (this.paperType == 1) {
            this.$router.push({
              path: "/askPreparationQuestions",
            });
          }
          else {
            this.$router.push({
              path: "/testPaper",
            });
          }
f45b3c05   LH_PC   云平台新UI界面
937
        } else {
ef16e57e   LH_PC   fix:前端版本迭代
938
          this.$message.error(info);
f45b3c05   LH_PC   云平台新UI界面
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
967
968
969
970
971
972
973
974
975
976
        }
      },
      async _QueryDetail() {
        //查询详情
        let detail;
        if (this.role == "ROLE_PERSONAL") {
          detail =
            this.type == 1
              ? this.$request.pPaperDetail
              : this.type == 2
                ? this.$request.pExamQuestionList
                : this.$request.pPeriodQuestionList;
        } else {
          detail =
            this.type == 1
              ? this.$request.fetchPaperDetail
              : this.type == 2
                ? this.$request.examQuestionList
                : this.$request.periodQuestionList;
        }
        let params =
          this.type == 1
            ? { paperId: this.$route.query.paperId }
            : this.type == 2
              ? { examId: this.$route.query.paperId }
              : {
                periodId: this.$route.query.paperId,
              };
        const { data, status, info } = await detail(params);
        if (status == 0) {
          let questionList;
          if (this.type == 1) {
            //修改答案信息
            this.paperModifyLog = {
              ...this.paperModifyLog,
              ...this.form.paperModifyLog,
            };
            this.form = deepClone(data);
6bca489d   LH_PC   云平台二期UI
977
  
f45b3c05   LH_PC   云平台新UI界面
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
            questionList = this.form.questionList.map((item) => {
              if (item.subQuestions) {
                item.subQuestions.map((subQuestion) => {
                  subQuestion.questionType == 2 || subQuestion.questionType == 3
                    ? (subQuestion.answerOptions =
                      subQuestion.answerOptions || "A,B,C,D")
                    : "";
                  subQuestion.correctAnswer = subQuestion.correctAnswer || "";
                });
              } else {
                item.questionType == 2 || item.questionType == 3
                  ? (item.answerOptions = item.answerOptions || "A,B,C,D")
                  : "";
                item.correctAnswer = item.correctAnswer || "";
              }
              return item;
            });
6bca489d   LH_PC   云平台二期UI
995
996
  
  
f45b3c05   LH_PC   云平台新UI界面
997
998
999
1000
1001
          } else {
            questionList = data.list.sort((a, b) => {
              return a.questionIndex - b.questionIndex;
            });
          }
77fa942a   LH_PC   feat:修改打印对接
1002
1003
1004
1005
          if (data.tag == "错题复习" && this.isViewer == false) {
            this.isViewer = true;
            this.isWrong = true;
          }
f45b3c05   LH_PC   云平台新UI界面
1006
          this.questionList = questionList;
f45b3c05   LH_PC   云平台新UI界面
1007
          this.formateQuestion();
6bca489d   LH_PC   云平台二期UI
1008
          this.checkedClass = data.classList?.map(item => item.classId);
f45b3c05   LH_PC   云平台新UI界面
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
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
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
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
        } else {
          this.$message.error(info);
        }
      },
      formateQuestion() {
        let arr = this.questionList;
        if (arr[0]?.subQuestions) {
          this.questionList = arr.map((item) => {
            let types = [{}];
            let addndex = 0;
            item.subQuestions.map((sub, index) => {
              if (!!sub.questionType) {
                if (
                  sub.questionType == types[addndex].qusType &&
                  sub.questionType != 5
                ) {
                  //同类型批量答案+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 - 1;
                    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 + 1,
                  0,
                  deepClone(types[i])
                );
              }
            }
            return item;
          });
        } else {
          let types = [{}];
          let addndex = 0;
          this.questionList = arr.map((sub, index) => {
            if (!!sub.questionType) {
              if (
                sub.questionType == types[addndex].qusType &&
                sub.questionType != 5
              ) {
                //同类型批量答案+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 == arr.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 =
                    this.questionList[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;
                types[addndex].answerList = this.setAnswer(
                  sub.questionType,
                  sub.correctAnswer
                );
              }
            }
            return sub;
          });
          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) {
              this.questionList.splice(
                types[i].index + i + 1,
                0,
                deepClone(types[i])
              );
            }
          }
        }
      },
    },
  };
  </script>
ead476dd   LH_PC   fix:最终定版
1144
  <style lang="scss" scoped>
6bca489d   LH_PC   云平台二期UI
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
  .line-value {
    color: black;
  }
  
  .question-contents {
  
    .el-input__inner,
    .el-input,
    .el-select,
    .el-input-number__decrease,
    .el-input-number__increase {
      background: white !important;
    }
  }
  
f45b3c05   LH_PC   云平台新UI界面
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
  .screenshot-box {
    width: 600px;
  }
  
  .screenshot {
    width: 100%;
    box-shadow: none;
    border: none;
    height: 400px;
  }
  
  .screenshot-img {
    display: block;
    width: auto;
    max-width: 100%;
    margin: 0 auto;
    margin-bottom: 10px;
  }
  </style>
  <style lang="scss" scoped>
  .content-fi {
6bca489d   LH_PC   云平台二期UI
1181
    padding-top: 12px;
f45b3c05   LH_PC   云平台新UI界面
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
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
    width: 200px;
    margin: 0px auto;
  }
  
  .content {
    * {
      font-size: 14px;
      font-weight: 400;
    }
  
    height: calc(100% - 60px);
    overflow-y: auto;
    width: 100%;
    box-sizing: border-box;
    padding: 0px 20px;
  
    .ml-20 {
      margin-left: 20px;
    }
  
    .btn-box {
      width: 120px;
      background-color: Red !important;
      // width: calc(100% - 240px);
      // position: fixed;
      // right: 40px;
      // bottom: 20px;
      // padding: 10px 0 5px;
      // background: #fff;
      // text-align: center;
      // margin-left: 140px;
      // z-index: 10;
    }
  
    .tips {
      height: 48px;
      line-height: 48px;
      padding: 0 16px;
      border: 1px solid #fac7cc;
      background-color: #ffebec;
      font-size: 14px;
      color: #fd9795;
      margin: 10px 0 20px 0;
  
      .fa-bell-o {
        font-size: 18px;
        margin-right: 5px;
      }
    }
  }
  
  .answer-title {
    text-align: center;
    font-size: 20px;
    color: #333;
    font-weight: 700;
    padding-top: 20px;
    padding-bottom: 10px;
  
    &.t-left {
      text-align: left;
    }
  
    .totals {
      font-size: 16px;
      color: #666;
      font-weight: normal;
    }
  
    .name-box {
      display: flex;
      white-space: nowrap;
      align-items: center;
      margin-bottom: 20px;
      font-weight: normal;
  
      :deep(.el-input__inner) {
        color: #333;
        font-weight: 700;
      }
  
      .name-radio {
        line-height: 1;
      }
    }
  }
  
  .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;
    }
  }
  
  .question-box {
    margin-bottom: 20px;
  
    .screenshot-box {
      width: 100%;
      border: 1px solid #e2e2e2;
      margin-bottom: 20px;
  
      .screenshot-img {
        margin: 0;
      }
    }
  }
  
  .set-ans-btn {
    width: 100%;
    padding: 10px 0 10px 630px;
    box-sizing: border-box;
    border-bottom: 1px solid #e2e2e2;
    border-right: 1px solid #e2e2e2;
  }
  
  .el-input-number {
    width: 140px;
  }
  
  .delete {
    margin-left: 8px;
  }
  
  .questions-ul {
    border-left: 1px solid #e2e2e2;
    border-top: 1px solid #e2e2e2;
    margin: 12px 0;
  }
  
  .questions-ul2 {
    margin: 0;
    border-top: none;
  
    &:nth-child(1) {
      border-top: 1px solid #e2e2e2;
    }
  }
  
  .courseware-content {
    background-color: rgb(245, 247, 250);
    margin-top: 10px;
    height: 80px;
    border-radius: 5px;
30db09b4   LH_PC   feat:修改错题的
1344
    padding: 5px 0px;
f45b3c05   LH_PC   云平台新UI界面
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
  }
  
  .sub-questions {
    width: 100%;
    display: flex;
    // border-bottom: 1px solid #e2e2e2;
  
    &>div {
      .answer-active {
        background: rgba(65, 204, 149, 1);
        color: white;
      }
  
      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-stem {
30db09b4   LH_PC   feat:修改错题的
1372
      width: 400px;
f45b3c05   LH_PC   云平台新UI界面
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
    }
  
    .qs-type {
      width: 130px;
    }
  
    .qs-score,
    .qs-partScore {
      width: 160px;
  
      .el-input-number__decrease,
      .el-input-number__increase {
        background: white !important;
      }
    }
  
    .qs-set {
ef16e57e   LH_PC   fix:前端版本迭代
1390
1391
      display: inline-block;
      padding: 0px 5px;
f45b3c05   LH_PC   云平台新UI界面
1392
1393
1394
    }
  
    .qs-oprations {
30db09b4   LH_PC   feat:修改错题的
1395
      width: 160px;
f45b3c05   LH_PC   云平台新UI界面
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
    }
  
    .qs-options {
      flex: 1;
    }
  
    // .qs-options2 {
    //   text-align: left;
    //   justify-content: flex-start;
    //   // padding-left: 20px;
    // }
  
    .answer-s {
      cursor: pointer;
      margin-right: 2px;
      margin-bottom: 5px;
      background-color: white;
    }
  
    .answer-opration {
      background-color: rgb(107, 126, 245);
      color: white;
      font-size: 22px;
      line-height: 1;
      height: 32px;
      width: 32px;
      line-height: 30px;
      border-radius: 32px;
    }
  
    :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-questions {
    .answer-box {
      .answer-s {
        cursor: pointer;
        user-select: none;
  
        &:first-of-type {
          margin-left: 0;
        }
      }
    }
  }
  
  .upload-box {
    .upload-demo {
      text-align: center;
    }
  
    .stem-pic {
      display: block;
      margin: 0 auto 20px;
      max-width: 100%;
      max-height: 200px;
      object-fit: cover;
    }
  }
  
  .row-subfix {
    margin-bottom: 10px;
  }
6bca489d   LH_PC   云平台二期UI
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
  
  .bigQuestion {
    padding: 20px;
    box-shadow: 0px 1px 4px 0px rgba(21, 34, 50, 0.08);
    border: 1px solid #ebeef5;
    border-radius: 5px;
    margin-top: 10px;
  
    .bigQuestionTitle {
      font-size: 16px;
      font-weight: bold;
    }
  }
f45b3c05   LH_PC   云平台新UI界面
1485
  </style>