lvmax vor 3 Monaten
Ursprung
Commit
f73651d727
2 geänderte Dateien mit 68 neuen und 51 gelöschten Zeilen
  1. 1 1
      examJs/examRequest.js
  2. 67 50
      pages/examPage/examStart.vue

+ 1 - 1
examJs/examRequest.js

@@ -78,7 +78,7 @@ export function request(url, requestType, requestData) {
 	})
 	} else {
 		request = uni.request({
-			url: "http://10.11.12.101:8080" + url,
+			url: "http://10.11.12.100:8080" + url,
 			method: requestType,
 			header: {
 				"x-access-token": sessionStorage.getItem("token"),

+ 67 - 50
pages/examPage/examStart.vue

@@ -36,14 +36,13 @@
 				</l-divider>
 				<button type="primary" style="margin-top: 10px;" @click="backPage">返回</button>
 			</uni-card>
-
 		</uni-col>
 		<uni-col :span="15" style="margin-top: 30px">
 			<uni-card style="height: 92vh;">
 				<scroll-view scroll-y="true" class="scroll-Y">
 					<uni-section :title="subjectTypes[subjectType-1]+'、'+(subjectNum+(pageNo-1)*pageSize)" type="line"
 						padding>
-						<view v-if="scantronType!==7&&scantronType!==8" id="scantronNodes">
+						<view id="scantronNodes">
 						</view>
 						<template v-if="scantron.type===1||scantron.type===3">
 							<view>
@@ -80,7 +79,6 @@
 							</view>
 						</template>
 						<template v-if="scantron.type===4">
-
 							<view>
 								<l-divider color="#aaaa7f">
 								</l-divider>
@@ -97,7 +95,6 @@
 							</view>
 						</template>
 						<template v-if="scantron.type===5">
-
 							<view>
 								<l-divider color="#aaaa7f">
 								</l-divider>
@@ -285,7 +282,6 @@
 								</l-divider>
 							</view>
 							<view style="height: 600px;width: 800;background-color: #ffffff;">
-
 								<movable-area
 									:style="`height: 500px;width: 700px;background-color: #8c8c8c;margin: auto;background-image: url('${drag[subjectNum].background.url}');background-size:${drag[subjectNum].background.width}px ${drag[subjectNum].background.height}px;background-repeat: no-repeat;`">
 									<!-- <rich-text :nodes="scantron.content"></rich-text> -->
@@ -293,44 +289,34 @@
 									<template v-for="item in drag[subjectNum].answer">
 										<view
 											:style="`position: absolute;width: ${item.width}px;height: ${item.height}px;border:solid 1px black;left:${item.x}px;top:${item.y}px;`">
-
+											{{Number(item.id.replace('answer',''))+1}}
 										</view>
 									</template>
-
 									<template v-for="item in drag[subjectNum].option">
 										<movable-view v-if="mbvShow" :id="item.id" :disabled="!disabledDrag"
 											:style="'width: '+item.width+'px;height: '+item.height+'px;background-color: '+item.backgroundColor+';'"
 											direction="all" :x="item.x" :y="item.y" @mousedown="onMousedown(item)"
 											@change="onChange">
-
-
 										</movable-view>
 										<movable-view v-if="!mbvShow" :id="item.id" :disabled="!disabledDrag"
 											:style="'width: '+item.width+'px;height: '+item.height+'px;background-color: '+item.backgroundColor+';'"
 											direction="all" :x="item.x" :y="item.y" @mousedown="onMousedown(item)"
 											@change="onChange">
-
-
 										</movable-view>
 									</template>
 								</movable-area>
-
 							</view>
-
 						</template>
 						<template v-if="scantron.type===8">
 							<view style="height: 5vh;">
-
 							</view>
 							<view>
 								<l-divider color="#aaaa7f">
 								</l-divider>
 							</view>
-
 							<view>
 								<view
 									style="height: 600px;width: 800px;background-color: #8c8c8c;margin: auto;padding-top: 50px;">
-
 									<movable-area
 										style="height: 550px;width: 700px;background-color: #f6f6f6;margin: auto;">
 										<canvas canvas-id="lineCanvas" style="width: 700px; height: 500px;">
@@ -353,11 +339,10 @@
 					</uni-section>
 					<view v-if="examObject.records[subjectNum-1].disable"
 						style="position: absolute;top: 0;background-color:rgb(255, 255, 255,0) ;width: 100%;height: 140%;">
-
 					</view>
 				</scroll-view>
 				<view style="padding: 1vh;">
-					<button v-if="scantron.type!==1&&scantron.type!==3" type="primary"
+					<button :disabled="!disabledDrag" v-if="scantron.type!==1&&scantron.type!==3" type="primary"
 						style="width: 20%;display: inline-block;margin-right: 1%;" @click="answerConfirm">答案确认
 					</button><button type="primary" style="width: 20%;display: inline-block;"
 						@click="answerInspect(3)">答案解析
@@ -373,7 +358,6 @@
 								<strong>很遗憾,做错了!</strong>
 							</view>
 						</view>
-
 						<view style="font-family:  '黑体';font-size: 20px;padding-top: 10px;">
 							<strong>答案:</strong>
 						</view>
@@ -386,7 +370,6 @@
 						<view v-if="answerAnalysis.analysis!==null"
 							style="font-family:  '楷体';font-size: 20px;padding-top: 10px;">
 							{{"  "+answerAnalysis.analysis}}
-
 						</view>
 					</view>
 				</scroll-view>
@@ -395,7 +378,6 @@
 						@click="previousQuestion">上一题</button>
 					<button type="primary" style="margin-left: 1%;margin-top: 10px;width: 48%;display: inline-block;"
 						@click="nextQuestion">下一题</button>
-
 				</view>
 			</uni-card>
 		</uni-col>
@@ -435,13 +417,10 @@
 						style="display: inline-block;width: 40px;border: #c1c1c1 solid 1px;border-radius: 3px;font-size: 20px;padding-top: 3px;"
 						v-model="pageSize" type="number" @blur="writePageNo=1;pageReplace(1,pageSize,0)" />条
 				</view>
-
 				<l-divider color="#251e75" />
-
 				<view>
 					<button type="primary" style="margin-top: 10px;" @click="previousPage">上一页</button>
 					<button type="primary" style="margin-top: 10px;" @click="nextPage">下一页</button>
-
 				</view>
 			</uni-card>
 		</uni-col>
@@ -647,6 +626,7 @@
 			},
 
 			pageReplace(thisPageNo, thisPageSize, num) {
+				this.drag = []
 				thisPageNo = Number(thisPageNo) + Number(num)
 				thisPageSize = Number(thisPageSize)
 				num =
@@ -678,6 +658,9 @@
 				console.log(this.scantron);
 				if (this.scantron.type !== 7 && this.scantron.type !== 8) {
 					document.getElementById('scantronNodes').innerHTML = this.scantron.content
+				} else {
+					console.log(this.scantron.content.split('%||||||||%')[0]);
+					document.getElementById('scantronNodes').innerHTML = this.scantron.content.split('%||||||||%')[0]
 				}
 
 				let combination = setInterval(() => {
@@ -716,7 +699,9 @@
 					this.drag[this.subjectNum].option = []
 					this.drag[this.subjectNum].background = {}
 					let content = this.stringToHTML(this.scantron.content)
+
 					for (var i = 0; i < content.children.length; i++) {
+						console.log(content.children[i]);
 						let thisTop = content.children[i].style.top.toString().replace("px", "")
 						let thisLeft = content.children[i].style.left.toString().replace("px", "")
 						let thisWidth = content.children[i].style.width.toString().replace("px", "")
@@ -1116,11 +1101,12 @@
 						// 	}
 						// }
 						if (dragOne !== undefined) {
-
 							this.radioAdd(this.dragItem, dragOne.id.replace("answer", ""), this.scantron)
 						}
-						this.disabledDrag = true
-
+						
+						
+							this.disabledDrag = true
+						
 					}, 700)
 				}
 
@@ -1469,6 +1455,7 @@
 									index: qIndex,
 									questionType: this.scantronType
 								})
+								this.scantron.answerList[Number(index) - 1].blankcontent = value.id
 							} else {
 								this.examObject.records[this.subjectNum - 1].isAnswer = false
 							}
@@ -1488,8 +1475,8 @@
 							index: qIndex,
 							questionType: this.scantronType
 						})
+						this.scantron.answerList[Number(index) - 1].blankcontent = value.id
 					}
-
 				} else if (this.scantron.type === 8) {
 					console.log(this.connectionContentALL[qIndex]);
 					let info = value
@@ -1504,6 +1491,7 @@
 					}
 					let b = true
 					console.log(this.userExamAnswers.length);
+					this.scantron.answerList[Number(index) - 1].blankcontent = value
 					for (var j = 0; j < this.userExamAnswers.length; j++) {
 						if (this.userExamAnswers[j].index !== qIndex) {
 							arr.push(this.userExamAnswers[j])
@@ -1521,7 +1509,7 @@
 									})
 								} else {
 									console.log(value);
-									this.scantron.answerList[Number(index) - 1].blankcontent = value
+
 									bc = false
 								}
 							}
@@ -1531,7 +1519,7 @@
 									tag: index,
 									content: value
 								})
-								this.scantron.answerList[Number(index) - 1].blankcontent = value
+
 							}
 							if (arrAnswer.length !== 0) {
 								arr.push({
@@ -1540,6 +1528,7 @@
 									coordinates: JSON.stringify(this.connectionContentALL[qIndex]),
 									questionType: this.scantronType
 								})
+
 							} else {
 								this.examObject.records[this.subjectNum - 1].isAnswer =
 									false
@@ -1565,6 +1554,8 @@
 					}
 				}
 				this.userExamAnswers = arr
+				console.log(this.scantron.answerList[Number(index) - 1]);
+				console.log(this.userExamAnswers);
 			},
 			// 类型点击
 			subjectTypeClick(item) {
@@ -1605,7 +1596,7 @@
 				this.answerInspect()
 			}, // 答案检查
 			answerInspect(state) {
-				console.log(this.examObject.records[this.subjectNum - 1].disable);
+				console.log(this.examObject.records[this.subjectNum - 1]);
 				if (this.examObject.records[this.subjectNum - 1].disable) {
 					console.log("0");
 					return
@@ -1625,34 +1616,60 @@
 						}
 					}
 				} else if (this.scantron.type === 5) {
-					console.log(this.scantron.answerList);
-					for (var i = 0; i < this.scantron.answerList.length; i++) {
-
-						for (var j = 0; j < this.scantron.answerList.length; j++) {
-							this.answerAnalysis.youAnswerState = 1
+					if(!this.examObject.records[this.subjectNum - 1].answerOrder){
+						console.log(this.scantron.answerList);
+							for (var i = 0; i < this.scantron.answerList.length; i++) {
+								this.answerAnalysis.youAnswerState = 1
+								for (var j = 0; j < this.scantron.answerList.length; j++) {
+									if (this.scantron.answerList[i].isRight) {
+										let arrAwn = this.scantron.answerList[i].content.split("||")
+											for (var a = 0; a < arrAwn.length; a++) {
+												if (arrAwn[a] === this.scantron.answerList[j].blankcontent) {
+													this.answerAnalysis.youAnswerState = 0
+													break
+													}
+											}
+														
+									}
+								}
+							if (this.answerAnalysis.youAnswerState === 1) {
+							break
+							}			
+						}
+						for (var i = 0; i < this.scantron.answerList.length; i++) {
+							if (this.scantron.answerList[i].isRight) {
+								this.answerAnalysis.answer += (i + 1) + "、" + this.scantron.answerList[i].content + ";"
+							}
+						}
+					}else{
+						for (var i = 0; i < this.scantron.answerList.length; i++) {
 							if (this.scantron.answerList[i].isRight) {
 								let arrAwn = this.scantron.answerList[i].content.split("||")
-								for (var a = 0; a < arrAwn.length; a++) {
-									if (arrAwn[a] === this.scantron.answerList[j].blankcontent) {
-										this.answerAnalysis.youAnswerState = 0
-										break
+									for (var a = 0; a < arrAwn.length; a++) {
+										if (arrAwn[a] === this.scantron.answerList[i].blankcontent) {
+											this.answerAnalysis.youAnswerState = 0
+											break
+											}
 									}
-								}
-								if (this.answerAnalysis.youAnswerState === 1) {
-									break
-								}
+												
 							}
+							if (this.answerAnalysis.youAnswerState === 1) {
+							break
+							}			
 						}
-
-						if (this.scantron.answerList[i].isRight) {
-							this.answerAnalysis.answer += (i + 1) + "、" + this.scantron.answerList[i].content + ";"
+						for (var i = 0; i < this.scantron.answerList.length; i++) {
+							if (this.scantron.answerList[i].isRight) {
+								this.answerAnalysis.answer += (i + 1) + "、" + this.scantron.answerList[i].content + ";"
+							}
 						}
 					}
+					
 				} else if (this.scantron.type === 7 || this.scantron.type === 8) {
-					let a=1
+					let a = 1
 					this.answerAnalysis.youAnswerState = 0
+					console.log(this.scantron.answerList);
 					for (var i = 0; i < this.scantron.answerList.length; i++) {
-						let a=1
+						let a = 1
 						for (var j = 0; j < this.scantron.answerList.length; j++) {
 
 							if (this.scantron.answerList[i].isRight) {
@@ -1662,7 +1679,7 @@
 							}
 
 						}
-
+						console.log(this.scantron.answerList);
 						if (this.scantron.answerList[i].isRight) {
 							this.answerAnalysis.answer += (i + 1) + "、" + this.scantron.answerList[i].content + ";"
 						}