diff --git a/src/App.vue b/src/App.vue index 32ba27b..b3f677f 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,169 +1,162 @@ diff --git a/src/api/urls/apis.js b/src/api/urls/apis.js index 00c09be..12ccdee 100644 --- a/src/api/urls/apis.js +++ b/src/api/urls/apis.js @@ -506,7 +506,7 @@ export default { // 获取年级信息 teacherClassList: "api_html/teaching/classList", // 获取班级信息 - teacherGradeList: "api_html/teaching/grade", + teacherGradeList: "api_html/teaching/gradeByTeacher", // 保存接口 getWrongQuestionSave: "api_html/teaching/wrongQuestion/save", }; diff --git a/src/assets/images/aside/wrong-question-default.png b/src/assets/images/aside/wrong-question-default.png new file mode 100644 index 0000000..93e6849 --- /dev/null +++ b/src/assets/images/aside/wrong-question-default.png diff --git a/src/assets/images/aside/wrong-question.png b/src/assets/images/aside/wrong-question.png new file mode 100644 index 0000000..7543ea6 --- /dev/null +++ b/src/assets/images/aside/wrong-question.png diff --git a/src/router/index.js b/src/router/index.js index 456cb56..18fc709 100755 --- a/src/router/index.js +++ b/src/router/index.js @@ -346,8 +346,8 @@ let addrouters = [ }, { path: "/wrongQuestion", - iconImage: require("@/assets/images/aside/suitangwen-baobiao-default.png"), - selectedIconImage: require("@/assets/images/aside/suitangwen-baobiao-selected.png"), + iconImage: require("@/assets/images/aside/wrong-question-default.png"), + selectedIconImage: require("@/assets/images/aside/wrong-question.png"), name: "错题组卷", demoRoles: ["ROLE_JIAOSHI"], component: wrongQuestion, diff --git a/src/views/basic/askTestQuestion/components/wrongQuestionDialog.vue b/src/views/basic/askTestQuestion/components/wrongQuestionDialog.vue index d594a4e..04914e3 100644 --- a/src/views/basic/askTestQuestion/components/wrongQuestionDialog.vue +++ b/src/views/basic/askTestQuestion/components/wrongQuestionDialog.vue @@ -37,6 +37,11 @@ style="padding: 0 200px" /> +
+
班级:_____________
+
姓名:_____________
+
学号:_____________
+
@@ -95,7 +100,7 @@ left: tooltipPosition.x + 'px', }" > - 单击设置试卷标题 + 单击修改大题名称
@@ -158,10 +164,18 @@ >分
- 保存试卷 - 保存并打印
-
+
题目排序 - (拖拽题号可拖拽排序)(拖拽题号可排序)
@@ -202,9 +216,10 @@ v-model="group.questionScore" :min="1" :max="30" - style="width: 100px" - :step="1" - :precision="0" + style="width: 120px" + :precision="1" + :step="0.5" + @change="handleInput" >
@@ -274,6 +289,13 @@ export default { return null; }, }, + userId: { + // uid + type: [String, Number], + default() { + return null; + }, + }, }, data() { return { @@ -302,24 +324,32 @@ export default { visible(val) { if (val) { // 上面数据测试 - this.testData = JSON.parse(localStorage.getItem("testData")) || []; - this.groups = JSON.parse(localStorage.getItem("question")) || []; + this.testData = + JSON.parse(localStorage.getItem(this.userId + "testData")) || []; + this.groups = + JSON.parse(localStorage.getItem(this.userId + "question")) || []; // 如果都没有直接return 执行初始化 if (this.groups.length == 0) { this.init(); - localStorage.setItem("testData", JSON.stringify(this.list)); + localStorage.setItem( + this.userId + "testData", + JSON.stringify(this.list) + ); return; } // 如果一致 就直接赋值 if ( this.arraysHaveSameIds(this.testData, this.list) && - JSON.parse(localStorage.getItem("question")) + JSON.parse(localStorage.getItem(this.userId + "question")) ) { return; } else { let data = this.findMissingIds(this.testData, this.list); this.testData = this.list; - localStorage.setItem("testData", JSON.stringify(this.testData)); + localStorage.setItem( + this.userId + "testData", + JSON.stringify(this.testData) + ); this.testAddDel(this.groups, data.addArr, data.delArr); } } else { @@ -346,7 +376,10 @@ export default { this.groups.reduce((accumulator, current) => { return accumulator.concat(current.subQuestionIds); }, []) || []; - localStorage.setItem("testData", JSON.stringify(this.testData)); + localStorage.setItem( + this.userId + "testData", + JSON.stringify(this.testData) + ); }, /** 按钮 - 取消 */ handleClose() { @@ -370,7 +403,10 @@ export default { allItems.forEach((item, index) => { item.globalIndex = index + 1; }); - localStorage.setItem("question", JSON.stringify(this.groups)); + localStorage.setItem( + this.userId + "question", + JSON.stringify(this.groups) + ); }, classifyByType(arr) { const result = {}; @@ -397,7 +433,9 @@ export default { const doc = iframeRef.contentDocument || iframeRef.contentWindow.document; const body = iframeRef.contentWindow.document.body; body.style.overflowX = "hidden"; // 不允许出现横向滚动条 - const height = body.scrollHeight; // 获取内容的高度 + const height = body.offsetHeight; // 获取内容的高度 + console.log(height, "height"); + console.log(body, "body"); iframeRef.style.height = `${height + 20}px`; // 设置 iframe 的高度 // 获取第一个P标签 const firstP = doc.getElementsByTagName("p")[0]; @@ -421,7 +459,10 @@ export default { // 保存修改后的内容,回车或失去焦点时触发 save() { this.isEditing = false; - localStorage.setItem("question", JSON.stringify(this.groups)); + localStorage.setItem( + this.userId + "question", + JSON.stringify(this.groups) + ); }, // 单题title修改 @@ -438,7 +479,10 @@ export default { // 单体title保存 groupSave(index) { this.$set(this.groups[index], "input", false); - localStorage.setItem("question", JSON.stringify(this.groups)); + localStorage.setItem( + this.userId + "question", + JSON.stringify(this.groups) + ); }, // 高亮 selectItem(id, type) { @@ -456,10 +500,16 @@ export default { let _index = this.groups.findIndex((item) => item.questionType == id); if (_index != -1) { this.groups.splice(_index, 1); - localStorage.setItem("question", JSON.stringify(this.groups)); + localStorage.setItem( + this.userId + "question", + JSON.stringify(this.groups) + ); this.updateGlobalIndexes(); this.testDataFun(); - localStorage.setItem("testlist", JSON.stringify(this.testData)); + localStorage.setItem( + this.userId + "testlist", + JSON.stringify(this.testData) + ); this.$emit("setQuestions"); } } else { @@ -470,10 +520,16 @@ export default { ); } }); - localStorage.setItem("question", JSON.stringify(this.groups)); + localStorage.setItem( + this.userId + "question", + JSON.stringify(this.groups) + ); this.updateGlobalIndexes(); this.testDataFun(); - localStorage.setItem("testlist", JSON.stringify(this.testData)); + localStorage.setItem( + this.userId + "testlist", + JSON.stringify(this.testData) + ); this.$emit("setQuestions"); } }, @@ -547,19 +603,32 @@ export default { return false; }, processString(input) { - // 正则表达式:匹配最多三位数字 - const regex = /^(\d{1,3})/; - - // 测试字符串是否以数字开头 - const match = input.match(regex); + // 正则表达式: + // const regexs = [/[0-9]+[.)]/, /(\d+分)/, /^(\d{1,3})/]; + // // 使用正则表达式匹配并处理输入字符串 + // for (const regex of regexs) { + // const match = input.match(regex); + // if (match) { + // if (regex === regexs[2]) { + // // 如果匹配第三条规则,使用substring截取返回结果的长度加1 + // const matchLength = match[0].length; + // return input.substring(matchLength + 1).trim(); + // } else { + // // 如果匹配第一条或第二条规则,替换匹配的部分 + // input = input.replace(regex, ""); + // } + // } + // } + const match = input.match(/^(\d{1,3})/); if (match) { - // 如果匹配,去掉开头的数字并返回剩余部分 - return input.substring(match[0].length + 1).trim(); + const matchLength = match[0].length; + input = input.substring(matchLength + 1).trim(); } - - // 如果没有匹配,直接返回原字符串 - return input; + // 使用正则表达式匹配并处理输入字符串 + input = input.replace(/[0-9]+[.).]/, ""); + input = input.replace(/(\d+(\.\d+)?分)/g, ""); + return input.trim(); }, // 接受两个参数,返回需要删除的数据以及需要添加的数据 @@ -608,16 +677,14 @@ export default { // 删除数据 arr3.forEach((item3) => { // 在 array1 中找到匹配的 type - let matchedArray1Item = arr1.find( - (item1) => item1.questionType == item3.questionType + let matchedArray1Item = arr1.find((item1) => + item1.subQuestionIds.filter((item) => item.id == item3.id) ); if (matchedArray1Item) { // 如果找到了匹配的 type,遍历 matchedArray1Item 的 items let _index = matchedArray1Item.subQuestionIds.findIndex( (item) => item.id === item3.id ); - console.log("_index"); - if (_index != -1) { matchedArray1Item.subQuestionIds.splice(_index, 1); } @@ -673,10 +740,21 @@ export default { if (res.status == 0) { this.groups = []; this.testData = []; - localStorage.setItem("testlist", JSON.stringify(this.testData)); - localStorage.setItem("question", JSON.stringify(this.groups)); + localStorage.setItem( + this.userId + "testlist", + JSON.stringify(this.testData) + ); + localStorage.setItem( + this.userId + "question", + JSON.stringify(this.groups) + ); this.$emit("setQuestions"); this.handleClose(); + this.$message({ + message: "已保存到“即时测-组卷-我自编的”", + type: "success", + }); + if (type == "print") { this.$request .tPaperDetail({ @@ -693,7 +771,7 @@ export default { // 清空 handleClear() { this.$confirm("确定要清空试题篮内的全部题目吗?", "提示", { - confirmButtonText: "确定", + confirmButtonText: "清空", cancelButtonText: "取消", confirmButtonClass: "el-button--danger1", cancelButtonClass: "el-button--primary", @@ -705,8 +783,15 @@ export default { .then(() => { this.groups = []; this.testDataFun(); - localStorage.setItem("question", JSON.stringify(this.groups)); - localStorage.setItem("testlist", JSON.stringify(this.testData)); + localStorage.setItem( + this.userId + "question", + JSON.stringify(this.groups) + ); + localStorage.setItem( + this.userId + "testlist", + JSON.stringify(this.testData) + ); + this.$emit("setQuestions"); }) .catch(() => { @@ -724,6 +809,30 @@ export default { return sum + Number(item.questionScore) * item.subQuestionIds.length; }, 0); }, + + // 当分数发生变化的时候 + handleInput() { + localStorage.setItem( + this.userId + "question", + JSON.stringify(this.groups) + ); + }, + dataYesNo(data) { + if (data.length < 1) { + return true; + } + let list = []; + data.forEach((item) => { + list.push(...item.subQuestionIds); + }); + console.log(list, "list"); + + if (list.length < 1) { + return true; + } else { + return false; + } + }, }, }; @@ -739,9 +848,9 @@ export default { .test { flex: 1; height: fit-content; - max-height: 742px; + height: 742px; overflow-y: auto; - box-shadow: 0 0 10px 0 #999999; + box-shadow: 0 0 10px 0 #cfcfcf; margin-right: 20px; box-sizing: border-box; padding: 0 20px; @@ -763,13 +872,17 @@ export default { justify-content: space-around; align-items: center; } - + .binding { + display: flex; + padding: 20px 80px; + justify-content: space-around; + } .test-group { .test-group-title { position: relative; height: 40px; - line-height: 30px; - padding: 10px 0 0 0; + line-height: 40px; + padding: 0; } } } @@ -782,7 +895,8 @@ export default { .edit-title { width: 100%; height: 200px; - border: 1px solid #999999; + border: 1px solid #cfcfcf; + border-radius: 5px; .edit-title-info { height: 60px; @@ -814,11 +928,12 @@ export default { .edit-info { flex: 1; - border: 1px solid #999999; + border: 1px solid #cfcfcf; margin-top: 20px; max-height: 500px; padding: 10px; overflow: auto; + border-radius: 5px; .group-item { margin: 10px; @@ -838,14 +953,14 @@ export default { .questions { display: flex; flex-wrap: wrap; - + padding: 10px 0; .question-item { width: 35px; height: 35px; border: 1px solid rgb(172, 188, 249); border-radius: 4px; cursor: grab; - margin: 5px 8px; + margin: 0 10px 10px 10px; line-height: 35px; text-align: center; font-size: 16px !important; @@ -882,6 +997,7 @@ export default { .border { border: 1px solid rgb(173, 190, 250); position: relative; + border-radius: 3px; .border-del { position: absolute; @@ -894,7 +1010,7 @@ export default { color: rgb(67, 141, 255); font-size: 14px !important; line-height: 28px; - font-weight: 600; + cursor: pointer; } } @@ -919,9 +1035,16 @@ export default { background: rgb(233, 237, 253); width: fit-content; } +.borderTitle { + background: rgba(102, 127, 253, 0.1); + padding: 0; +} .title-bg { background: rgb(115, 142, 246); border-bottom: 1px solid rgb(115, 142, 246); } +.font-weight { + font-weight: 400; +} diff --git a/src/views/basic/askTestQuestion/update.vue b/src/views/basic/askTestQuestion/update.vue index c562ea8..f64166b 100644 --- a/src/views/basic/askTestQuestion/update.vue +++ b/src/views/basic/askTestQuestion/update.vue @@ -80,7 +80,7 @@

------

-
@@ -162,7 +162,7 @@

------

-
@@ -331,7 +331,7 @@
取消 - 保存 + 保存
diff --git a/src/views/basic/askTestQuestion/wrongQuestion.vue b/src/views/basic/askTestQuestion/wrongQuestion.vue index 948f69d..ca98339 100644 --- a/src/views/basic/askTestQuestion/wrongQuestion.vue +++ b/src/views/basic/askTestQuestion/wrongQuestion.vue @@ -1,7 +1,13 @@