From 40af07730609152aabe5873f945f8b32a45a1999 Mon Sep 17 00:00:00 2001
From: "@fawn-nine" <1271023382@qq.com>
Date: Fri, 30 Aug 2024 10:42:24 +0800
Subject: [PATCH] =?UTF-8?q?=E6=80=9D=E8=80=83=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../course/examination/questionBank.vue | 142 +++++++++++++++---
.../course/examination/questionBank/add.vue | 3 +
2 files changed, 122 insertions(+), 23 deletions(-)
diff --git a/src/views/modules/course/examination/questionBank.vue b/src/views/modules/course/examination/questionBank.vue
index ba06d87..ba040f0 100644
--- a/src/views/modules/course/examination/questionBank.vue
+++ b/src/views/modules/course/examination/questionBank.vue
@@ -40,20 +40,18 @@
新增考题
-
- 导入考题 {{loadText}}
+
+ 导入考题 {{ loadText }}
@@ -142,7 +140,7 @@
>
{
+ console.log("reschenggong", res);
+ // if (res.data.code == 0) {
+ // this.$message.success("操作成功!");
+
+ // }
+ })
+ .catch(e => {
+ this.$message.error("获取课程信息失败");
+ _info = null;
+ });
+ },
+ handleRemoveNovel() {
+ console.log("删除文件");
},
handleExceed(files, fileList) {
this.$message.warning(`当前限制选择 3 个文件`);
@@ -422,6 +458,63 @@ export default {
}
this.directorShow = true;
},
+ handleRequest(option) {
+ console.log("jinlailema");
+ var that = this;
+ const { onProgress, onSuccess, onError } = option;
+ // this.progressPercent = 0;
+
+ this.currentFile = option.file;
+ let formdata = new FormData();
+ formdata.append("file", option.file);
+ // formdata.append("fileName", option.file.fileNamee);
+ formdata.append("courseId", this.course.id);
+ console.log("🚀 ~ handleRequest ~ formdata:", formdata);
+
+ this.showLoadIcon = true;
+ this.loadText = '正在上传文件'
+ // onProgress()
+ axios
+ .post(this.baseUrl + "/common/classExam/importSubject", formdata, {
+ headers: { token: this.$cookie.get("token") },
+ onUploadProgress: function(progressEvent) {
+ const percentCompleted = Math.round(
+ (progressEvent.loaded * 100) / progressEvent.total
+ );
+ if(percentCompleted == 100){
+ that.$message.success('文件上传成功,正在写入数据')
+ that.loadText = '文件上传成功,正在写入数据'
+ }
+ console.log(`Upload Progress: ${percentCompleted}%`);
+ }
+ })
+ .then(res => {
+ // console.log("上传成功", res);
+ if (res.data.code == 0) {
+ this.$message.success("导入成功!");
+ // that.fileList[that.fileList.length - 1].status = "done";
+ // clearInterval(that.uploadTimer);
+ that.showLoadIcon = false;
+ that.loadText = ''
+ that.currentFile = {};
+ onSuccess();
+ that.getDataList()
+ } else {
+ // that.fileList[that.fileList.length - 1].ststus = "error";
+ that.$message.error(res.data.msg);
+ onError();
+ that.showLoadIcon = false;
+ that.loadText = ''
+ }
+ })
+ .catch(e => {
+ that.$message.error(e.data.msg);
+ that.loadText = ''
+ });
+ // var prom = new Promise((resolve, reject) => {});
+ // prom.abort = () => {};
+ // return prom;
+ },
// 检索教务信息
getDirectorInfo(id) {
return new Promise((resolve, reject) => {
@@ -730,6 +823,9 @@ export default {
color: #149f97;
}
}
+.upload-demo {
+ display: contents;
+}
.flexbox {
display: flex;
}
diff --git a/src/views/modules/course/examination/questionBank/add.vue b/src/views/modules/course/examination/questionBank/add.vue
index f8696f8..21714cc 100644
--- a/src/views/modules/course/examination/questionBank/add.vue
+++ b/src/views/modules/course/examination/questionBank/add.vue
@@ -586,6 +586,7 @@ export default {
duration: 1500,
onClose: () => {
this.visible = false;
+ this.tableData = []
this.relationProductIds = [];
this.relationProducts = [];
this.$emit("refreshDataList");
@@ -627,9 +628,11 @@ export default {
handlereset() {
// (this.fileList = []), (this.fileListNovel = []), (this.visible = false);
this.$emit("pclose");
+
// this.relationProducts = [];
// this.courseId = undefined;
this.visible = false;
+ this.tableData = []
},
handlePreview(file) {
console.log(file);