diff --git a/src/views/basic/askTestQuestion/components/wrongQuestionDialog.vue b/src/views/basic/askTestQuestion/components/wrongQuestionDialog.vue
index 8b5e99d..60423dc 100644
--- a/src/views/basic/askTestQuestion/components/wrongQuestionDialog.vue
+++ b/src/views/basic/askTestQuestion/components/wrongQuestionDialog.vue
@@ -743,7 +743,7 @@ export default {
this.$emit("setQuestions");
this.handleClose();
this.$message({
- message: "已保存到“即时测-组卷-我自编的",
+ message: "已保存到“即时测-组卷-我自编的”",
type: "success",
});
diff --git a/src/views/basic/askTestQuestion/wrongQuestion.vue b/src/views/basic/askTestQuestion/wrongQuestion.vue
index deb2141..1f0020f 100644
--- a/src/views/basic/askTestQuestion/wrongQuestion.vue
+++ b/src/views/basic/askTestQuestion/wrongQuestion.vue
@@ -162,7 +162,9 @@
得分率:
- {{ item.scoreRate }}%
+ {{ formatNumber(item.scoreRate) }}%
({{ item.joinClassNames }})
@@ -656,23 +658,23 @@ export default {
// let a = this.processString(firstP.innerHTML);
// firstP.innerHTML = a;
// }
- // const doc = iframeRef.contentDocument || iframeRef.contentWindow.document;
- // const body = iframeRef.contentWindow.document.body;
- // body.style.overflowX = "hidden"; // 不允许出现横向滚动条
- // const height = body.offsetHeight; // 获取内容的高度
- // console.log(height, "height");
- // // console.log("body.offsetHeight:", body.offsetHeight);
- // // console.log("body.clientHeight:", body.clientHeight);
- // // console.log("body.scrollHeight:", body.scrollHeight);
-
- // iframeRef.style.height = `${height + 20}px`; // 设置 iframe 的高度
- // // 获取第一个P标签
- // const firstP = doc.getElementsByTagName("p")[0];
- // // 或者修改第一个 < p > 标签的内容;
- // if (firstP) {
- // let a = this.processString(firstP.innerHTML);
- // firstP.innerHTML = a;
- // }
+ const doc = iframeRef.contentDocument || iframeRef.contentWindow.document;
+ const body = iframeRef.contentWindow.document.body;
+ body.style.overflowX = "hidden"; // 不允许出现横向滚动条
+ const height = body.offsetHeight; // 获取内容的高度
+ console.log(height, "height");
+ // console.log("body.offsetHeight:", body.offsetHeight);
+ // console.log("body.clientHeight:", body.clientHeight);
+ // console.log("body.scrollHeight:", body.scrollHeight);
+
+ iframeRef.style.height = `${height + 20}px`; // 设置 iframe 的高度
+ // 获取第一个P标签
+ const firstP = doc.getElementsByTagName("p")[0];
+ // 或者修改第一个 < p > 标签的内容;
+ if (firstP) {
+ let a = this.processString(firstP.innerHTML);
+ firstP.innerHTML = a;
+ }
},
// 子集删除后 父级需要更新
@@ -686,6 +688,24 @@ export default {
this.analysisUrl = url;
this.analysisVisible = true;
},
+
+ // 保留两位小数
+ formatNumber(num) {
+ // 检查是否是数字
+ if (typeof num !== "number") {
+ throw new Error("输入必须是数字");
+ }
+
+ // 检查小数位数
+ const parts = num.toString().split(".");
+ if (parts.length === 2 && parts[1].length > 2) {
+ // 如果小数部分超过两位,保留两位小数
+ return parseFloat(num.toFixed(2));
+ } else {
+ // 否则返回原数据
+ return num;
+ }
+ },
},
};