Explorar o código

Merge branch 'develop5.0-tmd' of http://106.12.23.251:10000/TEAMMODEL/TEAMModelOS into develop5.0-tmd

CrazyIter_Bin %!s(int64=3) %!d(string=hai) anos
pai
achega
1392770507

+ 14 - 10
TEAMModelOS/ClientApp/src/store/module/answerSheet.js

@@ -76,14 +76,14 @@ export default {
 			"pageNumBlockCount": 3, //页码块数量
 			"pageNumStartValue": 1, //页码起始值, 起始是3个空格方块开始,写1; 2个空格1个实心,写0
 
-			"threshValue": [190, 220, 10], //二值化区间(pc)-->不同扫描仪的结果图像数据有差距, 按需调整
-			"threshValuePhone": [190, 220, 10], //二值化区间(手机)
+			// "threshValue": [190, 220, 10], //二值化区间(pc)-->不同扫描仪的结果图像数据有差距, 按需调整
+			// "threshValuePhone": [190, 220, 10], //二值化区间(手机)
 
 			// "huiSize": ANCHORPROP.width, //单个整体回字大小
-			"huiSize": 24, //绘制有误差,先暂时按照实际大小写固定值(待确认)
-			"minHuiSize": 0.005, //最小回字的大小比列, 以回字最中间的方块为最小
-			"maxHuiSize": 0.1, //最大回字的大小比列, 以回字最外层的方块为最大
-			"notHuisRect": [0.3, 0.3, 0.4, 0.4], //不检测回字区域(pc版辅助效果20%, 手机版50%)
+			// "huiSize": 24, //绘制有误差,先暂时按照实际大小写固定值(待确认)
+			// "minHuiSize": 0.005, //最小回字的大小比列, 以回字最中间的方块为最小
+			// "maxHuiSize": 0.1, //最大回字的大小比列, 以回字最外层的方块为最大
+			// "notHuisRect": [0.3, 0.3, 0.4, 0.4], //不检测回字区域(pc版辅助效果20%, 手机版50%)
 
 			//内容块 vblockCount为该模块竖向的方块数 hblockCount为该模块横向方块数
 			"contents": [],
@@ -125,12 +125,12 @@ export default {
 			val.y = Number(val.y.toFixed())
 			val.width = Number(val.width.toFixed())
 			val.height = Number(val.height.toFixed())
-			val.count = 0
+			val.count = val.hblockCount
 			val.id = val.pageNum + '-' + val.index
 			if(state.config.contents.length){
 				let infoItem = state.config.contents.find(i => i.type === 0)
 				if(infoItem){
-					infoItem.hblockCount = val.hblockCount
+					// infoItem.hblockCount = val.hblockCount
 				}else{
 					state.config.contents.push(val)
 				}
@@ -146,11 +146,12 @@ export default {
 			val.width = Number(val.width.toFixed())
 			val.height = Number(val.height.toFixed())
 			val.id = val.pageNum + '-' + val.index
+			val.index = 1
 			if(state.config.contents.length){
 				let infoItem = state.config.contents.find(i => i.type === 1)
 				if(infoItem){
 					infoItem.height= val.height
-					infoItem.vblockCount= val.vblockCount
+					// infoItem.vblockCount= val.vblockCount
 				}else{
 					state.config.contents.push(val)
 				}
@@ -165,7 +166,6 @@ export default {
 			val.width = Number(val.width.toFixed())
 			val.height = Number(val.height.toFixed())
 			val.id = val.pageNum + '-' + val.index
-			val.count = 0
 			// 如果是补充框 ID要保持和上一个ID一致
 			if(val.index === 1 && val.isFix){
 				let prePageItems = state.config.contents.filter(i => i.pageNum === val.pageNum - 1)
@@ -179,9 +179,13 @@ export default {
 					infoItem.y= val.y
 					infoItem.pageNum = val.pageNum
 				}else{
+					val.index = val.startOrder
+					delete val.startOrder
 					state.config.contents.push(val)
 				}
 			}else{
+				val.index = val.startOrder
+				delete val.startOrder
 				state.config.contents.push(val)
 			}
 		},

+ 29 - 24
TEAMModelOS/ClientApp/src/view/newsheet/BaseEditor.vue

@@ -125,7 +125,7 @@
 			},
 			
 			/* 设置填空题和简答题的配置数据 */
-			setSubjectiveConfig(y,height,pageNum,isFix){
+			setSubjectiveConfig(y,height,isFix,startOrder,count){
 				if(height === 0) return
 				let itemConfig = {
 					"type": 2,
@@ -134,7 +134,9 @@
 					"width": INFO_W,
 					"height": height,
 					"pageNum": this.$store.state.answerSheet.pages,
-					"isFix":isFix || false
+					"isFix":isFix || false,
+					"count":count,
+					"startOrder":startOrder
 				}
 				console.log(JSON.stringify(itemConfig))
 				this.$store.commit('setSubjectiveConfig', itemConfig)
@@ -151,21 +153,21 @@
 				if (this.curModel === '2') {
 					let lineCount = this.lineCount
 					let allHtml = ''
-					let singleStr = '<span class="underline" style="display:inline;line-height:35px">' + new Array(182).fill("&nbsp;").join("") + "</span>";
+					let singleStr = '<span class="underline" style="display:inline;line-height:35px">' + new Array(240).fill("&nbsp;").join("") + "</span>";
 					for(let i = 0 ; i < lineCount ; i++){
-						allHtml += '<p>' + singleStr+ '</p>'
+						allHtml += '<p style="margin:0">' + singleStr+ '</p>'
 					}
 					editor.config.height = lineCount * 35 + 40
 					newContent = orderStr + allHtml
 				} else if (this.curModel === '3') {
 					let wordCount = this.wordCount
 					let singleStr = '<span class="cell-item"></span>';
-					let lines = wordCount / 18
+					let lines = wordCount / 24
 					let allHtml = ''
 					for(let i = 0 ; i < lines; i++){
-						allHtml += '<p>' + singleStr.repeat(18) + '</p>'
+						allHtml += '<p>' + singleStr.repeat(24) + '</p>'
 					}
-					editor.config.height = lines * 40 + 60
+					editor.config.height = lines * 40 + 40
 					newContent = orderStr + '<p><br></p>' + allHtml
 				} else {
 					newContent = orderStr
@@ -204,8 +206,11 @@
 				let totalStr = '' // 填空题总体富文本
 				let lineBlankCount = 0 //总空格数
 				let lineStr = '' //每一行的富文本
+				let startOrder = this.isAutoCreate ? (allItemIds.indexOf(items[0].id) + 1) : items[0].order + ""
 				// 遍历所有填空题 生成对应题目的空格
 				items.forEach((item, index) => {
+					console.log(this.isAutoCreate);
+					console.log(item);
 					item.blankCount = item.blankCount || 1
 					let addStr = this.isAutoCreate ? (allItemIds.indexOf(item.id) + 1) : item.order + "";
 					for (let blankIndex = 0; blankIndex < item.blankCount; blankIndex++) {
@@ -253,7 +258,7 @@
 						if ( curEditorY + curEditorH + lastBottomGap + SVG_BORDER_MB > PAPER_H) {
 							// 如果剩余高度不满足渲染 并且需要补充的区域 则需要进行跨页处理
 							if (leftHeight > 100) {
-								this.setSubjectiveConfig(curEditorY,leftHeight + 20,curItemWhichPage,true)
+								this.setSubjectiveConfig(curEditorY,leftHeight + 20,true,startOrder,items.length)
 								this.$store.commit("addPage");
 								let heightArr = []
 								this.myEditor.config.height = leftHeight + 20;
@@ -281,7 +286,7 @@
 										let editorHeight = curEditorContent.html === '' ? heightArr[editorIndex] : heightArr[editorIndex]
 										// let curEditorContent = this.getSplitHtml(this.pArr,curEditorHeight)
 										if(editorIndex !== 0){
-											this.initFixEditor(this.ids + 'fix' + (editorIndex - 1), editorHeight, curEditorContent.html)
+											this.initFixEditor(this.ids + 'fix' + (editorIndex - 1), editorHeight, curEditorContent.html,startOrder,items.length)
 										}else{
 											this.myEditor.txt.clear();
 											this.myEditor.txt.html('<span></span>')
@@ -293,7 +298,7 @@
 								// 跨页处理不需要补充作答区域
 									this.$store.commit("addPage");
 								// if(this.$parent.completeItems.map(i => i.id).indexOf(this.curItemId) === 0){
-									this.setSubjectiveConfig(100,curEditorH,curItemWhichPage + 1)
+									this.setSubjectiveConfig(100,curEditorH,false,startOrder,items.length)
 									this.$EventBus.$emit('titleMovePage',{
 										type:'complete',
 										height:leftHeight
@@ -306,7 +311,8 @@
 								
 							}
 						}else {
-							this.setSubjectiveConfig(curEditorY,curEditorH,curItemWhichPage)
+							console.log(items);
+							this.setSubjectiveConfig(curEditorY,curEditorH,false,startOrder,items.length)
 							document.getElementById(this.ids + 'btn').style.top =  "20px";
 						}
 					})
@@ -384,7 +390,7 @@
 						let curEditorY = Y > paperH ? +((Y % paperH).toFixed(4)) : Y;
 						let curEditorH = editorDom.clientHeight; // 默认200px
 						let leftHeight = paperH - curEditorY - lastBottomGap - SVG_BORDER_MB;
-						let fixHeight = curEditorH - leftHeight + 20
+						let fixHeight = curEditorH - leftHeight
 						let curItemWhichPage = this.$store.state.answerSheet.pages
 						if(rectTop === 0) return
 						// 如果 渲染当前富文本的时候 需要渲染的高度超过当前页的剩余高度 则需要进行加页处理
@@ -393,10 +399,10 @@
 							console.log('xxxx',itemOrder,leftHeight)
 							// 如果剩余高度满足渲染一部分区域 并且需要补充的区域 则需要进行跨页处理
 							if (leftHeight > 100) {
-								this.setSubjectiveConfig(curEditorY,leftHeight + 20,curItemWhichPage,true)
+								this.setSubjectiveConfig(curEditorY,leftHeight,true,itemOrder,1)
 								this.$store.commit("addPage");
 								let heightArr = []
-								this.myEditor.config.height = leftHeight + 20;
+								this.myEditor.config.height = leftHeight;
 								heightArr.push(leftHeight)
 								// 如果渲染的客观题高度在这个区间 才需要在下一页添加补充作答区域 其余全部按照正常 跨页处理不需要补充作答区域
 								let fixCount = Math.ceil(fixHeight / SVG_BORDER_PROP.height)
@@ -418,7 +424,7 @@
 										let editorHeight = curEditorContent.html === '' ? heightArr[editorIndex] : heightArr[editorIndex]
 										// let curEditorContent = this.getSplitHtml(this.pArr,curEditorHeight)
 										if(editorIndex !== 0){
-											this.initFixEditor(this.ids + 'fix' + (editorIndex - 1), editorHeight, curEditorContent.html)
+											this.initFixEditor(this.ids + 'fix' + (editorIndex - 1), editorHeight, curEditorContent.html,itemOrder,1)
 										}else{
 											this.myEditor.txt.clear();
 											this.myEditor.txt.html('<span></span>')
@@ -430,20 +436,20 @@
 								// 跨页处理不需要补充作答区域
 								this.$store.commit("addPage");
 								if(this.$parent.subjectiveItems.map(i => i.id).indexOf(this.curItemId) === 0){
-									this.setSubjectiveConfig(100,curEditorH,curItemWhichPage + 1)
+									this.setSubjectiveConfig(100,curEditorH,false,itemOrder,1)
 									this.$EventBus.$emit('titleMovePage',{
 										type:'subjective',
 										height:leftHeight
 									})
 								}else{
-									this.setSubjectiveConfig(curEditorY,curEditorH,curItemWhichPage)
+									this.setSubjectiveConfig(curEditorY,curEditorH,false,itemOrder,1)
 									document.getElementById(this.ids).style.marginTop = (PAPER_H - curEditorY + lastBottomGap + SVG_BORDER_PROP.y) + "px";
 									document.getElementById(this.ids + 'btn').style.top = (PAPER_H - curEditorY + lastBottomGap + SVG_BORDER_PROP.y + 20) + "px";
 								}
 								
 							}
 						} else {
-							this.setSubjectiveConfig(curEditorY,curEditorH,curItemWhichPage)
+							this.setSubjectiveConfig(curEditorY,curEditorH,false,itemOrder,1)
 							document.getElementById(this.ids + 'btn') && (document.getElementById(this.ids + 'btn').style.top =  "20px")
 						}
 						this.$root.$children[0].spinShow = false;
@@ -700,10 +706,10 @@
 			},
 			
 			/* 初始化补充富文本编辑器 */
-			initFixEditor(curId,height,content){
+			initFixEditor(curId,height,content,itemOrder,count){
 				console.log('补充编辑器',height)
 				let curItemWhichPage = this.$store.state.answerSheet.pages
-				this.setSubjectiveConfig(90,height,curItemWhichPage,true)
+				this.setSubjectiveConfig(90,height,true,itemOrder,count)
 				const editor = new E("#" + curId);
 				editor.config.height = height;
 				editor.config.menus = [
@@ -767,7 +773,7 @@
 						content: html
 					})
 				};
-				document.getElementById(curId).style.marginTop = (SVG_BORDER_MB) * 2  + "px";
+				document.getElementById(curId).style.marginTop = (SVG_BORDER_MB - 10) * 2  + "px";
 				editor.config.focus = false;
 				editor.config.showFullScreen = false;
 				editor.config.placeholder = "";
@@ -872,8 +878,8 @@
 
 		.cell-item {
 			display: inline-block;
-			width: 32.4px;
-			height: 32.4px;
+			width: 32px;
+			height: 32px;
 			border: 1px solid;
 			margin-right: -1px;
 			pointer-events: none;
@@ -908,7 +914,6 @@
 		&::-webkit-scrollbar{
 			display: none;
 		}
-		
 		// p::after{
 		// 	content: '↩\A';
 		// 	white-space: pre-wrap;

+ 34 - 25
TEAMModelOS/ClientApp/src/view/newsheet/BaseSvgBg.vue

@@ -1,6 +1,6 @@
 <template>
 	<div
-		style="position:relative; width: 100%; height: 100%; overflow: hidden; margin-top: 0;border-bottom: 0px solid #b1b1b1;">
+		style="position:relative; width: 100%; height: 100%; overflow: hidden; margin-top: 0;border-bottom: 1px solid #b1b1b1;">
 		<div v-show="ids === 'svg0'" class="sheet-paper-title">
 			<BaseTitleEditor :ids="'sheetName' + ids" :content="sheetPaperName"></BaseTitleEditor>
 		</div>
@@ -46,15 +46,15 @@
 			BaseTitleEditor
 		},
 		created() {
-				// var reader = new FileReader();
-			 //    // 读取文件作为URL可访问地址
-			 //    var img = document.createElement("img");
-				// let s = 'file:///C:\Users\zxj\AppData\Local\Temp\ksohtml1436\wps8.jpg'
-				// let j = URL.createObjectURL(s)
-			 //    img.src = j;
-				// document.getElementById('pdfDom').append(img)
-				// console.log(j)
-				// console.log(img)
+			// var reader = new FileReader();
+			//    // 读取文件作为URL可访问地址
+			//    var img = document.createElement("img");
+			// let s = 'file:///C:\Users\zxj\AppData\Local\Temp\ksohtml1436\wps8.jpg'
+			// let j = URL.createObjectURL(s)
+			//    img.src = j;
+			// document.getElementById('pdfDom').append(img)
+			// console.log(j)
+			// console.log(img)
 		},
 		methods: {
 			doRenderPageAnchor(snap) {
@@ -75,7 +75,7 @@
 							10
 						)
 						.attr({
-							shapeRendering:"crispEdges",
+							shapeRendering: "crispEdges",
 							fill: radixArr.split('')[index] === '1' ? '#000' : "none",
 							stroke: "#000000",
 							strokeWidth: 2
@@ -106,18 +106,18 @@
 			doRenderId(snap) {
 				this.sheetIdBox.remove(); // 先清除之前的绘制内容
 				this.sheetIdBox = this.snap.paper.g();
-					var page = snap
-						.text(
-							550,
-							PAPER_H - 50,
-							`${this.sheetId}-${Number(this.ids.replace("svg", "")) + 1}`
-							)
-						.attr({
-							// color:this.sheetId ? 'transparent' : '#000',
-							fontSize: 16,
-							fontFamily: "Courier",
-						});
-					this.sheetIdBox.add(page);
+				var page = snap
+					.text(
+						550,
+						PAPER_H - 50,
+						this.sheetId ? `${this.sheetId}-${Number(this.ids.replace("svg", "")) + 1}` : ''
+					)
+					.attr({
+						// color:this.sheetId ? 'transparent' : '#000',
+						fontSize: 16,
+						fontFamily: "Courier",
+					});
+				this.sheetIdBox.add(page);
 			}
 		},
 		mounted() {
@@ -127,8 +127,13 @@
 			this.sheetIdBox = snap.paper.g();
 			let anchorProp = ANCHORPROP;
 			snap
-			  .rect(SVG_BORDER_PROP.x, SVG_BORDER_PROP.y, SVG_BORDER_PROP.width, SVG_BORDER_PROP.height)
-			  .attr({shapeRendering:"crispEdges", fill: "none", stroke: "#000", strokeWidth: 2 });
+				.rect(SVG_BORDER_PROP.x, SVG_BORDER_PROP.y, SVG_BORDER_PROP.width, SVG_BORDER_PROP.height)
+				.attr({
+					shapeRendering: "crispEdges",
+					fill: "none",
+					stroke: "#000",
+					strokeWidth: 2
+				});
 
 			// 画四个锚点
 			// snap.rect(
@@ -245,6 +250,10 @@
 		.w-e-text {
 			font-size: 18px !important;
 			text-align: center !important;
+
+			p {
+				margin: 0;
+			}
 		}
 	}
 </style>

+ 1 - 2
TEAMModelOS/ClientApp/src/view/newsheet/SheetObjective.vue

@@ -116,8 +116,7 @@
 			// 渲染客观题区域边框
 			doRenderBorder(items, number, blockCount) {
 				let snap = this.snap;
-				let objectiveHeight = 40 + this.blockHeight * blockCount;
-				this.svgHeight = this.anchorRectY + 40;
+				this.svgHeight = this.anchorRectY + 10;
 				this.setObjectiveConfig()
 				// 信息框
 				let infoBox = snap