Commit 03105460d3f1d5f8cceadaf0b48b6d887569bcfb
1 parent
343a33c6
feat: bug修复
Showing
2 changed files
with
30 additions
and
25 deletions
src/api/apis/apis.js
| ... | ... | @@ -8,11 +8,11 @@ const defaltService = (url, data) => { | 
| 8 | 8 | data, | 
| 9 | 9 | }); | 
| 10 | 10 | }; | 
| 11 | -const defaltGetService = (url, data) => { | |
| 11 | +const defaltGetService = (url, params) => { | |
| 12 | 12 | return service({ | 
| 13 | 13 | url: url, | 
| 14 | - method: "Get", | |
| 15 | - data, | |
| 14 | + method: "GET", | |
| 15 | + params, | |
| 16 | 16 | }); | 
| 17 | 17 | }; | 
| 18 | 18 | const downService = (url, data) => { | ... | ... | 
src/views/basic/askTestQuestion/wrongQuestion.vue
| ... | ... | @@ -471,11 +471,10 @@ export default { | 
| 471 | 471 | }, | 
| 472 | 472 | // 全部删除 | 
| 473 | 473 | handleDelTest() { | 
| 474 | - let list = this.removeMatchingValues( | |
| 475 | - this.topicList.map((item) => item.id), | |
| 476 | - this.questions.map((item) => item.id) | |
| 477 | - ); | |
| 474 | + let list = this.removeMatchingValues(this.topicList, this.questions); | |
| 478 | 475 | this.questions = list; | 
| 476 | + console.log("移除本业", this.questions); | |
| 477 | + | |
| 479 | 478 | localStorage.setItem("testlist", JSON.stringify(this.questions)); | 
| 480 | 479 | }, | 
| 481 | 480 | // 重置 去除locastorage 以及 questions | 
| ... | ... | @@ -496,11 +495,11 @@ export default { | 
| 496 | 495 | }, | 
| 497 | 496 | // 去除第二数组中存在第一数组中的值 | 
| 498 | 497 | removeMatchingValues(arr1, arr2) { | 
| 499 | - // 将第一个数组的值存入 Set,提高查找效率 | |
| 500 | - const valuesSet = new Set(arr1); | |
| 498 | + const arr1Ids = arr1.map((item) => item.id); | |
| 499 | + const res = arr2.filter((item) => !arr1Ids.includes(item.id)); | |
| 500 | + console.log(res, "res"); | |
| 501 | 501 | |
| 502 | - // 过滤第二个数组,保留不在 Set 中的值 | |
| 503 | - return arr2.filter((value) => !valuesSet.has(value)); | |
| 502 | + return res; | |
| 504 | 503 | }, | 
| 505 | 504 | |
| 506 | 505 | // 判断第一个数组在第二个种是否全部存在 | 
| ... | ... | @@ -525,6 +524,8 @@ export default { | 
| 525 | 524 | console.log(data, "--------"); | 
| 526 | 525 | |
| 527 | 526 | this.subjectList = data.data.subjectNames; | 
| 527 | + console.log(this.subjectList, "我被打印了"); | |
| 528 | + | |
| 528 | 529 | this.formData.subjectName = this.subjectList[0]; | 
| 529 | 530 | this.getClassList(); | 
| 530 | 531 | }, | 
| ... | ... | @@ -547,13 +548,17 @@ export default { | 
| 547 | 548 | }, | 
| 548 | 549 | // 获取班级信息 | 
| 549 | 550 | async getClassList() { | 
| 550 | - let data = await this.$request.getClassList({ | |
| 551 | + console.log(this.formData, "this.formDate"); | |
| 552 | + | |
| 553 | + let data = await this.$request.getGradeList({ | |
| 551 | 554 | grade: this.formData.grade, | 
| 552 | 555 | subjectName: this.formData.subjectName, | 
| 553 | 556 | }); | 
| 554 | 557 | this.classList = [ | 
| 555 | 558 | { className: "全部", classId: null }, | 
| 556 | - ...data.data.list, | |
| 559 | + ...data.data.map((item) => { | |
| 560 | + return { className: item.className, classId: item.id }; | |
| 561 | + }), | |
| 557 | 562 | ]; | 
| 558 | 563 | this.formData.classId = null; | 
| 559 | 564 | this.getList(); | 
| ... | ... | @@ -591,18 +596,18 @@ export default { | 
| 591 | 596 | // 获取ref | 
| 592 | 597 | onIFrameLoad(index) { | 
| 593 | 598 | const iframeRef = this.$refs["iframe" + index][0]; // 获取对应的 iframe | 
| 594 | - const doc = iframeRef.contentDocument || iframeRef.contentWindow.document; | |
| 595 | - const body = iframeRef.contentWindow.document.body; | |
| 596 | - body.style.overflowX = "hidden"; // 不允许出现横向滚动条 | |
| 597 | - const height = body.scrollHeight; // 获取内容的高度 | |
| 598 | - iframeRef.style.height = `${height}px`; // 设置 iframe 的高度 | |
| 599 | - // 获取第一个P标签 | |
| 600 | - const firstP = doc.getElementsByTagName("p")[0]; | |
| 601 | - // 或者修改第一个 < p > 标签的内容; | |
| 602 | - if (firstP) { | |
| 603 | - let a = this.processString(firstP.innerHTML); | |
| 604 | - firstP.innerHTML = a; | |
| 605 | - } | |
| 599 | + // const doc = iframeRef.contentDocument || iframeRef.contentWindow.document; | |
| 600 | + // const body = iframeRef.contentWindow.document.body; | |
| 601 | + // body.style.overflowX = "hidden"; // 不允许出现横向滚动条 | |
| 602 | + // const height = body.scrollHeight; // 获取内容的高度 | |
| 603 | + // iframeRef.style.height = `${height}px`; // 设置 iframe 的高度 | |
| 604 | + // // 获取第一个P标签 | |
| 605 | + // const firstP = doc.getElementsByTagName("p")[0]; | |
| 606 | + // // 或者修改第一个 < p > 标签的内容; | |
| 607 | + // if (firstP) { | |
| 608 | + // let a = this.processString(firstP.innerHTML); | |
| 609 | + // firstP.innerHTML = a; | |
| 610 | + // } | |
| 606 | 611 | }, | 
| 607 | 612 | |
| 608 | 613 | // 子集删除后 父级需要更新 | ... | ... | 
