zydx-plus 1.32.273 → 1.32.274
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/components/question/src/question.vue +342 -315
- package/src/index.js +1 -1
package/package.json
CHANGED
|
@@ -1,348 +1,375 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
</
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
2
|
+
<div class="question">
|
|
3
|
+
<table border="0" cellspacing="0" cellpadding="0">
|
|
4
|
+
<tr>
|
|
5
|
+
<th>题序</th>
|
|
6
|
+
<th>题型</th>
|
|
7
|
+
<th>易</th>
|
|
8
|
+
<th>中</th>
|
|
9
|
+
<th>难</th>
|
|
10
|
+
<th>合计题量</th>
|
|
11
|
+
<th>合计分值</th>
|
|
12
|
+
<th v-if="!readOnlys&&butShows">操作</th>
|
|
13
|
+
</tr>
|
|
14
|
+
<tbody v-for="(item,index) in question" :key="index">
|
|
15
|
+
<tr>
|
|
16
|
+
<td rowspan="2">{{ empty ? '-' : toChineseNum(index + 1) }}</td>
|
|
17
|
+
<td rowspan="2">{{ item.quesName }}</td>
|
|
18
|
+
<td>
|
|
19
|
+
<div v-if="empty" class="qu-input" :style="{'margin-left': '0px'}">
|
|
20
|
+
<span>{{ item.easy }}</span>
|
|
21
|
+
</div>
|
|
22
|
+
<div v-else class="qu-input" :style="{'margin-left': readOnlys?'0px':'-10px'}">
|
|
23
|
+
<span v-if="readOnlys">{{ item.easy === '' ? '-' : item.easy }}</span>
|
|
24
|
+
<input v-else type="number" placeholder="题量" :value="item.easy" @input="totalQuestions($event,1,index)"
|
|
25
|
+
@keypress="isNumberKey($event,1)"/>
|
|
26
|
+
</div>
|
|
27
|
+
</td>
|
|
28
|
+
<td>
|
|
29
|
+
<div v-if="empty" class="qu-input" :style="{'margin-left': '0px'}">
|
|
30
|
+
<span>{{ item.mid }}</span>
|
|
31
|
+
</div>
|
|
32
|
+
<div v-else class="qu-input" :style="{'margin-left': readOnlys?'0px':'-10px'}">
|
|
33
|
+
<span v-if="readOnlys">{{ item.mid === '' ? '-' : item.mid }}</span>
|
|
34
|
+
<input v-else type="number" placeholder="题量" :value="item.mid" @input="totalQuestions($event,3,index)"
|
|
35
|
+
@keypress="isNumberKey($event,1)"/>
|
|
36
|
+
</div>
|
|
37
|
+
</td>
|
|
38
|
+
<td>
|
|
39
|
+
<div v-if="empty" class="qu-input" :style="{'margin-left': '0px'}">
|
|
40
|
+
<span>{{ item.hard }}</span>
|
|
41
|
+
</div>
|
|
42
|
+
<div v-else class="qu-input" :style="{'margin-left': readOnlys?'0px':'-10px'}">
|
|
43
|
+
<span v-if="readOnlys">{{ item.hard === '' ? '-' : item.hard }}</span>
|
|
44
|
+
<input v-else type="number" placeholder="题量" :value="item.hard" @input="totalQuestions($event,2,index)"
|
|
45
|
+
@keypress="isNumberKey($event,1)"/>
|
|
46
|
+
</div>
|
|
47
|
+
</td>
|
|
48
|
+
<td rowspan="2">{{ item.count }}</td>
|
|
49
|
+
<td rowspan="2">{{ item.allScore }}</td>
|
|
50
|
+
<td rowspan="2" v-if="!readOnlys&&butShows">
|
|
51
|
+
<span class="buts" v-if="empty">-</span>
|
|
52
|
+
<button v-else class="but" @click="cancel(index)">撤销选择</button>
|
|
53
|
+
</td>
|
|
54
|
+
</tr>
|
|
55
|
+
<tr>
|
|
56
|
+
<td>
|
|
57
|
+
<div v-if="algorithm === 1">
|
|
58
|
+
<div v-if="empty" class="qu-input" :style="{'margin-left': '0px'}">
|
|
59
|
+
<span>{{ item.easyScore }}</span>
|
|
60
|
+
</div>
|
|
61
|
+
<div v-else class="qu-input" :style="{'margin-left': readOnlys?'0px':'-10px'}">
|
|
62
|
+
<span v-if="readOnlys">{{ item.easyScore === '' ? '-' : item.easyScore }}</span>
|
|
63
|
+
<input v-else type="number" placeholder="分值" :value="item.easyScore"
|
|
64
|
+
@input="totalQuestions($event,4,index)" @keypress="isNumberKey($event,2)"/>
|
|
65
|
+
</div>
|
|
66
|
+
</div>
|
|
67
|
+
<div v-if="algorithm === 2" class="qu-input" :style="{'margin-left': '-5px'}">
|
|
68
|
+
<span>{{ Number(item.easy) * Number(item.easyScore) }}</span>
|
|
69
|
+
</div>
|
|
70
|
+
</td>
|
|
71
|
+
<td>
|
|
72
|
+
<div v-if="algorithm === 1">
|
|
73
|
+
<div v-if="empty" class="qu-input" :style="{'margin-left': '0px'}">
|
|
74
|
+
<span>{{ item.midScore }}</span>
|
|
75
|
+
</div>
|
|
76
|
+
<div v-else class="qu-input" :style="{'margin-left': readOnlys?'0px':'-10px'}">
|
|
77
|
+
<span v-if="readOnlys">{{ item.midScore === '' ? '-' : item.midScore }}</span>
|
|
78
|
+
<input v-else type="number" placeholder="分值" :value="item.midScore"
|
|
79
|
+
@input="totalQuestions($event,6,index)" @keypress="isNumberKey($event,2)"/>
|
|
80
|
+
</div>
|
|
81
|
+
</div>
|
|
82
|
+
<div v-if="algorithm === 2" class="qu-input" :style="{'margin-left': '-5px'}">
|
|
83
|
+
<span>{{ Number(item.mid) * Number(item.midScore) }}</span>
|
|
84
|
+
</div>
|
|
85
|
+
</td>
|
|
86
|
+
<td>
|
|
87
|
+
<div v-if="algorithm === 1">
|
|
88
|
+
<div v-if="empty" class="qu-input" :style="{'margin-left': '0px'}">
|
|
89
|
+
<span>{{ item.hardScore === '' ? '-' : item.hardScore }}</span>
|
|
90
|
+
</div>
|
|
91
|
+
<div v-else class="qu-input" :style="{'margin-left': readOnlys?'0px':'-10px'}">
|
|
92
|
+
<span v-if="readOnlys">{{ item.hardScore === '' ? '-' : item.hardScore }}</span>
|
|
93
|
+
<input v-else type="number" placeholder="分值" :value="item.hardScore"
|
|
94
|
+
@input="totalQuestions($event,5,index)" @keypress="isNumberKey($event,2)"/>
|
|
95
|
+
</div>
|
|
96
|
+
</div>
|
|
97
|
+
<div v-if="algorithm === 2" class="qu-input" :style="{'margin-left': '-5px'}">
|
|
98
|
+
<span>{{ Number(item.hard) * Number(item.hardScore) }}</span>
|
|
99
|
+
</div>
|
|
100
|
+
</td>
|
|
101
|
+
</tr>
|
|
102
|
+
</tbody>
|
|
103
|
+
<tr>
|
|
104
|
+
<td colspan="2">合计分值</td>
|
|
105
|
+
<td>{{ easyNum === 0 ? '-' : easyNum }}</td>
|
|
106
|
+
<td>{{ midNum === 0 ? '-' : midNum }}</td>
|
|
107
|
+
<td>{{ hardNum === 0 ? '-' : hardNum }}</td>
|
|
108
|
+
<td>试卷总分</td>
|
|
109
|
+
<td :colspan="readOnlys&&butShows? 1: 2">{{ totalNum === 0 ? '-' : totalNum }}</td>
|
|
110
|
+
</tr>
|
|
111
|
+
</table>
|
|
112
|
+
</div>
|
|
92
113
|
</template>
|
|
93
114
|
|
|
94
115
|
<script>
|
|
95
116
|
|
|
96
117
|
export default {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
118
|
+
name: "zydx-question",
|
|
119
|
+
data() {
|
|
120
|
+
return {
|
|
121
|
+
question: [],
|
|
122
|
+
easyNum: 0,
|
|
123
|
+
hardNum: 0,
|
|
124
|
+
midNum: 0,
|
|
125
|
+
totalNum: 0,
|
|
126
|
+
readOnlys: this.readOnly,
|
|
127
|
+
butShows: this.butShow,
|
|
128
|
+
empty: false
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
props: {
|
|
132
|
+
data: {
|
|
133
|
+
type: Array,
|
|
134
|
+
default: []
|
|
135
|
+
},
|
|
136
|
+
readOnly: {
|
|
137
|
+
type: Boolean,
|
|
138
|
+
default: false
|
|
139
|
+
},
|
|
140
|
+
butShow: {
|
|
141
|
+
type: Boolean,
|
|
142
|
+
default: true
|
|
143
|
+
},
|
|
144
|
+
algorithm: {
|
|
145
|
+
type: Number,
|
|
146
|
+
default: 1
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
watch: {
|
|
150
|
+
readOnly: {
|
|
151
|
+
handler(val) {
|
|
152
|
+
this.readOnlys = val
|
|
153
|
+
},
|
|
154
|
+
deep: true
|
|
155
|
+
},
|
|
156
|
+
data: {
|
|
157
|
+
handler(val) {
|
|
158
|
+
if (val.length === 0) {
|
|
159
|
+
this.question = [{
|
|
160
|
+
quesType: '-',
|
|
161
|
+
quesName: '-',
|
|
162
|
+
easyScore: '-',
|
|
163
|
+
hardScore: '-',
|
|
164
|
+
midScore: '-',
|
|
165
|
+
easy: '-',
|
|
166
|
+
hard: '-',
|
|
167
|
+
mid: '-',
|
|
168
|
+
allScore: '-',
|
|
169
|
+
count: '-'
|
|
170
|
+
}]
|
|
171
|
+
this.empty = true
|
|
172
|
+
} else {
|
|
173
|
+
this.empty = false
|
|
174
|
+
this.getQuestionReadOnly(val)
|
|
108
175
|
}
|
|
176
|
+
},
|
|
177
|
+
immediate: true
|
|
178
|
+
}
|
|
179
|
+
},
|
|
180
|
+
emits: ['cancel'],
|
|
181
|
+
methods: {
|
|
182
|
+
getQuestionReadOnly(v) {
|
|
183
|
+
let arr = []
|
|
184
|
+
v.forEach(item => {
|
|
185
|
+
arr.push({
|
|
186
|
+
...item,
|
|
187
|
+
quesType: item.quesType,
|
|
188
|
+
quesName: item.quesName,
|
|
189
|
+
easyScore: item.easyScore ? item.easyScore : '',
|
|
190
|
+
hardScore: item.hardScore ? item.hardScore : '',
|
|
191
|
+
midScore: item.midScore ? item.midScore : '',
|
|
192
|
+
easy: item.easy ? item.easy : '',
|
|
193
|
+
hard: item.hard ? item.hard : '',
|
|
194
|
+
mid: item.mid ? item.mid : '',
|
|
195
|
+
allScore: item.allScore ? item.allScore : '-',
|
|
196
|
+
count: item.count ? item.count : '-',
|
|
197
|
+
})
|
|
198
|
+
})
|
|
199
|
+
this.question = arr
|
|
200
|
+
this.totalScore()
|
|
109
201
|
},
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
default: false
|
|
118
|
-
},
|
|
119
|
-
butShow: {
|
|
120
|
-
type: Boolean,
|
|
121
|
-
default: true
|
|
202
|
+
getContent() {
|
|
203
|
+
let arr = []
|
|
204
|
+
let state = false
|
|
205
|
+
for (let i = 0; i < this.question.length; i++) {
|
|
206
|
+
if (this.question[i].allScore === '-' || this.question[i].count === '-') {
|
|
207
|
+
state = true
|
|
208
|
+
continue;
|
|
122
209
|
}
|
|
210
|
+
arr.push({
|
|
211
|
+
...this.question[i],
|
|
212
|
+
easyScore: this.question[i].easy ? this.question[i].easyScore : '',
|
|
213
|
+
hardScore: this.question[i].hard ? this.question[i].hardScore : '',
|
|
214
|
+
midScore: this.question[i].mid ? this.question[i].midScore : '',
|
|
215
|
+
easy: this.question[i].easyScore ? this.question[i].easy : '',
|
|
216
|
+
hard: this.question[i].hardScore ? this.question[i].hard : '',
|
|
217
|
+
mid: this.question[i].midScore ? this.question[i].mid : ''
|
|
218
|
+
})
|
|
219
|
+
}
|
|
220
|
+
return {
|
|
221
|
+
data: arr,
|
|
222
|
+
total: this.totalNum,
|
|
223
|
+
state: state
|
|
224
|
+
}
|
|
225
|
+
},
|
|
226
|
+
// 添加数据
|
|
227
|
+
addData(v, n) {
|
|
228
|
+
const len = this.question.length
|
|
229
|
+
if (n) n(len)
|
|
230
|
+
if (len === 6) return
|
|
231
|
+
if (this.empty) {
|
|
232
|
+
this.empty = false
|
|
233
|
+
this.question = []
|
|
234
|
+
}
|
|
235
|
+
this.question.push({
|
|
236
|
+
...v,
|
|
237
|
+
quesType: v.quesType,
|
|
238
|
+
quesName: v.quesName,
|
|
239
|
+
easyScore: '',
|
|
240
|
+
hardScore: '',
|
|
241
|
+
midScore: '',
|
|
242
|
+
easy: '',
|
|
243
|
+
hard: '',
|
|
244
|
+
mid: '',
|
|
245
|
+
allScore: '-',
|
|
246
|
+
count: '-',
|
|
247
|
+
})
|
|
123
248
|
},
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
249
|
+
cancel(i) {
|
|
250
|
+
this.$emit('cancel', this.question[i])
|
|
251
|
+
this.question.splice(i, 1)
|
|
252
|
+
this.totalScore()
|
|
253
|
+
},
|
|
254
|
+
totalQuestions(v, i, n) {
|
|
255
|
+
const value = Number(v.target.value);
|
|
256
|
+
if (i === 1) this.question[n].easy = value === 0 ? '' : value
|
|
257
|
+
if (i === 2) this.question[n].hard = value === 0 ? '' : value
|
|
258
|
+
if (i === 3) this.question[n].mid = value === 0 ? '' : value
|
|
259
|
+
if (i === 4) this.question[n].easyScore = value === 0 ? '' : value
|
|
260
|
+
if (i === 5) this.question[n].hardScore = value === 0 ? '' : value
|
|
261
|
+
if (i === 6) this.question[n].midScore = value === 0 ? '' : value
|
|
262
|
+
const total = (this.question[n].easy === '' ? 0 : this.question[n].easy) + (this.question[n].hard === '' ? 0 : this.question[n].hard) + (this.question[n].mid === '' ? 0 : this.question[n].mid)
|
|
263
|
+
this.question[n].count = (total === 0) ? '-' : total
|
|
264
|
+
const num1 = this.question[n].easyScore === '' ? 0 : this.question[n].easyScore * this.question[n].easy
|
|
265
|
+
const num2 = this.question[n].hardScore === '' ? 0 : this.question[n].hardScore * this.question[n].hard
|
|
266
|
+
const num3 = this.question[n].midScore === '' ? 0 : this.question[n].midScore * this.question[n].mid
|
|
267
|
+
const total2 = num1 + num2 + num3
|
|
268
|
+
this.question[n].allScore = (total2 === 0) ? '-' : total2
|
|
269
|
+
this.totalScore()
|
|
270
|
+
},
|
|
271
|
+
totalScore() {
|
|
272
|
+
this.easyNum = 0
|
|
273
|
+
this.hardNum = 0
|
|
274
|
+
this.midNum = 0
|
|
275
|
+
this.question.forEach(x => {
|
|
276
|
+
this.easyNum += x.easyScore === '' ? 0 : Number(x.easyScore) * Number(x.easy)
|
|
277
|
+
this.hardNum += x.hardScore === '' ? 0 : Number(x.hardScore) * Number(x.hard)
|
|
278
|
+
this.midNum += x.midScore === '' ? 0 : Number(x.midScore) * Number(x.mid)
|
|
279
|
+
})
|
|
280
|
+
this.totalNum = this.easyNum + this.hardNum + this.midNum
|
|
281
|
+
},
|
|
282
|
+
// 数字转大写
|
|
283
|
+
toChineseNum(num) {
|
|
284
|
+
const chnNumChar = ["零", "一", "二", "三", "四", "五", "六", "七", "八", "九"];
|
|
285
|
+
if (num >= 10) {
|
|
286
|
+
if (num === 10) {
|
|
287
|
+
return "十"
|
|
288
|
+
} else {
|
|
289
|
+
return "十" + chnNumChar[num % 10]
|
|
153
290
|
}
|
|
291
|
+
}
|
|
292
|
+
return chnNumChar[num];
|
|
154
293
|
},
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
},
|
|
177
|
-
getContent() {
|
|
178
|
-
let arr = []
|
|
179
|
-
let state = false
|
|
180
|
-
for(let i=0; i< this.question.length; i++) {
|
|
181
|
-
if(this.question[i].allScore === '-' || this.question[i].count === '-') {
|
|
182
|
-
state = true
|
|
183
|
-
continue;
|
|
184
|
-
}
|
|
185
|
-
arr.push({
|
|
186
|
-
...this.question[i],
|
|
187
|
-
easyScore: this.question[i].easy? this.question[i].easyScore: '',
|
|
188
|
-
hardScore: this.question[i].hard? this.question[i].hardScore: '',
|
|
189
|
-
midScore: this.question[i].mid? this.question[i].midScore: '',
|
|
190
|
-
easy: this.question[i].easyScore? this.question[i].easy: '',
|
|
191
|
-
hard: this.question[i].hardScore? this.question[i].hard: '',
|
|
192
|
-
mid: this.question[i].midScore? this.question[i].mid: ''
|
|
193
|
-
})
|
|
194
|
-
}
|
|
195
|
-
return {
|
|
196
|
-
data: arr,
|
|
197
|
-
total: this.totalNum,
|
|
198
|
-
state: state
|
|
199
|
-
}
|
|
200
|
-
},
|
|
201
|
-
// 添加数据
|
|
202
|
-
addData(v,n) {
|
|
203
|
-
const len = this.question.length
|
|
204
|
-
if(n) n(len)
|
|
205
|
-
if(len === 6) return
|
|
206
|
-
if(this.empty) {
|
|
207
|
-
this.empty = false
|
|
208
|
-
this.question = []
|
|
209
|
-
}
|
|
210
|
-
this.question.push({
|
|
211
|
-
...v,
|
|
212
|
-
quesType: v.quesType,
|
|
213
|
-
quesName: v.quesName,
|
|
214
|
-
easyScore:'',
|
|
215
|
-
hardScore:'',
|
|
216
|
-
midScore: '',
|
|
217
|
-
easy: '',
|
|
218
|
-
hard: '',
|
|
219
|
-
mid: '',
|
|
220
|
-
allScore: '-',
|
|
221
|
-
count: '-',
|
|
222
|
-
})
|
|
223
|
-
},
|
|
224
|
-
cancel(i) {
|
|
225
|
-
this.$emit('cancel',this.question[i])
|
|
226
|
-
this.question.splice(i,1)
|
|
227
|
-
this.totalScore()
|
|
228
|
-
},
|
|
229
|
-
totalQuestions(v,i,n) {
|
|
230
|
-
const value = Number(v.target.value);
|
|
231
|
-
if(i === 1) this.question[n].easy = value === 0? '' : value
|
|
232
|
-
if(i === 2) this.question[n].hard = value === 0? '' : value
|
|
233
|
-
if(i === 3) this.question[n].mid = value === 0? '' : value
|
|
234
|
-
if(i === 4) this.question[n].easyScore = value === 0? '' : value
|
|
235
|
-
if(i === 5) this.question[n].hardScore = value === 0? '' : value
|
|
236
|
-
if(i === 6) this.question[n].midScore = value === 0? '' : value
|
|
237
|
-
const total = (this.question[n].easy === ''? 0: this.question[n].easy) + (this.question[n].hard === ''? 0: this.question[n].hard) + (this.question[n].mid === ''? 0: this.question[n].mid)
|
|
238
|
-
this.question[n].count = (total === 0)? '-' : total
|
|
239
|
-
const num1 = this.question[n].easyScore === ''? 0: this.question[n].easyScore * this.question[n].easy
|
|
240
|
-
const num2 = this.question[n].hardScore === ''? 0: this.question[n].hardScore * this.question[n].hard
|
|
241
|
-
const num3 = this.question[n].midScore === ''? 0: this.question[n].midScore * this.question[n].mid
|
|
242
|
-
const total2 = num1 + num2 + num3
|
|
243
|
-
this.question[n].allScore = (total2 === 0)? '-' : total2
|
|
244
|
-
this.totalScore()
|
|
245
|
-
},
|
|
246
|
-
totalScore() {
|
|
247
|
-
this.easyNum = 0
|
|
248
|
-
this.hardNum = 0
|
|
249
|
-
this.midNum = 0
|
|
250
|
-
this.question.forEach(x => {
|
|
251
|
-
this.easyNum += x.easyScore === '' ? 0: Number(x.easyScore) * Number(x.easy)
|
|
252
|
-
this.hardNum += x.hardScore === '' ? 0: Number(x.hardScore) * Number(x.hard)
|
|
253
|
-
this.midNum += x.midScore === '' ? 0: Number(x.midScore) * Number(x.mid)
|
|
254
|
-
})
|
|
255
|
-
this.totalNum = this.easyNum + this.hardNum + this.midNum
|
|
256
|
-
},
|
|
257
|
-
// 数字转大写
|
|
258
|
-
toChineseNum(num) {
|
|
259
|
-
const chnNumChar = ["零","一","二","三","四","五","六","七","八","九"];
|
|
260
|
-
if(num >= 10) {
|
|
261
|
-
if(num === 10) {
|
|
262
|
-
return "十"
|
|
263
|
-
}else {
|
|
264
|
-
return "十" + chnNumChar[num % 10]
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
return chnNumChar[num];
|
|
268
|
-
},
|
|
269
|
-
isNumberKey(event,num) {
|
|
270
|
-
const charCode = (event.which) ? event.which : event.keyCode;
|
|
271
|
-
const val = event.target.value;
|
|
272
|
-
if(val.length > 2) event.preventDefault();
|
|
273
|
-
if(num === 1) {
|
|
274
|
-
if (charCode > 31 && (charCode < 48 || charCode > 57)) event.preventDefault();
|
|
275
|
-
}else {
|
|
276
|
-
if (charCode === 46) {
|
|
277
|
-
if (val.indexOf('.') !== -1)
|
|
278
|
-
event.preventDefault();
|
|
279
|
-
else
|
|
280
|
-
return true;
|
|
281
|
-
} else if (charCode > 31 && (charCode < 48 || charCode > 57))
|
|
282
|
-
event.preventDefault();
|
|
283
|
-
}
|
|
284
|
-
if (this.valueState(event.target.value) && String.fromCharCode(charCode) === '0') event.preventDefault();
|
|
285
|
-
},
|
|
286
|
-
valueState(v) {
|
|
287
|
-
return v === '' || v === undefined || v === null;
|
|
288
|
-
},
|
|
289
|
-
}
|
|
294
|
+
isNumberKey(event, num) {
|
|
295
|
+
const charCode = (event.which) ? event.which : event.keyCode;
|
|
296
|
+
const val = event.target.value;
|
|
297
|
+
if (val.length > 2) event.preventDefault();
|
|
298
|
+
if (num === 1) {
|
|
299
|
+
if (charCode > 31 && (charCode < 48 || charCode > 57)) event.preventDefault();
|
|
300
|
+
} else {
|
|
301
|
+
if (charCode === 46) {
|
|
302
|
+
if (val.indexOf('.') !== -1)
|
|
303
|
+
event.preventDefault();
|
|
304
|
+
else
|
|
305
|
+
return true;
|
|
306
|
+
} else if (charCode > 31 && (charCode < 48 || charCode > 57))
|
|
307
|
+
event.preventDefault();
|
|
308
|
+
}
|
|
309
|
+
if (this.valueState(event.target.value) && String.fromCharCode(charCode) === '0') event.preventDefault();
|
|
310
|
+
},
|
|
311
|
+
valueState(v) {
|
|
312
|
+
return v === '' || v === undefined || v === null;
|
|
313
|
+
},
|
|
314
|
+
}
|
|
290
315
|
}
|
|
291
316
|
</script>
|
|
292
317
|
|
|
293
318
|
<style scoped>
|
|
294
319
|
.question {
|
|
295
|
-
|
|
320
|
+
width: 100%;
|
|
296
321
|
}
|
|
297
322
|
|
|
298
323
|
.question table {
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
324
|
+
width: 100%;
|
|
325
|
+
border-top: 1px solid #ccc;
|
|
326
|
+
border-left: 1px solid #ccc;
|
|
302
327
|
}
|
|
303
328
|
|
|
304
329
|
.question table th, .question table td {
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
330
|
+
font-size: 14px;
|
|
331
|
+
text-align: center;
|
|
332
|
+
padding: 5px 0;
|
|
333
|
+
border-bottom: 1px solid #ccc;
|
|
334
|
+
border-right: 1px solid #ccc;
|
|
335
|
+
font-weight: 400;
|
|
311
336
|
}
|
|
312
337
|
|
|
313
338
|
.qu-input {
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
339
|
+
width: 60px;
|
|
340
|
+
display: inline-block;
|
|
341
|
+
overflow: hidden;
|
|
317
342
|
}
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
343
|
+
|
|
344
|
+
.qu-input input {
|
|
345
|
+
border: 0;
|
|
346
|
+
outline: none;
|
|
347
|
+
text-align: center;
|
|
348
|
+
width: 80px;
|
|
323
349
|
}
|
|
324
350
|
|
|
325
351
|
.but {
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
352
|
+
margin-left: 1px;
|
|
353
|
+
font-size: 12px;
|
|
354
|
+
background-color: transparent;
|
|
355
|
+
border: 1px solid #000;
|
|
356
|
+
border-radius: 3px;
|
|
357
|
+
padding: 2px 5px;
|
|
358
|
+
cursor: pointer;
|
|
359
|
+
min-width: 60px;
|
|
360
|
+
height: 21px;
|
|
335
361
|
}
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
362
|
+
|
|
363
|
+
.buts {
|
|
364
|
+
margin-left: 1px;
|
|
365
|
+
font-size: 12px;
|
|
366
|
+
background-color: transparent;
|
|
367
|
+
border-radius: 3px;
|
|
368
|
+
padding: 2px 5px;
|
|
369
|
+
cursor: pointer;
|
|
370
|
+
min-width: 60px;
|
|
371
|
+
height: 21px;
|
|
372
|
+
display: inline-block;
|
|
373
|
+
font-weight: bold;
|
|
347
374
|
}
|
|
348
375
|
</style>
|