Commit 048689ea554b2715be335a711bd338f02f85db91

Authored by liufangjia
1 parent ce926d5e

feat: 代码提交

src/views/basic/askTestQuestion/components/wrongQuestionDialog.vue
... ... @@ -161,7 +161,9 @@
161 161 <el-button class="button-width" type="primary" @click="handleSava"
162 162 >保存试卷</el-button
163 163 >
164   - <el-button class="button-width" plain>保存并打印</el-button>
  164 + <el-button class="button-width" plain @click="handleSava('print')"
  165 + >保存并打印</el-button
  166 + >
165 167 <el-button
166 168 class="button-width"
167 169 type="danger"
... ... @@ -380,19 +382,19 @@ export default {
380 382 },
381 383 onIFrameLoad(id) {
382 384 const iframeRef = this.$refs["iframe" + id][0]; // 获取对应的 iframe
383   - const doc = iframeRef.contentDocument || iframeRef.contentWindow.document;
384   - const body = iframeRef.contentWindow.document.body;
385   - const height = body.scrollHeight; // 获取内容的高度
386   - console.log(height, "body高度");
387   - iframeRef.style.height = `${height}px`; // 设置 iframe 的高度
388   - // 获取第一个P标签
389   - const firstP = doc.getElementsByTagName("p")[0];
390   - // 或者修改第一个 < p > 标签的内容;
391   - if (firstP) {
392   - console.log(firstP, firstP.innerHTML, "-----innerHTML-----");
393   - let a = this.processString(firstP.innerHTML);
394   - firstP.innerHTML = a;
395   - }
  385 + // const doc = iframeRef.contentDocument || iframeRef.contentWindow.document;
  386 + // const body = iframeRef.contentWindow.document.body;
  387 + // const height = body.scrollHeight; // 获取内容的高度
  388 + // console.log(height, "body高度");
  389 + // iframeRef.style.height = `${height}px`; // 设置 iframe 的高度
  390 + // // 获取第一个P标签
  391 + // const firstP = doc.getElementsByTagName("p")[0];
  392 + // // 或者修改第一个 < p > 标签的内容;
  393 + // if (firstP) {
  394 + // console.log(firstP, firstP.innerHTML, "-----innerHTML-----");
  395 + // let a = this.processString(firstP.innerHTML);
  396 + // firstP.innerHTML = a;
  397 + // }
396 398 },
397 399  
398 400 // 启动编辑模式
... ... @@ -648,7 +650,7 @@ export default {
648 650 },
649 651  
650 652 // 保存
651   - handleSava() {
  653 + handleSava(type) {
652 654 let param = {
653 655 paperTitle: this.inputValue,
654 656 subjectName: this.subjectName,
... ... @@ -659,11 +661,13 @@ export default {
659 661 if (res.status == 0) {
660 662 this.groups = [];
661 663 this.testData = [];
662   - localStorage.setItem("testlist", JSON.stringify(this.questions));
  664 + localStorage.setItem("testlist", JSON.stringify(this.testData));
663 665 localStorage.setItem("question", JSON.stringify(this.groups));
664 666 this.$emit("setQuestions");
665   - this.testDataFun();
666 667 this.handleClose();
  668 + if (type) {
  669 + console.log(123);
  670 + }
667 671 }
668 672 });
669 673 },
... ...
src/views/basic/askTestQuestion/wrongQuestion.vue
... ... @@ -51,6 +51,7 @@
51 51 <el-col class="col-margin" :span="12">
52 52 <span style="font-weight: 600">时间:</span>
53 53 <el-date-picker
  54 + :clearable="false"
54 55 value-format="yyyy-MM-dd"
55 56 class="filter-datePicker"
56 57 v-model="formData.dateRange"
... ... @@ -566,24 +567,22 @@ export default {
566 567 // 获取ref
567 568 onIFrameLoad(index) {
568 569 const iframeRef = this.$refs["iframe" + index][0]; // 获取对应的 iframe
569   - const doc = iframeRef.contentDocument || iframeRef.contentWindow.document;
570   - const body = iframeRef.contentWindow.document.body;
571   - const height = body.scrollHeight; // 获取内容的高度
572   - iframeRef.style.height = `${height}px`; // 设置 iframe 的高度
573   - // 获取第一个P标签
574   - const firstP = doc.getElementsByTagName("p")[0];
575   - // 或者修改第一个 < p > 标签的内容;
576   - if (firstP) {
577   - console.log(firstP, firstP.innerHTML, "-----innerHTML-----");
578   - let a = this.processString(firstP.innerHTML);
579   - firstP.innerHTML = a;
580   - }
  570 + // const doc = iframeRef.contentDocument || iframeRef.contentWindow.document;
  571 + // const body = iframeRef.contentWindow.document.body;
  572 + // const height = body.scrollHeight; // 获取内容的高度
  573 + // iframeRef.style.height = `${height}px`; // 设置 iframe 的高度
  574 + // // 获取第一个P标签
  575 + // const firstP = doc.getElementsByTagName("p")[0];
  576 + // // 或者修改第一个 < p > 标签的内容;
  577 + // if (firstP) {
  578 + // console.log(firstP, firstP.innerHTML, "-----innerHTML-----");
  579 + // let a = this.processString(firstP.innerHTML);
  580 + // firstP.innerHTML = a;
  581 + // }
581 582 },
582 583  
583 584 // 子集删除后 父级需要更新
584 585 setQuestions() {
585   - console.log("我被调用");
586   -
587 586 this.questions = JSON.parse(localStorage.getItem("testlist")) || [];
588 587 },
589 588 },
... ...