Commit 3863a30a by zhangleyuan

feat:处理企业微信文件类型筛选不了

parent b135cf5a
...@@ -325,11 +325,15 @@ class SelectPrepareFileModal extends React.Component { ...@@ -325,11 +325,15 @@ class SelectPrepareFileModal extends React.Component {
// 上传文件 // 上传文件
handleUpload = (event) => { handleUpload = (event) => {
const { selectType } = this.props; const { selectType,accept} = this.props;
const fileList = event.target.files; const fileList = event.target.files;
// 判断文件的大小是否超出了限制 // 判断文件的大小是否超出了限制
const nonCompliantFileList = []; const nonCompliantFileList = [];
const _fileList = [...fileList]; const _fileList = [...fileList];
const _accept = accept.split(',');
console.log("_fileList",_fileList);
console.log('accept',_accept);
_fileList.map((file, index) => { _fileList.map((file, index) => {
let { size, type, name } = file; let { size, type, name } = file;
if (!type) { if (!type) {
...@@ -339,6 +343,10 @@ class SelectPrepareFileModal extends React.Component { ...@@ -339,6 +343,10 @@ class SelectPrepareFileModal extends React.Component {
nonCompliantFileList.push(file); nonCompliantFileList.push(file);
_fileList.splice(index, 1); _fileList.splice(index, 1);
} }
//mac的企业微信环境下加accept不起作用,所以需要我们在选择完成后做一层限制
if(accept && _accept.indexOf("."+_.last(name.split('.')).toLowerCase()) === -1){
_fileList.splice(index, 1);
}
file.key = count++; file.key = count++;
}); });
console.log("nonCompliantFileList",nonCompliantFileList); console.log("nonCompliantFileList",nonCompliantFileList);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment