Commit c90335222c97bb554041ab49928d6facbd31298d
1 parent
a61d16e2
更新前端代码
Showing
7 changed files
with
799 additions
and
51 deletions
src/router/index.js
... | ... | @@ -142,8 +142,15 @@ export const constantRoutes = [ |
142 | 142 | { |
143 | 143 | path: 'test', |
144 | 144 | component: () => import('@/views/testpaper/test/index'), // Parent router-view |
145 | - name: 'Menu1', | |
145 | + name: 'Test', | |
146 | 146 | meta: { title: '试卷管理' } |
147 | + }, | |
148 | + { | |
149 | + path: 'creatpaper', | |
150 | + component: () => import('@/views/testpaper/page/creatpaper'), // Parent router-view | |
151 | + name: 'Creatpaper', | |
152 | + meta: { title: '创建试卷', activeMenu: '/testpaper/test' }, | |
153 | + hidden: true | |
147 | 154 | } |
148 | 155 | ] |
149 | 156 | }, | ... | ... |
src/views/analysis/classes/index.vue
src/views/analysis/page/components/rightbl.vue
1 | 1 | <template> |
2 | 2 | <div class="rightbl"> |
3 | 3 | <div class="slider-bg"> |
4 | - <div style="width:100px;" class="slider-color" /> | |
4 | + <div :style="'width:'+wid*200+'px;'" class="slider-color" /> | |
5 | 5 | </div> |
6 | - <div class="bl">16.32%</div> | |
6 | + <div class="bl">{{ data }}</div> | |
7 | 7 | </div> |
8 | 8 | </template> |
9 | 9 | <script> |
10 | 10 | export default { |
11 | 11 | name: 'Rightbl', |
12 | 12 | props: { |
13 | - | |
13 | + data: { | |
14 | + type: String, | |
15 | + default: '' | |
16 | + } | |
17 | + }, | |
18 | + computed: { | |
19 | + wid() { | |
20 | + return parseFloat(this.data.replace('%', '')) / 100 | |
21 | + } | |
14 | 22 | } |
15 | 23 | } |
16 | 24 | </script> | ... | ... |
src/views/analysis/page/testinfo.vue
... | ... | @@ -67,34 +67,45 @@ |
67 | 67 | <div style="clear:both" /> |
68 | 68 | </div> |
69 | 69 | <div class="listbox"> |
70 | - <div class="list"> | |
70 | + <div v-for="(item,index) in errorList" :key="index" :ref="'list'" class="list"> | |
71 | 71 | <el-row> |
72 | 72 | <el-col :span="4"> |
73 | - <p class="bold">第1题</p> | |
74 | - <p>单选题</p> | |
73 | + <p class="bold">第{{ item.rank }}题</p> | |
74 | + <p>{{ item.type }}</p> | |
75 | 75 | </el-col> |
76 | 76 | <el-col :span="16"> |
77 | 77 | <div class="asw"> |
78 | - <p style="float:left"><i class="el-ump-icon-3" />易错项:AB</p> | |
79 | - <p style="float:left;margin-left:40px;"><i class="el-ump-icon-5" />正确答案:ABCDEFGHI</p> | |
78 | + <p style="float:left"><i class="el-ump-icon-3" />易错项:<span class="red">{{ item.easyerror }}</span></p> | |
79 | + <p style="float:left;margin-left:40px;"><i class="el-ump-icon-5" />正确答案:<span class="green">{{ item.right }}</span></p> | |
80 | 80 | <div style="clear:both" /> |
81 | 81 | </div> |
82 | - <div class="rightbl"> | |
82 | + <div v-if="activeShow!=index" class="rightbl"> | |
83 | 83 | <i class="el-ump-icon-6" /> |
84 | 84 | <span>正确率</span> |
85 | - <Rightbl /> | |
85 | + <Rightbl :data="item.rightbl" /> | |
86 | 86 | </div> |
87 | - <Aswdetail :data="data" class="detailbox" /> | |
87 | + <transition name="el-zoom-in-top"> | |
88 | + <Aswdetail v-show="activeShow==index" :data="item.aswdetail" class="detailbox" /> | |
89 | + </transition> | |
88 | 90 | </el-col> |
89 | 91 | <el-col :span="4" style="line-height:70px;"> |
90 | - <span>展开详情</span> | |
91 | - <i class="el-icon-caret-bottom" /> | |
92 | + <div v-if="activeShow!=index" style="display:inline-block;cursor: pointer;" @click="toggle(index)"> | |
93 | + <span>展开详情</span> | |
94 | + <i class="el-icon-caret-bottom" /> | |
95 | + </div> | |
96 | + <div v-else style="position:absolute;bottom:0px;cursor: pointer;" @click="toggle(-1)"> | |
97 | + <span>收起详情</span> | |
98 | + <i class="el-icon-caret-top" /> | |
99 | + </div> | |
92 | 100 | </el-col> |
93 | 101 | </el-row> |
102 | + <div v-if="activeShow==index" class="blbox"> | |
103 | + <i class="el-ump-icon-6" /> | |
104 | + 正确率:{{ item.rightbl }} | |
105 | + </div> | |
94 | 106 | </div> |
95 | 107 | </div> |
96 | 108 | </div> |
97 | - | |
98 | 109 | </div> |
99 | 110 | </div> |
100 | 111 | </template> |
... | ... | @@ -114,38 +125,8 @@ export default { |
114 | 125 | data() { |
115 | 126 | return { |
116 | 127 | content: '', |
117 | - data: [ | |
118 | - { | |
119 | - answer: 'A', | |
120 | - num: '33', | |
121 | - total: '60', | |
122 | - right: 1 | |
123 | - }, | |
124 | - { | |
125 | - answer: 'BCDEFGHIJKL', | |
126 | - num: '12', | |
127 | - total: '60', | |
128 | - right: 0 | |
129 | - }, | |
130 | - { | |
131 | - answer: 'C', | |
132 | - num: '5', | |
133 | - total: '60', | |
134 | - right: 0 | |
135 | - }, | |
136 | - { | |
137 | - answer: 'D', | |
138 | - num: '5', | |
139 | - total: '60', | |
140 | - right: 0 | |
141 | - }, | |
142 | - { | |
143 | - answer: '未提交', | |
144 | - num: '5', | |
145 | - total: '60', | |
146 | - right: -1 | |
147 | - } | |
148 | - ], | |
128 | + activeShow: -1, | |
129 | + tg: true, | |
149 | 130 | scoredata: [ |
150 | 131 | { |
151 | 132 | icon: 'el-ump-icon-4', |
... | ... | @@ -246,6 +227,86 @@ export default { |
246 | 227 | rightbl: '96%', |
247 | 228 | score: '96' |
248 | 229 | } |
230 | + ], | |
231 | + errorList: [ | |
232 | + { | |
233 | + rank: '1', | |
234 | + type: '单选题', | |
235 | + easyerror: 'AB', | |
236 | + right: 'ABCDEFG', | |
237 | + rightbl: '30.32%', | |
238 | + aswdetail: [ | |
239 | + { | |
240 | + answer: 'A', | |
241 | + num: '33', | |
242 | + total: '60', | |
243 | + right: 1 | |
244 | + }, | |
245 | + { | |
246 | + answer: 'BCDEFGHIJKL', | |
247 | + num: '12', | |
248 | + total: '60', | |
249 | + right: 0 | |
250 | + }, | |
251 | + { | |
252 | + answer: 'C', | |
253 | + num: '5', | |
254 | + total: '60', | |
255 | + right: 0 | |
256 | + }, | |
257 | + { | |
258 | + answer: 'D', | |
259 | + num: '5', | |
260 | + total: '60', | |
261 | + right: 0 | |
262 | + }, | |
263 | + { | |
264 | + answer: '未提交', | |
265 | + num: '5', | |
266 | + total: '60', | |
267 | + right: -1 | |
268 | + } | |
269 | + ] | |
270 | + }, | |
271 | + { | |
272 | + rank: '3', | |
273 | + type: '多选题', | |
274 | + easyerror: 'AB', | |
275 | + right: 'ABCDEFG', | |
276 | + rightbl: '30.32%', | |
277 | + aswdetail: [ | |
278 | + { | |
279 | + answer: 'A', | |
280 | + num: '33', | |
281 | + total: '60', | |
282 | + right: 1 | |
283 | + }, | |
284 | + { | |
285 | + answer: 'BCDEFGHIJKL', | |
286 | + num: '12', | |
287 | + total: '60', | |
288 | + right: 0 | |
289 | + }, | |
290 | + { | |
291 | + answer: 'C', | |
292 | + num: '5', | |
293 | + total: '60', | |
294 | + right: 0 | |
295 | + }, | |
296 | + { | |
297 | + answer: 'D', | |
298 | + num: '5', | |
299 | + total: '60', | |
300 | + right: 0 | |
301 | + }, | |
302 | + { | |
303 | + answer: '未提交', | |
304 | + num: '5', | |
305 | + total: '60', | |
306 | + right: -1 | |
307 | + } | |
308 | + ] | |
309 | + } | |
249 | 310 | ] |
250 | 311 | } |
251 | 312 | }, |
... | ... | @@ -295,13 +356,18 @@ export default { |
295 | 356 | } |
296 | 357 | ] |
297 | 358 | }) |
359 | + }, | |
360 | + toggle(index) { | |
361 | + index === -1 ? this.tg = true : this.tg = false | |
362 | + this.activeShow = index | |
298 | 363 | } |
299 | 364 | } |
300 | 365 | } |
301 | 366 | </script> |
302 | 367 | <style scoped> |
303 | 368 | .aswinfo{ |
304 | - max-width: 1100px; | |
369 | + min-width: 1100px; | |
370 | + max-width: 1700px; | |
305 | 371 | height:calc(100vh - 115px); |
306 | 372 | overflow: auto; |
307 | 373 | margin:0 auto; |
... | ... | @@ -369,12 +435,35 @@ export default { |
369 | 435 | margin-top:10px; |
370 | 436 | background: #eee; |
371 | 437 | } |
438 | +.listbox{ | |
439 | + max-height: 550px; | |
440 | + overflow: auto; | |
441 | +} | |
372 | 442 | .listbox .list{ |
373 | 443 | background: #fff; |
374 | 444 | border-radius: 15px; |
375 | 445 | padding:10px 15px; |
446 | + position: relative; | |
447 | + margin-bottom:20px; | |
376 | 448 | } |
377 | 449 | .detailbox{ |
378 | 450 | margin-top:30px; |
379 | 451 | } |
452 | +.list i{ | |
453 | + color:#ccc; | |
454 | + margin-right:10px; | |
455 | +} | |
456 | +.blbox{ | |
457 | + position:absolute; | |
458 | + right:20px; | |
459 | + top:10px; | |
460 | + border:1px solid #ccc; | |
461 | + padding:5px 10px; | |
462 | +} | |
463 | +.red{ | |
464 | + color: #f00; | |
465 | +} | |
466 | +.green{ | |
467 | + color:green; | |
468 | +} | |
380 | 469 | </style> | ... | ... |
src/views/analysis/testpaper/index.vue
... | ... | @@ -186,6 +186,10 @@ export default { |
186 | 186 | gradeclick() { |
187 | 187 | this.classFlag = false |
188 | 188 | this.gradeFlag = true |
189 | + }, | |
190 | + handleEdit(index, row) { | |
191 | + console.log(row) | |
192 | + this.$router.push('/analysis/testinfo') | |
189 | 193 | } |
190 | 194 | |
191 | 195 | } |
... | ... | @@ -193,7 +197,8 @@ export default { |
193 | 197 | </script> |
194 | 198 | <style scoped> |
195 | 199 | .testpaper{ |
196 | - max-width: 1100px; | |
200 | + max-width: 1700px; | |
201 | + min-width: 1100px; | |
197 | 202 | height:calc(100vh - 115px); |
198 | 203 | margin:0 auto; |
199 | 204 | background: #fff; | ... | ... |
src/views/testpaper/page/creatpaper.vue
0 → 100644
1 | +<template> | |
2 | + <div class="creatpaper"> | |
3 | + <Dec :content="content" /> | |
4 | + <div class="add"> | |
5 | + <p class="footer"> | |
6 | + <el-button v-show="active==1" type="primary" @click="next">下一步</el-button> | |
7 | + <el-button v-show="active==1" type="danger" @click="close">取消</el-button> | |
8 | + | |
9 | + <el-button v-show="active==2" type="primary" @click="prev">上一步</el-button> | |
10 | + <el-button v-show="active==2" type="primary" @click="next">发布</el-button> | |
11 | + <el-button v-show="active==2" type="primary" @click="close">取消</el-button> | |
12 | + <el-button v-show="active==2" type="primary" @click="save">存为草稿</el-button> | |
13 | + | |
14 | + <el-button v-show="active==3" type="primary" @click="close">返回列表页</el-button> | |
15 | + </p> | |
16 | + <div style="height:calc(100% - 40px);overflow:auto;"> | |
17 | + <el-steps :active="active" style="width:60%;margin:0 auto;"> | |
18 | + <el-step title="基本信息" /> | |
19 | + <el-step title="创建答题卡" /> | |
20 | + <el-step title="完成发布" /> | |
21 | + </el-steps> | |
22 | + <div v-show="active==1"> | |
23 | + <el-form ref="paper" :model="paper" label-width="100px" style="margin-top:30px;"> | |
24 | + <el-form-item label="试卷名称:"> | |
25 | + <el-input v-model="paper.name" style="width:500px;" placeholder="请输入试卷名称" maxlength="30" show-word-limit /> | |
26 | + </el-form-item> | |
27 | + <el-form-item label="试卷分类:"> | |
28 | + <el-select v-model="paper.type" placeholder="请选择"> | |
29 | + <el-option label="月考" value="month" /> | |
30 | + <el-option label="周考" value="week" /> | |
31 | + </el-select> | |
32 | + </el-form-item> | |
33 | + <el-form-item label="可视权限:"> | |
34 | + <el-select v-model="paper.permission" placeholder="请选择"> | |
35 | + <el-option label="月考" value="month" /> | |
36 | + <el-option label="周考" value="week" /> | |
37 | + </el-select> | |
38 | + </el-form-item> | |
39 | + <el-form-item label="科目:"> | |
40 | + <el-select v-model="paper.subject" placeholder="请选择"> | |
41 | + <el-option label="语文" value="yw" /> | |
42 | + <el-option label="数学" value="sx" /> | |
43 | + </el-select> | |
44 | + </el-form-item> | |
45 | + <el-form-item label="年级:"> | |
46 | + <el-select v-model="paper.schoollength" placeholder="请选择"> | |
47 | + <el-option label="小学" value="xx" /> | |
48 | + <el-option label="中学" value="zx" /> | |
49 | + </el-select> | |
50 | + <el-select v-model="paper.grade" placeholder="请选择"> | |
51 | + <el-option label="一年级" value="one" /> | |
52 | + <el-option label="二年级" value="two" /> | |
53 | + </el-select> | |
54 | + </el-form-item> | |
55 | + <el-form-item label="考试时长:"> | |
56 | + <el-input v-model="paper.timelength" style="width:500px;" placeholder="" /> | |
57 | + </el-form-item> | |
58 | + </el-form> | |
59 | + </div> | |
60 | + <div v-show="active==2"> | |
61 | + <p style="text-align:center;color:#888;">无需编辑题目,添加选项及答案即可快速组卷,考生通过纸质试卷或其他载体异步答题</p> | |
62 | + <div class="leftbox"><span>选择题型:</span></div> | |
63 | + <div class="typebox"> | |
64 | + <el-row> | |
65 | + <el-col :span="8"> | |
66 | + <p>题型</p> | |
67 | + <el-select v-model="qtype" @change="selctChange"> | |
68 | + <el-option label="单选" value="1" /> | |
69 | + <el-option label="多选" value="2" /> | |
70 | + <el-option label="判断" value="3" /> | |
71 | + <el-option label="数字" value="4" /> | |
72 | + <el-option label="排序" value="5" /> | |
73 | + </el-select> | |
74 | + </el-col> | |
75 | + <el-col :span="8"> | |
76 | + <div v-if="'12'.includes(qtype)"> | |
77 | + <p>选项个数</p> | |
78 | + <el-input-number v-model="qnum" :min="1" :max="10" label="描述文字" @change="numFun" /> | |
79 | + </div> | |
80 | + </el-col> | |
81 | + <el-col :span="8"> | |
82 | + <p>单题分值</p> | |
83 | + <el-input-number v-model="score" :min="1" :max="100" label="描述文字" @change="scoreFun" /> | |
84 | + </el-col> | |
85 | + </el-row> | |
86 | + </div> | |
87 | + <div class="leftbox" style="padding-top:10px;"><span>题目名称:</span></div> | |
88 | + <div class="typebox" style="padding-top:10px;"> | |
89 | + <el-input v-model="qtitle" placeholder="填写题目名称;例如:一、单选题" style="width:500px;" /> | |
90 | + </div> | |
91 | + <div class="leftbox" style="padding-top:10px;"><span>添加答案:</span></div> | |
92 | + <div class="typebox"> | |
93 | + <p v-if="qtype=='1'" style="margin-top:10px;">直接输入单题答案添加题目,例(若添加10道题):“ABCCD DCAAA”</p> | |
94 | + <p v-if="qtype=='2'" style="margin-top:10px;">题目之间用空格隔开,例(若添加5道题):“ABCD AB ACD ABD ABCD”</p> | |
95 | + <p v-if="qtype=='3'" style="margin-top:10px;">请点击“✔”或者“✘”添加答案</p> | |
96 | + <p v-if="qtype=='4'" style="margin-top:10px;">题目之间用空格隔开,例如(若添加5道题):“2.4 33 0 1 12”</p> | |
97 | + <p v-if="qtype=='5'" style="margin-top:10px;">题目之间用空格隔开,例如(若添加2道题):“12345 53421”</p> | |
98 | + <el-button v-if="qtype=='3'" type="primary" class="el-icon-check" @click="checktrue" /> | |
99 | + <el-button v-if="qtype=='3'" type="primary" class="el-icon-close" @click="checkfail" /> | |
100 | + <el-input v-model="aswString" placeholder="请输入内容" style="width:500px;" /> | |
101 | + <el-button type="primary" @click="creatPaper">添加</el-button> | |
102 | + </div> | |
103 | + <div style="clear:both" /> | |
104 | + <div class="paperbox"> | |
105 | + <h2 class="center">答题卡</h2> | |
106 | + <p class="center">卷面总分:{{ totalscore }}分</p> | |
107 | + <div v-for="(item,index) in paperdata" :key="index" class="bigq"> | |
108 | + <!--单选题--> | |
109 | + <div v-if="item.type==1"> | |
110 | + <h2>{{ item.title }}<span class="qtotal">共{{ item.total }}分</span></h2> | |
111 | + <el-row> | |
112 | + <el-col :span="2">题号</el-col> | |
113 | + <el-col :span="2">分数</el-col> | |
114 | + <el-col :span="20">选项及答案</el-col> | |
115 | + </el-row> | |
116 | + <el-row v-for="(list,index1) in item.info" :key="index1" style="margin-top:10px;"> | |
117 | + <el-col :span="2" style="line-height:40px;">{{ list.rank }}</el-col> | |
118 | + <el-col :span="2"><el-input v-model="list.score" maxlength="2" style="width:50px;" @change="reoder" /></el-col> | |
119 | + <el-col :span="20"> | |
120 | + <li v-for="count in list.num" :key="count" :class="list.right == String.fromCharCode(64 + parseInt(count))?'right':''" class="option" @click="checkoption(index,index1,count)">{{ String.fromCharCode(64 + parseInt(count)) }}</li> | |
121 | + | |
122 | + <el-button type="primary" icon="el-icon-plus" circle @click="addOption(index,index1)" /> | |
123 | + <el-button type="danger" icon="el-icon-delete" circle @click="delOption(index,index1)" /> | |
124 | + </el-col> | |
125 | + </el-row> | |
126 | + <p style="text-align:center"> | |
127 | + <el-button type="primary" @click="addQue(index)">添加单选题目</el-button> | |
128 | + </p> | |
129 | + </div> | |
130 | + <!--多选题--> | |
131 | + <div v-if="item.type==2"> | |
132 | + <h2>{{ item.title }}<span class="qtotal">共{{ item.total }}分</span></h2> | |
133 | + <el-row> | |
134 | + <el-col :span="2">题号</el-col> | |
135 | + <el-col :span="2">分数</el-col> | |
136 | + <el-col :span="20">选项及答案</el-col> | |
137 | + </el-row> | |
138 | + <el-row v-for="(list,index1) in item.info" :key="index1" style="margin-top:10px;"> | |
139 | + <el-col :span="2" style="line-height:40px;">{{ list.rank }}</el-col> | |
140 | + <el-col :span="2"><el-input v-model="list.score" maxlength="2" style="width:50px;" @change="reoder" /></el-col> | |
141 | + <el-col :span="20"> | |
142 | + <li v-for="count in list.num" :key="count" :class="list.right.includes( String.fromCharCode(64 + parseInt(count)))?'right':''" class="option" @click="checkoption2(index,index1,count)">{{ String.fromCharCode(64 + parseInt(count)) }}</li> | |
143 | + | |
144 | + <el-button type="primary" icon="el-icon-plus" circle @click="addOption(index,index1)" /> | |
145 | + <el-button type="danger" icon="el-icon-delete" circle @click="delOption(index,index1)" /> | |
146 | + </el-col> | |
147 | + </el-row> | |
148 | + <p style="text-align:center"> | |
149 | + <el-button type="primary" @click="addQue(index)">添加多选题目</el-button> | |
150 | + </p> | |
151 | + </div> | |
152 | + <!--判断题--> | |
153 | + <div v-if="item.type==3"> | |
154 | + <h2>{{ item.title }}<span class="qtotal">共{{ item.total }}分</span></h2> | |
155 | + <el-row> | |
156 | + <el-col :span="2">题号</el-col> | |
157 | + <el-col :span="2">分数</el-col> | |
158 | + <el-col :span="20">选项及答案</el-col> | |
159 | + </el-row> | |
160 | + <el-row v-for="(list,index1) in item.info" :key="index1" style="margin-top:10px;"> | |
161 | + <el-col :span="2" style="line-height:40px;">{{ list.rank }}</el-col> | |
162 | + <el-col :span="2"><el-input v-model="list.score" maxlength="2" style="width:50px;" @change="reoder" /></el-col> | |
163 | + <el-col :span="20"> | |
164 | + <li :class="list.right=='✔'?'right':''" class="option" @click="checkoption3(index,index1,1)">✔</li> | |
165 | + <li :class="list.right=='✘'?'right':''" class="option" @click="checkoption3(index,index1,2)">✘</li> | |
166 | + <el-button type="danger" icon="el-icon-delete" circle @click="delOption(index,index1)" /> | |
167 | + </el-col> | |
168 | + </el-row> | |
169 | + <p style="text-align:center"> | |
170 | + <el-button type="primary" @click="addQue3(index)">添加判断题目</el-button> | |
171 | + </p> | |
172 | + </div> | |
173 | + <!--数字题--> | |
174 | + <div v-if="item.type==4"> | |
175 | + <h2>{{ item.title }}<span class="qtotal">共{{ item.total }}分</span></h2> | |
176 | + <el-row> | |
177 | + <el-col :span="2">题号</el-col> | |
178 | + <el-col :span="2">分数</el-col> | |
179 | + <el-col :span="20">选项及答案</el-col> | |
180 | + </el-row> | |
181 | + <el-row v-for="(list,index1) in item.info" :key="index1" style="margin-top:10px;"> | |
182 | + <el-col :span="2" style="line-height:40px;">{{ list.rank }}</el-col> | |
183 | + <el-col :span="2"><el-input v-model="list.score" maxlength="2" style="width:50px;" @change="reoder" /></el-col> | |
184 | + <el-col :span="20"> | |
185 | + <el-input v-model="list.right" type="primary" style="width:100px;" /> | |
186 | + <el-button type="danger" icon="el-icon-delete" circle @click="delOption(index,index1)" /> | |
187 | + </el-col> | |
188 | + </el-row> | |
189 | + <p style="text-align:center"> | |
190 | + <el-button type="primary" @click="addQue3(index)">添加数字题目</el-button> | |
191 | + </p> | |
192 | + </div> | |
193 | + <!--排序题--> | |
194 | + <div v-if="item.type==5"> | |
195 | + <h2>{{ item.title }}<span class="qtotal">共{{ item.total }}分</span></h2> | |
196 | + <el-row> | |
197 | + <el-col :span="2">题号</el-col> | |
198 | + <el-col :span="2">分数</el-col> | |
199 | + <el-col :span="20">选项及答案</el-col> | |
200 | + </el-row> | |
201 | + <el-row v-for="(list,index1) in item.info" :key="index1" style="margin-top:10px;"> | |
202 | + <el-col :span="2" style="line-height:40px;">{{ list.rank }}</el-col> | |
203 | + <el-col :span="2"><el-input v-model="list.score" maxlength="2" style="width:50px;" @change="reoder" /></el-col> | |
204 | + <el-col :span="20"> | |
205 | + <el-input v-model="list.right" type="primary" style="width:200px;" /> | |
206 | + <el-button type="danger" icon="el-icon-delete" circle @click="delOption(index,index1)" /> | |
207 | + </el-col> | |
208 | + </el-row> | |
209 | + <p style="text-align:center"> | |
210 | + <el-button type="primary" @click="addQue3(index)">添加排序题目</el-button> | |
211 | + </p> | |
212 | + </div> | |
213 | + </div> | |
214 | + </div> | |
215 | + </div> | |
216 | + <div v-show="active==3"> | |
217 | + 789 | |
218 | + </div> | |
219 | + </div> | |
220 | + </div> | |
221 | + </div> | |
222 | +</template> | |
223 | +<script> | |
224 | +import Dec from '@/components/Dec' | |
225 | +export default { | |
226 | + name: 'Creatpaper', | |
227 | + components: { | |
228 | + Dec | |
229 | + }, | |
230 | + data() { | |
231 | + return { | |
232 | + content: '', | |
233 | + active: 1, | |
234 | + num: '', | |
235 | + qtype: '1', | |
236 | + qnum: '', | |
237 | + qtitle: '', | |
238 | + aswString: '', | |
239 | + score: '', | |
240 | + value: '1', | |
241 | + totalscore: 0, | |
242 | + paper: { | |
243 | + name: '', | |
244 | + type: '', | |
245 | + promission: '', | |
246 | + subject: '', | |
247 | + grade: '', | |
248 | + schoollength: '', | |
249 | + testtime: '' | |
250 | + }, | |
251 | + paperdata: [ | |
252 | + { | |
253 | + title: '一、单选题', | |
254 | + type: 1, | |
255 | + total: 4, | |
256 | + info: [ | |
257 | + { | |
258 | + rank: 1, | |
259 | + score: 1, | |
260 | + num: 4, | |
261 | + right: 'A' | |
262 | + }, | |
263 | + { | |
264 | + rank: 2, | |
265 | + score: 1, | |
266 | + num: 4, | |
267 | + right: 'B' | |
268 | + } | |
269 | + ] | |
270 | + }, | |
271 | + { | |
272 | + title: '二、多选题', | |
273 | + type: 2, | |
274 | + total: 4, | |
275 | + info: [ | |
276 | + { | |
277 | + rank: 1, | |
278 | + score: 1, | |
279 | + num: 4, | |
280 | + right: 'AB' | |
281 | + }, | |
282 | + { | |
283 | + rank: 2, | |
284 | + score: 1, | |
285 | + num: 4, | |
286 | + right: 'BD' | |
287 | + } | |
288 | + ] | |
289 | + }, | |
290 | + { | |
291 | + title: '三、判断题', | |
292 | + type: 3, | |
293 | + total: 4, | |
294 | + info: [ | |
295 | + { | |
296 | + rank: 1, | |
297 | + score: 1, | |
298 | + right: '✔' | |
299 | + }, | |
300 | + { | |
301 | + rank: 2, | |
302 | + score: 1, | |
303 | + right: '✘' | |
304 | + } | |
305 | + ] | |
306 | + }, | |
307 | + { | |
308 | + title: '四、数字题', | |
309 | + type: 4, | |
310 | + total: 4, | |
311 | + info: [ | |
312 | + { | |
313 | + rank: 1, | |
314 | + score: 1, | |
315 | + right: '2.75' | |
316 | + }, | |
317 | + { | |
318 | + rank: 2, | |
319 | + score: 1, | |
320 | + right: '12.3' | |
321 | + } | |
322 | + ] | |
323 | + }, | |
324 | + { | |
325 | + title: '五、排序题', | |
326 | + type: 5, | |
327 | + total: 4, | |
328 | + info: [ | |
329 | + { | |
330 | + rank: 1, | |
331 | + score: 1, | |
332 | + right: '12345' | |
333 | + }, | |
334 | + { | |
335 | + rank: 2, | |
336 | + score: 1, | |
337 | + right: '54312' | |
338 | + } | |
339 | + ] | |
340 | + } | |
341 | + ] | |
342 | + } | |
343 | + }, | |
344 | + created() { | |
345 | + this.reoder() | |
346 | + }, | |
347 | + methods: { | |
348 | + next() { | |
349 | + this.active++ | |
350 | + if (this.active > 3) { | |
351 | + return | |
352 | + } | |
353 | + }, | |
354 | + close() { | |
355 | + this.$router.push('/testpaper/test') | |
356 | + }, | |
357 | + prev() { | |
358 | + this.active-- | |
359 | + if (this.active < 1) { | |
360 | + return | |
361 | + } | |
362 | + }, | |
363 | + save() { | |
364 | + this.$router.push('/testpaper/test') | |
365 | + }, | |
366 | + handleChange() { | |
367 | + | |
368 | + }, | |
369 | + numFun() { | |
370 | + | |
371 | + }, | |
372 | + scoreFun() { | |
373 | + | |
374 | + }, | |
375 | + checkoption(bqindex, smindex, opindex) { | |
376 | + this.paperdata[bqindex].info[smindex].right = String.fromCharCode(64 + parseInt(opindex)) | |
377 | + }, | |
378 | + checkoption2(bqindex, smindex, opindex) { | |
379 | + console.log(!this.paperdata[bqindex].info[smindex].right.includes(String.fromCharCode(64 + parseInt(opindex)))) | |
380 | + if (!this.paperdata[bqindex].info[smindex].right.includes(String.fromCharCode(64 + parseInt(opindex)))) { | |
381 | + this.paperdata[bqindex].info[smindex].right += String.fromCharCode(64 + parseInt(opindex)) | |
382 | + } else { | |
383 | + this.paperdata[bqindex].info[smindex].right = this.paperdata[bqindex].info[smindex].right.replace(String.fromCharCode(64 + parseInt(opindex)), '') | |
384 | + } | |
385 | + }, | |
386 | + checkoption3(bqindex, smindex, opindex) { | |
387 | + this.paperdata[bqindex].info[smindex].right = opindex === 1 ? '✔' : '✘' | |
388 | + }, | |
389 | + addOption(bqindex, smindex) { | |
390 | + if (this.paperdata[bqindex].info[smindex].num < 10) { this.paperdata[bqindex].info[smindex].num++ } | |
391 | + }, | |
392 | + delOption(bqindex, smindex) { | |
393 | + this.paperdata[bqindex].info.splice(smindex, 1) | |
394 | + for (let i = 0; i < this.paperdata[bqindex].info.length; i++) { | |
395 | + this.paperdata[bqindex].info[i].rank = i + 1 | |
396 | + } | |
397 | + this.reoder() | |
398 | + console.log(this.paperdata) | |
399 | + }, | |
400 | + addQue(bqindex) { | |
401 | + this.paperdata[bqindex].info.push({ | |
402 | + rank: this.paperdata[bqindex].info.length + 1, | |
403 | + score: 1, | |
404 | + num: 4, | |
405 | + right: '' | |
406 | + }) | |
407 | + this.reoder() | |
408 | + }, | |
409 | + addQue3(bqindex) { | |
410 | + this.paperdata[bqindex].info.push({ | |
411 | + rank: this.paperdata[bqindex].info.length + 1, | |
412 | + score: 1, | |
413 | + right: '' | |
414 | + }) | |
415 | + this.reoder() | |
416 | + }, | |
417 | + checktrue() { | |
418 | + this.aswString += '✔' | |
419 | + }, | |
420 | + checkfail() { | |
421 | + this.aswString += '✘' | |
422 | + }, | |
423 | + reoder() { | |
424 | + let index = 0 | |
425 | + let totalscore = 0 | |
426 | + | |
427 | + for (let i = 0; i < this.paperdata.length; i++) { | |
428 | + let qtotal = 0 | |
429 | + for (let j = 0; j < this.paperdata[i].info.length; j++) { | |
430 | + index++ | |
431 | + totalscore += parseFloat(this.paperdata[i].info[j].score) | |
432 | + qtotal += parseFloat(this.paperdata[i].info[j].score) | |
433 | + this.totalscore = totalscore | |
434 | + this.paperdata[i].info[j].rank = index | |
435 | + } | |
436 | + this.paperdata[i].total = qtotal | |
437 | + } | |
438 | + }, | |
439 | + selctChange(value) { | |
440 | + console.log(value) | |
441 | + }, | |
442 | + creatPaper() { | |
443 | + let paramdata = {} | |
444 | + let qlength = [] | |
445 | + const aswarr = [] | |
446 | + switch (this.qtype) { | |
447 | + case '1': | |
448 | + qlength = this.aswString.split('') | |
449 | + for (let i = 0; i < qlength.length; i++) { | |
450 | + aswarr.push({ | |
451 | + rank: 1, | |
452 | + score: this.score, | |
453 | + num: this.qnum, | |
454 | + right: qlength[i] | |
455 | + }) | |
456 | + } | |
457 | + paramdata = { | |
458 | + title: this.qtitle, | |
459 | + type: 1, | |
460 | + total: qlength.length * this.score, | |
461 | + num: this.qnum, | |
462 | + info: aswarr | |
463 | + } | |
464 | + this.paperdata.push(paramdata) | |
465 | + this.score = 1 | |
466 | + this.qnum = 1 | |
467 | + this.aswString = '' | |
468 | + this.qtitle = '' | |
469 | + this.qtype = '1' | |
470 | + this.reoder() | |
471 | + break | |
472 | + case '2': | |
473 | + qlength = this.aswString.split(' ') | |
474 | + for (let i = 0; i < qlength.length; i++) { | |
475 | + aswarr.push({ | |
476 | + rank: 1, | |
477 | + score: this.score, | |
478 | + num: this.qnum, | |
479 | + right: qlength[i] | |
480 | + }) | |
481 | + } | |
482 | + paramdata = { | |
483 | + title: this.qtitle, | |
484 | + type: 2, | |
485 | + total: qlength.length * this.score, | |
486 | + num: this.qnum, | |
487 | + info: aswarr | |
488 | + } | |
489 | + this.paperdata.push(paramdata) | |
490 | + this.score = 1 | |
491 | + this.qnum = 1 | |
492 | + this.aswString = '' | |
493 | + this.qtitle = '' | |
494 | + this.qtype = '1' | |
495 | + this.reoder() | |
496 | + break | |
497 | + case '3':qlength = this.aswString.split('') | |
498 | + for (let i = 0; i < qlength.length; i++) { | |
499 | + aswarr.push({ | |
500 | + rank: 1, | |
501 | + score: this.score, | |
502 | + num: this.qnum, | |
503 | + right: qlength[i] | |
504 | + }) | |
505 | + } | |
506 | + paramdata = { | |
507 | + title: this.qtitle, | |
508 | + type: 3, | |
509 | + total: qlength.length * this.score, | |
510 | + info: aswarr | |
511 | + } | |
512 | + this.paperdata.push(paramdata) | |
513 | + this.score = 1 | |
514 | + this.aswString = '' | |
515 | + this.qtitle = '' | |
516 | + this.qtype = '1' | |
517 | + this.reoder() | |
518 | + break | |
519 | + case '4': | |
520 | + qlength = this.aswString.split(' ') | |
521 | + for (let i = 0; i < qlength.length; i++) { | |
522 | + aswarr.push({ | |
523 | + rank: 1, | |
524 | + score: this.score, | |
525 | + num: this.qnum, | |
526 | + right: qlength[i] | |
527 | + }) | |
528 | + } | |
529 | + paramdata = { | |
530 | + title: this.qtitle, | |
531 | + type: 4, | |
532 | + total: qlength.length * this.score, | |
533 | + num: this.qnum, | |
534 | + info: aswarr | |
535 | + } | |
536 | + this.paperdata.push(paramdata) | |
537 | + this.score = 1 | |
538 | + this.aswString = '' | |
539 | + this.qtitle = '' | |
540 | + this.qtype = '1' | |
541 | + this.reoder() | |
542 | + break | |
543 | + case '5': | |
544 | + qlength = this.aswString.split(' ') | |
545 | + for (let i = 0; i < qlength.length; i++) { | |
546 | + aswarr.push({ | |
547 | + rank: 1, | |
548 | + score: this.score, | |
549 | + num: this.qnum, | |
550 | + right: qlength[i] | |
551 | + }) | |
552 | + } | |
553 | + paramdata = { | |
554 | + title: this.qtitle, | |
555 | + type: 5, | |
556 | + total: qlength.length * this.score, | |
557 | + num: this.qnum, | |
558 | + info: aswarr | |
559 | + } | |
560 | + this.paperdata.push(paramdata) | |
561 | + this.score = 1 | |
562 | + this.aswString = '' | |
563 | + this.qtitle = '' | |
564 | + this.qtype = '1' | |
565 | + this.reoder() | |
566 | + break | |
567 | + } | |
568 | + } | |
569 | + | |
570 | + } | |
571 | +} | |
572 | +</script> | |
573 | +<style scoped> | |
574 | +.add{ | |
575 | + max-width: 1700px; | |
576 | + min-width: 1100px; | |
577 | + height:calc(100vh - 115px); | |
578 | + margin:0 auto; | |
579 | + background: #fff; | |
580 | + margin-top:15px; | |
581 | + padding:20px; | |
582 | + font-size: 14px; | |
583 | + position: relative; | |
584 | +} | |
585 | +.add .footer{ | |
586 | + width:100%; | |
587 | + height:40px; | |
588 | + line-height: 40px; | |
589 | + text-align: center; | |
590 | + position: absolute; | |
591 | + bottom:10px; | |
592 | + left:0; | |
593 | + background: #fff; | |
594 | + | |
595 | +} | |
596 | +.leftbox{ | |
597 | + width:20%; | |
598 | + float: left; | |
599 | +} | |
600 | +.typebox{ | |
601 | + width:80%; | |
602 | + float: left; | |
603 | +} | |
604 | +.typebox p{ | |
605 | + margin-top:0; | |
606 | +} | |
607 | +.option{ | |
608 | + border:1px solid #ccc; | |
609 | + width:40px; | |
610 | + height:40px; | |
611 | + margin-right:5px; | |
612 | + border-radius: 5px; | |
613 | + display: inline-block; | |
614 | + list-style: none; | |
615 | + text-align: center; | |
616 | + line-height: 40px; | |
617 | + cursor: pointer; | |
618 | +} | |
619 | +.right{ | |
620 | + background: green; | |
621 | + border:1px solid green; | |
622 | + color:#fff; | |
623 | +} | |
624 | +.qtotal{ | |
625 | + font-size:14px; | |
626 | + color:#888; | |
627 | + margin-left: 10px; | |
628 | +} | |
629 | +.center{ | |
630 | + text-align: center | |
631 | +} | |
632 | +.paperbox{ | |
633 | + padding-top: 20px; | |
634 | +} | |
635 | +</style> | ... | ... |
src/views/testpaper/test/index.vue
... | ... | @@ -6,7 +6,7 @@ |
6 | 6 | <el-row> |
7 | 7 | <el-col :span="9"> |
8 | 8 | <el-button type="primary" size="small">新增分类</el-button> |
9 | - <el-button type="primary" size="small">创建试卷</el-button> | |
9 | + <el-button type="primary" size="small" @click="creatpaper">创建试卷</el-button> | |
10 | 10 | <el-button type="primary" size="small">移动</el-button> |
11 | 11 | <el-button type="danger" size="small">删除</el-button> |
12 | 12 | </el-col> |
... | ... | @@ -157,6 +157,9 @@ export default { |
157 | 157 | }, |
158 | 158 | handleSelectionChange(val) { |
159 | 159 | console.log(val) |
160 | + }, | |
161 | + creatpaper() { | |
162 | + this.$router.push('/testpaper/creatpaper') | |
160 | 163 | } |
161 | 164 | } |
162 | 165 | } | ... | ... |