Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
X
xiaomai-cloud-class-web
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
xiaomai-cloud-class
xiaomai-cloud-class-web
Commits
bd2043ff
Commit
bd2043ff
authored
Dec 24, 2020
by
zhangleyuan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:处理上传文件的限制
parent
75061134
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
8 deletions
+9
-8
src/bu-components/SelectPrepareFileModal.jsx
+3
-3
src/modules/prepare-lesson/modal/SelectPrepareFileModal.jsx
+6
-5
No files found.
src/bu-components/SelectPrepareFileModal.jsx
View file @
bd2043ff
...
@@ -323,15 +323,15 @@ class SelectPrepareFileModal extends React.Component {
...
@@ -323,15 +323,15 @@ class SelectPrepareFileModal extends React.Component {
const
_fileList
=
[...
fileList
];
const
_fileList
=
[...
fileList
];
_fileList
.
map
((
file
,
index
)
=>
{
_fileList
.
map
((
file
,
index
)
=>
{
let
{
size
,
type
,
name
}
=
file
;
let
{
size
,
type
,
name
}
=
file
;
console
.
log
(
'file'
,
file
);
if
(
!
type
)
{
if
(
!
type
)
{
type
=
getFileTypeByName
(
name
);
type
=
getFileTypeByName
(
name
);
}
}
if
(
type
.
indexOf
(
'image'
)
>
-
1
&&
size
>
5
*
DEFAULT_SIZE_UNIT
)
{
if
(
type
.
indexOf
(
'image'
)
>
-
1
&&
size
>
50
*
DEFAULT_SIZE_UNIT
)
{
nonCompliantFileList
.
push
(
file
);
nonCompliantFileList
.
push
(
file
);
_fileList
.
splice
(
index
,
1
);
_fileList
.
splice
(
index
,
1
);
}
}
if
(
type
.
indexOf
(
'audio'
)
>
-
1
&&
size
>
5
0
*
DEFAULT_SIZE_UNIT
)
{
if
(
type
.
indexOf
(
'audio'
)
>
-
1
&&
size
>
2
0
*
DEFAULT_SIZE_UNIT
)
{
nonCompliantFileList
.
push
(
file
);
nonCompliantFileList
.
push
(
file
);
_fileList
.
splice
(
index
,
1
);
_fileList
.
splice
(
index
,
1
);
}
}
...
...
src/modules/prepare-lesson/modal/SelectPrepareFileModal.jsx
View file @
bd2043ff
...
@@ -19,7 +19,7 @@ import Service from '@/common/js/service';
...
@@ -19,7 +19,7 @@ import Service from '@/common/js/service';
import
_
from
'underscore'
;
import
_
from
'underscore'
;
import
{
import
{
DEFAULT_SIZE_UNIT
,
FileTypeIcon
,
NonCompliantFileMap
,
DEFAULT_SIZE_UNIT
,
FileTypeIcon
,
NonCompliantFileMap
,
DISK_LIST
,
SupportFileType
,
LocalFileType
DISK_LIST
,
SupportFileType
,
LocalFileType
,
FileVerifyMap
}
from
"@/common/constants/academic/lessonEnum"
;
}
from
"@/common/constants/academic/lessonEnum"
;
import
{
getFileTypeByName
}
from
'../components/FolderManage'
;
import
{
getFileTypeByName
}
from
'../components/FolderManage'
;
...
@@ -322,16 +322,16 @@ class SelectPrepareFileModal extends React.Component {
...
@@ -322,16 +322,16 @@ class SelectPrepareFileModal extends React.Component {
const
nonCompliantFileList
=
[];
const
nonCompliantFileList
=
[];
const
_fileList
=
[...
fileList
];
const
_fileList
=
[...
fileList
];
_fileList
.
map
((
file
,
index
)
=>
{
_fileList
.
map
((
file
,
index
)
=>
{
console
.
log
(
'file'
,
file
);
let
{
size
,
type
,
name
}
=
file
;
let
{
size
,
type
,
name
}
=
file
;
if
(
!
type
)
{
if
(
!
type
)
{
type
=
getFileTypeByName
(
name
);
type
=
getFileTypeByName
(
name
);
}
}
if
(
type
.
indexOf
(
'image'
)
>
-
1
&&
size
>
5
*
DEFAULT_SIZE_UNIT
)
{
if
(
type
.
indexOf
(
'image'
)
>
-
1
&&
size
>
50
*
DEFAULT_SIZE_UNIT
)
{
nonCompliantFileList
.
push
(
file
);
nonCompliantFileList
.
push
(
file
);
_fileList
.
splice
(
index
,
1
);
_fileList
.
splice
(
index
,
1
);
}
}
if
(
type
.
indexOf
(
'audio'
)
>
-
1
&&
size
>
5
0
*
DEFAULT_SIZE_UNIT
)
{
if
(
type
.
indexOf
(
'audio'
)
>
-
1
&&
size
>
2
0
*
DEFAULT_SIZE_UNIT
)
{
nonCompliantFileList
.
push
(
file
);
nonCompliantFileList
.
push
(
file
);
_fileList
.
splice
(
index
,
1
);
_fileList
.
splice
(
index
,
1
);
}
}
...
@@ -339,12 +339,13 @@ class SelectPrepareFileModal extends React.Component {
...
@@ -339,12 +339,13 @@ class SelectPrepareFileModal extends React.Component {
nonCompliantFileList
.
push
(
file
);
nonCompliantFileList
.
push
(
file
);
_fileList
.
splice
(
index
,
1
);
_fileList
.
splice
(
index
,
1
);
}
}
if
(
localFileType
.
indexOf
(
type
)
>
-
1
&&
size
>
100
*
DEFAULT_SIZE_UNIT
)
{
if
(
localFileType
.
indexOf
(
type
)
>
-
1
&&
size
>
FileVerifyMap
[
type
].
maxSize
*
DEFAULT_SIZE_UNIT
)
{
nonCompliantFileList
.
push
(
file
);
nonCompliantFileList
.
push
(
file
);
_fileList
.
splice
(
index
,
1
);
_fileList
.
splice
(
index
,
1
);
}
}
file
.
key
=
count
++
;
file
.
key
=
count
++
;
});
});
console
.
log
(
"nonCompliantFileList"
,
nonCompliantFileList
);
// 不符合规则的文件列表
// 不符合规则的文件列表
if
(
nonCompliantFileList
.
length
>
0
)
{
if
(
nonCompliantFileList
.
length
>
0
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment