|
@@ -17,11 +17,21 @@
|
|
<h2>文件上传</h2>
|
|
<h2>文件上传</h2>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div>
|
|
|
|
+ <upload-button
|
|
|
|
+ btn-content="重新上传文件"
|
|
|
|
+ btn-icon="icon icon-import"
|
|
|
|
+ :disabled="loading"
|
|
|
|
+ :upload-data="uploadData"
|
|
|
|
+ :upload-url="uploadUrl"
|
|
|
|
+ :format="importFileTypes"
|
|
|
|
+ @valid-error="uploadError"
|
|
|
|
+ @upload-error="uploadError"
|
|
|
|
+ @upload-success="uploaded"
|
|
|
|
+ ></upload-button>
|
|
<el-button
|
|
<el-button
|
|
size="small"
|
|
size="small"
|
|
type="danger"
|
|
type="danger"
|
|
- plain
|
|
|
|
- icon="icon icon-back"
|
|
|
|
|
|
+ icon="icon icon-back-white"
|
|
@click="cancel"
|
|
@click="cancel"
|
|
>返回</el-button
|
|
>返回</el-button
|
|
>
|
|
>
|
|
@@ -112,6 +122,7 @@
|
|
|
|
|
|
import { calcSum, deepCopy, objTypeOf, randomCode } from "@/plugins/utils";
|
|
import { calcSum, deepCopy, objTypeOf, randomCode } from "@/plugins/utils";
|
|
import QuestionImportPaperEdit from "./QuestionImportPaperEdit.vue";
|
|
import QuestionImportPaperEdit from "./QuestionImportPaperEdit.vue";
|
|
|
|
+import UploadButton from "@/components/UploadButton.vue";
|
|
import { isAnEmptyRichText } from "@/utils/utils";
|
|
import { isAnEmptyRichText } from "@/utils/utils";
|
|
import {
|
|
import {
|
|
questionImportPaperSave,
|
|
questionImportPaperSave,
|
|
@@ -136,7 +147,7 @@ const questionInfoField = [
|
|
|
|
|
|
export default {
|
|
export default {
|
|
name: "QuestionExportEdit",
|
|
name: "QuestionExportEdit",
|
|
- components: { QuestionImportPaperEdit, ImportFileDialog },
|
|
|
|
|
|
+ components: { QuestionImportPaperEdit, ImportFileDialog, UploadButton },
|
|
props: {
|
|
props: {
|
|
data: {
|
|
data: {
|
|
type: Object,
|
|
type: Object,
|
|
@@ -166,6 +177,10 @@ export default {
|
|
// upload answer
|
|
// upload answer
|
|
uploadAnswerUrl: `${QUESTION_API}/word/parse/import`,
|
|
uploadAnswerUrl: `${QUESTION_API}/word/parse/import`,
|
|
uploadAnswerData: {},
|
|
uploadAnswerData: {},
|
|
|
|
+ // word upload
|
|
|
|
+ uploadData: {},
|
|
|
|
+ importFileTypes: ["docx", "doc"],
|
|
|
|
+ uploadUrl: `${QUESTION_API}/word/parse/struct`,
|
|
};
|
|
};
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
@@ -173,6 +188,7 @@ export default {
|
|
await this.getCourseProperty();
|
|
await this.getCourseProperty();
|
|
// this.paperData = deepCopy(paperParseData);
|
|
// this.paperData = deepCopy(paperParseData);
|
|
// this.paperRichJson = deepCopy(paperRichTextJson);
|
|
// this.paperRichJson = deepCopy(paperRichTextJson);
|
|
|
|
+ this.uploadData = { courseId: this.data.importData.courseId };
|
|
this.paperRichJson = deepCopy(this.data.richText);
|
|
this.paperRichJson = deepCopy(this.data.richText);
|
|
this.paperData = deepCopy(this.data.detailInfo);
|
|
this.paperData = deepCopy(this.data.detailInfo);
|
|
this.transformDataInfo();
|
|
this.transformDataInfo();
|
|
@@ -656,6 +672,17 @@ export default {
|
|
);
|
|
);
|
|
this.questionKey = randomCode();
|
|
this.questionKey = randomCode();
|
|
},
|
|
},
|
|
|
|
+ // word upload
|
|
|
|
+ uploaded(res) {
|
|
|
|
+ this.$message.success("上传成功!");
|
|
|
|
+ this.paperRichJson = deepCopy(res.data.richText);
|
|
|
|
+ this.paperData = deepCopy(res.data.detailInfo);
|
|
|
|
+ this.transformDataInfo();
|
|
|
|
+ this.questionKey = randomCode();
|
|
|
|
+ },
|
|
|
|
+ uploadError(error) {
|
|
|
|
+ this.$message.error(error.message);
|
|
|
|
+ },
|
|
},
|
|
},
|
|
};
|
|
};
|
|
</script>
|
|
</script>
|