Blame view

src/views/examinationPaper/addAsk.vue 38.6 KB
4c4f7640   梁保满   路由表,路由前端文件
1
  <template>
ca39cc52   阿宝   飞书问题处理
2
    <div ref="content" class="content-box">
13b58a42   梁保满   备题组卷部分前端页面基本完成
3
4
      <back-box>
        <template slot="title">
8af7657f   梁保满   修改添加备题,组卷
5
          <span>导入课件</span>
13b58a42   梁保满   备题组卷部分前端页面基本完成
6
7
8
        </template>
      </back-box>
      <div class="content">
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
9
        <el-steps :active="step" finish-status="success" simple style="margin: 20px 0">
13b58a42   梁保满   备题组卷部分前端页面基本完成
10
11
          <el-step title="基础信息" icon="el-icon-edit"></el-step>
          <el-step title="题目编辑" icon="el-icon-tickets"></el-step>
8af7657f   梁保满   修改添加备题,组卷
12
          <el-step title="课件预览" icon="el-icon-edit-outline"></el-step>
13b58a42   梁保满   备题组卷部分前端页面基本完成
13
14
        </el-steps>
        <div v-show="step == 0">
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
15
          <el-form ref="forms" :model="form" :rules="formRules" label-width="140px">
8af7657f   梁保满   修改添加备题,组卷
16
            <el-form-item label="课件名称:" prop="title">
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
17
18
              <el-input class="sel2" type="text" placeholder="请输入答题卡名称" v-model.trim="form.title" maxlength="30" size="45"
                show-word-limit>
ca39cc52   阿宝   飞书问题处理
19
              </el-input>
13b58a42   梁保满   备题组卷部分前端页面基本完成
20
            </el-form-item>
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
21
22
23
            <el-form-item v-if="role != 'ROLE_PERSONAL'" 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">
13b58a42   梁保满   备题组卷部分前端页面基本完成
24
25
26
                </el-option>
              </el-select>
            </el-form-item>
ee6e7628   梁保满   备题组卷借口数据对接调整
27
28
            <el-form-item label="科目:" prop="subjectName">
              <el-select class="sel" v-model="form.subjectName" placeholder="">
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
29
30
                <el-option v-for="item in subjectList" :key="item.value" :label="item.label" :value="item.value">{{
                  item.label }}
13b58a42   梁保满   备题组卷部分前端页面基本完成
31
32
33
                </el-option>
              </el-select>
            </el-form-item>
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
34
            <el-form-item v-if="role != 'ROLE_PERSONAL'" label="分享范围:" prop="sharingType">
ee6e7628   梁保满   备题组卷借口数据对接调整
35
              <el-radio-group v-model="form.sharingType">
f356590c   阿宝   即时测列表,分析页面
36
37
                <el-radio :label="0">任课班级分享</el-radio>
                <el-radio :label="1">全年级分享</el-radio>
13b58a42   梁保满   备题组卷部分前端页面基本完成
38
39
40
41
              </el-radio-group>
            </el-form-item>
          </el-form>
          <div class="btn-box">
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
42
            <el-button type="danger" plain round @click="linkBack">取消</el-button>
13b58a42   梁保满   备题组卷部分前端页面基本完成
43
44
            <el-button type="primary" round @click="setStep1">下一步</el-button>
          </div>
13b58a42   梁保满   备题组卷部分前端页面基本完成
45
46
        </div>
        <div v-show="step == 1">
f26ecfa4   阿宝   测试bug
47
48
          <div class="answer-title">
            <p class="name">{{ form.title }}</p>
f26ecfa4   阿宝   测试bug
49
          </div>
8af7657f   梁保满   修改添加备题,组卷
50
          <div class="question-box">
f5729396   梁保满   批量设置答案
51
52
53
54
55
56
57
            <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>
8af7657f   梁保满   修改添加备题,组卷
58
                <div class="qs-upload">提干</div>
cb6ceaa8   梁保满   添加备题,组卷参数调整
59
60
                <div class="qs-upload">题目解析</div>
                <div class="qs-upload">知识点</div>
8af7657f   梁保满   修改添加备题,组卷
61
                <div class="qs-set"></div>
f5729396   梁保满   批量设置答案
62
              </li>
8af7657f   梁保满   修改添加备题,组卷
63
              <li v-for="(subQuestions, index) in form.questionList" :key="index">
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
64
65
66
67
                <p class="set-ans-btn" v-if="subQuestions.qusType &&
                  subQuestions.subNum &&
                  subQuestions.subNum > 4
                  ">
8af7657f   梁保满   修改添加备题,组卷
68
                  <el-button type="primary" @click="setFormAns(index)">批量设置答案</el-button>
f5729396   梁保满   批量设置答案
69
70
71
                </p>
                <div v-else class="sub-questions">
                  <div class="qs-num">
8af7657f   梁保满   修改添加备题,组卷
72
                    {{ index + 1 }}
3ba60a63   梁保满   发卡补卡,设备状态上传下载接口联调
73
                  </div>
f5729396   梁保满   批量设置答案
74
                  <div class="qs-type">
8af7657f   梁保满   修改添加备题,组卷
75
76
77
78
79
80
81
                    <el-select v-model="subQuestions.questionType" placeholder="选择题目类型"
                      @change="changeSubQuestions($event, subQuestions)">
                      <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>
f5729396   梁保满   批量设置答案
82
83
                  </div>
                  <div class="qs-score">
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
84
85
                    <el-input-number class="number-ipt" size="medium" :min="1" :max="200" :precision="2"
                      v-model="subQuestions.score" label="单题分值"></el-input-number>
f5729396   梁保满   批量设置答案
86
87
88
                  </div>
                  <div class="qs-partScore">
                    <p v-if="subQuestions.questionType != 3">--</p>
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
89
90
                    <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>
f5729396   梁保满   批量设置答案
91
92
93
94
                  </div>
                  <div class="qs-options qs-options2">
                    <p v-if="subQuestions.questionType == 5">--</p>
                    <p v-if="subQuestions.questionType == 4" class="answer-box">
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
95
96
97
98
                      <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>
f5729396   梁保满   批量设置答案
99
100
                    </p>
                    <p v-if="subQuestions.questionType == 3" class="answer-box">
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
101
102
103
104
                      <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>
f5729396   梁保满   批量设置答案
105
106
                    </p>
                    <p v-if="subQuestions.questionType == 2" class="answer-box">
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
107
108
                      <span class="answer-s" v-for="option in subQuestions.answerOptions.split(',')" :class="subQuestions.correctAnswer == option ? 'active' : ''
                        " :key="option" @click="subQuestions.correctAnswer = option">{{ option }}</span>
f5729396   梁保满   批量设置答案
109
110
                    </p>
                  </div>
8af7657f   梁保满   修改添加备题,组卷
111
112
113
114
115
116
117
118
119
120
                  <div class="qs-upload">
                    <el-popover placement="right" width="400" trigger="click">
                      <div class="screenshot-box">
                        <iframe class="screenshot"
                          v-if="subQuestions.screenshot && subQuestions.screenshot.includes('html')"
                          :src="subQuestions.screenshot"></iframe>
                        <img class="screenshot screenshot-img"
                          v-if="subQuestions.screenshot && !subQuestions.screenshot.includes('html')"
                          :src="subQuestions.screenshot" alt="">
                        <p style="textAlign:center"><el-button type="primary" round size="mini" icon="el-icon-upload"
cb6ceaa8   梁保满   添加备题,组卷参数调整
121
                            @click="openStem(subQuestions, index, 1)">重新选择图片</el-button></p>
8af7657f   梁保满   修改添加备题,组卷
122
123
124
125
126
                      </div>
                      <el-button slot="reference" class="icon-tickets" type="primary" circle size="mini"
                        icon="el-icon-tickets"></el-button>
                    </el-popover>
                  </div>
cb6ceaa8   梁保满   添加备题,组卷参数调整
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
                  <div class="qs-upload">
                    <el-popover placement="right" width="400" trigger="click">
                      <div class="screenshot-box">
                        <iframe class="screenshot"
                          v-if="subQuestions.answerScreenshot && subQuestions.answerScreenshot.includes('html')"
                          :src="subQuestions.answerScreenshot"></iframe>
                        <img class="screenshot screenshot-img"
                          v-if="subQuestions.answerScreenshot && !subQuestions.answerScreenshot.includes('html')"
                          :src="subQuestions.answerScreenshot" alt="">
                        <p style="textAlign:center"><el-button type="primary" round size="mini" icon="el-icon-upload"
                            @click="openStem(subQuestions, index, 2)">{{ subQuestions.answerScreenshot ? "重新选择图片" :
                              "上传题目解析" }}</el-button>
                        </p>
                      </div>
                      <el-button slot="reference" class="icon-tickets" type="primary" circle size="mini"
                        icon="el-icon-tickets"></el-button>
                    </el-popover>
                  </div>
                  <div class="qs-upload">
                    <el-button type="primary" circle size="mini" icon="el-icon-price-tag"
                      @click="openKnowledge(subQuestions, index)"></el-button>
                  </div>
8af7657f   梁保满   修改添加备题,组卷
149
150
151
152
153
154
                  <div class="qs-set">
                    <el-popconfirm title="确定删除这道题吗?" @confirm="delTabData(index)">
                      <el-button slot="reference" class="delete" type="danger" size="mini" circle
                        icon="el-icon-delete"></el-button>
                    </el-popconfirm>
                  </div>
f5729396   梁保满   批量设置答案
155
156
157
                </div>
              </li>
            </ul>
3ba60a63   梁保满   发卡补卡,设备状态上传下载接口联调
158
          </div>
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
159
160
          <el-dialog :close-on-click-modal="false" title="批量设置答案" :visible.sync="diaSetAns" width="400"
            :modal-append-to-body="false">
3ba60a63   梁保满   发卡补卡,设备状态上传下载接口联调
161
162
163
164
165
166
            <div class="qs-options">
              <p class="dia-tips">
                请点击选项按钮设置答案,多选题题目之间用“,”隔开,若添加5道题:“AC,AD,BD,AC,CD”
              </p>
              <p>{{ setSubPro(formAns.qusType) }}:</p>
              <p class="ipt">
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
167
                <el-input v-if="formAns.qusType == 2 || formAns.qusType == 3" ref="formAnsIpt" v-model="formAns.answerList"
3ba60a63   梁保满   发卡补卡,设备状态上传下载接口联调
168
                  @keydown.native="keydownAnswer($event, formAns.qusType)"
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
169
170
                  @input="setAllAnswer($event, formAns.qusType)"></el-input>
                <el-input v-if="formAns.qusType == 4" v-model="formAns.answerList" readonly=""></el-input>
3ba60a63   梁保满   发卡补卡,设备状态上传下载接口联调
171
172
173
              </p>
              <p class="answer-box">
                <template v-if="formAns.qusType == 4">
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
174
175
176
177
178
179
180
181
182
183
                  <span class="answer-s active" @click="
                    formAns.answerList.length < formAns.subNum
                      ? (formAns.answerList += '✓')
                      : ''
                    ">✓</span>
                  <span class="answer-s active" @click="
                    formAns.answerList.length < formAns.subNum
                      ? (formAns.answerList += '✗')
                      : ''
                    ">✗</span>
3ba60a63   梁保满   发卡补卡,设备状态上传下载接口联调
184
185
                </template>
                <template v-if="formAns.qusType == 3">
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
186
187
188
                  <span class="answer-s active" v-for="option in formAns.answerOptions.split(',')" :key="option"
                    @click="setMultiple(formAns, option, 2)">{{ option }}</span>
                  <span class="answer-s active" @click="setMultiple(formAns, ',', 2)">,</span>
3ba60a63   梁保满   发卡补卡,设备状态上传下载接口联调
189
                </template>
21dfdeae   梁保满   平台管理员
190
                <template v-if="formAns.qusType == 2">
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
191
192
193
194
195
                  <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>
3ba60a63   梁保满   发卡补卡,设备状态上传下载接口联调
196
                </template>
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
197
198
                <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>
3ba60a63   梁保满   发卡补卡,设备状态上传下载接口联调
199
200
201
202
203
204
205
              </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   梁保满   备题组卷部分前端页面基本完成
206
          <div class="btn-box">
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
207
            <el-button type="danger" plain round @click="linkBack">取消</el-button>
8af7657f   梁保满   修改添加备题,组卷
208
209
            <el-button round @click="step = 0">上一步</el-button>
            <el-button type="primary" round @click="toStep(2)">下一步</el-button>
13b58a42   梁保满   备题组卷部分前端页面基本完成
210
          </div>
cb6ceaa8   梁保满   添加备题,组卷参数调整
211
212
          <el-dialog :close-on-click-modal="false" :title="stem.type == 1 ? '上传题干' : '上传题目解析'" :visible.sync="dialogStem"
            v-if="dialogStem" width="500">
8af7657f   梁保满   修改添加备题,组卷
213
            <div class="upload-box">
cb6ceaa8   梁保满   添加备题,组卷参数调整
214
215
216
217
218
219
220
              <template v-show="stem.type == 1">
                <img v-if="stem.screenshot && !stem.screenshot.includes('html')" :src="stem.screenshot" class="stem-pic" />
              </template>
              <template v-show="stem.type == 2">
                <img v-if="stem.answerScreenshot && !stem.answerScreenshot.includes('html')" :src="stem.answerScreenshot"
                  class="stem-pic" />
              </template>
8af7657f   梁保满   修改添加备题,组卷
221
222
              <el-upload class="upload-demo" action="http://121.40.127.171/file/uploadImg" :limit="1"
                :on-success="upSuccess" :on-error="upError" accept="image/*">
cb6ceaa8   梁保满   添加备题,组卷参数调整
223
                <el-button v-show="stem.type == 1" size="small" type="primary">{{
8af7657f   梁保满   修改添加备题,组卷
224
225
                  stem.screenshot && !stem.screenshot.includes('html') ? "重新上传" : "选择照片"
                }}</el-button>
cb6ceaa8   梁保满   添加备题,组卷参数调整
226
227
228
                <el-button v-show="stem.type == 2" size="small" type="primary">{{
                  stem.answerScreenshot && !stem.answerScreenshot.includes('html') ? "重新上传" : "选择照片"
                }}</el-button>
8af7657f   梁保满   修改添加备题,组卷
229
230
231
232
233
234
              </el-upload>
            </div>
            <div slot="footer">
              <el-button @click="dialogStem = false">确定</el-button>
            </div>
          </el-dialog>
cb6ceaa8   梁保满   添加备题,组卷参数调整
235
236
237
238
239
240
241
242
243
244
245
246
247
248
          <el-dialog :close-on-click-modal="false" title="知识点" :visible.sync="dialogKnowledge" width="500">
            <div>
              <el-form ref="form" :model="stem" label-width="160px">
                <el-form-item label="知识点:">
                  <el-cascader size="small" filterable :show-all-levels="false" collapse clearable placeholder="选择知识点"
                    v-model="stem.knowledge" :options="knowledgeData" :props="{ expandTrigger: 'hover' }"></el-cascader>
                </el-form-item>
              </el-form>
            </div>
            <div slot="footer">
              <el-button @click="dialogKnowledge = false">取 消</el-button>
              <el-button type="primary" @click="setKnowledge">确 定</el-button>
            </div>
          </el-dialog>
13b58a42   梁保满   备题组卷部分前端页面基本完成
249
        </div>
8af7657f   梁保满   修改添加备题,组卷
250
251
252
        <div v-show="step == 2">
          <div class="answer-title">
            <p class="name">{{ form.title }}</p>
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
253
          </div>
8af7657f   梁保满   修改添加备题,组卷
254
255
256
257
258
259
260
261
          <div class="question-box">
            <div class="screenshot-box" v-for="(subQuestions, index) in form.questionList" :key="index">
              <iframe class="screenshot" v-if="subQuestions.screenshot && subQuestions.screenshot.includes('html')"
                :src="subQuestions.screenshot"></iframe>
              <img class="screenshot screenshot-img"
                v-if="subQuestions.screenshot && !subQuestions.screenshot.includes('html')" :src="subQuestions.screenshot"
                alt="">
            </div>
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
262
          </div>
8af7657f   梁保满   修改添加备题,组卷
263
264
265
266
267
268
          <div class="btn-box">
            <el-button type="danger" plain round @click="linkBack">取消</el-button>
            <el-button round @click="toStep(1)">上一步</el-button>
            <el-button type="primary" round @click="save">保存</el-button>
          </div>
        </div>
13b58a42   梁保满   备题组卷部分前端页面基本完成
269
270
      </div>
    </div>
4c4f7640   梁保满   路由表,路由前端文件
271
272
273
  </template>
  
  <script>
533a17d8   梁保满   备题组卷添加批量设置答案
274
  import { deepClone, checkAnswer } from "utils";
cb6ceaa8   梁保满   添加备题,组卷参数调整
275
  import knowledgeList from "assets/js/knowledgeList.js";
4c4f7640   梁保满   路由表,路由前端文件
276
  export default {
cb6ceaa8   梁保满   添加备题,组卷参数调整
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
    computed: {
      // 知识点列表 根据学段-科目筛选
      knowledgeData: function () {
        let jsons = []
        if (this.form.gradeName && this.form.subjectName) {
          let sectionName = ""
          this.gradeClassList.map(item => {
            if (this.form.gradeName == item.gradeName) {
              sectionName = item.sectionName
            }
          })
          if (sectionName && Object.keys(this.knowledgeList).includes(sectionName)) {
            if (Object.keys(this.knowledgeList[sectionName]).includes(this.form.subjectName)) {
              jsons = this.knowledgeList[sectionName][this.form.subjectName]
            }
          }
        }
        return jsons
      },
    },
255e2506   梁保满   飞书bug及优化
297
298
299
300
301
302
    watch: {
      step: function () {
        this.$nextTick(function () {
          this.$refs.content.scrollTop = 0;
        });
      },
ca39cc52   阿宝   飞书问题处理
303
    },
13b58a42   梁保满   备题组卷部分前端页面基本完成
304
305
    data() {
      return {
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
306
        role: "",
13b58a42   梁保满   备题组卷部分前端页面基本完成
307
        step: 0, //步骤
cb6ceaa8   梁保满   添加备题,组卷参数调整
308
        gradeClassList: [], //年级-班级数据
13b58a42   梁保满   备题组卷部分前端页面基本完成
309
310
        gradeList: [], //年级
        subjectList: [], //科目
13b58a42   梁保满   备题组卷部分前端页面基本完成
311
312
313
        form: {
          //答题卡详情
          title: "",
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
314
          gradeName: "",
8af7657f   梁保满   修改添加备题,组卷
315
          subjectName: "",
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
316
          sharingType: 0,
8af7657f   梁保满   修改添加备题,组卷
317
          questionList: [],
13b58a42   梁保满   备题组卷部分前端页面基本完成
318
319
320
321
322
323
324
325
326
327
328
329
        },
        formRules: {
          //答题卡验证
          title: [
            { required: true, message: "请输入答题卡名称", trigger: "blur" },
            {
              min: 1,
              max: 30,
              message: "长度在 1 到 30 个字符",
              trigger: "blur",
            },
          ],
8af7657f   梁保满   修改添加备题,组卷
330
331
332
          gradeName: [
            { required: true, message: "请选择年级", trigger: "blur" },
          ],
ee6e7628   梁保满   备题组卷借口数据对接调整
333
334
335
          subjectName: [
            { required: true, message: "请选择科目", trigger: "blur" },
          ],
13b58a42   梁保满   备题组卷部分前端页面基本完成
336
        },
818e50d7   梁保满   标签删除,修改
337
        tagList: [],
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
338
        diaSetAns: false, //答案开关
cb6ceaa8   梁保满   添加备题,组卷参数调整
339
        dialogKnowledge: false, //知识点
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
340
        dialogStem: false, //截图开关
533a17d8   梁保满   备题组卷添加批量设置答案
341
        formAns: {
98f6a547   梁保满   创建答题卡,统计答题信息
342
          index: 0, //相同题目最后一位题目的位置
533a17d8   梁保满   备题组卷添加批量设置答案
343
344
345
346
347
          qusType: "", //题目类型
          subNum: 0, //数量
          answerOptions: [], //答案选项
          answerList: "", //答案列表-字符串
        },
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
348
        stem: {
cb6ceaa8   梁保满   添加备题,组卷参数调整
349
          type: 1,
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
350
          index: 0, //大题位置
8af7657f   梁保满   修改添加备题,组卷
351
          screenshot: "", //题干图片地址
cb6ceaa8   梁保满   添加备题,组卷参数调整
352
353
          answerScreenshot: "", //题目解析图片地址
          knowledge: [], //知识点
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
354
355
        },
        type: 1, //1-创建,2-复制答题卡
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
356
357
358
359
360
361
362
        questionOptions: [
          { label: "单选题", value: 2 },
          { label: "多选题", value: 3 },
          { label: "判断题", value: 4 },
          { label: "主观题", value: 5 },
        ],
        rightOptions: ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J"],
cb6ceaa8   梁保满   添加备题,组卷参数调整
363
        knowledgeList: { ...knowledgeList }
13b58a42   梁保满   备题组卷部分前端页面基本完成
364
365
      };
    },
5424ef82   梁保满   接口调整
366
    async created() {
f26ecfa4   阿宝   测试bug
367
      this.type = this.$route.query.type ? this.$route.query.type : 1;
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
368
369
370
      this.role =
        this.$store.getters.info.showRole ||
        this.$store.getters.info.permissions[0].role;
8af7657f   梁保满   修改添加备题,组卷
371
372
373
374
375
376
      let params = this.$route.query.params && JSON.parse(this.$route.query.params) || null
      this.form.title = params?.name
      this.form.id = params?.id
      this.form.sharingType = params?.sharingType || 0
      this.formatData(params)
      console.log(this.form)
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
377
378
379
380
381
382
      if (this.role != "ROLE_PERSONAL") {
        this.formRules.gradeName = [
          { required: true, message: "请选择年级", trigger: "blur" },
        ];
        await this._GradeList();
      }
8f573b82   阿宝   组卷接口联调
383
      await this._QuerySubjectList(this.gradeList[0]);
13b58a42   梁保满   备题组卷部分前端页面基本完成
384
      if (this.type == 2) {
ee6e7628   梁保满   备题组卷借口数据对接调整
385
        this._QueryDetail();
13b58a42   梁保满   备题组卷部分前端页面基本完成
386
387
388
      }
    },
    methods: {
8af7657f   梁保满   修改添加备题,组卷
389
      // v1.5
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
390
      //上传截图
cb6ceaa8   梁保满   添加备题,组卷参数调整
391
      openStem(obj, index, type) {
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
392
        this.stem.index = index;
8af7657f   梁保满   修改添加备题,组卷
393
        this.stem.screenshot = obj.screenshot || "";
cb6ceaa8   梁保满   添加备题,组卷参数调整
394
395
396
397
398
399
400
        if (type == 1) {
          this.stem.screenshot = obj.screenshot || "";
          this.stem.answerScreenshot = "";
        } else {
          this.stem.answerScreenshot = obj.answerScreenshot || "";
          this.stem.screenshot = "";
        }
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
401
402
403
404
405
        this.dialogStem = true;
      },
      //图片上传成功
      upSuccess(res, file) {
        if (res && res.status == 0) {
cb6ceaa8   梁保满   添加备题,组卷参数调整
406
407
408
409
410
411
412
          if (this.stem.type == 1) {
            this.stem.screenshot = res.data.url;
            this.form.questionList[this.stem.index].screenshot = this.stem.screenshot;
          } else {
            this.stem.answerScreenshot = res.data.url;
            this.form.questionList[this.stem.index].answerScreenshot = this.stem.answerScreenshot;
          }
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
413
414
415
416
417
418
419
420
421
          this.$message.success("上传成功");
        } else {
          this.$message.error(res.info);
        }
      },
  
      upError(res) {
        this.$message.error("上传失败");
      },
cb6ceaa8   梁保满   添加备题,组卷参数调整
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
      // 知识点
      openKnowledge(obj, index) {
        this.stem.index = index;
        let knowledgeArr = (obj.knowledge && obj.knowledge.split(",")) || [];
        this.stem.knowledge = knowledgeArr.map(item => {
          return item.split("#")
        })
        this.dialogKnowledge = true;
      },
      // 知识点
      setKnowledge() {
        let knowledge = this.stem.knowledge.join(",");
        this.form.questionList[this.stem.index].knowledge = knowledge.map(item => {
          item = item.join("#")
        })
        this.dialogKnowledge = false;
      },
  
8af7657f   梁保满   修改添加备题,组卷
440
      //end
13b58a42   梁保满   备题组卷部分前端页面基本完成
441
442
      linkBack() {
        this.$confirm(
8af7657f   梁保满   修改添加备题,组卷
443
444
          (this.type == 2 ? "修改复制的" : "导入的") +
          "课件未保存,确认退出吗?",
13b58a42   梁保满   备题组卷部分前端页面基本完成
445
446
447
448
449
450
451
452
453
454
455
456
          "提示",
          {
            confirmButtonText: "取消",
            cancelButtonText: "确定",
            confirmButtonClass: "el-button--danger1",
            cancelButtonClass: "el-button--primary",
            showClose: false,
            roundButton: true,
            center: true,
            type: "warning",
          }
        )
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
457
          .then(() => { })
13b58a42   梁保满   备题组卷部分前端页面基本完成
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
          .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;
      },
8af7657f   梁保满   修改添加备题,组卷
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
      //整理问题
      formateQuestion() {
        let types = [{}];
        let addndex = 0;
        this.formatQuestionList()
        this.form.questionList.map((sub, index) => {
          sub.questionIndex = 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 = "";
              //循环最后类型数量大于等于5,保存批量答案
              if (types[addndex].subNum >= 5) {
                types[addndex].index = index;
              }
            } else {
              if (types[addndex].subNum >= 5) {
                //不同类型时如果原有类型数量大于等于5,保存批量答案
                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 = "";
            }
533a17d8   梁保满   备题组卷添加批量设置答案
519
          }
0e46bc25   梁保满   优化
520
        });
8af7657f   梁保满   修改添加备题,组卷
521
522
523
524
525
526
527
528
        for (let i = 0; i < types.length; i++) {
          if (types[i].subNum >= 5) {
            this.form.questionList.splice(
              types[i].index + i + 1,
              0,
              deepClone(types[i])
            );
          }
3ba60a63   梁保满   发卡补卡,设备状态上传下载接口联调
529
530
        }
      },
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
531
      //初始化要修改的答案
8af7657f   梁保满   修改添加备题,组卷
532
533
534
      setFormAns(index) {
        this.formAns = { ...this.form.questionList[index] };
        let startIndex = index - this.formAns.subNum; //批量设置开始位置
11a4e518   梁保满   背题组卷修改答案设置,即使测随堂问...
535
536
        this.formAns.answerList = [];
        let answerList = "";
8af7657f   梁保满   修改添加备题,组卷
537
538
        this.form.questionList.map((item, subIdx) => {
          if (subIdx >= startIndex && subIdx < index) {
f5729396   梁保满   批量设置答案
539
            answerList += this.setAnswer(item.questionType, item.correctAnswer);
8af7657f   梁保满   修改添加备题,组卷
540
541
            if (item.qusType == 3) {
              answerList = answerList.slice(0, -1);
11a4e518   梁保满   背题组卷修改答案设置,即使测随堂问...
542
            }
8af7657f   梁保满   修改添加备题,组卷
543
            this.formAns.answerList = answerList;
11a4e518   梁保满   背题组卷修改答案设置,即使测随堂问...
544
545
          }
        });
533a17d8   梁保满   备题组卷添加批量设置答案
546
547
        this.diaSetAns = true;
      },
def690b2   梁保满   批量设置答案
548
      insertTxtAndSetcursor(element, answerList, str) {
f5729396   梁保满   批量设置答案
549
550
551
552
553
554
555
556
557
558
559
560
561
562
        let startPos = element.selectionStart; // 获取光标开始的位置
        if (startPos === undefined) {
          // 如果没有光标位置 不操作
          return answerList;
        } else {
          return {
            text:
              answerList.substring(0, startPos) +
              str +
              answerList.substring(startPos), // 将文本插入
            startPos: startPos + str.length,
          };
        }
      },
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
563
      //多选答案设置
def690b2   梁保满   批量设置答案
564
      setMultiple(obj, answer, type) {
def690b2   梁保满   批量设置答案
565
566
567
568
569
570
571
572
573
        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   梁保满   批量设置答案
574
        obj.answerList = resault.text;
533a17d8   梁保满   备题组卷添加批量设置答案
575
        let str = obj.answerList;
3ba60a63   梁保满   发卡补卡,设备状态上传下载接口联调
576
577
578
579
580
581
        let str2;
        if (!!obj.answerOptions) {
          str2 = checkAnswer(
            str,
            3,
            obj.answerOptions.split(",").length,
b2d3d803   梁保满   批量设置答案优化
582
            obj.subNum
3ba60a63   梁保满   发卡补卡,设备状态上传下载接口联调
583
584
          );
        } else {
b2d3d803   梁保满   批量设置答案优化
585
          str2 = checkAnswer(str, 3, obj.selectNum, obj.number);
3ba60a63   梁保满   发卡补卡,设备状态上传下载接口联调
586
        }
533a17d8   梁保满   备题组卷添加批量设置答案
587
        obj.answerList = str2;
def690b2   梁保满   批量设置答案
588
589
        elements.focus();
        elements.selectionStart = resault.startPos;
533a17d8   梁保满   备题组卷添加批量设置答案
590
      },
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
591
      //批量修改答案
533a17d8   梁保满   备题组卷添加批量设置答案
592
      saveFormAns() {
533a17d8   梁保满   备题组卷添加批量设置答案
593
594
        let EndIndex;
        let subNum = this.formAns.subNum - 1;
8af7657f   梁保满   修改添加备题,组卷
595
        this.form.questionList.some(
533a17d8   梁保满   备题组卷添加批量设置答案
596
          (item, index) => {
8af7657f   梁保满   修改添加备题,组卷
597
            if (this.formAns.index == item.questionIndex) {
533a17d8   梁保满   备题组卷添加批量设置答案
598
              EndIndex = index;
533a17d8   梁保满   备题组卷添加批量设置答案
599
            }
8af7657f   梁保满   修改添加备题,组卷
600
            return this.formAns.index == item.questionIndex
533a17d8   梁保满   备题组卷添加批量设置答案
601
602
603
604
605
606
          }
        );
  
        for (let i = 0; i <= subNum; i++) {
          let correctAnswer = "";
          if (this.formAns.qusType == 2) {
f5729396   梁保满   批量设置答案
607
            correctAnswer = this.formAns.answerList[subNum - i] || "";
533a17d8   梁保满   备题组卷添加批量设置答案
608
          } else if (this.formAns.qusType == 3) {
f5729396   梁保满   批量设置答案
609
            correctAnswer = this.formAns.answerList.split(",")[subNum - i] || "";
533a17d8   梁保满   备题组卷添加批量设置答案
610
          } else if (this.formAns.qusType == 4) {
503b6063   梁保满   判断题答案选项
611
612
613
614
            correctAnswer =
              this.formAns.answerList[subNum - i] == "✓"
                ? 1
                : this.formAns.answerList[subNum - i] == "✗"
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
615
616
                  ? 2
                  : "";
533a17d8   梁保满   备题组卷添加批量设置答案
617
          }
8af7657f   梁保满   修改添加备题,组卷
618
          this.form.questionList[
533a17d8   梁保满   备题组卷添加批量设置答案
619
620
621
622
623
            EndIndex - i
          ].correctAnswer = correctAnswer;
        }
        this.diaSetAns = false;
      },
8af7657f   梁保满   修改添加备题,组卷
624
      keydownAnswer(event, type) {
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
625
626
        let answerA = "ABCDEFGHIJ";
        let answer_a = "abcdefghij";
8af7657f   梁保满   修改添加备题,组卷
627
628
629
630
  
        answerA = answerA.substring(0, this.formAns.subNum);
        answer_a = answer_a.substring(0, this.formAns.subNum);
  
813d4d64   梁保满   批量设置答案添加输入
631
632
        answerA += answer_a;
        answerA = type == 2 ? answerA : answerA + ",";
533a17d8   梁保满   备题组卷添加批量设置答案
633
634
635
636
637
638
639
640
641
642
643
644
645
646
        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   梁保满   批量设置答案添加输入
647
        )
533a17d8   梁保满   备题组卷添加批量设置答案
648
          return;
813d4d64   梁保满   批量设置答案添加输入
649
        if (!answerA.includes(event.key)) {
533a17d8   梁保满   备题组卷添加批量设置答案
650
651
652
          event.returnValue = "";
        }
      },
8af7657f   梁保满   修改添加备题,组卷
653
654
655
656
657
658
659
660
661
662
663
      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;
  
813d4d64   梁保满   批量设置答案添加输入
664
      },
533a17d8   梁保满   备题组卷添加批量设置答案
665
666
667
668
669
670
671
      setAnswer(type, ans) {
        let txt = "";
        if (type == 2) {
          txt = ans;
        } else if (type == 3) {
          txt = ans + ",";
        } else if (type == 4) {
d32e461c   梁保满   备题组卷
672
          txt = ans == 1 ? "✓" : ans == 2 ? "✗" : "";
533a17d8   梁保满   备题组卷添加批量设置答案
673
674
675
        }
        return txt;
      },
8af7657f   梁保满   修改添加备题,组卷
676
      toStep(step) {
533a17d8   梁保满   备题组卷添加批量设置答案
677
        this.formatQuestionList();
8af7657f   梁保满   修改添加备题,组卷
678
        this.step = step;
cb6ceaa8   梁保满   添加备题,组卷参数调整
679
        if (step == 1) {
8af7657f   梁保满   修改添加备题,组卷
680
681
          this.formateQuestion()
        }
533a17d8   梁保满   备题组卷添加批量设置答案
682
      },
13b58a42   梁保满   备题组卷部分前端页面基本完成
683
      setStep1() {
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
684
685
686
687
        if (this.subjectList.length == 0) {
          this.$message.warning("暂无绑定年级信息,请先联系管理员设置。");
          return;
        }
13b58a42   梁保满   备题组卷部分前端页面基本完成
688
689
690
        this.$refs["forms"].validate((valid) => {
          // 验证通过:保存
          if (valid) {
8af7657f   梁保满   修改添加备题,组卷
691
            this.formateQuestion()
13b58a42   梁保满   备题组卷部分前端页面基本完成
692
693
694
695
696
697
698
            this.step = 1;
          } else {
            this.$message.error("数据有误,请检查!");
            return false;
          }
        });
      },
8af7657f   梁保满   修改添加备题,组卷
699
  
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
700
      //删除批量操作数据
533a17d8   梁保满   备题组卷添加批量设置答案
701
702
      formatQuestionList() {
        for (let i = 0; i < this.form.questionList.length; i++) {
8af7657f   梁保满   修改添加备题,组卷
703
704
          if (this.form.questionList[i].qusType) {
            this.form.questionList.splice(i, 1);
3ba60a63   梁保满   发卡补卡,设备状态上传下载接口联调
705
          }
13b58a42   梁保满   备题组卷部分前端页面基本完成
706
        }
13b58a42   梁保满   备题组卷部分前端页面基本完成
707
      },
8af7657f   梁保满   修改添加备题,组卷
708
709
710
711
      //删除题
      delTabData(index) {
        this.form.questionList.splice(index, 1);
        this.formateQuestion()
13b58a42   梁保满   备题组卷部分前端页面基本完成
712
      },
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
713
      //切换多题型-小题题型
13b58a42   梁保满   备题组卷部分前端页面基本完成
714
      changeSubQuestions(val, subQuestions) {
13b58a42   梁保满   备题组卷部分前端页面基本完成
715
716
717
718
719
720
721
        const that = this;
        subQuestions.score = 1;
        subQuestions.partScore = 0;
        subQuestions.correctAnswer = "";
        subQuestions.selectNum = 4;
        switch (val) {
          case 2:
8f573b82   阿宝   组卷接口联调
722
723
724
            subQuestions.answerOptions = that.rightOptions
              .slice(0, subQuestions.selectNum)
              .join(",");
13b58a42   梁保满   备题组卷部分前端页面基本完成
725
726
            break;
          case 3:
8f573b82   阿宝   组卷接口联调
727
728
729
            subQuestions.answerOptions = that.rightOptions
              .slice(0, subQuestions.selectNum)
              .join(",");
13b58a42   梁保满   备题组卷部分前端页面基本完成
730
731
            break;
          case 4:
503b6063   梁保满   判断题答案选项
732
733
734
            subQuestions.selectNum = 0;
            subQuestions.answerOptions = "1,2";
            break;
13b58a42   梁保满   备题组卷部分前端页面基本完成
735
736
737
738
739
          case 5:
            subQuestions.selectNum = 0;
            break;
        }
      },
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
740
      //添加选项
13b58a42   梁保满   备题组卷部分前端页面基本完成
741
      addOptions(subQuestions) {
8f573b82   阿宝   组卷接口联调
742
        let length = subQuestions.answerOptions.split(",").length;
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
743
        if (length > 9) return;
13b58a42   梁保满   备题组卷部分前端页面基本完成
744
        subQuestions.selectNum = length + 1;
8f573b82   阿宝   组卷接口联调
745
746
747
        subQuestions.answerOptions = this.rightOptions
          .slice(0, subQuestions.selectNum)
          .join(",");
13b58a42   梁保满   备题组卷部分前端页面基本完成
748
      },
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
749
      //删除选项
13b58a42   梁保满   备题组卷部分前端页面基本完成
750
      removeOptions(subQuestions) {
8f573b82   阿宝   组卷接口联调
751
        let length = subQuestions.answerOptions.split(",").length;
f26ecfa4   阿宝   测试bug
752
        if (length < 3) return;
13b58a42   梁保满   备题组卷部分前端页面基本完成
753
        subQuestions.selectNum = length - 1;
8f573b82   阿宝   组卷接口联调
754
755
756
        subQuestions.answerOptions = this.rightOptions
          .slice(0, subQuestions.selectNum)
          .join(",");
98f6a547   梁保满   创建答题卡,统计答题信息
757
758
759
760
        subQuestions.correctAnswer = subQuestions.correctAnswer.slice(
          0,
          subQuestions.selectNum
        );
13b58a42   梁保满   备题组卷部分前端页面基本完成
761
      },
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
762
      //设置多选答案
13b58a42   梁保满   备题组卷部分前端页面基本完成
763
      changAnswer(sub, option) {
13b58a42   梁保满   备题组卷部分前端页面基本完成
764
765
766
767
768
769
770
771
772
        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("");
        }
      },
8af7657f   梁保满   修改添加备题,组卷
773
774
775
776
  
  
  
  
13b58a42   梁保满   备题组卷部分前端页面基本完成
777
      async save() {
8f573b82   阿宝   组卷接口联调
778
779
        if (this.saveLoading) return;
        this.saveLoading = true;
533a17d8   梁保满   备题组卷添加批量设置答案
780
        this.formatQuestionList();
f5729396   梁保满   批量设置答案
781
        let formDatas = deepClone(this.form);
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
782
783
784
785
786
        let addPaper =
          this.role == "ROLE_PERSONAL"
            ? this.$request.pAddPaper
            : this.$request.addPaper;
        const { data, status, info } = await addPaper({
8af7657f   梁保满   修改添加备题,组卷
787
          type: 1,
3ba60a63   梁保满   发卡补卡,设备状态上传下载接口联调
788
          ...formDatas,
13b58a42   梁保满   备题组卷部分前端页面基本完成
789
        });
8f573b82   阿宝   组卷接口联调
790
        this.saveLoading = false;
ee6e7628   梁保满   备题组卷借口数据对接调整
791
        if (status == 0) {
13b58a42   梁保满   备题组卷部分前端页面基本完成
792
          this.$router.push({
ee6e7628   梁保满   备题组卷借口数据对接调整
793
794
            path: "/examinationPaper",
          });
13b58a42   梁保满   备题组卷部分前端页面基本完成
795
        } else {
6fffbd55   阿宝   组卷接口调整
796
          this.$message.error(info);
13b58a42   梁保满   备题组卷部分前端页面基本完成
797
798
799
800
801
802
        }
      },
      async changeGrade() {
        //切换年级查询科目
        this._QuerySubjectList(this.form.gradeName);
      },
8af7657f   梁保满   修改添加备题,组卷
803
  
13b58a42   梁保满   备题组卷部分前端页面基本完成
804
805
      async _GradeList() {
        //查询年级列表
cb6ceaa8   梁保满   添加备题,组卷参数调整
806
807
808
809
810
811
812
813
814
        // const { data, status, info } = await this.$request.fetchGradeList();
        // 查找班级
  
        let fetchClassList =
          this.role == "ROLE_PERSONAL"
            ? this.$request.pClassList
            : this.$request.fetchClassList;
  
        const { data, status, info } = await fetchClassList();
ee6e7628   梁保满   备题组卷借口数据对接调整
815
        if (status == 0) {
cb6ceaa8   梁保满   添加备题,组卷参数调整
816
817
818
819
820
821
822
823
          this.gradeClassList = data.list?.map((item) => {
            console.log(!this.gradeList.includes(item.gradeName))
            if (!this.gradeList.includes(item.gradeName)) {
              this.gradeList.push(item.gradeName)
            }
            return item
          })
          // this.gradeList = (data.gradeNames && [...data.gradeNames]) || [];
13b58a42   梁保满   备题组卷部分前端页面基本完成
824
825
826
          if (this.type != 2) {
            this.form.gradeName = this.gradeList[0];
          }
13b58a42   梁保满   备题组卷部分前端页面基本完成
827
        } else {
6fffbd55   阿宝   组卷接口调整
828
          this.$message.error(info);
13b58a42   梁保满   备题组卷部分前端页面基本完成
829
830
        }
      },
5424ef82   梁保满   接口调整
831
      async _QuerySubjectList(grade) {
13b58a42   梁保满   备题组卷部分前端页面基本完成
832
        //查询科目列表
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
833
834
835
836
837
838
839
840
841
842
843
844
        if (!grade) {
          return;
        }
        let query = {};
        let fetchSubjectList =
          this.role == "ROLE_PERSONAL"
            ? this.$request.pSubjectList
            : this.$request.fetchSubjectList;
        if (this.role != "ROLE_PERSONAL") {
          query.gradeName = grade;
        }
        const { data, status, info } = await fetchSubjectList({ ...query });
ee6e7628   梁保满   备题组卷借口数据对接调整
845
        if (status === 0) {
f26ecfa4   阿宝   测试bug
846
847
848
          this.subjectList =
            data.subjectNames?.map((item) => {
              return {
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
849
850
                value: this.role == "ROLE_PERSONAL" ? item.subjectName : item,
                label: this.role == "ROLE_PERSONAL" ? item.subjectName : item,
f26ecfa4   阿宝   测试bug
851
852
              };
            }) || [];
ee6e7628   梁保满   备题组卷借口数据对接调整
853
854
          if (this.subjectList.length) {
            this.form.subjectName = this.subjectList[0].value;
13b58a42   梁保满   备题组卷部分前端页面基本完成
855
          }
13b58a42   梁保满   备题组卷部分前端页面基本完成
856
        } else {
6fffbd55   阿宝   组卷接口调整
857
          this.$message.error(info);
13b58a42   梁保满   备题组卷部分前端页面基本完成
858
859
        }
      },
ee6e7628   梁保满   备题组卷借口数据对接调整
860
      async _QueryDetail() {
03bce046   梁保满   个人版调整
861
        //查询答题卡详情
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
862
863
864
865
866
        let fetchPaperDetail =
          this.role == "ROLE_PERSONAL"
            ? this.$request.pPaperDetail
            : this.$request.fetchPaperDetail;
        const { data, status, info } = await fetchPaperDetail({
ee6e7628   梁保满   备题组卷借口数据对接调整
867
868
869
          paperId: this.$route.query.paperId,
        });
        if (status == 0) {
f26ecfa4   阿宝   测试bug
870
          this.form.title = data.title + "_副本";
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
871
872
          if (this.role != "ROLE_PERSONAL") {
            this.form.sharingType = data.sharingType;
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
873
          }
8af7657f   梁保满   修改添加备题,组卷
874
          this.formatData(data)
ee6e7628   梁保满   备题组卷借口数据对接调整
875
        } else {
6fffbd55   阿宝   组卷接口调整
876
          this.$message.error(info);
ee6e7628   梁保满   备题组卷借口数据对接调整
877
878
        }
      },
8af7657f   梁保满   修改添加备题,组卷
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
      formatData(data) {
        if (this.subjectList.length) {
          this.subjectList.map((item) => {
            if (item.label == data.subjectName) {
              this.form.subjectName = item.value;
            }
          });
        } else {
          this.form.subjectName = "";
        }
  
        if (this.role != "ROLE_PERSONAL") {
          if (this.gradeList.length) {
            this.gradeList.map((item) => {
              if (item == data.gradeName) {
                this.form.gradeName = data.gradeName;
              }
            });
          } else {
            this.form.gradeName = "";
          }
        }
        this.form.questionList = data.questionList?.map((item) => {
          return {
cb6ceaa8   梁保满   添加备题,组卷参数调整
903
904
905
906
907
908
            ...items,
            selectNum: items.answerOptions.split(",").length,
            answerOptions: items.answerOptions || "A,B,C,D",
            screenshot: items.screenshot || "",
            correctAnswer: items.correctAnswer || "",
            knowledge: items.knowledge || "",
8af7657f   梁保满   修改添加备题,组卷
909
910
911
          }
        });
      }
13b58a42   梁保满   备题组卷部分前端页面基本完成
912
913
914
    },
  };
  </script>
8af7657f   梁保满   修改添加备题,组卷
915
916
917
918
  <style>
  .screenshot-box {
    width: 400px;
  }
4c4f7640   梁保满   路由表,路由前端文件
919
  
8af7657f   梁保满   修改添加备题,组卷
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
  .screenshot {
    width: 100%;
    box-shadow: none;
    border: none;
    height: 300px;
  }
  
  .screenshot-img {
    display: block;
    width: auto;
    max-width: 100%;
    margin: 0 auto;
    margin-bottom: 10px;
  }
  </style>
13b58a42   梁保满   备题组卷部分前端页面基本完成
935
936
937
938
  <style lang="scss" scoped>
  .red {
    color: #f30;
  }
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
939
  
533a17d8   梁保满   备题组卷添加批量设置答案
940
941
  .qs-options {
    flex: 1;
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
942
  
533a17d8   梁保满   备题组卷添加批量设置答案
943
944
945
    .ipt {
      margin-bottom: 5px;
    }
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
946
  
533a17d8   梁保满   备题组卷添加批量设置答案
947
948
949
950
    .answer-box {
      .answer-s {
        cursor: pointer;
        user-select: none;
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
951
952
        margin-bottom: 10px;
  
533a17d8   梁保满   备题组卷添加批量设置答案
953
954
955
956
957
        &:first-of-type {
          margin-left: 0;
        }
      }
    }
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
958
959
960
961
962
  
    .answer-box2 {
      margin-bottom: 10px;
    }
  
533a17d8   梁保满   备题组卷添加批量设置答案
963
964
965
    .delButton {
      text-indent: -9999999px;
      border-color: #ff6868;
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
966
      background: #ff6868 url("../../assets/images/arrow.png") no-repeat center;
533a17d8   梁保满   备题组卷添加批量设置答案
967
968
969
      background-size: 19px;
      color: transparent;
    }
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
970
  
3ba60a63   梁保满   发卡补卡,设备状态上传下载接口联调
971
972
    .answer-s.ac {
      border: none;
11a4e518   梁保满   背题组卷修改答案设置,即使测随堂问...
973
    }
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
974
  
533a17d8   梁保满   备题组卷添加批量设置答案
975
976
977
    .ac {
      border-color: #ff6868;
      background: #ff6868;
3ba60a63   梁保满   发卡补卡,设备状态上传下载接口联调
978
      color: #fff !important;
533a17d8   梁保满   备题组卷添加批量设置答案
979
980
981
    }
  }
  
255e2506   梁保满   飞书bug及优化
982
983
  .sel2 {
    width: 480px;
e5ff81a1   阿宝   集团管理员接口
984
  }
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
985
  
533a17d8   梁保满   备题组卷添加批量设置答案
986
987
988
989
990
991
992
  .set-ans-btn {
    width: 100%;
    padding: 10px 0 10px 630px;
    box-sizing: border-box;
    border-right: 1px solid #e2e2e2;
    border-bottom: 1px solid #e2e2e2;
  }
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
993
  
255e2506   梁保满   飞书bug及优化
994
995
996
  .content-box {
    width: 100%;
    height: 100%;
ca39cc52   阿宝   飞书问题处理
997
998
    overflow-y: auto;
  }
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
999
  
13b58a42   梁保满   备题组卷部分前端页面基本完成
1000
1001
1002
  .content {
    width: 100%;
    box-sizing: border-box;
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
1003
1004
    padding: 0 24px;
  
13b58a42   梁保满   备题组卷部分前端页面基本完成
1005
1006
1007
    .ml-20 {
      margin-left: 20px;
    }
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
1008
  
13b58a42   梁保满   备题组卷部分前端页面基本完成
1009
1010
1011
1012
1013
    .btn-box {
      text-align: right;
      margin-left: 140px;
    }
  }
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
1014
  
13b58a42   梁保满   备题组卷部分前端页面基本完成
1015
1016
1017
1018
1019
1020
1021
  .dia-content {
    .dia-tit {
      font-size: 20px;
      color: #333;
      font-weight: 700;
      text-align: center;
    }
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
1022
  
13b58a42   梁保满   备题组卷部分前端页面基本完成
1023
    .add-type {
818e50d7   梁保满   标签删除,修改
1024
1025
      width: 100%;
      margin-bottom: 10px;
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
1026
  
818e50d7   梁保满   标签删除,修改
1027
1028
1029
1030
      .js-set {
        margin: 2.5px 10px 0 0;
        font-size: 14px;
      }
13b58a42   梁保满   备题组卷部分前端页面基本完成
1031
    }
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
1032
  
13b58a42   梁保满   备题组卷部分前端页面基本完成
1033
1034
1035
1036
    .add-btn {
      margin-left: 20px;
    }
  }
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
1037
  
13b58a42   梁保满   备题组卷部分前端页面基本完成
1038
1039
1040
1041
1042
  .el-message-box {
    :deep(.el-button--default) {
      color: #fff;
    }
  }
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
1043
  
13b58a42   梁保满   备题组卷部分前端页面基本完成
1044
1045
1046
1047
  .add-box {
    display: flex;
    justify-content: center;
    align-items: center;
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
1048
  
13b58a42   梁保满   备题组卷部分前端页面基本完成
1049
1050
1051
1052
1053
1054
1055
1056
    .add-question {
      display: flex;
      justify-content: center;
      align-items: center;
      font-size: 16px;
      font-weight: bolder;
      padding: 2px;
      cursor: pointer;
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
1057
  
13b58a42   梁保满   备题组卷部分前端页面基本完成
1058
1059
1060
      .s1 {
        margin-left: 6px;
      }
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
1061
  
13b58a42   梁保满   备题组卷部分前端页面基本完成
1062
1063
1064
1065
      :deep(.el-icon-plus) {
        font-size: 24px;
        font-weight: 900;
      }
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
1066
  
13b58a42   梁保满   备题组卷部分前端页面基本完成
1067
1068
1069
1070
1071
      :deep(.el-button--mini.is-circle) {
        padding: 3px;
      }
    }
  }
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
1072
  
13b58a42   梁保满   备题组卷部分前端页面基本完成
1073
1074
  .dialog-footer {
    text-align: center;
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
1075
  
13b58a42   梁保满   备题组卷部分前端页面基本完成
1076
1077
1078
1079
1080
1081
    :deep(.el-button) {
      border-radius: 20px;
      padding: 8px 20px 7px;
      margin: 0 12px;
    }
  }
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
1082
  
3ba60a63   梁保满   发卡补卡,设备状态上传下载接口联调
1083
1084
  .question-box {
    margin-bottom: 20px;
8af7657f   梁保满   修改添加备题,组卷
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
  
    .screenshot-box {
      width: 100%;
      border: 1px solid #e2e2e2;
      margin-bottom: 20px;
  
      .screenshot-img {
        margin: 0;
      }
    }
3ba60a63   梁保满   发卡补卡,设备状态上传下载接口联调
1095
  }
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
1096
  
13b58a42   梁保满   备题组卷部分前端页面基本完成
1097
1098
  .question-title {
    line-height: 40px;
3ba60a63   梁保满   发卡补卡,设备状态上传下载接口联调
1099
1100
1101
    display: flex;
    align-items: center;
    margin-bottom: 12px;
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
1102
  
503b6063   梁保满   判断题答案选项
1103
    .m20 {
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
1104
      margin: 0 20px;
d32e461c   梁保满   备题组卷
1105
    }
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
1106
  
13b58a42   梁保满   备题组卷部分前端页面基本完成
1107
1108
1109
    .ipt {
      width: 300px;
      margin: 0 16px 0 10px;
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
1110
  
13b58a42   梁保满   备题组卷部分前端页面基本完成
1111
1112
1113
1114
1115
1116
      :deep(.el-input__inner) {
        border-radius: 20px;
        border-color: #667ffd;
        background: rgba($color: #667ffd, $alpha: 0.05);
      }
    }
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
1117
  
13b58a42   梁保满   备题组卷部分前端页面基本完成
1118
1119
1120
    .delete {
      margin-right: 8px;
    }
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
1121
  
13b58a42   梁保满   备题组卷部分前端页面基本完成
1122
1123
1124
1125
1126
    .title-txt {
      margin-right: 20px;
      font-size: 16px;
      font-weight: 700;
    }
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
1127
  
3ba60a63   梁保满   发卡补卡,设备状态上传下载接口联调
1128
1129
1130
1131
1132
1133
    .el-icon-caret-right {
      font-size: 24px;
      color: #888;
      transition: all 0.4s;
      margin-right: 12px;
      cursor: pointer;
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
1134
  
3ba60a63   梁保满   发卡补卡,设备状态上传下载接口联调
1135
1136
1137
1138
1139
      &.active {
        transform: rotate(90deg);
      }
    }
  }
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
1140
  
3ba60a63   梁保满   发卡补卡,设备状态上传下载接口联调
1141
1142
1143
  .questions-ul {
    border-left: 1px solid #e2e2e2;
    border-top: 1px solid #e2e2e2;
13b58a42   梁保满   备题组卷部分前端页面基本完成
1144
  }
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
1145
  
13b58a42   梁保满   备题组卷部分前端页面基本完成
1146
1147
1148
  .el-input-number {
    width: 140px;
  }
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
1149
  
f26ecfa4   阿宝   测试bug
1150
1151
1152
1153
1154
1155
  .answer-title {
    text-align: center;
    font-size: 20px;
    color: #333;
    font-weight: 700;
    padding-bottom: 20px;
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
1156
  
f26ecfa4   阿宝   测试bug
1157
1158
1159
1160
1161
1162
    .totals {
      font-size: 16px;
      color: #888;
      font-weight: normal;
    }
  }
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
1163
  
13b58a42   梁保满   备题组卷部分前端页面基本完成
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
  .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;
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
1176
  
13b58a42   梁保满   备题组卷部分前端页面基本完成
1177
1178
1179
1180
1181
1182
1183
      &.active {
        background: #5e78fa;
        border-color: #5e78fa;
        color: #fff;
      }
    }
  }
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
1184
  
255e2506   梁保满   飞书bug及优化
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
  .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;
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
1198
  
255e2506   梁保满   飞书bug及优化
1199
1200
1201
1202
1203
1204
1205
      &.active {
        background: #5e78fa;
        border-color: #5e78fa;
        color: #fff;
      }
    }
  }
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
1206
  
13b58a42   梁保满   备题组卷部分前端页面基本完成
1207
1208
1209
1210
  .sub-questions {
    width: 100%;
    display: flex;
    border-bottom: 1px solid #e2e2e2;
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
1211
1212
  
    &>div {
13b58a42   梁保满   备题组卷部分前端页面基本完成
1213
1214
1215
1216
1217
1218
1219
1220
      min-height: 40px;
      padding: 5px;
      flex-shrink: 0;
      border-right: 1px solid #e2e2e2;
      display: flex;
      justify-content: center;
      align-items: center;
    }
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
1221
  
13b58a42   梁保满   备题组卷部分前端页面基本完成
1222
    .qs-num {
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
1223
      width: 70px;
13b58a42   梁保满   备题组卷部分前端页面基本完成
1224
    }
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
1225
  
13b58a42   梁保满   备题组卷部分前端页面基本完成
1226
1227
1228
    .qs-type {
      width: 160px;
    }
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
1229
  
13b58a42   梁保满   备题组卷部分前端页面基本完成
1230
1231
1232
1233
    .qs-score,
    .qs-partScore {
      width: 160px;
    }
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
1234
  
13b58a42   梁保满   备题组卷部分前端页面基本完成
1235
1236
1237
    .qs-options {
      flex: 1;
    }
cb6ceaa8   梁保满   添加备题,组卷参数调整
1238
1239
  
    .qs-upload {
8af7657f   梁保满   修改添加备题,组卷
1240
1241
      width: 60px;
    }
cb6ceaa8   梁保满   添加备题,组卷参数调整
1242
  
13b58a42   梁保满   备题组卷部分前端页面基本完成
1243
    .qs-set {
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
1244
      width: 60px;
13b58a42   梁保满   备题组卷部分前端页面基本完成
1245
    }
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
1246
  
13b58a42   梁保满   备题组卷部分前端页面基本完成
1247
1248
1249
1250
    .qs-options2 {
      text-align: left;
      justify-content: flex-start;
      padding-left: 20px;
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
1251
  
13b58a42   梁保满   备题组卷部分前端页面基本完成
1252
1253
1254
1255
      .answer-s {
        cursor: pointer;
      }
    }
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
1256
  
13b58a42   梁保满   备题组卷部分前端页面基本完成
1257
1258
1259
1260
1261
1262
1263
1264
1265
    :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);
      }
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
1266
  
13b58a42   梁保满   备题组卷部分前端页面基本完成
1267
1268
1269
1270
1271
      .el-input__icon {
        line-height: 32px;
      }
    }
  }
6192eba8   梁保满   引用上传文件组件问题,备题组卷顶部
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
  
  .upload-box {
    .upload-demo {
      text-align: center;
    }
  
    .stem-pic {
      display: block;
      margin: 0 auto 20px;
      height: 200px;
      object-fit: cover;
    }
  }
4c4f7640   梁保满   路由表,路由前端文件
1285
  </style>