|
@@ -95,8 +95,10 @@
|
|
|
|
|
|
|
|
import {usePaperResolver} from "@/views/dz/papers/hooks/usePaperStorage.js";
|
|
import {usePaperResolver} from "@/views/dz/papers/hooks/usePaperStorage.js";
|
|
|
import router from "@/router/index.js";
|
|
import router from "@/router/index.js";
|
|
|
|
|
+import {ElMessage} from "element-plus";
|
|
|
|
|
+import {buildPaperManual} from "@/api/dz/papers.js";
|
|
|
|
|
|
|
|
-const {paperLocal, q, groupedQuestions, toCommitPaper} = usePaperResolver()
|
|
|
|
|
|
|
+const {paperLocal, groupedQuestions, toCommitPaper} = usePaperResolver()
|
|
|
|
|
|
|
|
const chnNumChar = ["零", "一", "二", "三", "四", "五", "六", "七", "八", "九"];
|
|
const chnNumChar = ["零", "一", "二", "三", "四", "五", "六", "七", "八", "九"];
|
|
|
const chnUnitSection = ["", "万", "亿", "万亿", "亿亿"];
|
|
const chnUnitSection = ["", "万", "亿", "万亿", "亿亿"];
|
|
@@ -226,7 +228,7 @@ const handleDragStart = function (e, group) {
|
|
|
draggingGroup.value = group
|
|
draggingGroup.value = group
|
|
|
}
|
|
}
|
|
|
const handleDragEnd = function (e, group) {
|
|
const handleDragEnd = function (e, group) {
|
|
|
- draggingGroup.value = null;
|
|
|
|
|
|
|
+ draggingGroup.value = null;
|
|
|
}
|
|
}
|
|
|
const handleDragOver = function (e) {
|
|
const handleDragOver = function (e) {
|
|
|
e.dataTransfer.dropEffect = "move"; // e.dataTransfer.dropEffect="move";//在dragenter中针对放置目标来设置!
|
|
e.dataTransfer.dropEffect = "move"; // e.dataTransfer.dropEffect="move";//在dragenter中针对放置目标来设置!
|
|
@@ -250,8 +252,8 @@ const handleQuestionDragStart = function (e, q, i) {
|
|
|
draggingQIdx.value = i
|
|
draggingQIdx.value = i
|
|
|
}
|
|
}
|
|
|
const handleQuestionDragEnd = function (e, q) {
|
|
const handleQuestionDragEnd = function (e, q) {
|
|
|
- draggingQuestion.value = null
|
|
|
|
|
- draggingQIdx.value = null
|
|
|
|
|
|
|
+ draggingQuestion.value = null
|
|
|
|
|
+ draggingQIdx.value = null
|
|
|
}
|
|
}
|
|
|
const handleQuestionDragOver = function (e) {
|
|
const handleQuestionDragOver = function (e) {
|
|
|
e.dataTransfer.dropEffect = "move"; // e.dataTransfer.dropEffect="move";//在dragenter中针对放置目标来设置!
|
|
e.dataTransfer.dropEffect = "move"; // e.dataTransfer.dropEffect="move";//在dragenter中针对放置目标来设置!
|
|
@@ -268,8 +270,16 @@ const handleQuestionDragEnter = function (e, q, gIdx, qIdx) {
|
|
|
newItems.splice(dst, 0, ...newItems.splice(src, 1));
|
|
newItems.splice(dst, 0, ...newItems.splice(src, 1));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-const handleSavePaper = function () {
|
|
|
|
|
|
|
+const handleSavePaper = async function () {
|
|
|
|
|
+ const commit = toCommitPaper()
|
|
|
|
|
+ // validation
|
|
|
|
|
+ if (!commit.name) return ElMessage.error('请填写试卷名称')
|
|
|
|
|
+ if (!commit.questions?.length) return ElMessage.error('试卷至少包含1道试题')
|
|
|
|
|
|
|
|
|
|
+ // save
|
|
|
|
|
+ // TODO: 看看这个编辑有没有包含自动组卷的情况
|
|
|
|
|
+ await buildPaperManual(commit)
|
|
|
|
|
+ ElMessage.success('保存成功')
|
|
|
}
|
|
}
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|