Pārlūkot izejas kodu

#3794 C1192 学校/个人题库--快速组卷支持自动配分功能 && #3792 C1190 学校/个人题库--阅卷专用,快速组卷模式增加截图方式

XW 2 mēneši atpakaļ
vecāks
revīzija
68aa9070c4

+ 55 - 10
TEAMModelOS/ClientApp/src/common/BaseQuickPaper.vue

@@ -28,6 +28,8 @@
 					</Option>
 				</Select>
 			</div>
+			<p class="title">{{ $t('evaluation.exerciseList.totalScore') }}</p>
+			<InputNumber v-model="paperInfo.score" :max="1000" :min="1" style="width: 30%;" />
 			<p class="title">
 				{{ $t("evaluation.quickPaper.attachments") }}
 				<Upload action="" style="display: inline-block" :format="['jpg', 'jpeg', 'png', 'pdf']" :max-size="2048" multiple :before-upload="handleBeforeUpload" :show-upload-list="false">
@@ -51,6 +53,25 @@
 			<Tag color="blue">{{ condName.periodName }}</Tag>
 			<Tag color="geekblue">{{ condName.subjectName }}</Tag>
 			<Tag color="purple">{{ condName.gradeName }}</Tag>
+			<template v-if="buildMode === 'order'">
+				<p class="title">
+					{{ $t("evaluation.quickPaper.attachments1") }}
+					<Upload action="" style="display: inline-block" :format="['jpg', 'jpeg', 'png', 'pdf']" :max-size="2048" multiple :before-upload="handleBeforeUpload" :show-upload-list="false">
+						<span class="btn-upload">{{ $t("evaluation.quickPaper.upload") }}</span>
+					</Upload>
+					<span @click="screenshotChange()" style="color: #515a6e;" class="btn-upload" v-if="buildMode === 'order' && attachments.length">{{ $t("evaluation.quickPaper.screen") }}</span>
+				</p>
+				<div class="img-list">
+					<div v-if="!attachments.length" style="margin: 20px 30px; color: #9999">{{ $t("evaluation.quickPaper.empty") }}</div>
+					<div class="img-item" v-for="(img, imgIndex) in attachments" :key="imgIndex">
+						<img :src="img" alt="" srcset="" />
+						<p style="text-align: center; cursor: pointer; font-size: 12px">
+							<span @click="doPreview(img)">{{ $t("evaluation.quickPaper.preview") }}</span>
+							<span style="margin-left: 10px" @click="doDelete(imgIndex)">{{ $t("evaluation.quickPaper.del") }}</span>
+						</p>
+					</div>
+				</div>
+			</template>
 		</div>
 		<div class="type-quick-part" v-if="buildMode === 'type'">
 			<p class="title">{{ $t("evaluation.quickPaper.setItem") }}</p>
@@ -131,6 +152,7 @@
 			<p class="upper-tip" v-if="answerInputMode === 'code'">* {{ $t("evaluation.quickPaper.onlyUpper") }}</p>
 			<div class="add-type-list">
 				<span class="type-item" v-for="(type, typeIndex) in Object.keys(typeMap)" :key="typeIndex" @click="doAddItem(type)">+ {{ typeMap[type] }}</span>
+				<span class="type-item" @click="fenpeiscore()" style="background-color: #b0b0b0;" v-if="!isMarkModel">{{ $t('evaluation.quickPaper.handScore') }}</span>
 			</div>
 			<div class="items">
 				<div v-if="!orderItemsArr.length" style="margin: 20px 10px; color: #999999">{{ $t("evaluation.quickPaper.tip5") }}</div>
@@ -353,6 +375,7 @@
 					name: "",
 					periodIndex: 0,
 					subjectIndex: 0,
+					score: 0,
 					gradeIndex: [],
 					items: [
 						{
@@ -420,6 +443,13 @@
 					img: ''
 				});
 			},
+			fenpeiscore() {
+				if(!this.orderItemsArr.length) return
+				let scoreArr = this.$tools.doAverage(this.paperInfo.score, this.orderItemsArr.length, 0.5)
+				this.orderItemsArr.forEach((i, index) => {
+					i.score = scoreArr[index] || 0
+				})
+			},
 			/* 移除试题 */
 			doRemoveItem(index) {
 				this.orderItemsArr.splice(index, 1);
@@ -879,14 +909,24 @@
 			},
 			/* 保存试卷 */
 			async onConfirmSave(isAdjust) {
-				if (!this.paperInfo.name && !this.isMarkModel) {
-					this.$Message.warning(this.$t("evaluation.paperList.emptyNameTip"));
-					console.log(this.paperInfo);
-					return;
-				}
-				if(this.buildMode === "order" && this.orderScore != 100 && !isAdjust) {
-					this.isAdjustScore = true
-					return
+				if(!this.isMarkModel) {
+					if (!this.paperInfo.name) {
+						this.$Message.warning(this.$t("evaluation.paperList.emptyNameTip"));
+						console.log(this.paperInfo);
+						return;
+					}
+					if (!this.paperInfo.score) {
+						this.$Message.warning(this.$t("evaluation.quickPaper.tip19"));
+						return;
+					}
+					if (this.buildMode === "order" && this.orderScore != this.paperInfo.score) {
+						this.$Message.warning(this.$t("evaluation.quickPaper.tip20"));
+						return;
+					}
+					if(this.buildMode === "order" && this.orderScore != 100 && !isAdjust) {
+						this.isAdjustScore = true
+						return
+					}
 				}
 				
 				let saveFn = async () => {
@@ -1006,7 +1046,7 @@
 						this.orderItemsArr.forEach((item) => {
 							blobItemPromiseArr.push({
 								id: this.$tools.guid(),
-								question: this.typeMap[item.type],
+								question: item.img ? `<img src="${item.img}">` : this.typeMap[item.type],
 								option: this.getItemOptions(item),
 								type: item.type,
 								level: 1,
@@ -1072,6 +1112,11 @@
 				// 2、生成试题JSON文件
 				let blobItemPromiseArr = [];
 				if (this.buildMode === "type") {
+					let itemNum = 0
+					this.paperInfo.items.forEach(item => {
+						itemNum += item.count
+					})
+					let scoreArr = this.$tools.doAverage(this.paperInfo.score, itemNum, 0.5)
 					this.paperInfo.items.forEach(async (typeItem) => {
 						if (typeItem.count) {
 							for (var i = 0; i < typeItem.count; i++) {
@@ -1082,7 +1127,7 @@
 										question: "No." + (blobItemPromiseArr.length + 1),
 										option: this.getItemOptions(typeItem),
 										answer: this.getItemAnswer(typeItem, i),
-										score: 10,
+										score: scoreArr[blobItemPromiseArr.length] || 0,
 										knowledge: [],
 										field: 1,
 										level: 1,

+ 8 - 1
TEAMModelOS/ClientApp/src/common/MarkCanvas.vue

@@ -550,7 +550,10 @@ export default {
                     this.contentText.strokeStyle = 'blue';
                     this.contentText.rect(value.x, value.y, value.w, value.h);
                     this.contentText.stroke();
-                    this.contentText.fillStyle = 'blue'
+                    const textWidth = this.contentText.measureText(`${this.$t('answerSheet.tip2')}${this.editQuesIndex != -1 ? this.editQuesIndex + 1 : (value.qIndex !== undefined ? value.qIndex + 1 : value.addIndex)}${this.$t('answerSheet.tip14')}(${this.$t(`evaluation.${value.type}`)})`).width;
+                    this.contentText.fillStyle = "blue";
+                    this.contentText.fillRect(value.w < 0 ? (value.x + value.w) : (value.x), value.h < 0 ? (value.y + value.h - 30) : (value.y - 30), textWidth + 10, 30)
+                    this.contentText.fillStyle = '#fff'
                     this.contentText.fillText(`${this.$t('answerSheet.tip2')}${this.editQuesIndex != -1 ? this.editQuesIndex + 1 : (value.qIndex !== undefined ? value.qIndex + 1 : value.addIndex)}${this.$t('answerSheet.tip14')}(${this.$t(`evaluation.${value.type}`)})`, value.w < 0 ? (value.x + value.w + 5) : (value.x + 5), value.h < 0 ? (value.y + value.h - 10) : (value.y - 10))
                 }
             });
@@ -596,6 +599,10 @@ export default {
                     this.contentText.fillStyle = "red";
                     this.contentText.fill();// 画终点实心圆
                     this.contentText.stroke();
+                    const textWidth = this.contentText.measureText(`${this.$t('answerSheet.tip2')}${this.editQuesIndex != -1 ? this.editQuesIndex + 1 : (value.qIndex !== undefined ? value.qIndex + 1 : value.addIndex)}${this.$t('answerSheet.tip14')}(${this.$t(`evaluation.${value.type}`)})`).width;
+                    this.contentText.fillStyle = "red";
+                    this.contentText.fillRect(value.w < 0 ? (value.x + value.w) : (value.x), value.h < 0 ? (value.y + value.h - 30) : (value.y - 30), textWidth + 10, 30)
+                    this.contentText.fillStyle = "#fff";
                     this.contentText.fillText(`${this.$t('answerSheet.tip2')}${this.editQuesIndex != -1 ? this.editQuesIndex + 1 : (value.qIndex !== undefined ? value.qIndex + 1 : value.addIndex)}${this.$t('answerSheet.tip14')}(${this.$t(`evaluation.${value.type}`)})`, value.w < 0 ? (value.x + value.w + 5) : (value.x + 5), value.h < 0 ? (value.y + value.h - 10) : (value.y - 10))
                 }
             })