|
@@ -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(" ").join("") + "</span>";
|
|
|
+ let singleStr = '<span class="underline" style="display:inline;line-height:35px">' + new Array(240).fill(" ").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;
|