|
|
@@ -8,7 +8,7 @@
|
|
|
plain>新建</el-button>
|
|
|
</el-col>
|
|
|
<el-col :span="15">
|
|
|
- <span style="font-size: smaller; position: absolute; bottom: 25%">(支持拓展名:.pdf .jpg .jpeg .png .exe .zip)</span>
|
|
|
+ <span style="font-size: smaller; position: absolute; bottom: 25%">(支持拓展名:.pdf .jpg .jpeg .png .exe .zip,最大文件大小:100MB)</span>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
<el-dialog v-model="uploadDialogVisible" :before-close="handleCancelUpload" :width="700">
|
|
|
@@ -29,7 +29,8 @@
|
|
|
:auto-upload="false"
|
|
|
:show-file-list="false"
|
|
|
>
|
|
|
- <el-button plain type="primary" class="tabs-function-button">上传文件</el-button>(仅支持上传单个文件)
|
|
|
+ <el-button plain type="primary" class="tabs-function-button" size="small"
|
|
|
+ >上传文件</el-button>(仅支持上传单个文件,最大文件大小:100MB)
|
|
|
</el-upload>
|
|
|
<el-tag
|
|
|
v-if="isNameUnique"
|
|
|
@@ -60,10 +61,12 @@
|
|
|
<el-switch v-model="downloadValue" />
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
- <div style="margin: auto;width: fit-content">
|
|
|
- <el-button type="primary" @click="handleConfirmUpload">确定</el-button>
|
|
|
- <el-button @click="handleCancelUpload">取消</el-button>
|
|
|
+ <div style="margin: auto; width: fit-content">
|
|
|
+ <el-button type="primary" @click="handleConfirmUpload" size="small">确定</el-button>
|
|
|
+ <el-button @click="handleCancelUpload" size="small">取消</el-button>
|
|
|
</div>
|
|
|
+ <el-progress v-if="percentageVisible" :indeterminate="true" :percentage="100" status="warning"
|
|
|
+ style="width: 40%; margin-top: 20px; margin-left: 30%"></el-progress>
|
|
|
</el-dialog>
|
|
|
|
|
|
<el-table :data="fileEntryList" style="width: 100%">
|
|
|
@@ -222,7 +225,9 @@ export default {
|
|
|
pdfName: "",
|
|
|
downloadValue: true,
|
|
|
canDownloadList: [],
|
|
|
- courseWareNum: 0
|
|
|
+ courseWareNum: 0,
|
|
|
+ //percentage: 0,
|
|
|
+ percentageVisible: false
|
|
|
};
|
|
|
},
|
|
|
|
|
|
@@ -377,6 +382,8 @@ export default {
|
|
|
});
|
|
|
this.newName = null;
|
|
|
} else {
|
|
|
+ //this.percentage= 0;
|
|
|
+ this.percentageVisible = true;
|
|
|
this.$apis.uploadCourseWareFile(this.courseId + "/" + this.newName + this.nameAppend, this.file.raw)
|
|
|
.then(res => {
|
|
|
const fileUrl = res.data.data;
|
|
|
@@ -390,7 +397,7 @@ export default {
|
|
|
useMethod: this.form.useMethod,
|
|
|
fileUrl: fileUrl,
|
|
|
}).then(res => {
|
|
|
- console.log(res.data.data.id);
|
|
|
+ //this.percentage= 100;
|
|
|
this.$apis.setCanDownloadById(res.data.data.id, this.downloadValue);
|
|
|
this.$apis.getCourseWaresByCourseId(this.courseId)
|
|
|
.then(res => {
|
|
|
@@ -408,6 +415,7 @@ export default {
|
|
|
this.nameAppend = null;
|
|
|
this.file = null;
|
|
|
this.fileType = null;
|
|
|
+ this.percentageVisible = false;
|
|
|
});
|
|
|
});
|
|
|
});
|
|
|
@@ -422,6 +430,8 @@ export default {
|
|
|
this.nameAppend = null;
|
|
|
}
|
|
|
else {
|
|
|
+ //this.percentage= 0;
|
|
|
+ this.percentageVisible = true;
|
|
|
this.$message({
|
|
|
message: "上传中,请稍候",
|
|
|
type: "warning",
|
|
|
@@ -440,6 +450,7 @@ export default {
|
|
|
useMethod: this.form.useMethod,
|
|
|
fileUrl: fileUrl,
|
|
|
}).then(res => {
|
|
|
+ //this.percentage= 100;
|
|
|
this.$apis.setCanDownloadById(res.data.data.id, this.downloadValue);
|
|
|
this.$apis.getCourseWaresByCourseId(this.courseId)
|
|
|
.then(res => {
|
|
|
@@ -455,6 +466,7 @@ export default {
|
|
|
this.fileNum = 0;
|
|
|
this.file = null;
|
|
|
this.fileType = null;
|
|
|
+ this.percentageVisible = false;
|
|
|
});
|
|
|
});
|
|
|
});
|
|
|
@@ -476,6 +488,7 @@ export default {
|
|
|
this.newName = null;
|
|
|
this.nameAppend = null;
|
|
|
this.fileType = null;
|
|
|
+ this.percentageVisible = false;
|
|
|
this.clearForm();
|
|
|
// Zhurui修改,关闭dialog
|
|
|
done();
|
|
|
@@ -578,41 +591,7 @@ export default {
|
|
|
.then(() => {
|
|
|
this.picturePreviewDialogVisible = false;
|
|
|
});
|
|
|
- },
|
|
|
-
|
|
|
- // getCanDownloadById(id) {
|
|
|
- // this.$apis.getCanDownloadById(id).then(res => {
|
|
|
- // console.log(res.data.data);
|
|
|
- // return res.data.data;
|
|
|
- // });
|
|
|
- // },
|
|
|
-
|
|
|
- async getCanDownloadById(id) {
|
|
|
- const canDownload = (await this.$apis.getCanDownloadById(id)).data.data;
|
|
|
- //console.log(id + ": " + canDownload);
|
|
|
- return canDownload === true;
|
|
|
- },
|
|
|
-
|
|
|
- checkDownloadButton(id, name){
|
|
|
- this.$apis.getCanDownloadById(id).then(res => {
|
|
|
- const canDownload = res.data.data;
|
|
|
- const isPdf = this.isPdfOrPicture(name);
|
|
|
- if ((isPdf === "PDF") && (canDownload.toString() === "true")) {
|
|
|
- return "1";
|
|
|
- } else {
|
|
|
- return "0";
|
|
|
- }
|
|
|
- });
|
|
|
- // const isPdf = this.isPdfOrPicture(name);
|
|
|
- // const canDownload = (await this.$apis.getCanDownloadById(id)).data.data;
|
|
|
- // if ((isPdf === "PDF") && (canDownload.toString() === "true")) {
|
|
|
- // return "1";
|
|
|
- // } else {
|
|
|
- // return "0";
|
|
|
- // }
|
|
|
- //return "1";
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
};
|
|
|
</script>
|