diff --git a/src/App.vue b/src/App.vue index b3f677f..71079f9 100644 --- a/src/App.vue +++ b/src/App.vue @@ -103,7 +103,7 @@ export default { transform: scale(${scale}) ${translate}; transform-origin: top left; min-width: 1920px; - min-height:989px; + min-height: ${100 + 125 * (1 - scale)}vh; `; } } else { diff --git a/src/views/basic/askTestQuestion/components/wrongQuestionDialog.vue b/src/views/basic/askTestQuestion/components/wrongQuestionDialog.vue index f934686..3375fcb 100644 --- a/src/views/basic/askTestQuestion/components/wrongQuestionDialog.vue +++ b/src/views/basic/askTestQuestion/components/wrongQuestionDialog.vue @@ -350,6 +350,8 @@ export default { this.userId + "testData", JSON.stringify(this.testData) ); + console.log(data, "data"); + this.testAddDel(this.groups, data.addArr, data.delArr); } } else { @@ -429,19 +431,19 @@ export default { })); }, onIFrameLoad(id) { - const iframeRef = this.$refs["iframe" + id][0]; // 获取对应的 iframe - const doc = iframeRef.contentDocument || iframeRef.contentWindow.document; - const body = iframeRef.contentWindow.document.body; - body.style.overflowX = "hidden"; // 不允许出现横向滚动条 - const height = body.offsetHeight; // 获取内容的高度 - iframeRef.style.height = `${height + 20}px`; // 设置 iframe 的高度 - // 获取第一个P标签 - const firstP = doc.getElementsByTagName("p")[0]; - // 或者修改第一个 < p > 标签的内容; - if (firstP) { - let a = this.processString(firstP.innerHTML); - firstP.innerHTML = a; - } + // const iframeRef = this.$refs["iframe" + id][0]; // 获取对应的 iframe + // const doc = iframeRef.contentDocument || iframeRef.contentWindow.document; + // const body = iframeRef.contentWindow.document.body; + // body.style.overflowX = "hidden"; // 不允许出现横向滚动条 + // const height = body.offsetHeight; // 获取内容的高度 + // iframeRef.style.height = `${height + 20}px`; // 设置 iframe 的高度 + // // 获取第一个P标签 + // const firstP = doc.getElementsByTagName("p")[0]; + // // 或者修改第一个 < p > 标签的内容; + // if (firstP) { + // let a = this.processString(firstP.innerHTML); + // firstP.innerHTML = a; + // } }, // 启动编辑模式 @@ -639,14 +641,11 @@ export default { const addArr = array2.filter( (item2) => !array1.some((item1) => item1.id === item2.id) ); - return { delArr, addArr, }; }, - - // 添加,删除 // 需要的数据,添加的数据,删除的数据 testAddDel(arr1, arr2, arr3) { if (arr2 && arr2.length > 0) { @@ -672,22 +671,11 @@ export default { } if (arr3 && arr3.length > 0) { // 删除数据 - arr3.forEach((item3) => { - // 在 array1 中找到匹配的 type - let matchedArray1Item = arr1.find((item1) => - item1.subQuestionIds.filter((item) => item.id == item3.id) + const ids = new Set(arr3.map((item) => item.id)); + arr1.forEach((obj) => { + obj.subQuestionIds = obj.subQuestionIds.filter( + (item) => !ids.has(item.id) ); - if (matchedArray1Item) { - // 如果找到了匹配的 type,遍历 matchedArray1Item 的 items - let _index = matchedArray1Item.subQuestionIds.findIndex( - (item) => item.id === item3.id - ); - if (_index != -1) { - matchedArray1Item.subQuestionIds.splice(_index, 1); - } - } else { - return; - } }); } diff --git a/src/views/basic/askTestQuestion/wrongQuestion.vue b/src/views/basic/askTestQuestion/wrongQuestion.vue index 6cbd5ae..19a9534 100644 --- a/src/views/basic/askTestQuestion/wrongQuestion.vue +++ b/src/views/basic/askTestQuestion/wrongQuestion.vue @@ -625,23 +625,22 @@ export default { // 获取ref onIFrameLoad(index) { - const iframeRef = this.$refs["iframe" + index][0]; // 获取对应的 iframe - const doc = iframeRef.contentDocument || iframeRef.contentWindow.document; - const body = iframeRef.contentWindow.document.body; - body.style.overflowX = "hidden"; // 不允许出现横向滚动条 - const height = body.offsetHeight; // 获取内容的高度 - // console.log("body.offsetHeight:", body.offsetHeight); - // console.log("body.clientHeight:", body.clientHeight); - // console.log("body.scrollHeight:", body.scrollHeight); - - iframeRef.style.height = `${height + 20}px`; // 设置 iframe 的高度 - // 获取第一个P标签 - const firstP = doc.getElementsByTagName("p")[0]; - // 或者修改第一个 < p > 标签的内容; - if (firstP) { - let a = this.processString(firstP.innerHTML); - firstP.innerHTML = a; - } + // const iframeRef = this.$refs["iframe" + index][0]; // 获取对应的 iframe + // const doc = iframeRef.contentDocument || iframeRef.contentWindow.document; + // const body = iframeRef.contentWindow.document.body; + // body.style.overflowX = "hidden"; // 不允许出现横向滚动条 + // const height = body.offsetHeight; // 获取内容的高度 + // // console.log("body.offsetHeight:", body.offsetHeight); + // // console.log("body.clientHeight:", body.clientHeight); + // // console.log("body.scrollHeight:", body.scrollHeight); + // iframeRef.style.height = `${height + 20}px`; // 设置 iframe 的高度 + // // 获取第一个P标签 + // const firstP = doc.getElementsByTagName("p")[0]; + // // 或者修改第一个 < p > 标签的内容; + // if (firstP) { + // let a = this.processString(firstP.innerHTML); + // firstP.innerHTML = a; + // } }, // 子集删除后 父级需要更新