|
@@ -89,15 +89,24 @@ const selectFileTap = () => {
|
|
|
}
|
|
|
//文件选择完成
|
|
|
const selectFileChange = async (files) => {
|
|
|
- console.log(files)
|
|
|
- /*if (files && files.length > 0) {
|
|
|
+ if (files && files.length > 0) {
|
|
|
+ let isUnsupported = false
|
|
|
uni.showLoading({title: '上传文件中...', mask: true})
|
|
|
+ const fileType = ['doc', 'docx', 'pdf', 'xls', 'xlsx', 'gif', 'jpg', 'jpeg', 'png', 'bmp', 'webp']
|
|
|
for (let i = 0; i < files.length; i++) {
|
|
|
- await uploadFileApi(files[i].filePath)
|
|
|
- getBussFileList().then()
|
|
|
+ const extension = files[i].fileExtension.toLowerCase()
|
|
|
+ if (fileType.indexOf(extension) > -1) {
|
|
|
+ await uploadFileApi(files[i].filePath)
|
|
|
+ getBussFileList().then()
|
|
|
+ } else {
|
|
|
+ isUnsupported = true
|
|
|
+ }
|
|
|
}
|
|
|
uni.hideLoading()
|
|
|
- }*/
|
|
|
+ if (isUnsupported) {
|
|
|
+ errorToast('有不支持的文件格式,已过滤上传');
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
//处理文件上传
|