Commit 352c53cc5456abfe5b4fbd5d35568980afd602ce

Authored by 梁保满
1 parent 6192eba8

上传word回传数据

package.json
... ... @@ -21,8 +21,9 @@
21 21 "vue": "^2.6.11",
22 22 "vue-i18n": "^8.4.0",
23 23 "vue-router": "^3.5.1",
  24 + "vuedraggable": "^2.24.3",
24 25 "vuex": "^3.6.2",
25   - "vuedraggable": "^2.24.3"
  26 + "mockjs": "1.1.0"
26 27 },
27 28 "devDependencies": {
28 29 "@vue/cli-plugin-babel": "~4.5.0",
... ... @@ -45,4 +46,4 @@
45 46 "sass-loader": "^7.1.0",
46 47 "vue-template-compiler": "^2.5.2"
47 48 }
48 49 -}
  50 +}
49 51 \ No newline at end of file
... ...
src/api/apis/apis.js
... ... @@ -1604,4 +1604,22 @@ export default {
1604 1604 });
1605 1605 },
1606 1606  
  1607 +
  1608 + /** v1.5 */
  1609 + // 教师/个人版查询答题卡列表的分享数量
  1610 + paperShareCount(data) {
  1611 + return service({
  1612 + url: setUpUrls.paperShareCount,
  1613 + method: "POST",
  1614 + data
  1615 + });
  1616 + },
  1617 + // 教师/个人版导入备题组卷Word文档
  1618 + paperWordUpload(data) {
  1619 + return service({
  1620 + url: setUpUrls.paperWordUpload,
  1621 + method: "POST",
  1622 + data
  1623 + });
  1624 + },
1607 1625 };
... ...
src/api/urls/apis.js
... ... @@ -416,4 +416,12 @@ export default {
416 416 exportExamMultiReport: "/api_html/teaching/exportExamMultiReport",
417 417 //查询即时测多班默认等级列表
418 418 defaultLevels: "/api_html/teaching/defaultLevels",
  419 +
  420 +
  421 +
  422 + /** v1.5 */
  423 + //教师/个人版查询答题卡列表的分享数量
  424 + paperShareCount: "/api_html/common/paper/paperShareCount",
  425 + //教师/个人版导入备题组卷Word文档
  426 + paperWordUpload: "/api_html/common/paper/upload",
419 427 }
... ...
src/main.js
... ... @@ -28,6 +28,7 @@ Vue.use(permission)
28 28 NProgress.inc(0.2)
29 29 NProgress.configure({ easing: "ease", speed: 500, showSpinner: false })
30 30  
  31 +import "@/mock/index.js"
31 32  
32 33 Array.prototype.remove = function (val) {
33 34 var index = this.indexOf(val);
... ...
src/mock/index.js 0 → 100644
  1 +import Mock from "mockjs"
  2 +Mock.mock(
  3 + "/api_html/common/paper/paperShareCount", {
  4 + info: "success",
  5 + status: 0,
  6 + data: {
  7 + myCount: 24,
  8 + grade: 30
  9 + }
  10 +}
  11 +)
  12 +Mock.mock(
  13 + "/api_html/common/paper/upload", {
  14 + info: "success",
  15 + status: 0,
  16 + data: {
  17 + "name": "@cname",
  18 + "id|+1": 11,
  19 + "questionList": [
  20 + {
  21 + "examQuestionId|+1": 0,
  22 + "questionId|+1": 1,
  23 + "questionTitle": "@cname",
  24 + "questionType|1-4": 1,
  25 + "score|1-2": 1,
  26 + "partScore|0.5-1": 0.5,
  27 + "answerOptions": "A,B,C,D",
  28 + "correctAnswer|1": ["A", "B", "C", "D"],
  29 + "subQuestions": [
  30 + {
  31 + "questionType|1-4": 1,
  32 + "score": 1,
  33 + "partScore": 0,
  34 + "selectNum": 4,
  35 + "answerOptions": "A,B,C,D",
  36 + "correctAnswer|1": ["A", "B", "C", "D"],
  37 + "screenshot": "xxxx",
  38 + }
  39 + ]
  40 + }
  41 + ]
  42 + }
  43 +}
  44 +)
0 45 \ No newline at end of file
... ...
src/views/basic/setUp/archived.vue
... ... @@ -16,18 +16,8 @@
16 16 <li v-show="step == 0">
17 17 <div class="form-item">
18 18 <span class="s-txt">选择分班年级:</span>
19   - <el-select
20   - class="sel"
21   - v-model="grade"
22   - placeholder="选择年级"
23   - @change="changeGrade"
24   - >
25   - <el-option
26   - v-for="item in gradeList"
27   - :key="item.value"
28   - :label="item.label"
29   - :value="item.value"
30   - >
  19 + <el-select class="sel" v-model="grade" placeholder="选择年级" @change="changeGrade">
  20 + <el-option v-for="item in gradeList" :key="item.value" :label="item.label" :value="item.value">
31 21 </el-option>
32 22 </el-select>
33 23 </div>
... ... @@ -36,18 +26,11 @@
36 26 <i class="el-icon-loading" v-show="loadingClass"></i>
37 27 <div class="check-box" v-if="classList.length && !loadingClass">
38 28 <p class="all-check">
39   - <el-checkbox
40   - :indeterminate="isIndeterminate"
41   - v-model="checkAll"
42   - @change="handleCheckAllChange"
43   - >全选</el-checkbox
44   - >
  29 + <el-checkbox :indeterminate="isIndeterminate" v-model="checkAll"
  30 + @change="handleCheckAllChange">全选</el-checkbox>
45 31 </p>
46   - <el-checkbox-group
47   - v-model="classIds"
48   - @change="handleCheckedChange"
49   - >
50   - <el-checkbox v-for="item in classList" :label="item.id">{{
  32 + <el-checkbox-group v-model="classIds" @change="handleCheckedChange">
  33 + <el-checkbox v-for="item in classList" :key="item.id" :label="item.id">{{
51 34 item.className
52 35 }}</el-checkbox>
53 36 </el-checkbox-group>
... ... @@ -56,39 +39,23 @@
56 39 <div class="form-item">
57 40 <span class="s-txt"></span>
58 41 <p class="tips">
59   - <i class="el-icon-warning"></i
60   - >请谨慎操作,班级归档后,学生解除班级关系且相关老师任课信息将不存在。
  42 + <i class="el-icon-warning"></i>请谨慎操作,班级归档后,学生解除班级关系且相关老师任课信息将不存在。
61 43 </p>
62 44 </div>
63 45 <div class="btn-box">
64 46 <el-button class="btn" round @click="toClazz">取消</el-button>
65   - <el-popconfirm
66   - confirm-button-text="确定"
67   - cancel-button-text="取消"
68   - icon="el-icon-info"
69   - icon-color="red"
70   - title="确定要将所选班级归档吗?"
71   - @confirm="_ClassArchiving"
72   - >
73   - <el-button class="btn" slot="reference" type="primary" round
74   - >归档</el-button
75   - >
  47 + <el-popconfirm confirm-button-text="确定" cancel-button-text="取消" icon="el-icon-info" icon-color="red"
  48 + title="确定要将所选班级归档吗?" @confirm="_ClassArchiving">
  49 + <el-button class="btn" slot="reference" type="primary" round>归档</el-button>
76 50 </el-popconfirm>
77 51 </div>
78 52 </li>
79 53 <li v-show="step == 1">
80 54 <div class="step-item">
81   - <upload
82   - id="downTeacher"
83   - :url="urlClazz"
84   - @upSuccess="upStudentSuccess"
85   - fileName="学生名单模板"
86   - >
  55 + <upload id="downTeacher" :url="urlClazz" @upSuccess="upStudentSuccess" fileName="学生名单模板">
87 56 <p class="down-txt" slot="down">
88 57 通过Excel名单导入学生名单模板,点击
89   - <el-link type="primary" @click="downStudentExcel"
90   - >导出未分配学生</el-link
91   - >
  58 + <el-link type="primary" @click="downStudentExcel">导出未分配学生</el-link>
92 59
93 60 </p>
94 61 </upload>
... ... @@ -96,17 +63,10 @@
96 63 </li>
97 64 <li v-show="step == 2">
98 65 <div class="step-item">
99   - <upload
100   - id="downTeacher"
101   - :url="urlTeacher"
102   - @upSuccess="upTeacherSuccess"
103   - fileName="任课老师名单模板"
104   - >
  66 + <upload id="downTeacher" :url="urlTeacher" @upSuccess="upTeacherSuccess" fileName="任课老师名单模板">
105 67 <p class="down-txt" slot="down">
106 68 通过Excel名单导入任课老师名单模板,点击
107   - <el-link type="primary" @click="downTeacherExcel"
108   - >导出未分配教师</el-link
109   - >。
  69 + <el-link type="primary" @click="downTeacherExcel">导出未分配教师</el-link>。
110 70 </p>
111 71 </upload>
112 72 </div>
... ... @@ -114,14 +74,8 @@
114 74 <li v-show="step == 3">
115 75 <div class="step-item2">
116 76 <p class="p2">
117   - <el-button
118   - class="btn"
119   - type="success"
120   - icon="el-icon-check"
121   - circle
122   - size="small"
123   - ></el-button
124   - >恭喜您,分班已经完成,分班后老师第一次上课时注意事项:
  77 + <el-button class="btn" type="success" icon="el-icon-check" circle
  78 + size="small"></el-button>恭喜您,分班已经完成,分班后老师第一次上课时注意事项:
125 79 </p>
126 80 <p class="p1">
127 81 1、点击授课端的设置—应用设置—初始化设置—重新选择绑定班级。
... ... @@ -135,21 +89,8 @@
135 89 <li v-show="step != 0">
136 90 <div class="btn-box">
137 91 <el-button class="btn" round @click="step -= 1">上一步</el-button>
138   - <el-button
139   - v-show="step != 3"
140   - class="btn"
141   - type="primary"
142   - round
143   - @click="step += 1"
144   - >下一步</el-button
145   - ><el-button
146   - v-show="step == 3"
147   - class="btn"
148   - type="primary"
149   - round
150   - @click="toClazz"
151   - >完成</el-button
152   - >
  92 + <el-button v-show="step != 3" class="btn" type="primary" round @click="step += 1">下一步</el-button><el-button
  93 + v-show="step == 3" class="btn" type="primary" round @click="toClazz">完成</el-button>
153 94 </div>
154 95 </li>
155 96 </ul>
... ... @@ -183,8 +124,8 @@ export default {
183 124 handleCheckAllChange(val) {
184 125 this.classIds = val
185 126 ? this.classList.map((item) => {
186   - return item.id;
187   - })
  127 + return item.id;
  128 + })
188 129 : [];
189 130 this.isIndeterminate = false;
190 131 },
... ... @@ -315,59 +256,73 @@ export default {
315 256 padding: 20px;
316 257 box-sizing: border-box;
317 258 }
  259 +
318 260 .step {
319 261 margin-bottom: 40px;
320 262 }
  263 +
321 264 .form-item {
322 265 width: 70%;
323 266 display: flex;
324 267 margin: 0 auto 20px;
  268 +
325 269 .check-box {
326 270 flex: 1;
327 271 }
  272 +
328 273 .all-check {
329 274 margin-right: 30px;
330 275 }
  276 +
331 277 &:first-of-type {
332 278 .s-txt {
333 279 line-height: 40px;
334 280 }
335 281 }
  282 +
336 283 .s-txt {
337 284 width: 160px;
338 285 flex-shrink: 0;
339 286 }
  287 +
340 288 .sel {
341 289 :deep(.el-input__inner) {
342 290 border-radius: 20px;
343 291 }
344 292 }
  293 +
345 294 :deep(.el-checkbox) {
346 295 margin-bottom: 12px;
347 296 }
  297 +
348 298 .tips {
349 299 display: flex;
350 300 align-items: center;
351 301 color: #666;
352 302 }
  303 +
353 304 .el-icon-warning {
354 305 font-size: 20px;
355 306 color: #ec7f8c;
356 307 margin-right: 10px;
357 308 }
358 309 }
  310 +
359 311 .btn-box {
360 312 width: 80%;
361 313 margin: 60px auto 0;
362 314 display: flex;
363 315 justify-content: flex-end;
  316 +
364 317 .btn {
365 318 margin: 0 10px;
366 319 }
367 320 }
  321 +
368 322 .step-item {
369 323 text-align: center;
370 324 }
  325 +
371 326 .step-item2 {
372 327 width: 100%;
373 328 display: flex;
... ... @@ -375,19 +330,23 @@ export default {
375 330 align-items: center;
376 331 color: #000;
377 332 font-weight: 500;
  333 +
378 334 .p2 {
379 335 font-size: 16px;
380 336 margin: 0 0 20px -68px;
  337 +
381 338 .btn {
382 339 margin-right: 14px;
383 340 }
384 341 }
  342 +
385 343 .p1 {
386 344 width: 450px;
387 345 text-align: left;
388 346 margin-bottom: 20px;
389 347 }
390 348 }
  349 +
391 350 :deep(.down-txt) {
392 351 justify-content: center;
393 352 padding-left: 0;
... ...
src/views/examinationPaper/add.vue
... ... @@ -6,102 +6,44 @@
6 6 </template>
7 7 </back-box>
8 8 <div class="content">
9   - <el-steps
10   - :active="step"
11   - finish-status="success"
12   - simple
13   - style="margin: 20px 0"
14   - >
  9 + <el-steps :active="step" finish-status="success" simple style="margin: 20px 0">
15 10 <el-step title="基础信息" icon="el-icon-edit"></el-step>
16   - <el-step title="题目编辑" icon="el-icon-tickets"></el-step>
  11 + <el-step v-if="!isUpload" title="题目编辑" icon="el-icon-tickets"></el-step>
17 12 <el-step title="设置答案" icon="el-icon-edit-outline"></el-step>
18 13 </el-steps>
19 14 <div v-show="step == 0">
20   - <el-form
21   - ref="forms"
22   - :model="form"
23   - :rules="formRules"
24   - label-width="140px"
25   - >
  15 + <el-form ref="forms" :model="form" :rules="formRules" label-width="140px">
26 16 <el-form-item label="答题卡名称:" prop="title">
27   - <el-input
28   - class="sel2"
29   - type="text"
30   - placeholder="请输入答题卡名称"
31   - v-model.trim="form.title"
32   - maxlength="30"
33   - size="45"
34   - show-word-limit
35   - >
  17 + <el-input class="sel2" type="text" placeholder="请输入答题卡名称" v-model.trim="form.title" maxlength="30" size="45"
  18 + show-word-limit>
36 19 </el-input>
37 20 </el-form-item>
38 21 <el-form-item label="测验类型:">
39 22 <el-select v-model="form.tagId" placeholder="选择测验类型">
40 23 <el-option label="--" value=""> </el-option>
41   - <el-option
42   - v-for="item in answerTypeList"
43   - :key="item.id"
44   - :label="item.typeName"
45   - :value="item.id"
46   - >{{ item.typeName }}</el-option
47   - >
  24 + <el-option v-for="item in answerTypeList" :key="item.id" :label="item.typeName" :value="item.id">{{
  25 + item.typeName }}</el-option>
48 26 </el-select>
49   - <el-button
50   - class="ml-20"
51   - type="primary"
52   - round
53   - circle
54   - icon="el-icon-edit"
55   - @click="openTagDia"
56   - ></el-button>
  27 + <el-button class="ml-20" type="primary" round circle icon="el-icon-edit" @click="openTagDia"></el-button>
57 28 </el-form-item>
58   - <el-form-item
59   - v-if="role != 'ROLE_PERSONAL'"
60   - label="年级:"
61   - prop="gradeName"
62   - >
63   - <el-select
64   - class="sel"
65   - v-model="form.gradeName"
66   - placeholder=""
67   - @change="changeGrade"
68   - >
69   - <el-option
70   - v-for="item in gradeList"
71   - :key="item"
72   - :label="item"
73   - :value="item"
74   - >
  29 + <el-form-item v-if="role != 'ROLE_PERSONAL'" label="年级:" prop="gradeName">
  30 + <el-select class="sel" v-model="form.gradeName" placeholder="" @change="changeGrade">
  31 + <el-option v-for="item in gradeList" :key="item" :label="item" :value="item">
75 32 </el-option>
76 33 </el-select>
77 34 </el-form-item>
78 35 <el-form-item label="科目:" prop="subjectName">
79 36 <el-select class="sel" v-model="form.subjectName" placeholder="">
80   - <el-option
81   - v-for="item in subjectList"
82   - :key="item.value"
83   - :label="item.label"
84   - :value="item.value"
85   - >{{ item.label }}
  37 + <el-option v-for="item in subjectList" :key="item.value" :label="item.label" :value="item.value">{{
  38 + item.label }}
86 39 </el-option>
87 40 </el-select>
88 41 </el-form-item>
89 42 <el-form-item label="考试时长:">
90   - <el-input-number
91   - size="medium"
92   - :min="1"
93   - :max="140"
94   - :step-strictly="true"
95   - :step="1"
96   - v-model="form.examsDuration"
97   - label="考试时长"
98   - ></el-input-number>
  43 + <el-input-number size="medium" :min="1" :max="140" :step-strictly="true" :step="1"
  44 + v-model="form.examsDuration" label="考试时长"></el-input-number>
99 45 </el-form-item>
100   - <el-form-item
101   - v-if="role != 'ROLE_PERSONAL'"
102   - label="分享范围:"
103   - prop="sharingType"
104   - >
  46 + <el-form-item v-if="role != 'ROLE_PERSONAL'" label="分享范围:" prop="sharingType">
105 47 <el-radio-group v-model="form.sharingType">
106 48 <el-radio :label="0">任课班级分享</el-radio>
107 49 <el-radio :label="1">全年级分享</el-radio>
... ... @@ -109,52 +51,24 @@
109 51 </el-form-item>
110 52 </el-form>
111 53 <div class="btn-box">
112   - <el-button type="danger" plain round @click="linkBack"
113   - >取消</el-button
114   - >
115   - <el-button type="primary" round @click="setStep1">下一步</el-button>
  54 + <el-button type="danger" plain round @click="linkBack">取消</el-button>
  55 + <el-button type="primary" round @click="isUpload ? setStep2() : setStep1()">下一步</el-button>
116 56 </div>
117   - <el-dialog :close-on-click-modal="false"
118   - title="设置测验类型"
119   - :visible.sync="dialogVisible"
120   - width="500px"
121   - >
  57 + <el-dialog :close-on-click-modal="false" title="设置测验类型" :visible.sync="dialogVisible" width="500px">
122 58 <div class="dia-content">
123 59 <p class="add-type" v-for="item in tagList" :key="item.id">
124 60 <el-row :gutter="10">
125   - <el-col :span="18"
126   - ><el-input
127   - v-model="item.typeName"
128   - :maxlength="10"
129   - placeholder="请输入答题卡类型名称"
130   - ></el-input
131   - ></el-col>
  61 + <el-col :span="18"><el-input v-model="item.typeName" :maxlength="10"
  62 + placeholder="请输入答题卡类型名称"></el-input></el-col>
132 63 <el-col :span="6">
133 64 <el-tooltip effect="dark" content="保存" placement="top">
134   - <el-button
135   - class="js-set"
136   - type="primary"
137   - size="small"
138   - round
139   - circle
140   - icon="el-icon-check"
141   - @click="editTypeName(item)"
142   - ></el-button>
  65 + <el-button class="js-set" type="primary" size="small" round circle icon="el-icon-check"
  66 + @click="editTypeName(item)"></el-button>
143 67 </el-tooltip>
144 68 <el-tooltip effect="dark" content="删除" placement="right">
145   - <el-popconfirm
146   - title="确定删除这道大题吗?"
147   - @confirm="removeTypeName(item)"
148   - >
149   - <el-button
150   - class="js-set"
151   - type="danger"
152   - size="small"
153   - round
154   - circle
155   - icon="el-icon-delete"
156   - slot="reference"
157   - ></el-button>
  69 + <el-popconfirm title="确定删除这道大题吗?" @confirm="removeTypeName(item)">
  70 + <el-button class="js-set" type="danger" size="small" round circle icon="el-icon-delete"
  71 + slot="reference"></el-button>
158 72 </el-popconfirm>
159 73 </el-tooltip>
160 74 </el-col>
... ... @@ -163,25 +77,13 @@
163 77 <p class="add-type">
164 78 <el-row :gutter="10">
165 79 <el-col :span="18">
166   - <el-input
167   - type="text"
168   - placeholder="请输入答题卡类型名称"
169   - v-model.trim="answerTypeName"
170   - :maxlength="10"
171   - >
  80 + <el-input type="text" placeholder="请输入答题卡类型名称" v-model.trim="answerTypeName" :maxlength="10">
172 81 </el-input>
173 82 </el-col>
174 83 <el-col :span="6">
175 84 <el-tooltip effect="dark" content="添加" placement="right">
176   - <el-button
177   - class="js-set"
178   - type="primary"
179   - size="small"
180   - round
181   - circle
182   - icon="el-icon-plus"
183   - @click="addPaperType"
184   - ></el-button>
  85 + <el-button class="js-set" type="primary" size="small" round circle icon="el-icon-plus"
  86 + @click="addPaperType"></el-button>
185 87 </el-tooltip>
186 88 </el-col>
187 89 </el-row>
... ... @@ -192,438 +94,223 @@
192 94 </div>
193 95 </el-dialog>
194 96 </div>
195   - <div v-show="step == 1">
196   - <div
197   - class="question-box"
198   - v-for="(question, index) in form.questionList"
199   - :key="index"
200   - >
201   - <p class="question-title">
202   - <el-tooltip
203   - effect="dark"
204   - :content="question.show ? '收起' : '展开'"
205   - placement="left"
206   - >
207   - <i
208   - class="el-icon-caret-right"
209   - :class="question.show ? 'active' : ''"
210   - @click="question.show = !question.show"
211   - ></i>
212   - </el-tooltip>
213   - <span>{{ setBigNum(index) }}、</span>
214   - <el-input
215   - class="ipt"
216   - v-model.trim="question.questionTitle"
217   - maxlength="30"
218   - placeholder="填写大题名称"
219   - ></el-input>
220   - <el-popconfirm
221   - title="确定删除这道大题吗?"
222   - @confirm="form.questionList.splice(index, 1)"
223   - >
224   - <el-button
225   - slot="reference"
226   - class="delete"
227   - type="danger"
228   - size="mini"
229   - circle
230   - icon="el-icon-delete"
231   - ></el-button>
232   - </el-popconfirm>
233   - <span class="m20">共:{{ question.subQuestions.length }}题</span>
234   - <span>共:{{ setScore(question) }}分</span>
235   - </p>
236   - <transition name="el-zoom-in-top">
237   - <ul v-show="question.show" class="questions-ul">
238   - <li class="sub-questions">
239   - <div class="qs-num">题号</div>
240   - <div class="qs-type">题型</div>
241   - <div class="qs-score">分数</div>
242   - <div class="qs-partScore">漏选得分</div>
243   - <div class="qs-options">选项设置</div>
244   - <div class="qs-set">操作</div>
245   - </li>
246   - <li
247   - class="sub-questions"
248   - v-for="(subQuestions, indexs) in question.subQuestions"
249   - :key="indexs"
250   - >
251   - <div class="qs-num">{{ setNum(index, indexs) }}</div>
252   - <div class="qs-type">
253   - <el-select
254   - v-model="subQuestions.questionType"
255   - placeholder="选择题目类型"
256   - @change="changeSubQuestions($event, subQuestions)"
257   - >
258   - <el-option label="单选题" :value="2"></el-option>
259   - <el-option label="多选题" :value="3"></el-option>
260   - <el-option label="判断题" :value="4"></el-option>
261   - <el-option label="主观题" :value="5"></el-option>
262   - </el-select>
263   - </div>
264   - <div class="qs-score">
265   - <el-input-number
266   - class="number-ipt"
267   - size="medium"
268   - :min="1"
269   - :max="200"
270   - :precision="2"
271   - :step="1"
272   - v-model="subQuestions.score"
273   - label="单题分值"
274   - ></el-input-number>
275   - </div>
276   - <div class="qs-partScore">
277   - <p v-if="subQuestions.questionType != 3">--</p>
278   - <el-input-number
279   - class="number-ipt"
280   - v-else
281   - size="medium"
282   - :min="0"
283   - :precision="2"
284   - :max="subQuestions.score"
285   - :step="0.5"
286   - v-model="subQuestions.partScore"
287   - label="漏选得分"
288   - ></el-input-number>
289   - </div>
290   - <div class="qs-options">
291   - <p v-if="subQuestions.questionType == 5">--</p>
292   - <p v-if="subQuestions.questionType == 4" class="answer-box">
293   - <span
294   - class="answer-s"
295   - :class="subQuestions.correctAnswer == 1 ? 'active' : ''"
296   - @click="subQuestions.correctAnswer = 1"
297   - >✓</span
298   - >
299   - <span
300   - class="answer-s"
301   - :class="subQuestions.correctAnswer == 2 ? 'active' : ''"
302   - @click="subQuestions.correctAnswer = 2"
303   - >✗</span
304   - >
305   - </p>
306   - <p v-if="subQuestions.questionType == 3" class="answer-box">
307   - <span
308   - class="answer-s"
309   - v-for="option in subQuestions.answerOptions.split(',')"
310   - :class="
311   - subQuestions.correctAnswer?.includes(option)
312   - ? 'active'
313   - : ''
314   - "
315   - :key="option"
316   - @click="changAnswer(subQuestions, option)"
317   - >{{ option }}</span
318   - >
319   - </p>
320   - <p v-if="subQuestions.questionType == 2" class="answer-box">
321   - <span
322   - class="answer-s"
323   - v-for="option in subQuestions.answerOptions.split(',')"
324   - :class="
325   - subQuestions.correctAnswer == option ? 'active' : ''
326   - "
327   - :key="option"
328   - @click="subQuestions.correctAnswer = option"
329   - >{{ option }}</span
330   - >
331   - </p>
332   - <p
333   - v-if="
334   - subQuestions.questionType == 3 ||
  97 + <template v-if="!isUpload">
  98 + <div v-show="step == 1">
  99 + <div class="question-box" v-for="(question, index) in form.questionList" :key="index">
  100 + <p class="question-title">
  101 + <el-tooltip effect="dark" :content="question.show ? '收起' : '展开'" placement="left">
  102 + <i class="el-icon-caret-right" :class="question.show ? 'active' : ''"
  103 + @click="question.show = !question.show"></i>
  104 + </el-tooltip>
  105 + <span>{{ setBigNum(index) }}、</span>
  106 + <el-input class="ipt" v-model.trim="question.questionTitle" maxlength="30" placeholder="填写大题名称"></el-input>
  107 + <el-popconfirm title="确定删除这道大题吗?" @confirm="form.questionList.splice(index, 1)">
  108 + <el-button slot="reference" class="delete" type="danger" size="mini" circle
  109 + icon="el-icon-delete"></el-button>
  110 + </el-popconfirm>
  111 + <span class="m20">共:{{ question.subQuestions?.length }}题</span>
  112 + <span>共:{{ setScore(question) }}分</span>
  113 + </p>
  114 + <transition name="el-zoom-in-top">
  115 + <ul v-show="question.show" class="questions-ul">
  116 + <li class="sub-questions">
  117 + <div class="qs-num">题号</div>
  118 + <div class="qs-type">题型</div>
  119 + <div class="qs-score">分数</div>
  120 + <div class="qs-partScore">漏选得分</div>
  121 + <div class="qs-options">选项设置</div>
  122 + <div class="qs-set">操作</div>
  123 + </li>
  124 + <li class="sub-questions" v-for="(subQuestions, indexs) in question.subQuestions" :key="indexs">
  125 + <div class="qs-num">{{ setNum(index, indexs) }}</div>
  126 + <div class="qs-type">
  127 + <el-select v-model="subQuestions.questionType" placeholder="选择题目类型"
  128 + @change="changeSubQuestions($event, subQuestions)">
  129 + <el-option label="单选题" :value="2"></el-option>
  130 + <el-option label="多选题" :value="3"></el-option>
  131 + <el-option label="判断题" :value="4"></el-option>
  132 + <el-option label="主观题" :value="5"></el-option>
  133 + </el-select>
  134 + </div>
  135 + <div class="qs-score">
  136 + <el-input-number class="number-ipt" size="medium" :min="1" :max="200" :precision="2" :step="1"
  137 + v-model="subQuestions.score" label="单题分值"></el-input-number>
  138 + </div>
  139 + <div class="qs-partScore">
  140 + <p v-if="subQuestions.questionType != 3">--</p>
  141 + <el-input-number class="number-ipt" v-else size="medium" :min="0" :precision="2"
  142 + :max="subQuestions.score" :step="0.5" v-model="subQuestions.partScore"
  143 + label="漏选得分"></el-input-number>
  144 + </div>
  145 + <div class="qs-options">
  146 + <p v-if="subQuestions.questionType == 5">--</p>
  147 + <p v-if="subQuestions.questionType == 4" class="answer-box">
  148 + <span class="answer-s" :class="subQuestions.correctAnswer == 1 ? 'active' : ''"
  149 + @click="subQuestions.correctAnswer = 1">✓</span>
  150 + <span class="answer-s" :class="subQuestions.correctAnswer == 2 ? 'active' : ''"
  151 + @click="subQuestions.correctAnswer = 2">✗</span>
  152 + </p>
  153 + <p v-if="subQuestions.questionType == 3" class="answer-box">
  154 + <span class="answer-s" v-for="option in subQuestions.answerOptions.split(',')" :class="subQuestions.correctAnswer?.includes(option)
  155 + ? 'active'
  156 + : ''
  157 + " :key="option" @click="changAnswer(subQuestions, option)">{{ option }}</span>
  158 + </p>
  159 + <p v-if="subQuestions.questionType == 2" class="answer-box">
  160 + <span class="answer-s" v-for="option in subQuestions.answerOptions.split(',')" :class="subQuestions.correctAnswer == option ? 'active' : ''
  161 + " :key="option" @click="subQuestions.correctAnswer = option">{{ option }}</span>
  162 + </p>
  163 + <p v-if="subQuestions.questionType == 3 ||
335 164 subQuestions.questionType == 2
336   - "
337   - class="answer-box answer-box2"
338   - >
339   - <el-button
340   - size="mini"
341   - type="primary"
342   - icon="el-icon-plus"
343   - circle
344   - @click="addOptions(subQuestions)"
345   - ></el-button>
346   - <el-button
347   - size="mini"
348   - type="primary"
349   - icon="el-icon-minus"
350   - round
351   - circle
352   - @click="removeOptions(subQuestions)"
353   - ></el-button>
354   - </p>
355   - </div>
356   - <div class="qs-set">
357   - <el-popconfirm
358   - title="确定删除这道题吗?"
359   - @confirm="delTabData(indexs, index)"
360   - >
361   - <el-button
362   - slot="reference"
363   - class="delete"
364   - type="danger"
365   - size="mini"
366   - circle
367   - icon="el-icon-delete"
368   - ></el-button>
369   - </el-popconfirm>
370   - </div>
371   - </li>
372   - <li class="sub-questions">
373   - <div class="qs-num">添加</div>
374   - <div class="qs-type">
375   - <el-select
376   - v-model="addSubQuestionsType"
377   - placeholder="选择题目类型"
378   - @change="changeAddSubQuestions($event, question)"
379   - >
380   - <el-option label="单选题" :value="2"></el-option>
381   - <el-option label="多选题" :value="3"></el-option>
382   - <el-option label="判断题" :value="4"></el-option>
383   - <el-option label="主观题" :value="5"></el-option>
  165 + " class="answer-box answer-box2">
  166 + <el-button size="mini" type="primary" icon="el-icon-plus" circle
  167 + @click="addOptions(subQuestions)"></el-button>
  168 + <el-button size="mini" type="primary" icon="el-icon-minus" round circle
  169 + @click="removeOptions(subQuestions)"></el-button>
  170 + </p>
  171 + </div>
  172 + <div class="qs-set">
  173 + <el-popconfirm title="确定删除这道题吗?" @confirm="delTabData(indexs, index)">
  174 + <el-button slot="reference" class="delete" type="danger" size="mini" circle
  175 + icon="el-icon-delete"></el-button>
  176 + </el-popconfirm>
  177 + </div>
  178 + </li>
  179 + <li class="sub-questions">
  180 + <div class="qs-num">添加</div>
  181 + <div class="qs-type">
  182 + <el-select v-model="addSubQuestionsType" placeholder="选择题目类型"
  183 + @change="changeAddSubQuestions($event, question)">
  184 + <el-option label="单选题" :value="2"></el-option>
  185 + <el-option label="多选题" :value="3"></el-option>
  186 + <el-option label="判断题" :value="4"></el-option>
  187 + <el-option label="主观题" :value="5"></el-option>
  188 + </el-select>
  189 + </div>
  190 + <div class="qs-score"></div>
  191 + <div class="qs-partScore"></div>
  192 + <div class="qs-options"></div>
  193 + <div class="qs-set"></div>
  194 + </li>
  195 + </ul>
  196 + </transition>
  197 + </div>
  198 + <div class="add-box">
  199 + <p class="add-question" @click="openQuestion">
  200 + <el-button size="mini" type="primary" icon="el-icon-plus" circle></el-button>
  201 + <span class="s1">添加大题</span>
  202 + </p>
  203 + </div>
  204 + <div class="btn-box">
  205 + <el-button type="danger" plain round @click="linkBack">取消</el-button>
  206 + <el-button round @click="step = 0">上一步</el-button>
  207 + <el-button :type="form.questionList.length == 0 ? 'info' : 'primary'" round @click="setStep2">下一步</el-button>
  208 + </div>
  209 + <el-dialog :close-on-click-modal="false" title="添加大题" :visible.sync="addQuestionVisible" width="600px">
  210 + <div class="dia-content">
  211 + <el-form ref="form" :model="questionForm" :rules="questionFormRules" label-width="100px">
  212 + <el-form-item label="标题:">
  213 + <el-col :span="20">
  214 + <el-input v-model.trim="questionForm.questionTitle" maxlength="30" placeholder="输入大题名称"></el-input>
  215 + </el-col>
  216 + </el-form-item>
  217 + <el-form-item label="选择题型:">
  218 + <el-select v-model="questionForm.questionType" placeholder="" @change="setQuestionForm">
  219 + <el-option v-for="item in questionOptions" :key="item.value" :label="item.label" :value="item.value">
  220 + </el-option>
  221 + <el-option label="混合题" :value="6"> </el-option>
384 222 </el-select>
385   - </div>
386   - <div class="qs-score"></div>
387   - <div class="qs-partScore"></div>
388   - <div class="qs-options"></div>
389   - <div class="qs-set"></div>
390   - </li>
391   - </ul>
392   - </transition>
393   - </div>
394   - <div class="add-box">
395   - <p class="add-question" @click="openQuestion">
396   - <el-button
397   - size="mini"
398   - type="primary"
399   - icon="el-icon-plus"
400   - circle
401   - ></el-button>
402   - <span class="s1">添加大题</span>
403   - </p>
404   - </div>
405   - <div class="btn-box">
406   - <el-button type="danger" plain round @click="linkBack"
407   - >取消</el-button
408   - >
409   - <el-button round @click="step = 0">上一步</el-button>
410   - <el-button
411   - :type="form.questionList.length == 0 ? 'info' : 'primary'"
412   - round
413   - @click="setStep2"
414   - >下一步</el-button
415   - >
416   - </div>
417   - <el-dialog :close-on-click-modal="false"
418   - title="添加大题"
419   - :visible.sync="addQuestionVisible"
420   - width="600px"
421   - >
422   - <div class="dia-content">
423   - <el-form
424   - ref="form"
425   - :model="questionForm"
426   - :rules="questionFormRules"
427   - label-width="100px"
428   - >
429   - <el-form-item label="标题:">
430   - <el-col :span="20">
431   - <el-input
432   - v-model.trim="questionForm.questionTitle"
433   - maxlength="30"
434   - placeholder="输入大题名称"
435   - ></el-input>
436   - </el-col>
437   - </el-form-item>
438   - <el-form-item label="选择题型:">
439   - <el-select
440   - v-model="questionForm.questionType"
441   - placeholder=""
442   - @change="setQuestionForm"
443   - >
444   - <el-option
445   - v-for="item in questionOptions"
446   - :key="item.value"
447   - :label="item.label"
448   - :value="item.value"
449   - >
450   - </el-option>
451   - <el-option label="混合题" :value="6"> </el-option>
452   - </el-select>
453   - </el-form-item>
454   - <el-form-item label="题数:">
455   - <el-input-number
456   - v-model="questionForm.number"
457   - @change="changeQesNum"
458   - :min="1"
459   - :max="100"
460   - :step-strictly="true"
461   - :step="1"
462   - label="label"
463   - ></el-input-number>
464   - </el-form-item>
465   - <el-form-item
466   - label="选项个数:"
467   - v-show="
468   - questionForm.questionType != 4 &&
  223 + </el-form-item>
  224 + <el-form-item label="题数:">
  225 + <el-input-number v-model="questionForm.number" @change="changeQesNum" :min="1" :max="100"
  226 + :step-strictly="true" :step="1" label="label"></el-input-number>
  227 + </el-form-item>
  228 + <el-form-item label="选项个数:" v-show="questionForm.questionType != 4 &&
469 229 questionForm.questionType != 5
470   - "
471   - >
472   - <el-input-number
473   - v-model="questionForm.selectNum"
474   - :min="3"
475   - :max="10"
476   - :step-strictly="true"
477   - :step="1"
478   - label="label"
479   - ></el-input-number>
480   - </el-form-item>
481   - <el-form-item label="单题分数:">
482   - <el-input-number
483   - v-model="questionForm.score"
484   - :min="1"
485   - :max="200"
486   - :precision="2"
487   - :step="1"
488   - label="label"
489   - ></el-input-number>
490   - </el-form-item>
491   - <el-form-item
492   - label="漏选得分:"
493   - v-if="questionForm.questionType == 3"
494   - >
495   - <el-input-number
496   - v-model="questionForm.partScore"
497   - :min="0"
498   - :max="questionForm.score"
499   - :precision="2"
500   - :step="0.5"
501   - label="label"
502   - ></el-input-number>
503   - </el-form-item>
504   - <el-form-item
505   - label="设置答案:"
506   - v-show="
507   - questionForm.questionType != 5 &&
  230 + ">
  231 + <el-input-number v-model="questionForm.selectNum" :min="3" :max="10" :step-strictly="true" :step="1"
  232 + label="label"></el-input-number>
  233 + </el-form-item>
  234 + <el-form-item label="单题分数:">
  235 + <el-input-number v-model="questionForm.score" :min="1" :max="200" :precision="2" :step="1"
  236 + label="label"></el-input-number>
  237 + </el-form-item>
  238 + <el-form-item label="漏选得分:" v-if="questionForm.questionType == 3">
  239 + <el-input-number v-model="questionForm.partScore" :min="0" :max="questionForm.score" :precision="2"
  240 + :step="0.5" label="label"></el-input-number>
  241 + </el-form-item>
  242 + <el-form-item label="设置答案:" v-show="questionForm.questionType != 5 &&
508 243 questionForm.questionType != 6
509   - "
510   - >
511   - <div class="qs-options">
512   - <p class="ipt">
513   - <el-input
514   - v-if="
515   - questionForm.questionType == 2 ||
  244 + ">
  245 + <div class="qs-options">
  246 + <p class="ipt">
  247 + <el-input v-if="questionForm.questionType == 2 ||
516 248 questionForm.questionType == 3 ||
517 249 questionForm.questionType == 6
518   - "
519   - ref="formAnsIpt2"
520   - v-model="questionForm.answerList"
521   - @keydown.native="
522   - keydownAnswer($event, questionForm.questionType, 1)
523   - "
524   - @input="
525   - setAllAnswer($event, questionForm.questionType, 1)
526   - "
527   - ></el-input>
528   - <el-input
529   - v-if="questionForm.questionType == 4"
530   - v-model="questionForm.answerList"
531   - readonly=""
532   - ></el-input>
533   - </p>
534   - <p class="answer-box">
535   - <template v-if="questionForm.questionType == 4">
536   - <span
537   - class="answer-s active"
538   - @click="
  250 + " ref="formAnsIpt2" v-model="questionForm.answerList" @keydown.native="
  251 + keydownAnswer($event, questionForm.questionType, 1)
  252 + " @input="
  253 + setAllAnswer($event, questionForm.questionType, 1)
  254 + "></el-input>
  255 + <el-input v-if="questionForm.questionType == 4" v-model="questionForm.answerList"
  256 + readonly=""></el-input>
  257 + </p>
  258 + <p class="answer-box">
  259 + <template v-if="questionForm.questionType == 4">
  260 + <span class="answer-s active" @click="
539 261 questionForm.answerList.length < questionForm.number
540 262 ? (questionForm.answerList += '✓')
541 263 : ''
542   - "
543   - >✓</span
544   - >
545   - <span
546   - class="answer-s active"
547   - @click="
  264 + ">✓</span>
  265 + <span class="answer-s active" @click="
548 266 questionForm.answerList.length < questionForm.number
549 267 ? (questionForm.answerList += '✗')
550 268 : ''
551   - "
552   - >✗</span
553   - >
554   - </template>
555   - <template v-if="questionForm.questionType == 3">
556   - <template v-for="(option, opIdx) in rightOptions">
557   - <span
558   - v-if="opIdx < questionForm.selectNum"
559   - class="answer-s active"
560   - :key="option"
561   - @click="setMultiple(questionForm, option, 1)"
562   - >{{ option }}</span
563   - >
  269 + ">✗</span>
  270 + </template>
  271 + <template v-if="questionForm.questionType == 3">
  272 + <template v-for="(option, opIdx) in rightOptions">
  273 + <span v-if="opIdx < questionForm.selectNum" class="answer-s active" :key="option"
  274 + @click="setMultiple(questionForm, option, 1)">{{ option }}</span>
  275 + </template>
  276 + <span class="answer-s active" @click="setMultiple(questionForm, ',', 1)">,</span>
564 277 </template>
565   - <span
566   - class="answer-s active"
567   - @click="setMultiple(questionForm, ',', 1)"
568   - >,</span
569   - >
570   - </template>
571   - <template
572   - v-if="
573   - questionForm.questionType == 2 ||
  278 + <template v-if="questionForm.questionType == 2 ||
574 279 questionForm.questionType == 6
575   - "
576   - >
577   - <template v-for="(option, opIdx) in rightOptions">
578   - <span
579   - v-if="opIdx < questionForm.selectNum"
580   - class="answer-s active"
581   - :key="option"
582   - @click="
  280 + ">
  281 + <template v-for="(option, opIdx) in rightOptions">
  282 + <span v-if="opIdx < questionForm.selectNum" class="answer-s active" :key="option" @click="
583 283 questionForm.answerList.length < questionForm.number
584 284 ? (questionForm.answerList += option)
585 285 : ''
586   - "
587   - >{{ option }}</span
588   - >
  286 + ">{{ option }}</span>
  287 + </template>
589 288 </template>
590   - </template>
591   - <span
592   - class="answer-s delButton"
593   - @click="
  289 + <span class="answer-s delButton" @click="
594 290 questionForm.answerList = questionForm.answerList.slice(
595 291 0,
596 292 -1
597 293 )
598   - "
599   - >x</span
600   - >
601   - <span
602   - class="answer-s ac"
603   - @click="questionForm.answerList = ''"
604   - >ac</span
605   - >
606   - </p>
607   - </div>
608   - </el-form-item>
609   - </el-form>
610   - </div>
611   - <div class="dialog-footer" slot="footer">
612   - <el-button type="primary" @click="addQuestion">确 定</el-button>
613   - <el-button @click="addQuestionVisible = false">取 消</el-button>
614   - </div>
615   - </el-dialog>
616   - </div>
  294 + ">x</span>
  295 + <span class="answer-s ac" @click="questionForm.answerList = ''">ac</span>
  296 + </p>
  297 + </div>
  298 + </el-form-item>
  299 + </el-form>
  300 + </div>
  301 + <div class="dialog-footer" slot="footer">
  302 + <el-button type="primary" @click="addQuestion">确 定</el-button>
  303 + <el-button @click="addQuestionVisible = false">取 消</el-button>
  304 + </div>
  305 + </el-dialog>
  306 + </div>
  307 + </template>
617 308 <div v-show="step == 2">
618 309 <div class="answer-title">
619 310 <p class="name">{{ form.title }}</p>
620 311 <p class="totals">卷面总分:{{ allScore }}分</p>
621 312 </div>
622   - <div
623   - class="question-box"
624   - v-for="(question, index) in form.questionList"
625   - :key="index"
626   - >
  313 + <div class="question-box" v-for="(question, index) in form.questionList" :key="index">
627 314 <p class="question-title">
628 315 <span>{{ setBigNum(index) }}、</span>
629 316 <span class="title-txt">{{ question.questionTitle }}</span>
... ... @@ -638,21 +325,12 @@
638 325 <div class="qs-partScore">漏选得分</div>
639 326 <div class="qs-options qs-options2">选项设置</div>
640 327 </li>
641   - <li
642   - v-for="(subQuestions, indexs) in question.subQuestions"
643   - :key="indexs"
644   - >
645   - <p
646   - class="set-ans-btn"
647   - v-if="
648   - subQuestions.qusType &&
649   - subQuestions.subNum &&
650   - subQuestions.subNum > 4
651   - "
652   - >
653   - <el-button type="primary" @click="setFormAns(indexs, index)"
654   - >批量设置答案</el-button
655   - >
  328 + <li v-for="(subQuestions, indexs) in question.subQuestions" :key="indexs">
  329 + <p class="set-ans-btn" v-if="subQuestions.qusType &&
  330 + subQuestions.subNum &&
  331 + subQuestions.subNum > 4
  332 + ">
  333 + <el-button type="primary" @click="setFormAns(indexs, index)">批量设置答案</el-button>
656 334 </p>
657 335 <div v-else class="sub-questions">
658 336 <div class="qs-num">
... ... @@ -662,158 +340,77 @@
662 340 {{ setSubPro(subQuestions.questionType) }}
663 341 </div>
664 342 <div class="qs-score">
665   - <el-input-number
666   - class="number-ipt"
667   - size="medium"
668   - :min="1"
669   - :max="200"
670   - :precision="2"
671   - v-model="subQuestions.score"
672   - label="单题分值"
673   - ></el-input-number>
  343 + <el-input-number class="number-ipt" size="medium" :min="1" :max="200" :precision="2"
  344 + v-model="subQuestions.score" label="单题分值"></el-input-number>
674 345 </div>
675 346 <div class="qs-partScore">
676 347 <p v-if="subQuestions.questionType != 3">--</p>
677   - <el-input-number
678   - class="number-ipt"
679   - v-else
680   - size="medium"
681   - :min="0"
682   - :precision="2"
683   - :max="subQuestions.score"
684   - :step="0.5"
685   - v-model="subQuestions.partScore"
686   - label="漏选得分"
687   - ></el-input-number>
  348 + <el-input-number class="number-ipt" v-else size="medium" :min="0" :precision="2"
  349 + :max="subQuestions.score" :step="0.5" v-model="subQuestions.partScore" label="漏选得分"></el-input-number>
688 350 </div>
689 351 <div class="qs-options qs-options2">
690 352 <p v-if="subQuestions.questionType == 5">--</p>
691 353 <p v-if="subQuestions.questionType == 4" class="answer-box">
692   - <span
693   - class="answer-s"
694   - :class="subQuestions.correctAnswer == 1 ? 'active' : ''"
695   - @click="subQuestions.correctAnswer = 1"
696   - >✓</span
697   - >
698   - <span
699   - class="answer-s"
700   - :class="subQuestions.correctAnswer == 2 ? 'active' : ''"
701   - @click="subQuestions.correctAnswer = 2"
702   - >✗</span
703   - >
  354 + <span class="answer-s" :class="subQuestions.correctAnswer == 1 ? 'active' : ''"
  355 + @click="subQuestions.correctAnswer = 1">✓</span>
  356 + <span class="answer-s" :class="subQuestions.correctAnswer == 2 ? 'active' : ''"
  357 + @click="subQuestions.correctAnswer = 2">✗</span>
704 358 </p>
705 359 <p v-if="subQuestions.questionType == 3" class="answer-box">
706   - <span
707   - class="answer-s"
708   - v-for="option in subQuestions.answerOptions.split(',')"
709   - :class="
710   - subQuestions.correctAnswer?.includes(option)
711   - ? 'active'
712   - : ''
713   - "
714   - :key="option"
715   - @click="changAnswer(subQuestions, option)"
716   - >{{ option }}</span
717   - >
  360 + <span class="answer-s" v-for="option in subQuestions.answerOptions.split(',')" :class="subQuestions.correctAnswer?.includes(option)
  361 + ? 'active'
  362 + : ''
  363 + " :key="option" @click="changAnswer(subQuestions, option)">{{ option }}</span>
718 364 </p>
719 365 <p v-if="subQuestions.questionType == 2" class="answer-box">
720   - <span
721   - class="answer-s"
722   - v-for="option in subQuestions.answerOptions.split(',')"
723   - :class="
724   - subQuestions.correctAnswer == option ? 'active' : ''
725   - "
726   - :key="option"
727   - @click="subQuestions.correctAnswer = option"
728   - >{{ option }}</span
729   - >
  366 + <span class="answer-s" v-for="option in subQuestions.answerOptions.split(',')" :class="subQuestions.correctAnswer == option ? 'active' : ''
  367 + " :key="option" @click="subQuestions.correctAnswer = option">{{ option }}</span>
730 368 </p>
731 369 </div>
732 370 </div>
733 371 </li>
734 372 </ul>
735 373 </div>
736   - <el-dialog :close-on-click-modal="false"
737   - title="批量设置答案"
738   - :visible.sync="diaSetAns"
739   - width="400"
740   - :modal-append-to-body="false"
741   - >
  374 + <el-dialog :close-on-click-modal="false" title="批量设置答案" :visible.sync="diaSetAns" width="400"
  375 + :modal-append-to-body="false">
742 376 <div class="qs-options">
743 377 <p class="dia-tips">
744 378 请点击选项按钮设置答案,多选题题目之间用“,”隔开,若添加5道题:“AC,AD,BD,AC,CD”
745 379 </p>
746 380 <p>{{ setSubPro(formAns.qusType) }}:</p>
747 381 <p class="ipt">
748   - <el-input
749   - v-if="formAns.qusType == 2 || formAns.qusType == 3"
750   - ref="formAnsIpt"
751   - v-model="formAns.answerList"
  382 + <el-input v-if="formAns.qusType == 2 || formAns.qusType == 3" ref="formAnsIpt" v-model="formAns.answerList"
752 383 @keydown.native="keydownAnswer($event, formAns.qusType)"
753   - @input="setAllAnswer($event, formAns.qusType)"
754   - ></el-input>
755   - <el-input
756   - v-if="formAns.qusType == 4"
757   - v-model="formAns.answerList"
758   - readonly=""
759   - ></el-input>
  384 + @input="setAllAnswer($event, formAns.qusType)"></el-input>
  385 + <el-input v-if="formAns.qusType == 4" v-model="formAns.answerList" readonly=""></el-input>
760 386 </p>
761 387 <p class="answer-box">
762 388 <template v-if="formAns.qusType == 4">
763   - <span
764   - class="answer-s active"
765   - @click="
766   - formAns.answerList.length < formAns.subNum
767   - ? (formAns.answerList += '✓')
768   - : ''
769   - "
770   - >✓</span
771   - >
772   - <span
773   - class="answer-s active"
774   - @click="
775   - formAns.answerList.length < formAns.subNum
776   - ? (formAns.answerList += '✗')
777   - : ''
778   - "
779   - >✗</span
780   - >
  389 + <span class="answer-s active" @click="
  390 + formAns.answerList.length < formAns.subNum
  391 + ? (formAns.answerList += '✓')
  392 + : ''
  393 + ">✓</span>
  394 + <span class="answer-s active" @click="
  395 + formAns.answerList.length < formAns.subNum
  396 + ? (formAns.answerList += '✗')
  397 + : ''
  398 + ">✗</span>
781 399 </template>
782 400 <template v-if="formAns.qusType == 3">
783   - <span
784   - class="answer-s active"
785   - v-for="option in formAns.answerOptions.split(',')"
786   - :key="option"
787   - @click="setMultiple(formAns, option, 2)"
788   - >{{ option }}</span
789   - >
790   - <span
791   - class="answer-s active"
792   - @click="setMultiple(formAns, ',', 2)"
793   - >,</span
794   - >
  401 + <span class="answer-s active" v-for="option in formAns.answerOptions.split(',')" :key="option"
  402 + @click="setMultiple(formAns, option, 2)">{{ option }}</span>
  403 + <span class="answer-s active" @click="setMultiple(formAns, ',', 2)">,</span>
795 404 </template>
796 405 <template v-if="formAns.qusType == 2">
797   - <span
798   - class="answer-s active"
799   - v-for="option in formAns.answerOptions.split(',')"
800   - :key="option"
801   - @click="
802   - formAns.answerList.length < formAns.subNum
803   - ? (formAns.answerList += option)
804   - : ''
805   - "
806   - >{{ option }}</span
807   - >
  406 + <span class="answer-s active" v-for="option in formAns.answerOptions.split(',')" :key="option" @click="
  407 + formAns.answerList.length < formAns.subNum
  408 + ? (formAns.answerList += option)
  409 + : ''
  410 + ">{{ option }}</span>
808 411 </template>
809   - <span
810   - class="answer-s delButton"
811   - @click="formAns.answerList = formAns.answerList.slice(0, -1)"
812   - >x</span
813   - >
814   - <span class="answer-s ac" @click="formAns.answerList = ''"
815   - >ac</span
816   - >
  412 + <span class="answer-s delButton" @click="formAns.answerList = formAns.answerList.slice(0, -1)">x</span>
  413 + <span class="answer-s ac" @click="formAns.answerList = ''">ac</span>
817 414 </p>
818 415 </div>
819 416 <div class="dialog-footer" slot="footer">
... ... @@ -822,13 +419,25 @@
822 419 </div>
823 420 </el-dialog>
824 421 <div class="btn-box">
825   - <el-button type="danger" plain round @click="linkBack"
826   - >取消</el-button
827   - >
  422 + <el-button type="danger" plain round @click="linkBack">取消</el-button>
828 423 <el-button round @click="backStep1">上一步</el-button>
829 424 <el-button type="primary" round @click="save">保存</el-button>
830 425 </div>
831 426 </div>
  427 + <el-dialog :close-on-click-modal="false" title="上传题干" :visible.sync="dialogStem" v-if="dialogStem" width="500">
  428 + <div class="upload-box">
  429 + <img v-if="stem.screenshot" :src="stem.screenshot" class="stem-pic" />
  430 + <el-upload class="upload-demo" action="http://121.40.127.171/file/uploadImg" :limit="1" :on-success="upSuccess"
  431 + :on-error="upError" accept="image/*">
  432 + <el-button size="small" type="primary">{{
  433 + stem.screenshot ? "重新上传" : "选择照片"
  434 + }}</el-button>
  435 + </el-upload>
  436 + </div>
  437 + <div slot="footer">
  438 + <el-button @click="dialogStem = false">关闭弹窗</el-button>
  439 + </div>
  440 + </el-dialog>
832 441 </div>
833 442 </div>
834 443 </template>
... ... @@ -857,7 +466,7 @@ export default {
857 466 allScore: function () {
858 467 let score = 0;
859 468 this.form.questionList.map((item) => {
860   - score += item.subQuestions.reduce((a, b) => {
  469 + score += item.subQuestions?.reduce((a, b) => {
861 470 return a + Number(b.score ? b.score : 0);
862 471 }, 0);
863 472 }, 0);
... ... @@ -941,6 +550,15 @@ export default {
941 550 ],
942 551 rightOptions: ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J"],
943 552 addSubQuestionsType: "",
  553 +
  554 + //v1.5
  555 + isUpload: false,
  556 + dialogStem: false, //截图开关
  557 + stem: {
  558 + index: 0, //大题位置
  559 + indexs: 0, //小题位置
  560 + screenshot: "", //题干图片地址
  561 + },
944 562 };
945 563 },
946 564 async created() {
... ... @@ -954,6 +572,13 @@ export default {
954 572 ];
955 573 await this._GradeList();
956 574 }
  575 + this.isUpload = this.$route.query.isUpload || false
  576 + if (this.isUpload) {
  577 + let params = this.$route.query.params && JSON.parse(this.$route.query.params) || null
  578 + this.form.title = params?.name
  579 + this.form.id = params?.id
  580 + this.formatData(params)
  581 + }
957 582 await this._QuerySubjectList(this.gradeList[0]);
958 583 await this._TypeList();
959 584 if (this.type == 2) {
... ... @@ -961,11 +586,41 @@ export default {
961 586 }
962 587 },
963 588 methods: {
964   -
  589 +
  590 + // v1.5
  591 + //上传截图
  592 + openStem(obj, index, indexs) {
  593 + this.stem.index = index;
  594 + this.stem.indexs = indexs;
  595 + if (type == 1) {
  596 + this.stem.screenshot = obj.screenshot || "";
  597 + } else {
  598 + this.stem.screenshot = "";
  599 + }
  600 + this.dialogStem = true;
  601 + },
  602 + //图片上传成功
  603 + upSuccess(res, file) {
  604 + if (res && res.status == 0) {
  605 + this.stem.screenshot = res.data.url;
  606 + this.form.questionList[this.stem.index].subQuestions[this.stem.indexs][
  607 + keys
  608 + ] = this.stem.screenshot;
  609 + this.$message.success("上传成功");
  610 + } else {
  611 + this.$message.error(res.info);
  612 + }
  613 + },
  614 +
  615 + upError(res) {
  616 + this.$message.error("上传失败");
  617 + },
  618 + //end
  619 +
965 620 linkBack() {
966 621 this.$confirm(
967 622 (this.type == 2 ? "修改复制的" : "组建的") +
968   - "答题卡未保存,确认退出吗?",
  623 + "答题卡未保存,确认退出吗?",
969 624 "提示",
970 625 {
971 626 confirmButtonText: "取消",
... ... @@ -978,7 +633,7 @@ export default {
978 633 type: "warning",
979 634 }
980 635 )
981   - .then(() => {})
  636 + .then(() => { })
982 637 .catch(() => {
983 638 this.$router.push({
984 639 path: "/examinationPaper",
... ... @@ -1022,9 +677,9 @@ export default {
1022 677 },
1023 678 setNums(ques) {
1024 679 let lengths = 0;
1025   - let subArr = ques.filter((item) => {
  680 + let subArr = ques?.filter((item) => {
1026 681 return !!item.questionType;
1027   - });
  682 + }) || [];
1028 683 lengths = subArr.length;
1029 684 return lengths;
1030 685 },
... ... @@ -1169,8 +824,8 @@ export default {
1169 824 this.formAns.answerList[subNum - i] == "✓"
1170 825 ? 1
1171 826 : this.formAns.answerList[subNum - i] == "✗"
1172   - ? 2
1173   - : "";
  827 + ? 2
  828 + : "";
1174 829 }
1175 830 this.form.questionList[this.formAns.listIndex].subQuestions[
1176 831 EndIndex - i
... ... @@ -1244,7 +899,7 @@ export default {
1244 899 },
1245 900 backStep1() {
1246 901 this.formatQuestionList();
1247   - this.step = 1;
  902 + this.step = this.isUpload ? 0 : 1
1248 903 },
1249 904 setStep1() {
1250 905 if (this.subjectList.length == 0) {
... ... @@ -1269,7 +924,7 @@ export default {
1269 924 //添加题目ID、序号
1270 925 this.form.questionList.map((item, index) => {
1271 926 item.questionType = 0;
1272   - item.subQuestions.map((items, indexs) => {
  927 + item.subQuestions?.map((items, indexs) => {
1273 928 items.questionId = this.setNum(index, indexs);
1274 929 items.questionIndex = this.setNum(index, indexs);
1275 930 });
... ... @@ -1278,7 +933,7 @@ export default {
1278 933 this.form.questionList?.map((item) => {
1279 934 let types = [{}];
1280 935 let addndex = 0;
1281   - item.subQuestions.map((sub, index) => {
  936 + item.subQuestions?.map((sub, index) => {
1282 937 if (!!sub.questionType) {
1283 938 if (
1284 939 sub.questionType == types[addndex].qusType &&
... ... @@ -1323,7 +978,7 @@ export default {
1323 978 });
1324 979 for (let i = 0; i < types.length; i++) {
1325 980 if (types[i].subNum >= 5) {
1326   - item.subQuestions.splice(
  981 + item.subQuestions?.splice(
1327 982 types[i].index + i + 1,
1328 983 0,
1329 984 deepClone(types[i])
... ... @@ -1339,11 +994,11 @@ export default {
1339 994 for (let i = 0; i < this.form.questionList.length; i++) {
1340 995 for (
1341 996 let j = 0;
1342   - j < this.form.questionList[i].subQuestions.length;
  997 + j < this.form.questionList[i].subQuestions?.length;
1343 998 j++
1344 999 ) {
1345   - if (this.form.questionList[i].subQuestions[j].qusType) {
1346   - this.form.questionList[i].subQuestions.splice(j, 1);
  1000 + if (this.form.questionList[i].subQuestions[j]?.qusType) {
  1001 + this.form.questionList[i].subQuestions?.splice(j, 1);
1347 1002 }
1348 1003 }
1349 1004 }
... ... @@ -1391,8 +1046,8 @@ export default {
1391 1046 this.questionForm.answerList[i] == "✓"
1392 1047 ? 1
1393 1048 : this.questionForm.answerList[i] == "✗"
1394   - ? 2
1395   - : "";
  1049 + ? 2
  1050 + : "";
1396 1051 } else if (questionsOptions.questionType == 3) {
1397 1052 answer = this.questionForm.answerList.split(",")[i] || "";
1398 1053 } else if (questionsOptions.questionType == 2) {
... ... @@ -1415,7 +1070,7 @@ export default {
1415 1070 this.form.questionList[index].subQuestions.splice(subIndex, 1);
1416 1071 },
1417 1072 setScore(question) {
1418   - let score = question.subQuestions.reduce((a, b) => {
  1073 + let score = question.subQuestions?.reduce((a, b) => {
1419 1074 return a + (b.score ? b.score : 0);
1420 1075 }, 0);
1421 1076 return Number(score).toFixed(2);
... ... @@ -1446,7 +1101,7 @@ export default {
1446 1101 questionsOptions.selectNum = 0;
1447 1102 break;
1448 1103 }
1449   - question.subQuestions.push(questionsOptions);
  1104 + question.subQuestions ? question.subQuestions.push(questionsOptions) : question.subQuestions = [(questionsOptions)];
1450 1105 this.addSubQuestionsType = "";
1451 1106 }
1452 1107 },
... ... @@ -1600,15 +1255,6 @@ export default {
1600 1255 let formDatas = deepClone(this.form);
1601 1256 for (let i = 0; i < formDatas.questionList.length; i++) {
1602 1257 delete formDatas.questionList[i].show;
1603   - for (let j = 0; j < formDatas.questionList[i].subQuestions; j++) {
1604   - if (!!formDatas.questionList[i].subQuestions[j].answerScreenshotSrc) {
1605   - delete formDatas.questionList[i].subQuestions[j]
1606   - .answerScreenshotSrc;
1607   - }
1608   - if (!!formDatas.questionList[i].subQuestions[j].screenshotSrc) {
1609   - delete formDatas.questionList[i].subQuestions[j].screenshotSrc;
1610   - }
1611   - }
1612 1258 }
1613 1259 let addPaper =
1614 1260 this.role == "ROLE_PERSONAL"
... ... @@ -1668,7 +1314,7 @@ export default {
1668 1314 },
1669 1315 async _QuerySubjectList(grade) {
1670 1316 //查询科目列表
1671   - if (!grade) {
  1317 + if (!grade && this.role != "ROLE_PERSONAL") {
1672 1318 return;
1673 1319 }
1674 1320 let query = {};
... ... @@ -1707,56 +1353,56 @@ export default {
1707 1353 if (status == 0) {
1708 1354 this.form.title = data.title + "_副本";
1709 1355 this.form.tagId = data.tagId === 0 ? "" : data.tagId;
1710   - if (this.subjectList.length) {
1711   - this.subjectList.map((item) => {
1712   - if (item.label == data.subjectName) {
1713   - this.form.subjectName = item.value;
  1356 +
  1357 + this.formatData(data)
  1358 + } else {
  1359 + this.$message.error(info);
  1360 + }
  1361 + },
  1362 +
  1363 + formatData(data) {
  1364 + if (this.subjectList.length) {
  1365 + this.subjectList.map((item) => {
  1366 + if (item.label == data.subjectName) {
  1367 + this.form.subjectName = item.value;
  1368 + }
  1369 + });
  1370 + } else {
  1371 + this.form.subjectName = "";
  1372 + }
  1373 + this.form.examsDuration = data.examsDuration;
  1374 + if (this.role != "ROLE_PERSONAL") {
  1375 + this.form.sharingType = data.sharingType;
  1376 + if (this.gradeList.length) {
  1377 + this.gradeList.map((item) => {
  1378 + if (item == data.gradeName) {
  1379 + this.form.gradeName = data.gradeName;
1714 1380 }
1715 1381 });
1716 1382 } else {
1717   - this.form.subjectName = "";
  1383 + this.form.gradeName = "";
1718 1384 }
1719   - this.form.examsDuration = data.examsDuration;
1720   - if (this.role != "ROLE_PERSONAL") {
1721   - this.form.sharingType = data.sharingType;
1722   - if (this.gradeList.length) {
1723   - this.gradeList.map((item) => {
1724   - if (item == data.gradeName) {
1725   - this.form.gradeName = data.gradeName;
1726   - }
1727   - });
1728   - } else {
1729   - this.form.gradeName = "";
1730   - }
1731   - }
1732   - this.form.questionList = data.questionList?.map((item) => {
1733   - let subQuestions =
1734   - item.subQuestions?.map((items) => {
1735   - return {
1736   - questionType: items.questionType,
1737   - score: items.score,
1738   - partScore: items.partScore,
1739   - selectNum: items.answerOptions.split(",").length,
1740   - answerOptions: items.answerOptions || "A,B,C,D",
1741   - correctAnswer: items.correctAnswer,
1742   - screenshot: items.screenshot || "",
1743   - screenshotSrc: items.screenshot || "",
1744   - answerScreenshot: items.answerScreenshot || "",
1745   - answerScreenshotSrc: items.answerScreenshot || "",
1746   - difficultyFactor: items.difficultyFactor || "", //题目难度
1747   - knowledge: items.knowledge || null, //知识点
1748   - };
1749   - }) || [];
1750   - return {
1751   - questionTitle: item.questionTitle,
1752   - subQuestions: subQuestions,
1753   - show: false,
1754   - };
1755   - });
1756   - } else {
1757   - this.$message.error(info);
1758 1385 }
1759   - },
  1386 + this.form.questionList = data.questionList?.map((item) => {
  1387 + let subQuestions =
  1388 + item.subQuestions?.map((items) => {
  1389 + return {
  1390 + questionType: items.questionType,
  1391 + score: items.score,
  1392 + partScore: items.partScore,
  1393 + selectNum: items.answerOptions.split(",").length,
  1394 + answerOptions: items.answerOptions || "A,B,C,D",
  1395 + correctAnswer: items.correctAnswer,
  1396 + screenshot: items.screenshot || "",
  1397 + };
  1398 + }) || [];
  1399 + return {
  1400 + questionTitle: item.questionTitle,
  1401 + subQuestions: subQuestions,
  1402 + show: false,
  1403 + };
  1404 + });
  1405 + }
1760 1406 },
1761 1407 };
1762 1408 </script>
... ... @@ -1765,24 +1411,30 @@ export default {
1765 1411 .red {
1766 1412 color: #f30;
1767 1413 }
  1414 +
1768 1415 .qs-options {
1769 1416 flex: 1;
  1417 +
1770 1418 .ipt {
1771 1419 margin-bottom: 5px;
1772 1420 }
  1421 +
1773 1422 .answer-box {
1774 1423 .answer-s {
1775 1424 cursor: pointer;
1776 1425 user-select: none;
1777 1426 margin-bottom: 10px;
  1427 +
1778 1428 &:first-of-type {
1779 1429 margin-left: 0;
1780 1430 }
1781 1431 }
1782 1432 }
  1433 +
1783 1434 .answer-box2 {
1784 1435 margin-bottom: 10px;
1785 1436 }
  1437 +
1786 1438 .delButton {
1787 1439 text-indent: -9999999px;
1788 1440 border-color: #ff6868;
... ... @@ -1790,9 +1442,11 @@ export default {
1790 1442 background-size: 19px;
1791 1443 color: transparent;
1792 1444 }
  1445 +
1793 1446 .answer-s.ac {
1794 1447 border: none;
1795 1448 }
  1449 +
1796 1450 .ac {
1797 1451 border-color: #ff6868;
1798 1452 background: #ff6868;
... ... @@ -1803,6 +1457,7 @@ export default {
1803 1457 .sel2 {
1804 1458 width: 480px;
1805 1459 }
  1460 +
1806 1461 .set-ans-btn {
1807 1462 width: 100%;
1808 1463 padding: 10px 0 10px 630px;
... ... @@ -1810,23 +1465,28 @@ export default {
1810 1465 border-right: 1px solid #e2e2e2;
1811 1466 border-bottom: 1px solid #e2e2e2;
1812 1467 }
  1468 +
1813 1469 .content-box {
1814 1470 width: 100%;
1815 1471 height: 100%;
1816 1472 overflow-y: auto;
1817 1473 }
  1474 +
1818 1475 .content {
1819 1476 width: 100%;
1820 1477 box-sizing: border-box;
1821 1478 padding: 0 24px;
  1479 +
1822 1480 .ml-20 {
1823 1481 margin-left: 20px;
1824 1482 }
  1483 +
1825 1484 .btn-box {
1826 1485 text-align: right;
1827 1486 margin-left: 140px;
1828 1487 }
1829 1488 }
  1489 +
1830 1490 .dia-content {
1831 1491 .dia-tit {
1832 1492 font-size: 20px;
... ... @@ -1834,27 +1494,33 @@ export default {
1834 1494 font-weight: 700;
1835 1495 text-align: center;
1836 1496 }
  1497 +
1837 1498 .add-type {
1838 1499 width: 100%;
1839 1500 margin-bottom: 10px;
  1501 +
1840 1502 .js-set {
1841 1503 margin: 2.5px 10px 0 0;
1842 1504 font-size: 14px;
1843 1505 }
1844 1506 }
  1507 +
1845 1508 .add-btn {
1846 1509 margin-left: 20px;
1847 1510 }
1848 1511 }
  1512 +
1849 1513 .el-message-box {
1850 1514 :deep(.el-button--default) {
1851 1515 color: #fff;
1852 1516 }
1853 1517 }
  1518 +
1854 1519 .add-box {
1855 1520 display: flex;
1856 1521 justify-content: center;
1857 1522 align-items: center;
  1523 +
1858 1524 .add-question {
1859 1525 display: flex;
1860 1526 justify-content: center;
... ... @@ -1863,84 +1529,103 @@ export default {
1863 1529 font-weight: bolder;
1864 1530 padding: 2px;
1865 1531 cursor: pointer;
  1532 +
1866 1533 .s1 {
1867 1534 margin-left: 6px;
1868 1535 }
  1536 +
1869 1537 :deep(.el-icon-plus) {
1870 1538 font-size: 24px;
1871 1539 font-weight: 900;
1872 1540 }
  1541 +
1873 1542 :deep(.el-button--mini.is-circle) {
1874 1543 padding: 3px;
1875 1544 }
1876 1545 }
1877 1546 }
  1547 +
1878 1548 .dialog-footer {
1879 1549 text-align: center;
  1550 +
1880 1551 :deep(.el-button) {
1881 1552 border-radius: 20px;
1882 1553 padding: 8px 20px 7px;
1883 1554 margin: 0 12px;
1884 1555 }
1885 1556 }
  1557 +
1886 1558 .question-box {
1887 1559 margin-bottom: 20px;
1888 1560 }
  1561 +
1889 1562 .question-title {
1890 1563 line-height: 40px;
1891 1564 display: flex;
1892 1565 align-items: center;
1893 1566 margin-bottom: 12px;
  1567 +
1894 1568 .m20 {
1895 1569 margin: 0 20px;
1896 1570 }
  1571 +
1897 1572 .ipt {
1898 1573 width: 300px;
1899 1574 margin: 0 16px 0 10px;
  1575 +
1900 1576 :deep(.el-input__inner) {
1901 1577 border-radius: 20px;
1902 1578 border-color: #667ffd;
1903 1579 background: rgba($color: #667ffd, $alpha: 0.05);
1904 1580 }
1905 1581 }
  1582 +
1906 1583 .delete {
1907 1584 margin-right: 8px;
1908 1585 }
  1586 +
1909 1587 .title-txt {
1910 1588 margin-right: 20px;
1911 1589 font-size: 16px;
1912 1590 font-weight: 700;
1913 1591 }
  1592 +
1914 1593 .el-icon-caret-right {
1915 1594 font-size: 24px;
1916 1595 color: #888;
1917 1596 transition: all 0.4s;
1918 1597 margin-right: 12px;
1919 1598 cursor: pointer;
  1599 +
1920 1600 &.active {
1921 1601 transform: rotate(90deg);
1922 1602 }
1923 1603 }
1924 1604 }
  1605 +
1925 1606 .questions-ul {
1926 1607 border-left: 1px solid #e2e2e2;
1927 1608 border-top: 1px solid #e2e2e2;
1928 1609 }
  1610 +
1929 1611 .el-input-number {
1930 1612 width: 140px;
1931 1613 }
  1614 +
1932 1615 .answer-title {
1933 1616 text-align: center;
1934 1617 font-size: 20px;
1935 1618 color: #333;
1936 1619 font-weight: 700;
1937 1620 padding-bottom: 20px;
  1621 +
1938 1622 .totals {
1939 1623 font-size: 16px;
1940 1624 color: #888;
1941 1625 font-weight: normal;
1942 1626 }
1943 1627 }
  1628 +
1944 1629 .answer-box {
1945 1630 .answer-s {
1946 1631 display: inline-block;
... ... @@ -1953,6 +1638,7 @@ export default {
1953 1638 color: #333;
1954 1639 text-align: center;
1955 1640 line-height: 30px;
  1641 +
1956 1642 &.active {
1957 1643 background: #5e78fa;
1958 1644 border-color: #5e78fa;
... ... @@ -1960,6 +1646,7 @@ export default {
1960 1646 }
1961 1647 }
1962 1648 }
  1649 +
1963 1650 .qs-options {
1964 1651 .answer-s {
1965 1652 display: inline-block;
... ... @@ -1973,6 +1660,7 @@ export default {
1973 1660 text-align: center;
1974 1661 line-height: 30px;
1975 1662 cursor: pointer;
  1663 +
1976 1664 &.active {
1977 1665 background: #5e78fa;
1978 1666 border-color: #5e78fa;
... ... @@ -1980,11 +1668,13 @@ export default {
1980 1668 }
1981 1669 }
1982 1670 }
  1671 +
1983 1672 .sub-questions {
1984 1673 width: 100%;
1985 1674 display: flex;
1986 1675 border-bottom: 1px solid #e2e2e2;
1987   - & > div {
  1676 +
  1677 + &>div {
1988 1678 min-height: 40px;
1989 1679 padding: 5px;
1990 1680 flex-shrink: 0;
... ... @@ -1993,30 +1683,38 @@ export default {
1993 1683 justify-content: center;
1994 1684 align-items: center;
1995 1685 }
  1686 +
1996 1687 .qs-num {
1997 1688 width: 70px;
1998 1689 }
  1690 +
1999 1691 .qs-type {
2000 1692 width: 160px;
2001 1693 }
  1694 +
2002 1695 .qs-score,
2003 1696 .qs-partScore {
2004 1697 width: 160px;
2005 1698 }
  1699 +
2006 1700 .qs-options {
2007 1701 flex: 1;
2008 1702 }
  1703 +
2009 1704 .qs-set {
2010 1705 width: 60px;
2011 1706 }
  1707 +
2012 1708 .qs-options2 {
2013 1709 text-align: left;
2014 1710 justify-content: flex-start;
2015 1711 padding-left: 20px;
  1712 +
2016 1713 .answer-s {
2017 1714 cursor: pointer;
2018 1715 }
2019 1716 }
  1717 +
2020 1718 :deep(.el-select) {
2021 1719 .el-input__inner {
2022 1720 border-radius: 20px;
... ... @@ -2026,6 +1724,7 @@ export default {
2026 1724 line-height: 32px;
2027 1725 background: rgba($color: #667ffd, $alpha: 0.05);
2028 1726 }
  1727 +
2029 1728 .el-input__icon {
2030 1729 line-height: 32px;
2031 1730 }
... ...
src/views/examinationPaper/index.vue
... ... @@ -38,14 +38,13 @@
38 38 <el-option v-for="item in classList" :key="item.value" :label="item.label" :value="item.value">
39 39 </el-option>
40 40 </el-select>
41   - <el-select class="sel" v-model="query.subjectName" placeholder="选择科目" @change="_QueryData()">
  41 + <el-select class="sel" v-model="query.subjectName" placeholder="选择科目" @change="getData(false)">
42 42 <el-option v-for="item in subjectList" :key="item.value" :label="item.label" :value="item.value">
43 43 </el-option>
44 44 </el-select>
45 45  
46   - <el-input placeholder="试卷名称" v-model="query.title" class="input-with-select"
47   - @keyup.enter.native="_QueryData(true)">
48   - <el-button slot="append" icon="el-icon-search" @click="_QueryData(true)"></el-button>
  46 + <el-input placeholder="试卷名称" v-model="query.title" class="input-with-select" @keyup.enter.native="getData(true)">
  47 + <el-button slot="append" icon="el-icon-search" @click="getData(true)"></el-button>
49 48 </el-input>
50 49 </div>
51 50 </div>
... ... @@ -53,63 +52,72 @@
53 52 <span>回收站内已有{{ archivedTotal }}份答题卡,</span>
54 53 <router-link to="/examinationPaperRecycle">点击查看&gt;&gt;</router-link>
55 54 </p>
56   -
57   - <ul class="content" v-if="tableData && tableData.length">
58   - <li class="item" v-for="item in tableData" :key="item.id">
59   - <div class="pic-box">
60   - <p class="i-box"><i class="fa fa-map-o"></i></p>
61   - <p class="ids">{{ item.id }}</p>
62   - </div>
63   - <div class="info">
64   - <p class="title">
65   - {{ item.title }}
66   - <span class="label" v-if="!!item.tag">{{ item.tag }}</span>
67   - </p>
68   - <p class="num">
69   - 总题数:{{ item.questionNum }}
70   - <em class="s-line">|</em>
71   - 预计时长:{{ item.examsDuration }}
72   - <em class="s-line">|</em>
73   - <template v-if="role != 'ROLE_PERSONAL'">
74   - 授课端同步:
75   - <span class="clazz" v-for="(clazzChild, indexs) in item.classList" :key="clazzChild.classId"
76   - :class="clazzChild.keepStatus == 1 ? 'active' : ''">{{
77   - `${clazzChild.className}${indexs != item.classList.length - 1 ? "、" : ""
78   - }`
79   - }}
80   - <i v-if="clazzChild.keepStatus == 1" class="el-icon-success"></i></span>
81   - <el-tooltip effect="dark" content="刷新同步状态" placement="right">
82   - <i class="icon-refresh el-icon-refresh" @click="refreshStic"></i>
83   - </el-tooltip>
84   - </template>
85   - </p>
86   - <p class="person">
87   - {{ item.realName }}<em class="s-line">|</em><span class="date">{{ item.modifiedTime }}</span>
88   - </p>
89   - </div>
90   - <div class="btn-box">
91   - <el-tooltip effect="dark" content="修改答案" placement="bottom">
92   - <el-button class="edit" type="primary" size="mini" circle icon="el-icon-edit"
93   - @click="toEdit(item)"></el-button>
94   - </el-tooltip>
95   - <el-dropdown trigger="click" @command="handleDropdownClick($event, item)">
96   - <el-button type="info" size="mini" circle icon="el-icon-more"></el-button>
97   - <el-dropdown-menu slot="dropdown">
98   - <el-dropdown-item :command="1"
99   - v-if="userName == item.realName && role != 'ROLE_PERSONAL'">修改分享范围</el-dropdown-item>
100   - <el-dropdown-item :command="2">复制</el-dropdown-item>
101   - <el-dropdown-item :command="3">放入回收站</el-dropdown-item>
102   - </el-dropdown-menu>
103   - </el-dropdown>
104   - </div>
105   - </li>
106   - </ul>
107   - <div class="pagination-box">
108   - <el-pagination small="" layout="total,prev, pager, next" :hide-on-single-page="true" :total="total"
109   - @current-change="changePage" :current-page="page" :page-size="size">
110   - </el-pagination>
  55 + <div class="content">
  56 + <p class="tab-box">
  57 + <span :class="['tab-s', query.type == 1 ? 'active' : '']" @click="changType(1)">我自编的 ({{ totalCount.my
  58 + }})</span>
  59 + <span :class="['tab-s', query.type == 2 ? 'active' : '']" @click="changType(2)">年级共享的 ({{ totalCount.share
  60 + }})</span>
  61 + </p>
  62 + <ul v-if="tableData && tableData.length" v-loading="loading">
  63 + <li class="item" v-for="item in tableData" :key="item.id">
  64 + <div class="pic-box">
  65 + <p class="i-box"><i class="fa fa-map-o"></i></p>
  66 + <p class="ids">{{ item.id }}</p>
  67 + </div>
  68 + <div class="info">
  69 + <p class="title">
  70 + {{ item.title }}
  71 + <span class="label" v-if="!!item.tag">{{ item.tag }}</span>
  72 + </p>
  73 + <p class="num">
  74 + 总题数:{{ item.questionNum }}
  75 + <em class="s-line">|</em>
  76 + 预计时长:{{ item.examsDuration }}
  77 + <em class="s-line">|</em>
  78 + <template v-if="role != 'ROLE_PERSONAL'">
  79 + 授课端同步:
  80 + <span class="clazz" v-for="(clazzChild, indexs) in item.classList" :key="clazzChild.classId"
  81 + :class="clazzChild.keepStatus == 1 ? 'active' : ''">{{
  82 + `${clazzChild.className}${indexs != item.classList.length - 1 ? "、" : ""
  83 + }`
  84 + }}
  85 + <i v-if="clazzChild.keepStatus == 1" class="el-icon-success"></i></span>
  86 + <el-tooltip effect="dark" content="刷新同步状态" placement="right">
  87 + <i class="icon-refresh el-icon-refresh" @click="refreshStic"></i>
  88 + </el-tooltip>
  89 + </template>
  90 + </p>
  91 + <p class="person">
  92 + {{ item.realName }}<em class="s-line">|</em><span class="date">{{ item.modifiedTime }}</span>
  93 + </p>
  94 + </div>
  95 + <div class="btn-box">
  96 + <el-tooltip effect="dark" content="修改答案" placement="bottom">
  97 + <el-button class="edit" type="primary" size="mini" circle icon="el-icon-edit"
  98 + @click="toEdit(item)"></el-button>
  99 + </el-tooltip>
  100 + <el-dropdown trigger="click" @command="handleDropdownClick($event, item)">
  101 + <el-button type="info" size="mini" circle icon="el-icon-more"></el-button>
  102 + <el-dropdown-menu slot="dropdown">
  103 + <el-dropdown-item :command="1"
  104 + v-if="userName == item.realName && role != 'ROLE_PERSONAL'">修改分享范围</el-dropdown-item>
  105 + <el-dropdown-item :command="2">复制</el-dropdown-item>
  106 + <el-dropdown-item :command="3">放入回收站</el-dropdown-item>
  107 + </el-dropdown-menu>
  108 + </el-dropdown>
  109 + </div>
  110 + </li>
  111 + </ul>
  112 + <div class="pagination-box">
  113 + <el-pagination small="" layout="total,prev, pager, next" :hide-on-single-page="true" :total="total"
  114 + @current-change="changePage" :current-page="page" :page-size="size">
  115 + </el-pagination>
  116 + </div>
  117 + <el-empty v-if="!loading && tableData.length == 0" content="没有更多数据" :image-size="100"></el-empty>
111 118 </div>
112   - <el-empty v-if="!loading && tableData.length == 0" content="没有更多数据" :image-size="100"></el-empty>
  119 +
  120 +
113 121 <el-dialog :close-on-click-modal="false" title="选择分享范围" :visible.sync="dialogVisible" width="400">
114 122 <el-form :model="shareForm" :rules="shareRulesForm" label-width="160px">
115 123 <el-form-item prop="share" label="分享范围:">
... ... @@ -125,7 +133,7 @@
125 133 </div>
126 134 </el-dialog>
127 135 <el-dialog :close-on-click-modal="false" title="上传word文档" :visible.sync="diaUp" width="600">
128   - <upload id="upWords" :url="url" @upSuccess="upSuccess" fileName="下载">
  136 + <upload :url="url" :params="{ type: examinationPaperType }" @upSuccess="upSuccess" fileName="下载">
129 137 <div class="down-box" slot="down">
130 138 <p>第一步:导出菁优网试卷或
131 139 <el-link type="danger" @click="downExcel">模板下载</el-link> 。
... ... @@ -154,6 +162,7 @@ export default {
154 162 classId: "",
155 163 subjectName: "",
156 164 title: "",
  165 + type: 1, //试卷类型
157 166 },
158 167 classList: [],
159 168 subjectList: [],
... ... @@ -173,9 +182,13 @@ export default {
173 182 size: 20,
174 183  
175 184 // v1.5
176   - diaUp: false,
  185 + totalCount: {//数量统计
  186 + my: 0,
  187 + share: 0,
  188 + },
  189 + diaUp: false,//上传word弹窗开关
177 190 examinationPaperType: 1,//题型类型
178   - url: "xxxxx",//上传文档地址
  191 + url: "/api_html/common/paper/upload",//上传文档地址
179 192 };
180 193 },
181 194 async created() {
... ... @@ -184,13 +197,14 @@ export default {
184 197 this.$store.getters.info.showRole ||
185 198 this.$store.getters.info.permissions[0].role;
186 199 this.userName = this.$store.getters.info.name || "";
187   - // this._QueryClassList2()
188   - // await this._QueryClassList();
189   - // if (!this.query.classId) {
190   - // return;
191   - // }
192   - // await this._QuerySubjectList();
193   - // this._QueryData();
  200 + this._QueryClassList2()
  201 + await this._QueryClassList();
  202 + if (!this.query.classId) {
  203 + return;
  204 + }
  205 + await this._QuerySubjectList();
  206 + this._QueryData();
  207 + this._QueryTotal();
194 208 },
195 209 methods: {
196 210 refreshStic() {
... ... @@ -222,8 +236,7 @@ export default {
222 236 },
223 237 });
224 238 },
225   - handleDropdownClick(value, item) {
226   - //更多
  239 + handleDropdownClick(value, item) {//更多
227 240 const that = this;
228 241 switch (value) {
229 242 case 1:
... ... @@ -246,8 +259,8 @@ export default {
246 259 this.page = page;
247 260 this._QueryData(this.query.title);
248 261 },
  262 + //修改分享范围
249 263 async saveShare() {
250   - //修改分享范围
251 264 const { data, status, info } = await this.$request.modifyPaper({
252 265 paperId: this.shareForm.id,
253 266 sharingType: this.shareForm.sharingType,
... ... @@ -262,8 +275,8 @@ export default {
262 275 this.$message.error(info);
263 276 }
264 277 },
  278 + //归档
265 279 async recovery(item) {
266   - //归档
267 280 let modifyPaper =
268 281 this.role == "ROLE_PERSONAL"
269 282 ? this.$request.pModifyPaper
... ... @@ -273,17 +286,29 @@ export default {
273 286 status: 2,
274 287 });
275 288 if (status === 0) {
276   - let type = this.query.title ? 1 : 0;
  289 + let type = this.query.title ? true : false;
277 290 this.page = 1;
278 291 this._QueryData(type);
279 292 } else {
280 293 this.$message.error(info);
281 294 }
282 295 },
  296 + //根据试卷名称查找
  297 + async getData(bool) {
  298 + this._QueryData(bool);
  299 + this._QueryTotal();
  300 + },
283 301 //切换班级
284 302 async changClazz() {
285 303 await this._QuerySubjectList();
286 304 this._QueryData(false);
  305 + this._QueryTotal();
  306 + },
  307 + //切换类型
  308 + async changType(type) {
  309 + this.query.type = type
  310 + this.page = 1;
  311 + this._QueryData(false);
287 312 },
288 313 // 查找班级
289 314 async _QueryClassList2() {
... ... @@ -363,7 +388,7 @@ export default {
363 388 query.subjectName = this.query.subjectName;
364 389 for (let key in query) {
365 390 if (!query[key]) {
366   - query[key] = null;
  391 + delete query[key]
367 392 }
368 393 }
369 394 if (!query.classId) {
... ... @@ -393,20 +418,41 @@ export default {
393 418 this.$message.error(info);
394 419 }
395 420 },
  421 + async _QueryTotal() {
  422 + //获取答题卡列表
  423 + let query = { ...this.query };
  424 + for (let key in query) {
  425 + if (!query[key]) {
  426 + delete query[key]
  427 + }
  428 + }
  429 + const { data, status, info } = await this.$request.paperShareCount({
  430 + ...query,
  431 + });
  432 + if (status === 0) {
  433 + this.totalCount.my = data?.myCount || 0;
  434 + this.totalCount.share = data?.grade || 0;
  435 + } else {
  436 + this.$message.error(info);
  437 + }
  438 + },
396 439  
397 440  
398 441 //v1.5
399 442 upSuccess(res) {
400   - //导入成功
401   - this.$message.closeAll();
402   - this.$message({
403   - showClose: true,
404   - message: `成功(${res.data.success})`,
405   - type: "success",
406   - duration: 5000,
407   - });
408   - this.diaUp = false;
409   -
  443 + if (res.status == 0) {
  444 + //导入成功
  445 + this.$message.closeAll();
  446 + this.$message({
  447 + showClose: true,
  448 + message: `${res.info}`,
  449 + type: "success",
  450 + duration: 2000,
  451 + });
  452 + this.diaUp = false;
  453 + let params = JSON.stringify(res.data)
  454 + this.toAdd({ params, isUpload: 1 })
  455 + }
410 456 },
411 457 handleAdd(value) {
412 458 if (value == 2) {
... ... @@ -589,4 +635,27 @@ export default {
589 635 display: flex;
590 636 justify-content: space-between;
591 637 }
  638 +
  639 +.content {
  640 + .tab-box {
  641 + padding-bottom: 10px;
  642 +
  643 + .tab-s {
  644 + margin: 0 10px;
  645 + font-size: 17px;
  646 + line-height: 24px;
  647 + font-weight: 500;
  648 + cursor: pointer;
  649 +
  650 + &:hover {
  651 + color: #667ffd;
  652 + }
  653 +
  654 + &.active {
  655 + color: #667ffd;
  656 + border-bottom: 1px solid #667ffd
  657 + }
  658 + }
  659 + }
  660 +}
592 661 </style>
593 662 \ No newline at end of file
... ...