|
@@ -88,7 +88,7 @@
|
|
|
|
|
|
<script>
|
|
<script>
|
|
import ImportFile from "@/components/ImportFile.vue";
|
|
import ImportFile from "@/components/ImportFile.vue";
|
|
-import { questionImportFileUpload } from "../api";
|
|
|
|
|
|
+import { questionImportFileUpload, importQuestionApi } from "../api";
|
|
import { QUESTION_API } from "@/constants/constants";
|
|
import { QUESTION_API } from "@/constants/constants";
|
|
import { mapState } from "vuex";
|
|
import { mapState } from "vuex";
|
|
|
|
|
|
@@ -213,10 +213,16 @@ export default {
|
|
// Object.entries(this.modalForm).forEach(([key, val]) => {
|
|
// Object.entries(this.modalForm).forEach(([key, val]) => {
|
|
// if (val !== null) formData.append(key, val);
|
|
// if (val !== null) formData.append(key, val);
|
|
// });
|
|
// });
|
|
- formData.append("courseId", this.modalForm.courseId);
|
|
|
|
|
|
+ if (this.importType === "docx")
|
|
|
|
+ formData.append("courseId", this.modalForm.courseId);
|
|
formData.append("file", this.fileData.file);
|
|
formData.append("file", this.fileData.file);
|
|
|
|
|
|
- const res = await questionImportFileUpload(formData, {
|
|
|
|
|
|
+ const uploadApi =
|
|
|
|
+ this.importType === "zip"
|
|
|
|
+ ? importQuestionApi
|
|
|
|
+ : questionImportFileUpload;
|
|
|
|
+
|
|
|
|
+ const res = await uploadApi(formData, {
|
|
md5: this.fileData.md5,
|
|
md5: this.fileData.md5,
|
|
}).catch(() => {});
|
|
}).catch(() => {});
|
|
this.loading = false;
|
|
this.loading = false;
|
|
@@ -228,6 +234,7 @@ export default {
|
|
this.$emit("modified", {
|
|
this.$emit("modified", {
|
|
...res.data,
|
|
...res.data,
|
|
importData: this.modalForm,
|
|
importData: this.modalForm,
|
|
|
|
+ importType: this.importType,
|
|
});
|
|
});
|
|
this.cancel();
|
|
this.cancel();
|
|
},
|
|
},
|