|
@@ -69,12 +69,14 @@
|
|
|
<el-table :data="fileEntryList" style="width: 100%">
|
|
<el-table :data="fileEntryList" style="width: 100%">
|
|
|
<el-table-column
|
|
<el-table-column
|
|
|
type="index"
|
|
type="index"
|
|
|
- width="30">
|
|
|
|
|
|
|
+ width="30"
|
|
|
|
|
+ >
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
<el-table-column
|
|
<el-table-column
|
|
|
prop="name"
|
|
prop="name"
|
|
|
label="文件名"
|
|
label="文件名"
|
|
|
- width="260">
|
|
|
|
|
|
|
+ width="260"
|
|
|
|
|
+ >
|
|
|
<template #default="scope">
|
|
<template #default="scope">
|
|
|
<el-icon v-if="scope.row['courseWareVO'].useMethod === 'SCAN'" style="color: #337ecc" class="myicon"><Reading /></el-icon>
|
|
<el-icon v-if="scope.row['courseWareVO'].useMethod === 'SCAN'" style="color: #337ecc" class="myicon"><Reading /></el-icon>
|
|
|
<el-icon v-if="scope.row['courseWareVO'].useMethod === 'ATTACHMENT'" style="color: green" class="myicon"><Paperclip /></el-icon>
|
|
<el-icon v-if="scope.row['courseWareVO'].useMethod === 'ATTACHMENT'" style="color: green" class="myicon"><Paperclip /></el-icon>
|
|
@@ -96,7 +98,7 @@
|
|
|
<el-table-column
|
|
<el-table-column
|
|
|
prop="created_time"
|
|
prop="created_time"
|
|
|
label="上传时间"
|
|
label="上传时间"
|
|
|
- width="140"
|
|
|
|
|
|
|
+ width="160"
|
|
|
:sortable="true"
|
|
:sortable="true"
|
|
|
>
|
|
>
|
|
|
<template #default="scope">
|
|
<template #default="scope">
|
|
@@ -105,8 +107,7 @@
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
<el-table-column
|
|
<el-table-column
|
|
|
prop="operation"
|
|
prop="operation"
|
|
|
- label="操作"
|
|
|
|
|
- width="200">
|
|
|
|
|
|
|
+ label="操作">
|
|
|
<template #default="scope">
|
|
<template #default="scope">
|
|
|
<!-- <a :href="scope.row['courseWareVO'].fileUrl" v-if="isPdfOrPicture(scope.row['courseWareVO'].name) === 'OFFICE'">-->
|
|
<!-- <a :href="scope.row['courseWareVO'].fileUrl" v-if="isPdfOrPicture(scope.row['courseWareVO'].name) === 'OFFICE'">-->
|
|
|
<!-- <el-button style="color: #409EFF; margin-right: 10px" type="text">预览</el-button>-->
|
|
<!-- <el-button style="color: #409EFF; margin-right: 10px" type="text">预览</el-button>-->
|
|
@@ -227,8 +228,10 @@ export default {
|
|
|
this.init();
|
|
this.init();
|
|
|
},
|
|
},
|
|
|
methods: {
|
|
methods: {
|
|
|
- async init() {
|
|
|
|
|
- this.fileEntryList = (await this.$apis.getCourseWaresByCourseId(this.courseId)).data.data;
|
|
|
|
|
|
|
+ init() {
|
|
|
|
|
+ this.$apis.getCourseWaresByCourseId(this.courseId).then(res => {
|
|
|
|
|
+ this.fileEntryList = res.data.data;
|
|
|
|
|
+ });
|
|
|
console.log(this.fileEntryList);
|
|
console.log(this.fileEntryList);
|
|
|
},
|
|
},
|
|
|
|
|
|
|
@@ -255,11 +258,11 @@ export default {
|
|
|
type: "warning",
|
|
type: "warning",
|
|
|
center: true,
|
|
center: true,
|
|
|
})
|
|
})
|
|
|
- .then(() => {
|
|
|
|
|
- this.newName = null;
|
|
|
|
|
- this.nameAppend = null;
|
|
|
|
|
- this.nameChangeDialogVisible = false;
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ .then(() => {
|
|
|
|
|
+ this.newName = null;
|
|
|
|
|
+ this.nameAppend = null;
|
|
|
|
|
+ this.nameChangeDialogVisible = false;
|
|
|
|
|
+ });
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
handleConfirmChangeName() {
|
|
handleConfirmChangeName() {
|
|
@@ -270,36 +273,39 @@ export default {
|
|
|
});
|
|
});
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
- ElMessageBox.confirm("是否确定修改课件名称?", "提示", {
|
|
|
|
|
- confirmButtonText: "确认修改",
|
|
|
|
|
- cancelButtonText: "我再想想",
|
|
|
|
|
- type: "warning",
|
|
|
|
|
- center: true,
|
|
|
|
|
- })
|
|
|
|
|
- .then(async () => {
|
|
|
|
|
- const isNameUnique = (await this.$apis.checkCourseWareNameUnique(this.courseId, this.newName + this.nameAppend)).data.data;
|
|
|
|
|
|
|
+ // ElMessageBox.confirm("是否确定修改课件名称?", "提示", {
|
|
|
|
|
+ // confirmButtonText: "确认修改",
|
|
|
|
|
+ // cancelButtonText: "我再想想",
|
|
|
|
|
+ // type: "warning",
|
|
|
|
|
+ // center: true,
|
|
|
|
|
+ // })
|
|
|
|
|
+ // .then(res => {
|
|
|
|
|
+ this.$apis.checkCourseWareNameUnique(this.courseId, this.newName + this.nameAppend)
|
|
|
|
|
+ .then(res=> {
|
|
|
|
|
+ const isNameUnique = res.data.data;
|
|
|
if (!isNameUnique) {
|
|
if (!isNameUnique) {
|
|
|
this.$message({
|
|
this.$message({
|
|
|
message: "该课程下已存在同名课件",
|
|
message: "该课程下已存在同名课件",
|
|
|
type: "error"
|
|
type: "error"
|
|
|
});
|
|
});
|
|
|
- return;
|
|
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.$apis.changeCourseWareName(this.idToBeChangeName, this.newName + this.nameAppend)
|
|
|
|
|
+ .then(res=> {
|
|
|
|
|
+ this.$apis.getCourseWaresByCourseId(this.courseId).then(res => {
|
|
|
|
|
+ this.fileEntryList = res.data.data;
|
|
|
|
|
+ });
|
|
|
|
|
+ this.newName = null;
|
|
|
|
|
+ this.nameAppend = null;
|
|
|
|
|
+ this.nameChangeDialogVisible = false;
|
|
|
|
|
+ });
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- this.$apis.changeCourseWareName(this.idToBeChangeName, this.newName + this.nameAppend)
|
|
|
|
|
- .then(async () => {
|
|
|
|
|
- console.log("1");
|
|
|
|
|
- this.fileEntryList = (await this.$apis.getCourseWaresByCourseId(this.courseId)).data.data;
|
|
|
|
|
- });
|
|
|
|
|
- this.newName = null;
|
|
|
|
|
- this.nameAppend = null;
|
|
|
|
|
- this.nameChangeDialogVisible = false;
|
|
|
|
|
});
|
|
});
|
|
|
|
|
+ // });
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
timestampToTime: portal.functions.timestampToTime,
|
|
timestampToTime: portal.functions.timestampToTime,
|
|
|
|
|
|
|
|
- async handleUploadFile(file, fileList) {
|
|
|
|
|
|
|
+ handleUploadFile(file, fileList) {
|
|
|
console.log(file);
|
|
console.log(file);
|
|
|
console.log(fileList);
|
|
console.log(fileList);
|
|
|
const fileType = file.name.substring(file.name.lastIndexOf(".") + 1);
|
|
const fileType = file.name.substring(file.name.lastIndexOf(".") + 1);
|
|
@@ -330,71 +336,114 @@ export default {
|
|
|
}
|
|
}
|
|
|
this.file = file;
|
|
this.file = file;
|
|
|
this.fileList = fileList;
|
|
this.fileList = fileList;
|
|
|
- const isNameUnique = (await this.$apis.checkCourseWareNameUnique(this.courseId, this.file.name)).data.data;
|
|
|
|
|
- if (!isNameUnique) {
|
|
|
|
|
- this.$message({
|
|
|
|
|
- message: "该课程下已存在同名课件",
|
|
|
|
|
- type: "error"
|
|
|
|
|
- });
|
|
|
|
|
- } else {
|
|
|
|
|
- this.isNameUnique = true;
|
|
|
|
|
- this.fileNum = 1;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ this.$apis.checkCourseWareNameUnique(this.courseId, this.file.name)
|
|
|
|
|
+ .then(res => {
|
|
|
|
|
+ const isNameUnique = res.data.data;
|
|
|
|
|
+ if (!isNameUnique) {
|
|
|
|
|
+ this.$message({
|
|
|
|
|
+ message: "该课程下已存在同名课件",
|
|
|
|
|
+ type: "error"
|
|
|
|
|
+ });
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.isNameUnique = true;
|
|
|
|
|
+ this.fileNum = 1;
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
- async handleConfirmUpload() {
|
|
|
|
|
|
|
+ handleConfirmUpload() {
|
|
|
if (this.file === null) {
|
|
if (this.file === null) {
|
|
|
this.$message({
|
|
this.$message({
|
|
|
message: "尚未上传课件",
|
|
message: "尚未上传课件",
|
|
|
type: "error"
|
|
type: "error"
|
|
|
});
|
|
});
|
|
|
- return;
|
|
|
|
|
}
|
|
}
|
|
|
- if (this.newName === null && this.nameAppend !== null) {
|
|
|
|
|
- this.$message({
|
|
|
|
|
- message: "课件名称不可为空,请重新修改课件名称",
|
|
|
|
|
- type: "error"
|
|
|
|
|
|
|
+ else if (this.newName !== null) {
|
|
|
|
|
+ this.$apis.checkCourseWareNameUnique(this.courseId, this.newName + this.nameAppend)
|
|
|
|
|
+ .then(res => {
|
|
|
|
|
+ const isNameUnique = res.data.data;
|
|
|
|
|
+ if (!isNameUnique) {
|
|
|
|
|
+ this.$message({
|
|
|
|
|
+ message: "该课程下已存在同名课件",
|
|
|
|
|
+ type: "error"
|
|
|
|
|
+ });
|
|
|
|
|
+ this.newName = null;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.$apis.uploadCourseWareFile(this.courseId + "/" + this.newName + this.nameAppend, this.file.raw)
|
|
|
|
|
+ .then(res => {
|
|
|
|
|
+ const fileUrl = res.data.data;
|
|
|
|
|
+ this.$apis.createCourseWare({
|
|
|
|
|
+ name: this.newName === null ? this.file.name : (this.newName + this.nameAppend),
|
|
|
|
|
+ size: this.file.size,
|
|
|
|
|
+ senderId: this.$store.state.user.id,
|
|
|
|
|
+ courseId: this.courseId,
|
|
|
|
|
+ createdTime: new Date(),
|
|
|
|
|
+ useTime: "BEFORE_CLASS",
|
|
|
|
|
+ useMethod: this.form.useMethod,
|
|
|
|
|
+ fileUrl: fileUrl,
|
|
|
|
|
+ canDownload: this.downloadValue
|
|
|
|
|
+ }).then(res => {
|
|
|
|
|
+ this.$apis.getCourseWaresByCourseId(this.courseId)
|
|
|
|
|
+ .then(res => {
|
|
|
|
|
+ this.fileEntryList = res.data.data;
|
|
|
|
|
+ this.$message({
|
|
|
|
|
+ message: "上传课件成功",
|
|
|
|
|
+ type: "success"
|
|
|
|
|
+ });
|
|
|
|
|
+ this.uploadDialogVisible = false;
|
|
|
|
|
+ this.isChangeNameWhenUpload = false;
|
|
|
|
|
+ this.isNameUnique = false;
|
|
|
|
|
+ this.fileNum = 0;
|
|
|
|
|
+ this.newName = null;
|
|
|
|
|
+ this.nameAppend = null;
|
|
|
|
|
+ this.file = null;
|
|
|
|
|
+ });
|
|
|
|
|
+ });
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
});
|
|
});
|
|
|
- return;
|
|
|
|
|
}
|
|
}
|
|
|
- if (this.newName !== null) {
|
|
|
|
|
- const isNameUnique = (await this.$apis.checkCourseWareNameUnique(this.courseId, this.newName + this.nameAppend)).data.data;
|
|
|
|
|
- if (!isNameUnique) {
|
|
|
|
|
|
|
+ else if (this.nameAppend !== null) {
|
|
|
this.$message({
|
|
this.$message({
|
|
|
- message: "该课程下已存在同名课件",
|
|
|
|
|
|
|
+ message: "课件名称不可为空,请重新修改课件名称",
|
|
|
type: "error"
|
|
type: "error"
|
|
|
});
|
|
});
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ this.nameAppend = null;
|
|
|
|
|
+ }
|
|
|
|
|
+ else {
|
|
|
|
|
+ this.$apis.uploadCourseWareFile(this.courseId + "/" + this.file.name, this.file.raw)
|
|
|
|
|
+ .then(res => {
|
|
|
|
|
+ const fileUrl = res.data.data;
|
|
|
|
|
+ this.$apis.createCourseWare({
|
|
|
|
|
+ name: this.newName === null ? this.file.name : (this.newName + this.nameAppend),
|
|
|
|
|
+ size: this.file.size,
|
|
|
|
|
+ senderId: this.$store.state.user.id,
|
|
|
|
|
+ courseId: this.courseId,
|
|
|
|
|
+ createdTime: new Date(),
|
|
|
|
|
+ useTime: "BEFORE_CLASS",
|
|
|
|
|
+ useMethod: this.form.useMethod,
|
|
|
|
|
+ fileUrl: fileUrl,
|
|
|
|
|
+ canDownload: this.downloadValue
|
|
|
|
|
+ }).then(res => {
|
|
|
|
|
+ this.$apis.getCourseWaresByCourseId(this.courseId)
|
|
|
|
|
+ .then(res => {
|
|
|
|
|
+ this.fileEntryList = res.data.data;
|
|
|
|
|
+ this.$message({
|
|
|
|
|
+ message: "上传课件成功",
|
|
|
|
|
+ type: "success"
|
|
|
|
|
+ });
|
|
|
|
|
+ this.uploadDialogVisible = false;
|
|
|
|
|
+ this.isChangeNameWhenUpload = false;
|
|
|
|
|
+ this.isNameUnique = false;
|
|
|
|
|
+ this.fileNum = 0;
|
|
|
|
|
+ this.file = null;
|
|
|
|
|
+ });
|
|
|
|
|
+ });
|
|
|
|
|
+ });
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- const fileUrl = (await this.$apis.uploadCourseWareFile(this.courseId + "/" + (this.newName == null ?
|
|
|
|
|
- this.file.name : (this.newName + this.nameAppend)), this.file.raw)).data.data;
|
|
|
|
|
- console.log(this.downloadValue);
|
|
|
|
|
- this.$apis.createCourseWare({
|
|
|
|
|
- name: this.newName === null ? this.file.name : (this.newName + this.nameAppend),
|
|
|
|
|
- size: this.file.size,
|
|
|
|
|
- senderId: this.$store.state.user.id,
|
|
|
|
|
- courseId: this.courseId,
|
|
|
|
|
- createdTime: new Date(),
|
|
|
|
|
- useTime: "BEFORE_CLASS",
|
|
|
|
|
- useMethod: this.form.useMethod,
|
|
|
|
|
- fileUrl: fileUrl,
|
|
|
|
|
- canDownload: this.downloadValue
|
|
|
|
|
- }).then(async () => {
|
|
|
|
|
- this.fileEntryList = (await this.$apis.getCourseWaresByCourseId(this.courseId)).data.data;
|
|
|
|
|
- });
|
|
|
|
|
- this.$message({
|
|
|
|
|
- message: "上传课件成功",
|
|
|
|
|
- type: "success"
|
|
|
|
|
- });
|
|
|
|
|
- this.uploadDialogVisible = false;
|
|
|
|
|
- this.isChangeNameWhenUpload = false;
|
|
|
|
|
- this.isNameUnique = false;
|
|
|
|
|
- this.fileNum = 0;
|
|
|
|
|
- this.newName = null;
|
|
|
|
|
- this.nameAppend = null;
|
|
|
|
|
- this.file = null;
|
|
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
handleCancelUpload(done) {
|
|
handleCancelUpload(done) {
|