|
@@ -341,12 +341,16 @@
|
|
|
if (!scrollDom) return
|
|
|
let editorDom = this.myEditor.$textElem.elems[0]
|
|
|
let scrollDis = scrollDom.getPosition().scrollTop
|
|
|
+ // 整个试卷题目的ID集合
|
|
|
let allItemIds = this.$store.state.answerSheet.paperItem.item.map(i => i.id)
|
|
|
+ // 小题拉平的ID集合
|
|
|
+ let flatIds = this.flatSubjectiveItems(this.$store.state.answerSheet.paperItem.item).map(i => i.id)
|
|
|
let subjectiveItem = items[0];
|
|
|
// 拿到当前题目序号
|
|
|
let curItemId = subjectiveItem.pid || subjectiveItem.id
|
|
|
let itemOrder = this.isAutoCreate ? allItemIds.indexOf(curItemId) + 1 : subjectiveItem.order;
|
|
|
- let configIndex = subjectiveItem.pid ? (itemOrder + subjectiveItem.childIndex - 1 ): itemOrder
|
|
|
+ // let configIndex = subjectiveItem.pid ? (itemOrder + subjectiveItem.childIndex - 1 ): itemOrder
|
|
|
+ let configIndex = flatIds.indexOf(subjectiveItem.id) + 1
|
|
|
if(subjectiveItem.pid){
|
|
|
itemOrder = itemOrder + '-' + subjectiveItem.childIndex
|
|
|
}
|
|
@@ -441,8 +445,8 @@
|
|
|
this.$nextTick(() => {
|
|
|
let splitHtmlArr = this.getSplitHtml(this.pArr,heightArr)
|
|
|
splitHtmlArr.forEach((curEditorContent,editorIndex) => {
|
|
|
- console.log('富文本的分割高度',heightArr)
|
|
|
- console.log('富文本的分割',splitHtmlArr)
|
|
|
+ // console.log('富文本的分割高度',heightArr)
|
|
|
+ // console.log('富文本的分割',splitHtmlArr)
|
|
|
let editorHeight = curEditorContent.html === '' ? heightArr[editorIndex] : heightArr[editorIndex]
|
|
|
// let curEditorContent = this.getSplitHtml(this.pArr,curEditorHeight)
|
|
|
if(editorIndex !== 0){
|
|
@@ -482,6 +486,21 @@
|
|
|
});
|
|
|
},
|
|
|
|
|
|
+ flatSubjectiveItems(arr){
|
|
|
+ let flatItems = []
|
|
|
+ arr.forEach(i => {
|
|
|
+ if(i.children.length){
|
|
|
+ i.children.forEach((child,childIndex) => {
|
|
|
+ child.childIndex = childIndex + 1
|
|
|
+ flatItems.push(child)
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ flatItems.push(i)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ return flatItems
|
|
|
+ },
|
|
|
+
|
|
|
// 跨页内容分割处理
|
|
|
getSplitHtml(pArr,heightArr){
|
|
|
let result = []
|