|
@@ -79,13 +79,6 @@
|
|
|
@click="toImportPaperProperty"
|
|
|
>导入属性</el-button
|
|
|
>
|
|
|
- <!-- <el-button
|
|
|
- size="small"
|
|
|
- type="primary"
|
|
|
- plain
|
|
|
- @click="toExportPaperAnswer"
|
|
|
- >导出答案</el-button
|
|
|
- > -->
|
|
|
<el-button
|
|
|
size="small"
|
|
|
type="danger"
|
|
@@ -144,6 +137,7 @@
|
|
|
size="small"
|
|
|
type="primary"
|
|
|
plain
|
|
|
+ :loading="downloading"
|
|
|
@click="toExportPaperBlue"
|
|
|
>导出试卷蓝图</el-button
|
|
|
>
|
|
@@ -635,6 +629,7 @@ import {
|
|
|
paperDetailAddQuestionApi,
|
|
|
paperQuestionChangeApi,
|
|
|
paperCardDeleteApi,
|
|
|
+ paperPropertyExportApi,
|
|
|
} from "../api";
|
|
|
import { QUESTION_API } from "@/constants/constants";
|
|
|
|
|
@@ -649,6 +644,7 @@ import QuestionEditDialog from "../../question/components/QuestionEditDialog.vue
|
|
|
import SelectQuestionDialog from "../components/SelectQuestionDialog.vue";
|
|
|
import QuestionAnswer from "../../question/components/QuestionAnswer.vue";
|
|
|
import { calcSum } from "@/plugins/utils";
|
|
|
+import { downloadByApi } from "@/plugins/download";
|
|
|
|
|
|
export default {
|
|
|
name: "EditPaper",
|
|
@@ -687,6 +683,7 @@ export default {
|
|
|
curQuestion: {},
|
|
|
paperQuestionIds: [],
|
|
|
changeSelectQuestionMap: {},
|
|
|
+ downloading: false,
|
|
|
// upload answer
|
|
|
uploadAnswerUrl: "",
|
|
|
answerTemplateUrl: "",
|
|
@@ -793,27 +790,28 @@ export default {
|
|
|
},
|
|
|
// 导入答案
|
|
|
toImportPaperAnswer() {
|
|
|
- const { key, token } = this.user;
|
|
|
- this.answerTemplateUrl = `${QUESTION_API}/paper/answer/export/${this.paperId}?$key=${key}&$token=${token}`;
|
|
|
+ this.answerTemplateUrl = `${QUESTION_API}/paper/answer/export/${this.paperId}`;
|
|
|
this.uploadAnswerUrl = `${QUESTION_API}/paper/answer/import/${this.paperId}`;
|
|
|
this.$refs.ImportAnswerDialog.open();
|
|
|
},
|
|
|
- // 导出答案
|
|
|
- toExportPaperAnswer() {
|
|
|
- const { key, token } = this.user;
|
|
|
- const url = `${QUESTION_API}/paper/answer/export/${this.paperId}?$key=${key}&$token=${token}`;
|
|
|
- window.open(url);
|
|
|
- },
|
|
|
// 导出试卷蓝图
|
|
|
- toExportPaperBlue() {
|
|
|
- const { key, token } = this.user;
|
|
|
- const url = `${QUESTION_API}/paper/property/export?paperId=${this.paperId}&$key=${key}&$token=${token}`;
|
|
|
- window.open(url);
|
|
|
+ async toExportPaperBlue() {
|
|
|
+ if (this.downloading) return;
|
|
|
+ this.downloading = true;
|
|
|
+
|
|
|
+ const res = await downloadByApi(() => {
|
|
|
+ return paperPropertyExportApi(this.paperId);
|
|
|
+ }).catch((e) => {
|
|
|
+ this.$message.error(e || "下载失败,请重新尝试!");
|
|
|
+ });
|
|
|
+ this.downloading = false;
|
|
|
+
|
|
|
+ if (!res) return;
|
|
|
+ this.$message.success("下载成功!");
|
|
|
},
|
|
|
// 导入属性
|
|
|
toImportPaperProperty() {
|
|
|
- const { key, token } = this.user;
|
|
|
- this.propertyTemplateUrl = `${QUESTION_API}/paper/property/template?paperId=${this.paperId}&$key=${key}&$token=${token}`;
|
|
|
+ this.propertyTemplateUrl = `${QUESTION_API}/paper/property/template?paperId=${this.paperId}`;
|
|
|
this.uploadPropertyUrl = `${QUESTION_API}/paper/property/import?paperId=${this.paperId}`;
|
|
|
this.$refs.ImportPorpertyDialog.open();
|
|
|
},
|