From b82c38c60e0d912f5edf29011ca4cd4c87c84465 Mon Sep 17 00:00:00 2001 From: JIAN Date: Thu, 6 Jun 2024 10:54:54 +0800 Subject: [PATCH 1/2] =?UTF-8?q?feat:=E5=A2=9E=E5=8A=A0=E9=A2=86=E8=88=AA?= =?UTF-8?q?=E5=A4=A7=E5=AD=A6=E8=8B=B1=E8=AF=AD=E7=BB=BC=E5=90=88=E6=95=99?= =?UTF-8?q?=E7=A8=8B1=E5=92=8C2=E7=9A=84=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/projects/welearn/exercise/courses.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/projects/welearn/exercise/courses.ts b/src/projects/welearn/exercise/courses.ts index 7b7f413..dbed974 100644 --- a/src/projects/welearn/exercise/courses.ts +++ b/src/projects/welearn/exercise/courses.ts @@ -41,6 +41,8 @@ const DATA_SOLUTION = [ "New Advanced College English-Integrated Course 2", // 所以如果只是后端添加catalog,只有第一个页面有效 "New Advanced College English-Integrated Course 3", "New Advanced College English-Integrated Course 4", + "Pioneer College English Integrated Course 1", // 领航大学英语综合教程1 + "Pioneer College English Integrated Course 2", // 领航大学英语综合教程2 ]; /**et类型(url中包含data)理论上可以直接在原始页面上找(Demcorazy就是这么做的),不过也可以统一通过ajax请求获取*/ From fa25b874d4ce4d07816c77a00006d11c3b61f175 Mon Sep 17 00:00:00 2001 From: JIAN Date: Thu, 6 Jun 2024 11:59:05 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix:=E9=A2=86=E8=88=AA=E5=A4=A7=E5=AD=A6?= =?UTF-8?q?=E8=8B=B1=E8=AF=AD=E4=B8=AD=E9=83=A8=E5=88=86=E5=A1=AB=E7=A9=BA?= =?UTF-8?q?=E9=A2=98=E6=97=A0=E6=B3=95=E8=8E=B7=E5=8F=96=E7=AD=94=E6=A1=88?= =?UTF-8?q?=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../welearn/exercise/dataSolution/parser.ts | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/projects/welearn/exercise/dataSolution/parser.ts b/src/projects/welearn/exercise/dataSolution/parser.ts index 278320f..938b142 100644 --- a/src/projects/welearn/exercise/dataSolution/parser.ts +++ b/src/projects/welearn/exercise/dataSolution/parser.ts @@ -27,13 +27,26 @@ function parseAnswer(element: HTMLElement) { answerType = "blank"; } else { //选择题 + answerType = "choice"; try { - answerText = element.firstElementChild!.textContent; - if (!answerText) answerText = element.textContent; + let Nodechild = element.firstElementChild!; + let NodeSibling = element.nextElementSibling; + if (Nodechild) { + answerText = Nodechild.textContent; + } else if (NodeSibling) { + // 适配领航大学英语中部分填空题的答案位置(被相邻节点包含) + if (NodeSibling.hasChildNodes()) { + NodeSibling.childNodes.forEach(node => answerText += node.textContent?.trim() + " " || "") + } else { + answerText = NodeSibling.textContent?.trim() || answerText + } + answerType = "blank"; + } else { + answerText = element.textContent; + } } catch (error) { answerText = element.textContent; } - answerType = "choice"; } return {