| | |
| | | // 大小限制(MB) |
| | | fileSize: propTypes.number.def(200), |
| | | // 文件类型, 例如['png', 'jpg', 'jpeg'] |
| | | fileType: propTypes.array.def(["doc","docx","xlsx", "xls", "ppt", "txt", "pdf"]), |
| | | fileType: propTypes.array.def(['doc', 'docx', 'xlsx', 'xls', 'ppt', 'txt', 'pdf', 'mp3', 'mp4', 'mov', 'png', 'jpg', 'jpeg', 'zip', 'rar', '7z']), |
| | | // 是否显示提示 |
| | | isShowTip: propTypes.bool.def(true), |
| | | }); |
| | | |
| | | const { proxy } = getCurrentInstance() as ComponentInternalInstance; |
| | | const emit = defineEmits(['update:modelValue','closePopup']); |
| | | const emit = defineEmits(['update:modelValue','closePopup','openPopup']); |
| | | const number = ref(0); |
| | | const uploadList = ref<any[]>([]); |
| | | //互联网端 |
| | |
| | | // 上传前校检格式和大小 |
| | | const handleBeforeUpload = (file: any) => { |
| | | // 校检文件类型 |
| | | // if (props.fileType.length) { |
| | | // const fileName = file.name.split('.'); |
| | | // const fileExt = fileName[fileName.length - 1]; |
| | | // const isTypeOk = props.fileType.indexOf(fileExt) >= 0; |
| | | // if (!isTypeOk) { |
| | | // proxy?.$modal.msgError(`文件格式不正确, 请上传${props.fileType.join("/")}格式文件!`); |
| | | // return false; |
| | | // } |
| | | // } |
| | | if (props.fileType.length) { |
| | | const fileName = file.name.split('.'); |
| | | const fileExt = fileName[fileName.length - 1]; |
| | | const isTypeOk = props.fileType.indexOf(fileExt) >= 0; |
| | | if (!isTypeOk) { |
| | | proxy?.$modal.msgError(`文件格式不正确, 请上传${props.fileType.join("/")}格式文件!`); |
| | | return false; |
| | | } |
| | | } |
| | | // 校检文件大小 |
| | | if (props.fileSize) { |
| | | const isLt = file.size / 1024 / 1024 < props.fileSize; |
| | |
| | | } |
| | | } |
| | | const handleUploadProgress=(e: any) => { |
| | | debounce(() =>{ |
| | | emit('closePopup','123123'); |
| | | },1500) |
| | | // downloadProgress.value = downloadProgress.value + 50 |
| | | // emit('closePopup','123123'); |
| | | emit('openPopup','123123'); |
| | | } |
| | | // 上传成功回调 |
| | | const handleUploadSuccess = (res: any, file: UploadFile) => { |