|
@@ -28,7 +28,7 @@
|
|
<span>{{ file.file_name ?? file.name }}</span>
|
|
<span>{{ file.file_name ?? file.name }}</span>
|
|
<!-- <span>({{ file.size }})</span> -->
|
|
<!-- <span>({{ file.size }})</span> -->
|
|
</span>
|
|
</span>
|
|
- <span v-show="file.progress > 0 && file.progress < 100"> {{ file.progress }}% </span>
|
|
|
|
|
|
+ <span v-show="file.progress > 0"> {{ file.progress }}% </span>
|
|
<span v-show="file.file_id"> 完成 </span>
|
|
<span v-show="file.file_id"> 完成 </span>
|
|
</div>
|
|
</div>
|
|
<SvgIcon icon-class="delete-black" size="12" @click="removeFile(file, i)" />
|
|
<SvgIcon icon-class="delete-black" size="12" @click="removeFile(file, i)" />
|
|
@@ -44,6 +44,7 @@
|
|
import { fileUpload } from '@/api/app';
|
|
import { fileUpload } from '@/api/app';
|
|
import { conversionSize } from '@/utils/common';
|
|
import { conversionSize } from '@/utils/common';
|
|
import FillDescribe from '../../common/FillDescribe';
|
|
import FillDescribe from '../../common/FillDescribe';
|
|
|
|
+import { GetCoursewareComponentContent_View } from '@/api/book';
|
|
|
|
|
|
export default {
|
|
export default {
|
|
name: 'UploadFile',
|
|
name: 'UploadFile',
|
|
@@ -51,6 +52,16 @@ export default {
|
|
FillDescribe,
|
|
FillDescribe,
|
|
},
|
|
},
|
|
props: {
|
|
props: {
|
|
|
|
+ // 课件id
|
|
|
|
+ coursewareId: {
|
|
|
|
+ type: String,
|
|
|
|
+ default: '',
|
|
|
|
+ },
|
|
|
|
+ // 组件id
|
|
|
|
+ componentId: {
|
|
|
|
+ type: String,
|
|
|
|
+ default: '',
|
|
|
|
+ },
|
|
// 组件标签
|
|
// 组件标签
|
|
labelText: {
|
|
labelText: {
|
|
type: String,
|
|
type: String,
|
|
@@ -87,17 +98,28 @@ export default {
|
|
},
|
|
},
|
|
computed: {},
|
|
computed: {},
|
|
watch: {},
|
|
watch: {},
|
|
|
|
+ created() {
|
|
|
|
+ this.getCoursewareComponentContent_View();
|
|
|
|
+ },
|
|
methods: {
|
|
methods: {
|
|
|
|
+ // 获取数据
|
|
|
|
+ getCoursewareComponentContent_View() {
|
|
|
|
+ GetCoursewareComponentContent_View({ courseware_id: this.coursewareId, component_id: this.componentId }).then(
|
|
|
|
+ ({ content }) => {
|
|
|
|
+ if (content) this.file_list = JSON.parse(content).file_list;
|
|
|
|
+ },
|
|
|
|
+ );
|
|
|
|
+ },
|
|
|
|
+
|
|
// 显示自定义样式文件列表
|
|
// 显示自定义样式文件列表
|
|
onFileChange(file, fileList) {
|
|
onFileChange(file, fileList) {
|
|
this.afterSelectFile(file);
|
|
this.afterSelectFile(file);
|
|
- console.log(123);
|
|
|
|
fileList.forEach((file) => {
|
|
fileList.forEach((file) => {
|
|
if (!file.progress || file.progress <= 0) file.progress = 0;
|
|
if (!file.progress || file.progress <= 0) file.progress = 0;
|
|
if (!file.title) file.title = '';
|
|
if (!file.title) file.title = '';
|
|
if (!file.describe) file.describe = '';
|
|
if (!file.describe) file.describe = '';
|
|
});
|
|
});
|
|
- this.file_list = fileList;
|
|
|
|
|
|
+ this.file_list.push(file);
|
|
},
|
|
},
|
|
|
|
|
|
// 删除文件
|
|
// 删除文件
|
|
@@ -158,7 +180,7 @@ export default {
|
|
}
|
|
}
|
|
const totalSize = files.reduce((sum, cur) => sum + Number(cur.size || 0), 0);
|
|
const totalSize = files.reduce((sum, cur) => sum + Number(cur.size || 0), 0);
|
|
if (totalSize > this.moduleData.total_size * 1024 * 1024) {
|
|
if (totalSize > this.moduleData.total_size * 1024 * 1024) {
|
|
- this.$message.error(`文件总大小不能超过${conversionSize(this.moduleData.total_size)}`);
|
|
|
|
|
|
+ this.$message.error(`文件总大小不能超过${conversionSize(this.moduleData.total_size)}!`);
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -179,6 +201,7 @@ export default {
|
|
if (file_index > -1) {
|
|
if (file_index > -1) {
|
|
this.file_list[file_index] = file_info_list[0];
|
|
this.file_list[file_index] = file_info_list[0];
|
|
this.file_id_list.push(file_info_list[0].file_id);
|
|
this.file_id_list.push(file_info_list[0].file_id);
|
|
|
|
+ this.$emit('saveDate', file_info_list[0]);
|
|
}
|
|
}
|
|
});
|
|
});
|
|
});
|
|
});
|
|
@@ -255,6 +278,10 @@ export default {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ .old_file_list {
|
|
|
|
+ margin-top: 16px;
|
|
|
|
+ }
|
|
|
|
+
|
|
.file-list {
|
|
.file-list {
|
|
display: flex;
|
|
display: flex;
|
|
flex-direction: column;
|
|
flex-direction: column;
|