|
@@ -86,11 +86,27 @@ export default defineComponent({
|
|
|
|
|
|
const fileListRef = ref<UploadFileInfo[]>([]);
|
|
|
const uploadList = ref([] as any);
|
|
|
+
|
|
|
+ // 获取文件后缀名
|
|
|
+ // function getFileExtension(filename: string) {
|
|
|
+ // return filename.slice(((filename.lastIndexOf('.') - 1) >>> 0) + 2);
|
|
|
+ // }
|
|
|
+
|
|
|
+ // // 判断是否是允许的文件类型
|
|
|
+ // function isAllowedFileType(filename: string, allowedExtensions: any) {
|
|
|
+ // const extension = getFileExtension(filename).toLowerCase();
|
|
|
+ // return allowedExtensions.includes(extension);
|
|
|
+ // }
|
|
|
+
|
|
|
const onBeforeUpload = async (options: any) => {
|
|
|
const file = options.file;
|
|
|
// 文件大小
|
|
|
let isLt2M = true;
|
|
|
|
|
|
+ // JPG、PNG、MP3、MP4、PPT
|
|
|
+ // const filename = 'example.jpg';
|
|
|
+ // const allowedExtensions = ['jpg', 'jpeg', 'png', 'mp4', 'ppt'];
|
|
|
+
|
|
|
const type = file.type.includes('image')
|
|
|
? NaturalTypeEnum.IMG
|
|
|
: file.type.includes('audio')
|
|
@@ -103,8 +119,6 @@ export default defineComponent({
|
|
|
? NaturalTypeEnum.PPT
|
|
|
: 'other';
|
|
|
|
|
|
- console.log(type, 'type');
|
|
|
-
|
|
|
if (type === 'other') {
|
|
|
message.error(`文件格式不支持`);
|
|
|
return false;
|
|
@@ -392,7 +406,6 @@ export default defineComponent({
|
|
|
list.push(item);
|
|
|
}
|
|
|
});
|
|
|
- console.log(fileListRef.value, uploadList.value);
|
|
|
emit('confrim', list);
|
|
|
};
|
|
|
|