|
@@ -65,6 +65,13 @@
|
|
>
|
|
>
|
|
进入查重
|
|
进入查重
|
|
</el-button>
|
|
</el-button>
|
|
|
|
+ <el-button
|
|
|
|
+ size="small"
|
|
|
|
+ type="primary"
|
|
|
|
+ plain
|
|
|
|
+ @click="toImportPaperAnswer"
|
|
|
|
+ >导入答案</el-button
|
|
|
|
+ >
|
|
<el-button
|
|
<el-button
|
|
size="small"
|
|
size="small"
|
|
type="primary"
|
|
type="primary"
|
|
@@ -192,7 +199,7 @@
|
|
>编辑
|
|
>编辑
|
|
</el-button>
|
|
</el-button>
|
|
<el-button
|
|
<el-button
|
|
- v-if="!detailIndex"
|
|
|
|
|
|
+ v-if="detailIndex"
|
|
size="small"
|
|
size="small"
|
|
type="primary"
|
|
type="primary"
|
|
plain
|
|
plain
|
|
@@ -315,7 +322,7 @@
|
|
>编辑
|
|
>编辑
|
|
</el-button>
|
|
</el-button>
|
|
<el-button
|
|
<el-button
|
|
- v-if="!unitIndex"
|
|
|
|
|
|
+ v-if="unitIndex"
|
|
size="small"
|
|
size="small"
|
|
type="primary"
|
|
type="primary"
|
|
plain
|
|
plain
|
|
@@ -389,7 +396,7 @@
|
|
>
|
|
>
|
|
<div class="edit-cont">
|
|
<div class="edit-cont">
|
|
<div class="edit-cont-title">
|
|
<div class="edit-cont-title">
|
|
- <span>{{ subQuestion.subNumber }}. </span>
|
|
|
|
|
|
+ <span>{{ subIndex + 1 }}. </span>
|
|
<rich-text :text-json="subQuestion.quesBody"></rich-text>
|
|
<rich-text :text-json="subQuestion.quesBody"></rich-text>
|
|
<span
|
|
<span
|
|
>({{ paperDetailUnit.subScoreList[subIndex] }}分)</span
|
|
>({{ paperDetailUnit.subScoreList[subIndex] }}分)</span
|
|
@@ -458,6 +465,15 @@
|
|
></modify-detail-struct>
|
|
></modify-detail-struct>
|
|
<!-- 基础构成 -->
|
|
<!-- 基础构成 -->
|
|
<paper-base-info ref="PaperBaseInfo" :paper-id="paperId"></paper-base-info>
|
|
<paper-base-info ref="PaperBaseInfo" :paper-id="paperId"></paper-base-info>
|
|
|
|
+ <!-- 上传答案文件 -->
|
|
|
|
+ <import-file-dialog
|
|
|
|
+ ref="ImportAnswerDialog"
|
|
|
|
+ dialog-title="上传答案文件"
|
|
|
|
+ :template-url="answerTemplateUrl"
|
|
|
|
+ :upload-url="uploadAnswerUrl"
|
|
|
|
+ add-file-param="dataFile"
|
|
|
|
+ @uploaded="initPaper"
|
|
|
|
+ ></import-file-dialog>
|
|
<!-- 题型分布 -->
|
|
<!-- 题型分布 -->
|
|
<paper-questype-info
|
|
<paper-questype-info
|
|
ref="PaperQuestypeInfo"
|
|
ref="PaperQuestypeInfo"
|
|
@@ -474,6 +490,12 @@
|
|
ref="PaperAuditInfo"
|
|
ref="PaperAuditInfo"
|
|
:paper-id="paperId"
|
|
:paper-id="paperId"
|
|
></paper-audit-info>
|
|
></paper-audit-info>
|
|
|
|
+ <!-- 试题编辑 -->
|
|
|
|
+ <question-edit-dialog
|
|
|
|
+ ref="QuestionEditDialog"
|
|
|
|
+ :question="curQuestion"
|
|
|
|
+ @modified="questionEdited"
|
|
|
|
+ ></question-edit-dialog>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
@@ -488,15 +510,19 @@ import {
|
|
paperQuestionMoveApi,
|
|
paperQuestionMoveApi,
|
|
paperQuestionDeleteApi,
|
|
paperQuestionDeleteApi,
|
|
paperQuestionUnitDeleteApi,
|
|
paperQuestionUnitDeleteApi,
|
|
|
|
+ paperQuestionSaveApi,
|
|
} from "../api";
|
|
} from "../api";
|
|
import { QUESTION_API } from "@/constants/constants";
|
|
import { QUESTION_API } from "@/constants/constants";
|
|
|
|
|
|
|
|
+import ImportFileDialog from "@/components/ImportFileDialog.vue";
|
|
import PaperBaseInfo from "../components/PaperBaseInfo.vue";
|
|
import PaperBaseInfo from "../components/PaperBaseInfo.vue";
|
|
import PaperQuestypeInfo from "../components/PaperQuestypeInfo.vue";
|
|
import PaperQuestypeInfo from "../components/PaperQuestypeInfo.vue";
|
|
import PaperBlueInfo from "../components/PaperBlueInfo.vue";
|
|
import PaperBlueInfo from "../components/PaperBlueInfo.vue";
|
|
import PaperAuditInfo from "../components/PaperAuditInfo.vue";
|
|
import PaperAuditInfo from "../components/PaperAuditInfo.vue";
|
|
import ModifyDetailStruct from "../components/ModifyDetailStruct.vue";
|
|
import ModifyDetailStruct from "../components/ModifyDetailStruct.vue";
|
|
import ModifyRichText from "@/components/ModifyRichText.vue";
|
|
import ModifyRichText from "@/components/ModifyRichText.vue";
|
|
|
|
+import QuestionEditDialog from "../../question/components/QuestionEditDialog.vue";
|
|
|
|
+import { calcSum } from "@/plugins/utils";
|
|
|
|
|
|
export default {
|
|
export default {
|
|
name: "EditPaper",
|
|
name: "EditPaper",
|
|
@@ -507,6 +533,8 @@ export default {
|
|
PaperBlueInfo,
|
|
PaperBlueInfo,
|
|
ModifyDetailStruct,
|
|
ModifyDetailStruct,
|
|
ModifyRichText,
|
|
ModifyRichText,
|
|
|
|
+ QuestionEditDialog,
|
|
|
|
+ ImportFileDialog,
|
|
},
|
|
},
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
@@ -527,6 +555,10 @@ export default {
|
|
quesTagShow: false,
|
|
quesTagShow: false,
|
|
quesAnswerShow: false,
|
|
quesAnswerShow: false,
|
|
curDetail: {},
|
|
curDetail: {},
|
|
|
|
+ curQuestion: {},
|
|
|
|
+ // upload answer
|
|
|
|
+ uploadAnswerUrl: "",
|
|
|
|
+ answerTemplateUrl: "",
|
|
};
|
|
};
|
|
},
|
|
},
|
|
computed: {
|
|
computed: {
|
|
@@ -618,6 +650,13 @@ export default {
|
|
window.history.go(-1);
|
|
window.history.go(-1);
|
|
this.toBack();
|
|
this.toBack();
|
|
},
|
|
},
|
|
|
|
+ // 导入答案
|
|
|
|
+ toImportPaperAnswer() {
|
|
|
|
+ const { key, token } = this.user;
|
|
|
|
+ this.answerTemplateUrl = `${QUESTION_API}/paper/answer/template?$key=${key}&$token=${token}`;
|
|
|
|
+ this.uploadAnswerUrl = `${QUESTION_API}/paper/answer/import/${this.paperId}`;
|
|
|
|
+ this.$refs.ImportAnswerDialog.open();
|
|
|
|
+ },
|
|
// 导出答案
|
|
// 导出答案
|
|
toExportPaperAnswer() {
|
|
toExportPaperAnswer() {
|
|
const { key, token } = this.user;
|
|
const { key, token } = this.user;
|
|
@@ -776,7 +815,45 @@ export default {
|
|
},
|
|
},
|
|
});
|
|
});
|
|
},
|
|
},
|
|
- toEditQues() {},
|
|
|
|
|
|
+ toEditQues(row) {
|
|
|
|
+ let question = row.question;
|
|
|
|
+ const courseInfo = {
|
|
|
|
+ courseId: question.course.id,
|
|
|
|
+ courseCode: question.course.code,
|
|
|
|
+ courseName: question.course.name,
|
|
|
|
+ };
|
|
|
|
+ let curQuestion = {
|
|
|
|
+ ...question,
|
|
|
|
+ ...courseInfo,
|
|
|
|
+ score: row.score,
|
|
|
|
+ editMode: "paper",
|
|
|
|
+ questionUnitId: row.id,
|
|
|
|
+ };
|
|
|
|
+ if (curQuestion.subQuestions && curQuestion.subQuestions.length) {
|
|
|
|
+ curQuestion.subQuestions = curQuestion.subQuestions.map((q) => {
|
|
|
|
+ return { ...q, ...courseInfo, editMode: "paper" };
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ this.curQuestion = curQuestion;
|
|
|
|
+
|
|
|
|
+ this.$refs.QuestionEditDialog.open();
|
|
|
|
+ },
|
|
|
|
+ async questionEdited(question) {
|
|
|
|
+ if (question.subQuestions && question.subQuestions.length) {
|
|
|
|
+ question.score = calcSum(
|
|
|
|
+ question.subQuestions.map((item) => item.score || 0)
|
|
|
|
+ );
|
|
|
|
+ }
|
|
|
|
+ let questionUnit = {
|
|
|
|
+ id: this.curQuestion.questionUnitId,
|
|
|
|
+ question,
|
|
|
|
+ score: question.score,
|
|
|
|
+ };
|
|
|
|
+ const res = await paperQuestionSaveApi(questionUnit).catch(() => {});
|
|
|
|
+ if (!res) return;
|
|
|
|
+ this.$message.success("保存成功!");
|
|
|
|
+ this.initPaper();
|
|
|
|
+ },
|
|
// 移动小题
|
|
// 移动小题
|
|
async toMoveQues(detailId, unitid, vector) {
|
|
async toMoveQues(detailId, unitid, vector) {
|
|
const vectorStr = vector == "up" ? "上移" : "下移";
|
|
const vectorStr = vector == "up" ? "上移" : "下移";
|