|
@@ -14,6 +14,12 @@
|
|
label-width="100px"
|
|
label-width="100px"
|
|
>
|
|
>
|
|
<el-row>
|
|
<el-row>
|
|
|
|
+ <el-form-item label="导入类型" label-width="120px" class="pull-left">
|
|
|
|
+ <el-radio v-model="importType" label="word">word</el-radio>
|
|
|
|
+ <el-radio v-model="importType" label="zip">zip</el-radio>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-row>
|
|
|
|
+ <el-row v-show="importType == 'word'">
|
|
<el-form-item label="课程名称" label-width="120px" class="pull-left">
|
|
<el-form-item label="课程名称" label-width="120px" class="pull-left">
|
|
<el-select
|
|
<el-select
|
|
v-model="formSearch.courseNo"
|
|
v-model="formSearch.courseNo"
|
|
@@ -35,13 +41,8 @@
|
|
</el-option>
|
|
</el-option>
|
|
</el-select>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
- <el-form-item class="pull-right">
|
|
|
|
- <el-button type="primary" @click="back"
|
|
|
|
- ><i class="el-icon-arrow-left"></i> 返回</el-button
|
|
|
|
- >
|
|
|
|
- </el-form-item>
|
|
|
|
</el-row>
|
|
</el-row>
|
|
- <el-row>
|
|
|
|
|
|
+ <el-row v-show="importType == 'word'">
|
|
<el-form-item label="试卷名称" label-width="120px" class="pull-left">
|
|
<el-form-item label="试卷名称" label-width="120px" class="pull-left">
|
|
<el-input
|
|
<el-input
|
|
v-model="formSearch.name"
|
|
v-model="formSearch.name"
|
|
@@ -78,7 +79,7 @@
|
|
<el-upload
|
|
<el-upload
|
|
ref="upload"
|
|
ref="upload"
|
|
class="form_left"
|
|
class="form_left"
|
|
- accept=".docx,.json"
|
|
|
|
|
|
+ accept=".docx,.zip"
|
|
:action="uploadAction"
|
|
:action="uploadAction"
|
|
:headers="uploadHeaders"
|
|
:headers="uploadHeaders"
|
|
:data="uploadData"
|
|
:data="uploadData"
|
|
@@ -105,9 +106,10 @@
|
|
@click="removeFile"
|
|
@click="removeFile"
|
|
><i class="el-icon-refresh"></i> 清空文件
|
|
><i class="el-icon-refresh"></i> 清空文件
|
|
</el-button>
|
|
</el-button>
|
|
- <div slot="tip" class="el-upload__tip">
|
|
|
|
- 只能上传docx和json文件
|
|
|
|
- </div>
|
|
|
|
|
|
+ <el-button type="primary" @click="back"
|
|
|
|
+ ><i class="el-icon-arrow-left"></i> 返回</el-button
|
|
|
|
+ >
|
|
|
|
+ <div slot="tip" class="el-upload__tip">只能上传docx和zip文件</div>
|
|
</el-upload>
|
|
</el-upload>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</el-row>
|
|
</el-row>
|
|
@@ -129,6 +131,7 @@ export default {
|
|
components: { LinkTitlesCustom },
|
|
components: { LinkTitlesCustom },
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
|
|
+ importType: "word",
|
|
scoreCheck: "0",
|
|
scoreCheck: "0",
|
|
formSearch: {
|
|
formSearch: {
|
|
courseNo: "",
|
|
courseNo: "",
|
|
@@ -199,9 +202,13 @@ export default {
|
|
});
|
|
});
|
|
this.fileLoading = false;
|
|
this.fileLoading = false;
|
|
sessionStorage.setItem("question_back", "true");
|
|
sessionStorage.setItem("question_back", "true");
|
|
- this.$router.push({
|
|
|
|
- path: "/edit_paper/" + response.id + "/import_paper",
|
|
|
|
- });
|
|
|
|
|
|
+ if (this.importType == "word") {
|
|
|
|
+ this.$router.push({
|
|
|
|
+ path: "/edit_paper/" + response.id + "/import_paper",
|
|
|
|
+ });
|
|
|
|
+ } else {
|
|
|
|
+ this.back();
|
|
|
|
+ }
|
|
},
|
|
},
|
|
uploadError(err) {
|
|
uploadError(err) {
|
|
var result = err.message.match(/\{.+}/);
|
|
var result = err.message.match(/\{.+}/);
|
|
@@ -216,7 +223,7 @@ export default {
|
|
this.formSearch.courseNo = "";
|
|
this.formSearch.courseNo = "";
|
|
},
|
|
},
|
|
checkUpload() {
|
|
checkUpload() {
|
|
- if (!this.formSearch.courseNo) {
|
|
|
|
|
|
+ if (this.importType == "word" && !this.formSearch.courseNo) {
|
|
this.$notify({
|
|
this.$notify({
|
|
message: "课程名称不能为空",
|
|
message: "课程名称不能为空",
|
|
type: "error",
|
|
type: "error",
|
|
@@ -228,7 +235,7 @@ export default {
|
|
this.uploadData.level = this.formSearch.courseLevel;
|
|
this.uploadData.level = this.formSearch.courseLevel;
|
|
this.uploadData.sameName = this.formSearch.sameName;
|
|
this.uploadData.sameName = this.formSearch.sameName;
|
|
}
|
|
}
|
|
- if (!this.formSearch.name) {
|
|
|
|
|
|
+ if (this.importType == "word" && !this.formSearch.name) {
|
|
this.$notify({
|
|
this.$notify({
|
|
message: "试卷名称不能为空",
|
|
message: "试卷名称不能为空",
|
|
type: "error",
|
|
type: "error",
|
|
@@ -256,15 +263,15 @@ export default {
|
|
}
|
|
}
|
|
if (fileList.length > 1) {
|
|
if (fileList.length > 1) {
|
|
this.$notify({
|
|
this.$notify({
|
|
- message: "每次只能上传一个word或json文件",
|
|
|
|
|
|
+ message: "每次只能上传一个word或zip文件",
|
|
type: "error",
|
|
type: "error",
|
|
});
|
|
});
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
for (let file of fileList) {
|
|
for (let file of fileList) {
|
|
- if (!file.name.endsWith(".docx") && !file.name.endsWith(".json")) {
|
|
|
|
|
|
+ if (!file.name.endsWith(".docx") && !file.name.endsWith(".zip")) {
|
|
this.$notify({
|
|
this.$notify({
|
|
- message: "上传文件必须为docx或json格式",
|
|
|
|
|
|
+ message: "上传文件必须为docx或zip格式",
|
|
type: "error",
|
|
type: "error",
|
|
});
|
|
});
|
|
this.initUpload();
|
|
this.initUpload();
|