From 8f4845a37cd76fd012c26a8c48b58614a5cef6d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Czouyf=E2=80=9D?= <80906036@qq.com> Date: Thu, 31 Oct 2024 12:33:16 +0800 Subject: [PATCH] =?UTF-8?q?[=E9=80=90=E9=A2=98=E8=AE=B2=E8=A7=A3]=20-=20?= =?UTF-8?q?=E5=85=BC=E5=AE=B9=E5=A1=AB=E7=A9=BA=E8=87=AA=E5=BB=BA=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/classTask/container/classOverview.vue | 8 ++++++-- src/renderer/src/views/classTask/container/quizStats.vue | 9 +++++++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/renderer/src/views/classTask/container/classOverview.vue b/src/renderer/src/views/classTask/container/classOverview.vue index 8ce866b..c3992f3 100644 --- a/src/renderer/src/views/classTask/container/classOverview.vue +++ b/src/renderer/src/views/classTask/container/classOverview.vue @@ -147,8 +147,12 @@ const initData = () => { }) } else if (o.worktype == '填空题') { // 填空题 - const regex = /(.*?)/g // 定义正则表达式,匹配 xxx 格式的内容 - children = (o.title||'').match(regex).map((v,i) => { + let title = o.title.replace(/_{3,}/g, '_____'); //将3-10的下划线统一格式为5个 + let regex = /(.*?)/g // 定义正则表达式,匹配 xxx 格式的内容 + if (title.indexOf('_____') != -1) { + regex = /_{5}/g // 定义正则表达式,匹配 xxx 格式的内容 + } + children = (title||'').match(regex).map((v,i) => { const def = `填空项 ${i+1}` //const code = '( )' const code = '(略)', txt=v diff --git a/src/renderer/src/views/classTask/container/quizStats.vue b/src/renderer/src/views/classTask/container/quizStats.vue index cd824c9..da72dcc 100644 --- a/src/renderer/src/views/classTask/container/quizStats.vue +++ b/src/renderer/src/views/classTask/container/quizStats.vue @@ -224,8 +224,13 @@ const initData = () => { }) } else if (o.worktype == '填空题') { // 填空题 - const regex = /(.*?)/g // 定义正则表达式,匹配 xxx 格式的内容 - children = (o.title||'').match(regex).map((v,i) => { + //console.log('填空题->', o.title); + let title = o.title.replace(/_{3,}/g, '_____'); //将3-10的下划线统一格式为5个 + let regex = /(.*?)/g // 定义正则表达式,匹配 xxx 格式的内容 + if (title.indexOf('_____') != -1) { + regex = /_{5}/g // 定义正则表达式,匹配 xxx 格式的内容 + } + children = (title||'').match(regex).map((v,i) => { const def = `填空项 ${i+1}` //const code = '( )' const code = '(略)', txt=v