From df2979bc59739a60c7bf8234c1625da8e949e610 Mon Sep 17 00:00:00 2001 From: 刘有才luck <14606842+liu-youcai-luck@user.noreply.gitee.com> Date: Thu, 12 Dec 2024 09:55:23 +0800 Subject: [PATCH] wip: 细节修改 --- src/views/basic/askTestQuestion/components/analysisDialog.vue | 6 ++---- src/views/basic/askTestQuestion/components/wrongQuestionDialog.vue | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++------- src/views/basic/askTestQuestion/wrongQuestion.vue | 18 +++++++++++------- 3 files changed, 64 insertions(+), 18 deletions(-) diff --git a/src/views/basic/askTestQuestion/components/analysisDialog.vue b/src/views/basic/askTestQuestion/components/analysisDialog.vue index 99b14e8..dce6007 100644 --- a/src/views/basic/askTestQuestion/components/analysisDialog.vue +++ b/src/views/basic/askTestQuestion/components/analysisDialog.vue @@ -10,7 +10,7 @@ :src="analysisUrl" ref="iframe" @load="onIFrameLoad()" - style="width: 100%; border: none; /* 启用点击穿透 */" + style="width: 100%; border: none; max-height: 600px; /* 启用点击穿透 */" > @@ -94,8 +94,6 @@ export default { .test-box { width: 100%; box-sizing: border-box; - padding: 20px; - max-height: 600px; - overflow-y: auto; + overflow: auto; } diff --git a/src/views/basic/askTestQuestion/components/wrongQuestionDialog.vue b/src/views/basic/askTestQuestion/components/wrongQuestionDialog.vue index 86ffa3a..afea32c 100644 --- a/src/views/basic/askTestQuestion/components/wrongQuestionDialog.vue +++ b/src/views/basic/askTestQuestion/components/wrongQuestionDialog.vue @@ -69,7 +69,7 @@ @mouseenter="handleGroupMouseEnter(group.questionType, 'all')" >
- {{ index + 1 }}、 + {{ numberToChinese(index + 1) }}、
- {{ index + 1 }}、{{ group.questionTitle }} + {{ numberToChinese(index + 1) }}、{{ group.questionTitle }}
单题分值: @@ -434,9 +434,10 @@ export default { const iframeRef = this.$refs["iframe" + id][0]; // 获取对应的 iframe const doc = iframeRef.contentDocument || iframeRef.contentWindow.document; const body = iframeRef.contentWindow.document.body; - body.style.overflowX = "hidden"; // 不允许出现横向滚动条 + body.style.overflow = "hidden"; // 不允许出现横向滚动条 const height = body.offsetHeight; // 获取内容的高度 iframeRef.style.height = `${height + 40}px`; // 设置 iframe 的高度 + iframeRef.style.overflow = "hidden"; // 设置 iframe 的高度 // 获取第一个P标签 const firstP = doc.getElementsByTagName("p")[0]; // 或者修改第一个 < p > 标签的内容; @@ -755,7 +756,7 @@ export default { // 清空 handleClear() { - this.$confirm("此操作将永久删除该文件, 是否继续?", "提示", { + this.$confirm("确定要清空试题篮内的全部题目吗?", "提示", { confirmButtonText: "确定", cancelButtonText: "取消", confirmButtonClass: "el-button--danger1", @@ -847,11 +848,54 @@ export default { return false; } }, + + numberToChinese(num) { + const units = ["", "十", "百", "千", "万", "十万", "百万", "千万", "亿"]; + const digits = [ + "零", + "一", + "二", + "三", + "四", + "五", + "六", + "七", + "八", + "九", + ]; + + if (num === 0) return digits[0]; + + let result = ""; + let unitIndex = 0; // 单位索引 + let zeroFlag = false; // 用于处理连续的零 + + while (num > 0) { + const digit = num % 10; // 取出当前最低位的数字 + if (digit !== 0) { + result = digits[digit] + units[unitIndex] + result; // 拼接数字和单位 + zeroFlag = false; // 当前位不是零,重置标志 + } else if (!zeroFlag) { + result = digits[0] + result; // 只在前面有非零数字时添加零 + zeroFlag = true; // 设置标志,表示已经添加过零 + } + num = Math.floor(num / 10); // 去掉最低位 + unitIndex++; // 单位索引加一 + } + + // 处理“十”的特殊情况 + if (result.startsWith(digits[1]) && result.length > 1) { + result = result.replace(digits[1], ""); // 去掉开头的“一十” + } + + return result; + }, }, };