From 048689ea554b2715be335a711bd338f02f85db91 Mon Sep 17 00:00:00 2001 From: liufangjia Date: Tue, 26 Nov 2024 17:05:03 +0800 Subject: [PATCH] feat: 代码提交 --- src/views/basic/askTestQuestion/components/wrongQuestionDialog.vue | 38 +++++++++++++++++++++----------------- src/views/basic/askTestQuestion/wrongQuestion.vue | 27 +++++++++++++-------------- 2 files changed, 34 insertions(+), 31 deletions(-) diff --git a/src/views/basic/askTestQuestion/components/wrongQuestionDialog.vue b/src/views/basic/askTestQuestion/components/wrongQuestionDialog.vue index a062f3a..fad43b4 100644 --- a/src/views/basic/askTestQuestion/components/wrongQuestionDialog.vue +++ b/src/views/basic/askTestQuestion/components/wrongQuestionDialog.vue @@ -161,7 +161,9 @@ 保存试卷 - 保存并打印 + 保存并打印 标签的内容; - if (firstP) { - console.log(firstP, firstP.innerHTML, "-----innerHTML-----"); - let a = this.processString(firstP.innerHTML); - firstP.innerHTML = a; - } + // const doc = iframeRef.contentDocument || iframeRef.contentWindow.document; + // const body = iframeRef.contentWindow.document.body; + // const height = body.scrollHeight; // 获取内容的高度 + // console.log(height, "body高度"); + // iframeRef.style.height = `${height}px`; // 设置 iframe 的高度 + // // 获取第一个P标签 + // const firstP = doc.getElementsByTagName("p")[0]; + // // 或者修改第一个 < p > 标签的内容; + // if (firstP) { + // console.log(firstP, firstP.innerHTML, "-----innerHTML-----"); + // let a = this.processString(firstP.innerHTML); + // firstP.innerHTML = a; + // } }, // 启动编辑模式 @@ -648,7 +650,7 @@ export default { }, // 保存 - handleSava() { + handleSava(type) { let param = { paperTitle: this.inputValue, subjectName: this.subjectName, @@ -659,11 +661,13 @@ export default { if (res.status == 0) { this.groups = []; this.testData = []; - localStorage.setItem("testlist", JSON.stringify(this.questions)); + localStorage.setItem("testlist", JSON.stringify(this.testData)); localStorage.setItem("question", JSON.stringify(this.groups)); this.$emit("setQuestions"); - this.testDataFun(); this.handleClose(); + if (type) { + console.log(123); + } } }); }, diff --git a/src/views/basic/askTestQuestion/wrongQuestion.vue b/src/views/basic/askTestQuestion/wrongQuestion.vue index caab381..a92f116 100644 --- a/src/views/basic/askTestQuestion/wrongQuestion.vue +++ b/src/views/basic/askTestQuestion/wrongQuestion.vue @@ -51,6 +51,7 @@ 时间: 标签的内容; - if (firstP) { - console.log(firstP, firstP.innerHTML, "-----innerHTML-----"); - let a = this.processString(firstP.innerHTML); - firstP.innerHTML = a; - } + // const doc = iframeRef.contentDocument || iframeRef.contentWindow.document; + // const body = iframeRef.contentWindow.document.body; + // const height = body.scrollHeight; // 获取内容的高度 + // iframeRef.style.height = `${height}px`; // 设置 iframe 的高度 + // // 获取第一个P标签 + // const firstP = doc.getElementsByTagName("p")[0]; + // // 或者修改第一个 < p > 标签的内容; + // if (firstP) { + // console.log(firstP, firstP.innerHTML, "-----innerHTML-----"); + // let a = this.processString(firstP.innerHTML); + // firstP.innerHTML = a; + // } }, // 子集删除后 父级需要更新 setQuestions() { - console.log("我被调用"); - this.questions = JSON.parse(localStorage.getItem("testlist")) || []; }, }, -- libgit2 0.21.4