tanyanfei 2 månader sedan
förälder
incheckning
1842362828
1 ändrade filer med 238 tillägg och 126 borttagningar
  1. 238 126
      src/views/anscard/Index.vue

+ 238 - 126
src/views/anscard/Index.vue

@@ -227,13 +227,22 @@
 	}
 	.stdPoints{
 		position:absolute;background-color:black;
+		z-index: 99;
 	}
 	.content_box{
-		top:20mm;left:15mm;width:180mm;height:257mm;position:absolute;
+		// border: 1px solid red;
+		width:180mm;height:257mm;position:absolute;
 	}
 	.w-e-text{
 		min-height: auto !important;
 	}
+	#paperNameTextAreaTem{
+		resize:none;width:177mm;color:#000;font-size:20px;
+		font-weight:600;height: 15mm;max-height:21mm;
+		text-align: center;word-wrap: normal;line-height:15mm;overflow:hidden;
+		margin-left: 9mm;
+		margin-top: 9mm;
+	}
 </style>
 <template>
   <section class="content">
@@ -258,10 +267,13 @@
 					</div>
 					<!-- //试卷内容 -->
 					
-					<div class="content_box">
+					<div class="content_box" :style="{
+						left: paper.stdPoints[0].x+'mm',
+						top: paper.stdPoints[0].y+'mm'
+					}">
 						<template v-if='page.pno == 1'>
-							<textarea id="paperNameTextAreaTem" rows="3" cols="78" style="resize:none;width:100%;color:#000;font-size:20px;font-weight:600;height: 15mm;max-height:21mm;text-align: center;word-wrap: normal;line-height:15mm;overflow:hidden" placeholder="请输入试卷名称"></textarea>
-							<div style="top:18mm;left:2mm;width:95mm;height:60mm;position:absolute;"> 
+							<textarea id="paperNameTextAreaTem" rows="3" cols="78" style="" placeholder="请输入试卷名称"></textarea>
+							<div style="top:27mm;left:11mm;width:95mm;height:60mm;position:absolute;"> 
 								<div style="line-height:6.6mm"> 
 									<span style="font-weight: bold;font-size: 4mm;">姓名:</span>
 									<span style="width:30mm;border-bottom: solid 1px black;display:inline-block">&nbsp;</span>
@@ -282,9 +294,10 @@
 										<br>5.保持答卷清洁、完整。严禁折叠,严禁在答题卷上做任何标记,严禁使用涂改液、胶带纸和修正带。<br>  
 									</p>
 									</div> <div style="border:solid 1px black;margin-top:2mm;line-height: 7mm">  <table style="width:100%;height:100%;"><tbody><tr> <td width="30%"> <span style="font-size: 3mm;font-weight: bold;">正确填涂</span></td><td width="25%"> <div style="border: solid 1px black;width:4mm;height: 2mm;background-color: black;">&nbsp;</div> </td> <td width="30%"> <span style="font-size: 3mm;font-weight: bold;">缺考标记</span>  </td> <td width="25%">   
-								<div style="border:1px solid #000000;width:4mm;height: 2mm;"></div> </td> </tr></tbody></table></div></div>
+								<div style="border:1px solid #000000;width:4mm;height: 2mm;"></div> </td> </tr></tbody></table></div>
+							</div>
 								
-								<div style="top:23mm;left:107mm;width:65mm;height:60mm;position:absolute;font-size:3mm;">
+							<div style="top:32mm;left:116mm;width:65mm;height:60mm;position:absolute;font-size:3mm;">
 								<table v-if='data.khType == 2' cellpadding="0" cellspacing="0" style="border-collapse:collapse;text-align: center;width:100%;height:100%;line-height: 5mm">
 									<tr height='6mm'>
 										<td :colspan="data.khLength" style="width:30mm;border:solid 1px black;border-collapse:collapse;text-align:center;">准考证号</td>
@@ -319,20 +332,23 @@
 							</div>
 						</template>
 						<!-- 选择题 -->
-						<template v-if='paper.obj.list.length>0 && page.pno == 1'>
-						<!-- {{paper.obj}} -->
-							<div class="sub" :style="{
-									width: paper.objAnsPoints[0].w+'mm',
-									height: paper.objAnsPoints[0].h+'mm',
-									left: paper.objAnsPoints[0].x+'mm',
-									top: (paper.objAnsPoints[0].y-5)+'mm',
-									position:'absolute'
-								}"> 
-								<div class="opLabel">
+						<template v-if='paper.obj.list.length>0 && page.pno == 1'>	
+							<div class="sub">
+								<div class="opLabel" :style="{
+										left: paper.objAnsPoints[0].x+'mm',
+										top: (paper.objAnsPoints[0].y-5)+'mm',
+										position:'absolute'
+									}">
 									{{paper.obj.title}}
+									<img @click="delTm(0,1)" class="del" src="../../assets/delete.png" alt="">
 								</div>
-								<img @click="delTm(0,1)" class="del" src="../../assets/delete.png" alt="">
-								<div class="obj" > 
+								<div class="obj" :style="{
+										width: paper.objAnsPoints[0].w+'mm',
+										height: paper.objAnsPoints[0].h+'mm',
+										left: paper.objAnsPoints[0].x+'mm',
+										top: (paper.objAnsPoints[0].y)+'mm',
+										position:'absolute'
+									}">
 									<div  v-for='(item,index) in paper.obj.list'>
 										<span class="tm_id" :style="{
 											left:(item.points[0].x-8)+'mm',
@@ -354,65 +370,86 @@
 									</div>					
 								</div>
 							</div>
+
 						</template>
 						<!-- 填空题 -->
 						<template v-if='paper.sub.length>0'>
-							<div class="sub" v-for='(item,i) in paper.stdSujQnoPoints' v-if='item.pno == page.pno' :style="{
-								width: item.w+'mm',
-								height: item.h+'mm',
-								left: item.x+'mm',
-								top: (item.y)+'mm',
-								position:'absolute'
-							}"> 
-								<div class="opLabel">{{paper.sub[i].title}}</div>
-								<img @click="delTm(i)" class="del" src="../../assets/delete.png" alt="">
-								<div class="obj" v-if='paper.sub[i].type==2'> 
-									<div v-for='sub in paper.sub[i].list' class="tk">
-										<span class="tm_id" :style="{
-											left:(sub.x-6)+'mm',
-											top:(sub.y-3)+'mm'
-										}">{{sub.id}}.</span>
-										<div :style="{
-											width:sub.w+'mm',
-											height:sub.h+'mm',
-											left: sub.x+'mm',
-											top: sub.y+'mm',
-										}"></div>
-									</div>
-								</div>
-								<div class="obj" v-else-if='paper.sub[i].type==3'>
-									<Editor :value='paper.sub[i].option.id'/>
-									<!-- <span class="tm_id" style="top: 2.5mm;">{{paper.sub[i].option.id}}</span> -->
-								</div>
-								<div class="obj" v-else-if='paper.sub[i].type==4' style="padding: 1mm;font-size: 3mm;line-height: 5mm;">
-									<span>请考生从<template v-for='(opt,i) in paper.sub[i].list'>{{opt.id}} </template>
-									题任选一题作答,作答时用2B铅笔在答题卡上把所选题目对应的选考标记涂黑,
-									不涂或多涂或填涂和作答不符,均不得分。</span><br>
-									<span>我选择的题号为:</span>
-									<span v-for='opt in paper.sub[i].list' class="options" :style="{
-										width: opt.w+'mm',
-										height: opt.h+'mm',
-										left: opt.x+'mm',
-										top: opt.y+'mm'
-									}">{{opt.id}}</span>
-								</div>
-								<div class="obj" v-else-if='paper.sub[i].type==5'>
-									<span class="tm_id" v-if='paper.sub[i].title' style="top: 2.5mm;">{{paper.sub[i].id}}.</span>
-									<ul class="words">
-										<li v-for='num in paper.sub[i].end' v-if='num>=paper.sub[i].start'>
-											<span v-if='num%100 == 0'>{{num}}</span>
-										</li>
-									</ul>
+							<div class="sub" v-for='(item,i) in paper.stdSujQnoPoints' v-if='item.pno == page.pno'>
+								<!-- 标题 -->
+								<div class="opLabel" :style="{
+									left: item.x+'mm',
+									top: (item.y-5)+'mm',
+									position:'absolute'
+								}">
+									{{paper.sub[i].title}}
+									
 								</div>
-								<div class="obj" v-else-if='paper.sub[i].type==6'>
-									<span class="tm_id" style="top: 7mm;">{{paper.sub[i].id}}.</span>
-									<ul class="english">
-										<li v-for='num in paper.sub[i].rows'>
-											
-										</li>
-									</ul>
+								
+								<div class="obj" :style="{
+									width: item.w+'mm',
+									height: item.h+'mm',
+									left: item.x+'mm',
+									top: (item.y)+'mm',
+									position:'absolute'
+									}"
+								>
+									<img @click="delTm(i)" class="del" src="../../assets/delete.png" alt="">
+									<!-- 填空 -->
+									<template v-if='paper.sub[i].type==2'>
+										<div v-for='sub in paper.sub[i].list' class="tk">
+											<span class="tm_id" :style="{
+												left:(sub.x-6)+'mm',
+												top:(sub.y-3)+'mm'
+											}">{{sub.id}}.</span>
+											<div :style="{
+												width:sub.w+'mm',
+												height:sub.h+'mm',
+												left: sub.x+'mm',
+												top: sub.y+'mm',
+											}"></div>
+										</div>
+									</template>
+									<!-- 解答题 -->
+									<template v-else-if='paper.sub[i].type==3'>
+										<Editor :value='paper.sub[i].option.id'/>
+									</template>
+									<!-- 选做题 -->
+									<template v-else-if='paper.sub[i].type==4'>
+										<div style="padding: 1mm;font-size: 3mm;line-height: 5mm;">
+											<span>请考生从<template v-for='(opt,i) in paper.sub[i].list'>{{opt.id}} </template>
+											题任选一题作答,作答时用2B铅笔在答题卡上把所选题目对应的选考标记涂黑,
+											不涂或多涂或填涂和作答不符,均不得分。</span><br>
+											<span>我选择的题号为:</span>
+											<span v-for='opt in paper.sub[i].list' class="options" :style="{
+												width: opt.w+'mm',
+												height: opt.h+'mm',
+												left: opt.x+'mm',
+												top: opt.y+'mm'
+											}">{{opt.id}}</span>
+										</div>
+									</template>
+									<!-- 语文作文 -->
+									<template v-else-if='paper.sub[i].type==5'>
+										<span class="tm_id" v-if='paper.sub[i].title' style="top: 2.5mm;left:3mm">{{paper.sub[i].id}}.</span>
+										<ul class="words">
+											<li v-for='num in paper.sub[i].end' v-if='num>=paper.sub[i].start'>
+												<span v-if='num%100 == 0'>{{num}}</span>
+											</li>
+										</ul>
+									</template>
+									<!-- 英语作文 -->
+									<template v-else-if='paper.sub[i].type==6'>
+										<span class="tm_id" v-if='paper.sub[i].title' style="top: 2.5mm;left:3mm">{{paper.sub[i].id}}.</span>
+										<ul class="english">
+											<li v-for='num in paper.sub[i].rows'>
+												
+											</li>
+										</ul>
+									</template>
 								</div>
 							</div>
+						
+
 						</template>
 					</div>
 					<!-- //试卷内容 -->
@@ -559,7 +596,6 @@
 <script>
 import Page from "../../components/Page";
 import Editor from "../../components/fuEditor/index1";
-import { max } from "moment";
 export default {
   components: {
     Page,Editor
@@ -626,8 +662,8 @@ export default {
 		  ]
 	  },
 	  dft:{
-		  x:0,
-		  y:100,
+		  x:9,
+		  y:109,
 		  w:180,
 		  h:28
 	  }
@@ -637,32 +673,55 @@ export default {
   watch:{
 	  "paper.stdSujQnoPoints":{
 		  handler(value){
-			  if(value.length <= 1)return
-			  var arr=value.filter(item=>item.pno == this.cur_page)
-			  if(arr.length <= 0){
-				  this.cur_page--
-				  this.paper_page.pop()
+			  if(this.paper_page.length <= 1)return
+			  if(value.length>0){
+				  // this.cur_page=value[value.length-1].pno
+				  // this.paper_page=this.paper_page.filter(item=>item<=this.cur_page)
 			  }
+			
 		  },
 		  deep:true
 	  },
-	 "paper.objAnsPoints":{
+	 paper:{
 		 handler(newvalue){
-			 var y
-			 if(newvalue.length>0){
-				y=newvalue[0].y+newvalue[0].h+8
-			 }else{
-				 y=this.dft.y
-			 }
-			
-			var sub=this.paper.stdSujQnoPoints
-			sub.forEach((item,index)=>{
-				if(index > 0){
-					item.y=item.y-height-8
-				}else{
-					item.y=y
-				}
-			})
+			//  console.log(newvalue)
+			// var list=[]
+			// if(newvalue.obj.list.length>0){
+			// 	list.push({
+			// 		name:'客观题',
+			// 		num:newvalue.obj.list.length
+			// 	})
+			// }
+			// if(newvalue.sub.length>0){
+			// 	let t2=newvalue.sub.filter(item=>item.type == 2),n2=0
+			// 	t2.forEach(item=>{
+			// 		n2+=item.list.length
+			// 	})
+			// 	list.push({
+			// 		name:'填空题',
+			// 		num:n2
+			// 	})
+			// 	let t3=newvalue.sub.filter(item=>item.type == 3),n3=t3.length
+			// 	let t4=newvalue.sub.filter(item=>item.type == 4)
+			// 	t4.forEach(item=>{
+			// 		n3+=item.list.length
+			// 	})
+			// 	list.push({
+			// 		name:'解答题',
+			// 		num:n3
+			// 	})
+			// 	let t5=newvalue.sub.filter(item=>item.type == 5 && item.title)
+			// 	list.push({
+			// 		name:'语文作文题',
+			// 		num:t5.length
+			// 	})
+			// 	let t6=newvalue.sub.filter(item=>item.type == 6)
+			// 	list.push({
+			// 		name:'英语作文题',
+			// 		num:t6.length
+			// 	})
+			// }
+			// console.log(list)
 		 },
 		 deep:true
 	 }
@@ -693,41 +752,68 @@ export default {
 	},
 	//删除主观题目
 	delTm(i,flag){
-		
+	
 		var sub=this.paper.stdSujQnoPoints,list=this.paper.sub
+		var height=sub[i]?sub[i].h:0,cur={...list[i]}
 		if(flag){  //客观题
 			this.paper.objAnsPoints=[]
 			this.paper.obj.list=[]
 			if(sub.length == 0){
 				this.addForm.start=1
 			}
-			return
-		}
-		
-		var height=sub[i].h,cur={...list[i]}
-
-		if(cur.type == 5){
-			list=list.filter(item=>item.id!=cur.id)
 		}else{
-			sub.splice(i,1)
-			list.splice(i,1)
+			if(cur.type == 5){
+				// sub=sub.filter(item=>item.id!=cur.id)
+				for(let j=list.length-1;j>=0;j--){
+					if(list[j].id==cur.id){
+						sub.splice(j,1)
+						list.splice(j,1)
+					}
+				}
+			}else{
+				sub.splice(i,1)
+				list.splice(i,1)
+			}
 		}
-	
+		var obj=this.paper.objAnsPoints
 		sub.forEach((item,index)=>{
-			if(index >= i){	
-				item.y=sub[index-1].y+sub[index-1].h+8
-				item.pno=sub[index-1].pno
-			}
-		})
+			if(index >= i){
+				if(index == 0){
+					if(obj.length > 0){
+						item.y=obj[0].y+obj[0].h+8
+					}else{
+						item.y=this.dft.y
+					}
+					item.pno=1
+				}else{
+					if(list[index].title){
+						item.y=sub[index-1].y+sub[index-1].h+8
+					}else{
+						item.y=sub[index-1].y+sub[index-1].h+3
+					}
+					item.pno=sub[index-1].pno
+				}
+			}	
+		})	
 		if(i>=sub.length-1){
-			if(cur.type == 2){
-				this.addForm.start-=item.list.length
+			if(cur.type == 2 || cur.type == 4){
+				this.addForm.start-=cur.list.length
 			}else{
 				this.addForm.start--
 			}
 		}
 		if(this.paper.objAnsPoints.length == 0 && this.paper.stdSujQnoPoints.length == 0){
 			this.addForm.start=1
+			this.cur_page=1
+			this.paper_page=[{pno:1,bin:'0001'}]
+		}
+		if(sub.length>0){
+			this.cur_page=sub[sub.length-1].pno
+			this.paper_page=this.paper_page.filter(item=>item.pno<=this.cur_page)
+			
+		}else{
+			this.cur_page=1
+			this.paper_page=[{pno:1,bin:'0001'}]
 		}
 		this.changpage()
 	},
@@ -774,7 +860,7 @@ export default {
 				let list=this.list
 				let count=this.addForm.count
 				var obj=this.paper.objAnsPoints,sub=this.paper.stdSujQnoPoints
-				let h=Math.ceil(list.length/count)*12
+				let h=Math.ceil(list.length/count)*11
 				if(sub.length>0){
 					let i=sub.length-1
 					this.paper.stdSujQnoPoints.push({
@@ -806,7 +892,7 @@ export default {
 					item.w=parseInt(this.dft.w/count-10)
 					item.h=0.1
 					item.x=8+(8+item.w)*col
-					item.y=8+row*10
+					item.y=9+row*10
 				})
 				this.paper.sub.push({
 					title:'填空题',
@@ -863,7 +949,7 @@ export default {
 						let x=index==1?6:1
 						this.paper.stdSujQnoPoints.push({
 							x:sub[i].x,
-							y:sub[i].y+sub[i].h+8,
+							y:sub[i].y+sub[i].h+3,
 							w:sub[i].w,
 							h:50,
 							pno:this.cur_page
@@ -928,6 +1014,7 @@ export default {
 				var obj=this.paper.objAnsPoints,sub=this.paper.stdSujQnoPoints
 				var row=Math.ceil(words/20)+1,height=row*9.5+30
 				var max_height,cur_obj={}
+				
 				if(sub.length>0){
 					let i=sub.length-1
 					cur_obj={
@@ -953,9 +1040,21 @@ export default {
 					dft.pno=this.cur_page
 					cur_obj=dft	
 				}
-				max_height=this.paper.stdPoints[1].y-cur_obj.y-31
+				max_height=this.paper.stdPoints[1].y-cur_obj.y-20
+				if(max_height < 20){
+					max_height=250
+					this.cur_page++
+					cur_obj.pno=this.cur_page
+					this.paper_page.push({
+						pno:this.cur_page,
+						bin:this.decToBin4(this.cur_page).split('')
+					})
+					cur_obj.y=10
+				}
 				let real_row=Math.floor((max_height-10)/9.5)
 				cur_obj.h=max_height
+				
+				console.log(23333,max_height)
 				this.paper.stdSujQnoPoints.push(cur_obj)
 				this.paper.sub.push({
 					title:'语文作文题',
@@ -965,10 +1064,11 @@ export default {
 					end:real_row*20,
 					id:this.addForm.start
 				})
+			
 				if(row > real_row){
 					let page_row=Math.floor((this.paper.stdPoints[1].y-36)/9.5)  //一页的行数
 					let pages=Math.ceil((row-real_row)/page_row)
-					let start=real_row*20+1,end,h
+					let start_w=real_row*20+1,end_w,h
 					for(let i=1;i<=pages;i++){
 						this.cur_page++
 						this.paper_page.push({
@@ -976,20 +1076,20 @@ export default {
 							bin:this.decToBin4(this.cur_page).split('')
 						})
 						if(i == pages){
-							end=row*20
+							end_w=row*20
 						}else{
-							end=start+page_row*20-1
+							end_w=start_w+page_row*20-1
 						}
 						h=page_row*9.5
 						this.paper.sub.push({
 							title:'',
 							type:5,
 							// words:row*20,
-							start:start,
-							end:end,
+							start:start_w,
+							end:end_w,
 							id:this.addForm.start
 						})
-						start=end+1
+						start_w=end_w+1
 						
 						let l=sub.length-1
 						this.paper.stdSujQnoPoints.push({
@@ -1002,6 +1102,7 @@ export default {
 					}
 					
 				}
+				console.log(7777,this.paper)
 				this.addForm.end=this.addForm.start
 				break;
 			case 6:
@@ -1047,6 +1148,7 @@ export default {
 		this.addForm.start=Number(this.addForm.end)+1
 		this.addForm.end=''
 		this.open=false
+		
 		this.changpage()
 		
 	},
@@ -1056,9 +1158,9 @@ export default {
 		if(i>0){
 						  let down_point=this.paper.stdPoints[1]
 						  let s=-1
+						  
 						  for(let i=0;i<value.length;i++){
 							  if((value[i].y+value[i].h) >= (down_point.y-10)){
-								  
 							  		s=i
 							  		this.cur_page++
 							  		this.paper_page.push({
@@ -1072,10 +1174,20 @@ export default {
 						  value.forEach((item,index)=>{
 							  if(index == s){
 								  item.pno++
-								  item.y=5
+								  if(this.paper.sub[index].title){
+									item.y=10  
+								  }else{
+									  item.y=5
+								  }
+								  
 							  }else if(index > s){
 								  item.pno++
-								  item.y=value[index-1].y+value[index-1].h+1
+								  if(this.paper.sub[index].title){
+								  	item.y=value[index-1].y+value[index-1].h+8
+								  }else{
+								  	item.y=value[index-1].y+value[index-1].h+3								
+								  }
+								  
 							  }
 						  })
 			this.changpage()