123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- // 附件处理——格式
- const judgeFileFormat = (fileType) => {
- console.log(fileType, 'fileType');
- let fileFormat = '';
- switch (fileType) {
- case 'txt':
- return fileFormat = 'text/plain';
- case 'docx':
- // return fileFormat = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document';
- return fileFormat = 'application/msword';
- // return fileFormat = 'application/x-msdownload';
- case 'doc':
- return fileFormat = 'application/msword';
- case 'xlsx':
- return fileFormat = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';
- case 'xls':
- return fileFormat = 'application/vnd.ms-excel';
- case 'pptx':
- return fileFormat = 'application/vnd.openxmlformats-officedocument.presentationml.presentation';
- case 'ppt':
- return fileFormat = 'application/vnd.ms-powerpoint';
- case 'pdf':
- return fileFormat = 'application/pdf';
- case 'zip':
- return fileFormat = 'application/zip';
- case 'rar':
- return fileFormat = 'application/x-rar-compressed';
- case 'jpg':
- return fileFormat = 'image/jpeg';
- case 'jpeg':
- return fileFormat = 'image/jpeg';
- case 'png':
- return fileFormat = 'image/png';
- case 'gif':
- return fileFormat = 'image/gif';
- case 'bmp':
- return fileFormat = 'image/bmp';
- case 'mp3':
- return fileFormat = 'audio/mpeg';
- case 'mp4':
- return fileFormat = 'video/mp4';
- case 'avi':
- return fileFormat = 'video/x-msvideo';
- }
- }
- export default judgeFileFormat;
|