zydx-plus 1.31.177 → 1.32.177
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
CHANGED
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
<template>
|
|
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="!readOnly">操作</th>
|
|
13
|
+
</tr>
|
|
14
|
+
<tbody v-for="(item,index) in question" :key="index">
|
|
15
|
+
<tr>
|
|
16
|
+
<td rowspan="2">{{ toChineseNum(index + 1) }}</td>
|
|
17
|
+
<td rowspan="2">{{ item.quesName }}</td>
|
|
18
|
+
<td>
|
|
19
|
+
<div class="qu-input" :style="{'margin-left': readOnly?'0px':'-10px'}">
|
|
20
|
+
<span v-if="readOnly">{{ item.easy }}</span>
|
|
21
|
+
<input v-else type="number" placeholder="题量" :value="item.easy" @input="totalQuestions($event,1,index)" @keypress="isNumberKey($event,1)" />
|
|
22
|
+
</div>
|
|
23
|
+
</td>
|
|
24
|
+
<td>
|
|
25
|
+
<div class="qu-input" :style="{'margin-left': readOnly?'0px':'-10px'}">
|
|
26
|
+
<span v-if="readOnly">{{ item.hard }}</span>
|
|
27
|
+
<input v-else type="number" placeholder="题量" :value="item.hard" @input="totalQuestions($event,2,index)" @keypress="isNumberKey($event,1)" />
|
|
28
|
+
</div>
|
|
29
|
+
</td>
|
|
30
|
+
<td>
|
|
31
|
+
<div class="qu-input" :style="{'margin-left': readOnly?'0px':'-10px'}">
|
|
32
|
+
<span v-if="readOnly">{{ item.mid }}</span>
|
|
33
|
+
<input v-else type="number" placeholder="题量" :value="item.mid" @input="totalQuestions($event,3,index)" @keypress="isNumberKey($event,1)" />
|
|
34
|
+
</div>
|
|
35
|
+
</td>
|
|
36
|
+
<td rowspan="2">{{ item.count }}</td>
|
|
37
|
+
<td rowspan="2">{{ item.allScore }}</td>
|
|
38
|
+
<td rowspan="2" v-if="!readOnly">
|
|
39
|
+
<button class="but" @click="cancel(index)">撤销选择</button>
|
|
40
|
+
</td>
|
|
41
|
+
</tr>
|
|
42
|
+
<tr>
|
|
43
|
+
<td>
|
|
44
|
+
<div class="qu-input" :style="{'margin-left': readOnly?'0px':'-10px'}">
|
|
45
|
+
<span v-if="readOnly">{{ item.easyScore }}</span>
|
|
46
|
+
<input v-else type="number" placeholder="分值" :value="item.easyScore" @input="totalQuestions($event,4,index)" @keypress="isNumberKey($event,2)" />
|
|
47
|
+
</div>
|
|
48
|
+
</td>
|
|
49
|
+
<td>
|
|
50
|
+
<div class="qu-input" :style="{'margin-left': readOnly?'0px':'-10px'}">
|
|
51
|
+
<span v-if="readOnly">{{ item.hardScore }}</span>
|
|
52
|
+
<input v-else type="number" placeholder="分值" :value="item.hardScore" @input="totalQuestions($event,5,index)" @keypress="isNumberKey($event,2)" />
|
|
53
|
+
</div>
|
|
54
|
+
</td>
|
|
55
|
+
<td>
|
|
56
|
+
<div class="qu-input" :style="{'margin-left': readOnly?'0px':'-10px'}">
|
|
57
|
+
<span v-if="readOnly">{{ item.midScore }}</span>
|
|
58
|
+
<input v-else type="number" placeholder="分值" :value="item.midScore" @input="totalQuestions($event,6,index)" @keypress="isNumberKey($event,2)" />
|
|
59
|
+
</div>
|
|
60
|
+
</td>
|
|
61
|
+
</tr>
|
|
62
|
+
</tbody>
|
|
63
|
+
<tr>
|
|
64
|
+
<td colspan="2">合计分值</td>
|
|
65
|
+
<td>{{ easyNum === 0? '-': easyNum }}</td>
|
|
66
|
+
<td>{{ hardNum === 0? '-': hardNum }}</td>
|
|
67
|
+
<td>{{ midNum === 0? '-': midNum }}</td>
|
|
68
|
+
<td>试卷总分</td>
|
|
69
|
+
<td :colspan="readOnly? 1: 2">{{ totalNum === 0? '-': totalNum }}</td>
|
|
70
|
+
</tr>
|
|
71
|
+
</table>
|
|
72
|
+
</div>
|
|
73
|
+
</template>
|
|
74
|
+
|
|
75
|
+
<script>
|
|
76
|
+
import TableHead from "@/components/data_table/src/table_head.vue";
|
|
77
|
+
|
|
78
|
+
export default {
|
|
79
|
+
name: "zydx-question",
|
|
80
|
+
components: {TableHead},
|
|
81
|
+
data() {
|
|
82
|
+
return {
|
|
83
|
+
question: [],
|
|
84
|
+
easyNum: 0,
|
|
85
|
+
hardNum: 0,
|
|
86
|
+
midNum: 0,
|
|
87
|
+
totalNum: 0
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
props: {
|
|
91
|
+
data: {
|
|
92
|
+
type: Array,
|
|
93
|
+
default: []
|
|
94
|
+
},
|
|
95
|
+
readOnly: {
|
|
96
|
+
type: Boolean,
|
|
97
|
+
default: false
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
watch: {
|
|
101
|
+
data: {
|
|
102
|
+
handler(val) {
|
|
103
|
+
this.getQuestionReadOnly(val)
|
|
104
|
+
},
|
|
105
|
+
immediate: true
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
emits: ['cancel'],
|
|
109
|
+
methods: {
|
|
110
|
+
getQuestionReadOnly(v) {
|
|
111
|
+
let arr = []
|
|
112
|
+
v.forEach(item => {
|
|
113
|
+
arr.push({
|
|
114
|
+
quesType: item.quesType,
|
|
115
|
+
quesName: item.quesName,
|
|
116
|
+
easyScore: item.easyScore? item.easyScore: '',
|
|
117
|
+
hardScore: item.hardScore? item.hardScore: '',
|
|
118
|
+
midScore: item.midScore? item.midScore: '',
|
|
119
|
+
easy: item.easy? item.easy: '',
|
|
120
|
+
hard: item.hard? item.hard: '',
|
|
121
|
+
mid: item.mid? item.mid: '',
|
|
122
|
+
allScore: item.allScore? item.allScore: '-',
|
|
123
|
+
count: item.count? item.count: '-',
|
|
124
|
+
})
|
|
125
|
+
})
|
|
126
|
+
this.question = arr
|
|
127
|
+
this.totalScore()
|
|
128
|
+
},
|
|
129
|
+
getContent() {
|
|
130
|
+
return {
|
|
131
|
+
data: this.question,
|
|
132
|
+
total: this.totalNum,
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
// 添加数据
|
|
136
|
+
addData(v) {
|
|
137
|
+
this.question.push({
|
|
138
|
+
quesType: v.quesType,
|
|
139
|
+
quesName: v.quesName,
|
|
140
|
+
easyScore:'',
|
|
141
|
+
hardScore:'',
|
|
142
|
+
midScore: '',
|
|
143
|
+
easy: '',
|
|
144
|
+
hard: '',
|
|
145
|
+
mid: '',
|
|
146
|
+
allScore: '-',
|
|
147
|
+
count: '-',
|
|
148
|
+
})
|
|
149
|
+
},
|
|
150
|
+
cancel(i) {
|
|
151
|
+
this.$emit('cancel',this.question[i])
|
|
152
|
+
this.question.splice(i,1)
|
|
153
|
+
this.totalScore()
|
|
154
|
+
},
|
|
155
|
+
totalQuestions(v,i,n) {
|
|
156
|
+
const value = Number(v.target.value);
|
|
157
|
+
if(i === 1) this.question[n].easy = value === 0? '' : value
|
|
158
|
+
if(i === 2) this.question[n].hard = value === 0? '' : value
|
|
159
|
+
if(i === 3) this.question[n].mid = value === 0? '' : value
|
|
160
|
+
if(i === 4) this.question[n].easyScore = value === 0? '' : value
|
|
161
|
+
if(i === 5) this.question[n].hardScore = value === 0? '' : value
|
|
162
|
+
if(i === 6) this.question[n].midScore = value === 0? '' : value
|
|
163
|
+
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)
|
|
164
|
+
this.question[n].count = (total === 0)? '-' : total
|
|
165
|
+
const total2 = (this.question[n].easyScore === ''? 0: this.question[n].easyScore) + (this.question[n].hardScore === ''? 0: this.question[n].hardScore) + (this.question[n].midScore === ''? 0: this.question[n].midScore)
|
|
166
|
+
this.question[n].allScore = (total2 === 0)? '-' : total2
|
|
167
|
+
this.totalScore()
|
|
168
|
+
},
|
|
169
|
+
totalScore() {
|
|
170
|
+
this.easyNum = 0
|
|
171
|
+
this.hardNum = 0
|
|
172
|
+
this.midNum = 0
|
|
173
|
+
this.question.forEach(x => {
|
|
174
|
+
this.easyNum += x.easyScore === '' ? 0: Number(x.easyScore)
|
|
175
|
+
this.hardNum += x.hardScore === '' ? 0: Number(x.hardScore)
|
|
176
|
+
this.midNum += x.midScore === '' ? 0: Number(x.midScore)
|
|
177
|
+
})
|
|
178
|
+
this.totalNum = this.easyNum + this.hardNum + this.midNum
|
|
179
|
+
},
|
|
180
|
+
// 数字转大写
|
|
181
|
+
toChineseNum(num) {
|
|
182
|
+
const chnNumChar = ["零","一","二","三","四","五","六","七","八","九"];
|
|
183
|
+
if(num >= 10) {
|
|
184
|
+
if(num === 10) {
|
|
185
|
+
return "十"
|
|
186
|
+
}else {
|
|
187
|
+
return "十" + chnNumChar[num % 10]
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
return chnNumChar[num];
|
|
191
|
+
},
|
|
192
|
+
isNumberKey(event,num) {
|
|
193
|
+
const charCode = (event.which) ? event.which : event.keyCode;
|
|
194
|
+
const val = event.target.value;
|
|
195
|
+
if(val.length > 2) event.preventDefault();
|
|
196
|
+
if(num === 1) {
|
|
197
|
+
if (charCode > 31 && (charCode < 48 || charCode > 57)) event.preventDefault();
|
|
198
|
+
}else {
|
|
199
|
+
if (charCode === 46) {
|
|
200
|
+
if (val.indexOf('.') !== -1)
|
|
201
|
+
event.preventDefault();
|
|
202
|
+
else
|
|
203
|
+
return true;
|
|
204
|
+
} else if (charCode > 31 && (charCode < 48 || charCode > 57))
|
|
205
|
+
event.preventDefault();
|
|
206
|
+
}
|
|
207
|
+
if (this.valueState(event.target.value) && String.fromCharCode(charCode) === '0') event.preventDefault();
|
|
208
|
+
},
|
|
209
|
+
valueState(v) {
|
|
210
|
+
return v === '' || v === undefined || v === null;
|
|
211
|
+
},
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
</script>
|
|
215
|
+
|
|
216
|
+
<style scoped>
|
|
217
|
+
.question {
|
|
218
|
+
width: 100%;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
.question table {
|
|
222
|
+
width: 100%;
|
|
223
|
+
border-top: 1px solid #ccc;
|
|
224
|
+
border-left: 1px solid #ccc;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
.question table th, .question table td {
|
|
228
|
+
font-size: 14px;
|
|
229
|
+
text-align: center;
|
|
230
|
+
padding: 5px 0;
|
|
231
|
+
border-bottom: 1px solid #ccc;
|
|
232
|
+
border-right: 1px solid #ccc;
|
|
233
|
+
font-weight: 400;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
.qu-input {
|
|
237
|
+
width: 60px;
|
|
238
|
+
display: inline-block;
|
|
239
|
+
overflow: hidden;
|
|
240
|
+
}
|
|
241
|
+
.qu-input input{
|
|
242
|
+
border: 0;
|
|
243
|
+
outline: none;
|
|
244
|
+
text-align: center;
|
|
245
|
+
width: 80px;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
.but {
|
|
249
|
+
margin-left: 1px;
|
|
250
|
+
font-size: 12px;
|
|
251
|
+
background-color: transparent;
|
|
252
|
+
border: 1px solid #000;
|
|
253
|
+
border-radius: 3px;
|
|
254
|
+
padding: 2px 5px;
|
|
255
|
+
cursor: pointer;
|
|
256
|
+
min-width: 60px;
|
|
257
|
+
height: 21px;
|
|
258
|
+
}
|
|
259
|
+
</style>
|
package/src/index.js
CHANGED
|
@@ -31,6 +31,7 @@ import sketchpad from './components/sketchpad/index';
|
|
|
31
31
|
import pictureViewer from './components/pictureViewer/index';
|
|
32
32
|
import lessonTemplate from './components/lesson_template/index';
|
|
33
33
|
import paper from './components/word2/index';
|
|
34
|
+
import question from './components/question/index';
|
|
34
35
|
|
|
35
36
|
const components = [
|
|
36
37
|
Calendar,
|
|
@@ -63,7 +64,8 @@ const components = [
|
|
|
63
64
|
sketchpad,
|
|
64
65
|
pictureViewer,
|
|
65
66
|
lessonTemplate,
|
|
66
|
-
paper
|
|
67
|
+
paper,
|
|
68
|
+
question
|
|
67
69
|
];
|
|
68
70
|
|
|
69
71
|
function install(app) {
|
|
@@ -75,7 +77,7 @@ function install(app) {
|
|
|
75
77
|
}
|
|
76
78
|
|
|
77
79
|
export default {
|
|
78
|
-
version: '1.
|
|
80
|
+
version: '1.32.177',
|
|
79
81
|
install,
|
|
80
82
|
Calendar,
|
|
81
83
|
Message,
|
|
@@ -109,6 +111,7 @@ export default {
|
|
|
109
111
|
sketchpad,
|
|
110
112
|
pictureViewer,
|
|
111
113
|
lessonTemplate,
|
|
112
|
-
paper
|
|
114
|
+
paper,
|
|
115
|
+
question
|
|
113
116
|
};
|
|
114
117
|
|