Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
jinfa-platform
Project
Project
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
shenshaokai
jinfa-platform
Commits
ca0ddcac
Commit
ca0ddcac
authored
Apr 19, 2022
by
xiexiuxing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
素材库文件名优化
parent
5c929b45
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
67 additions
and
23 deletions
+67
-23
Doc.png
src/pages/systemSetting/materialmanagement/img/Doc.png
+0
-0
Excel.png
src/pages/systemSetting/materialmanagement/img/Excel.png
+0
-0
Others.png
src/pages/systemSetting/materialmanagement/img/Others.png
+0
-0
PDF.png
src/pages/systemSetting/materialmanagement/img/PDF.png
+0
-0
PPT.png
src/pages/systemSetting/materialmanagement/img/PPT.png
+0
-0
Photo.png
src/pages/systemSetting/materialmanagement/img/Photo.png
+0
-0
Video.png
src/pages/systemSetting/materialmanagement/img/Video.png
+0
-0
Zip.png
src/pages/systemSetting/materialmanagement/img/Zip.png
+0
-0
index.less
src/pages/systemSetting/materialmanagement/index.less
+9
-1
index.tsx
src/pages/systemSetting/materialmanagement/index.tsx
+58
-22
No files found.
src/pages/systemSetting/materialmanagement/img/Doc.png
0 → 100644
View file @
ca0ddcac
2.49 KB
src/pages/systemSetting/materialmanagement/img/Excel.png
0 → 100644
View file @
ca0ddcac
2.6 KB
src/pages/systemSetting/materialmanagement/img/Others.png
0 → 100644
View file @
ca0ddcac
2.52 KB
src/pages/systemSetting/materialmanagement/img/PDF.png
0 → 100644
View file @
ca0ddcac
2.08 KB
src/pages/systemSetting/materialmanagement/img/PPT.png
0 → 100644
View file @
ca0ddcac
1.93 KB
src/pages/systemSetting/materialmanagement/img/Photo.png
0 → 100644
View file @
ca0ddcac
2.07 KB
src/pages/systemSetting/materialmanagement/img/Video.png
0 → 100644
View file @
ca0ddcac
1.87 KB
src/pages/systemSetting/materialmanagement/img/Zip.png
0 → 100644
View file @
ca0ddcac
1.57 KB
src/pages/systemSetting/materialmanagement/index.less
View file @
ca0ddcac
...
@@ -27,10 +27,18 @@
...
@@ -27,10 +27,18 @@
border: 1px solid #ccc;
border: 1px solid #ccc;
border-radius: 5px;
border-radius: 5px;
position: relative;
position: relative;
img{
display: flex;
align-items: center;
justify-content: center;
background-color: #F5F6F7;
.Img{
width: 100%;
width: 100%;
height: 100%;
height: 100%;
}
}
img{
width: 48px;
height: 48px;
}
video{
video{
width: 100%;
width: 100%;
height: 100%;
height: 100%;
...
...
src/pages/systemSetting/materialmanagement/index.tsx
View file @
ca0ddcac
...
@@ -8,6 +8,15 @@ import moment from 'moment';
...
@@ -8,6 +8,15 @@ import moment from 'moment';
import
styles
from
'./index.less'
;
import
styles
from
'./index.less'
;
import
{
UPLOAD_TYPE
}
from
'@/constants'
import
{
UPLOAD_TYPE
}
from
'@/constants'
import
{
postManageMaterialLibraryPage
,
postManageMaterialLibraryAdd
,
postManageMaterialLibraryBatchDel
}
from
'@/services/ManageV2Api'
;
import
{
postManageMaterialLibraryPage
,
postManageMaterialLibraryAdd
,
postManageMaterialLibraryBatchDel
}
from
'@/services/ManageV2Api'
;
import
Zip
from
'./img/Zip.png'
;
import
Doc
from
'./img/Doc.png'
;
import
Xlsx
from
'./img/Excel.png'
;
import
Video
from
'./img/Video.png'
;
import
PDF
from
'./img/PDF.png'
;
import
PPT
from
'./img/PPT.png'
;
import
Photo
from
'./img/Photo.png'
;
import
Others
from
'./img/Others.png'
;
const
{
RangePicker
}
=
DatePicker
const
{
RangePicker
}
=
DatePicker
const
{
Option
}
=
Select
;
const
{
Option
}
=
Select
;
...
@@ -72,10 +81,17 @@ const Materialmanagement = () => {
...
@@ -72,10 +81,17 @@ const Materialmanagement = () => {
if
(
data
.
fileType
==
0
)
{
if
(
data
.
fileType
==
0
)
{
data
.
fileType
=
''
data
.
fileType
=
''
}
}
const
res
=
await
postManageMaterialLibraryPage
(
data
)
const
res
=
await
postManageMaterialLibraryPage
(
data
,
{
ctlType
:
'none'
})
console
.
log
(
res
);
const
list
=
res
.
data
.
data
.
map
((
item
:
any
)
=>
{
const
flieCode
=
item
.
fileUrl
.
split
(
'.'
)
return
{
...
item
,
flieCode
:
flieCode
[
flieCode
.
length
-
1
]
}
})
console
.
log
(
list
)
if
(
res
.
code
===
1000
)
{
if
(
res
.
code
===
1000
)
{
setdataSource
(
res
.
data
.
data
)
setdataSource
(
list
)
settotal
(
res
.
data
.
totalCount
)
settotal
(
res
.
data
.
totalCount
)
}
}
}
}
...
@@ -97,7 +113,6 @@ const Materialmanagement = () => {
...
@@ -97,7 +113,6 @@ const Materialmanagement = () => {
if
(
fileList
[
0
].
response
)
{
if
(
fileList
[
0
].
response
)
{
if
(
fileList
[
0
].
response
.
code
===
1000
)
{
if
(
fileList
[
0
].
response
.
code
===
1000
)
{
let
fileType
=
3
;
let
fileType
=
3
;
console
.
log
(
fileList
[
0
].
type
)
const
isJpgOrPng
=
fileList
[
0
].
type
===
'image/jpeg'
||
fileList
[
0
].
type
===
'image/png'
||
fileList
[
0
].
type
===
'image/jpg'
;
const
isJpgOrPng
=
fileList
[
0
].
type
===
'image/jpeg'
||
fileList
[
0
].
type
===
'image/png'
||
fileList
[
0
].
type
===
'image/jpg'
;
if
(
isJpgOrPng
)
{
if
(
isJpgOrPng
)
{
fileType
=
1
fileType
=
1
...
@@ -170,22 +185,53 @@ const Materialmanagement = () => {
...
@@ -170,22 +185,53 @@ const Materialmanagement = () => {
materialList
()
materialList
()
}
}
const
fileTypeDom
=
(
type
,
item
)
=>
{
if
(
type
==
1
)
{
const
fileTypeDom
=
(
item
)
=>
{
const
{
flieCode
}
=
item
;
const
isJpgOrPng
=
flieCode
===
'jpeg'
||
flieCode
===
'png'
||
flieCode
===
'jpg'
;
console
.
log
(
isJpgOrPng
)
if
(
isJpgOrPng
)
{
return
(
<
img
className=
{
styles
.
Img
}
src=
{
item
.
fileUrl
}
alt=
""
/>
)
}
if
(
flieCode
==
'zip'
)
{
return
(
<
img
src=
{
Zip
}
alt=
""
/>
)
}
if
(
flieCode
==
'docx'
)
{
return
(
<
img
src=
{
Doc
}
alt=
""
/>
)
}
if
(
flieCode
==
'xlsx'
)
{
return
(
return
(
<
img
src=
{
item
.
fileUrl
}
alt=
""
/>
<
img
src=
{
Xlsx
}
alt=
""
/>
)
)
}
}
if
(
type
==
2
)
{
if
(
flieCode
==
'mp4'
)
{
return
(
return
(
<
video
src=
{
item
.
fileUrl
}
></
video
>
<
video
src=
{
item
.
fileUrl
}
></
video
>
// <img className={styles.Img} src={Video} alt="" />
)
)
}
}
else
{
if
(
flieCode
==
'pptx'
)
{
return
(
return
(
<
img
src=
"http://lingxi-mini.oss-cn-hangzhou.aliyuncs.com/Images/fujian@2x.png"
alt=
""
/>
<
img
src=
{
PPT
}
alt=
""
/>
)
)
}
}
if
(
flieCode
==
'pdf'
)
{
return
(
<
img
src=
{
PDF
}
alt=
""
/>
)
}
else
{
return
(
<
img
src=
{
Others
}
alt=
""
/>
)
}
}
}
const
download
=
(
url
,
fileName
)
=>
{
const
download
=
(
url
,
fileName
)
=>
{
...
@@ -200,17 +246,7 @@ const Materialmanagement = () => {
...
@@ -200,17 +246,7 @@ const Materialmanagement = () => {
a
.
click
()
a
.
click
()
}
}
x
.
send
();
x
.
send
();
// const eleLink = document.createElement('a');
// eleLink.download = fileName;
// eleLink.style.display = 'none';
// // 字符内容转变成blob地址
// const blob = new Blob([url]);
// eleLink.href = URL.createObjectURL(blob);
// // 触发点击
// document.body.appendChild(eleLink);
// eleLink.click();
// // 然后移除
// document.body.removeChild(eleLink);
}
}
...
@@ -267,7 +303,7 @@ const Materialmanagement = () => {
...
@@ -267,7 +303,7 @@ const Materialmanagement = () => {
<
div
className=
{
styles
.
listItem
}
>
<
div
className=
{
styles
.
listItem
}
>
<
div
onClick=
{
()
=>
setfalg
(
item
,
index
)
}
className=
{
[
styles
[
'Imgbox'
],
item
.
cheboxUrl
?
styles
[
'ImgboxAtive'
]
:
''
].
join
(
' '
)
}
>
<
div
onClick=
{
()
=>
setfalg
(
item
,
index
)
}
className=
{
[
styles
[
'Imgbox'
],
item
.
cheboxUrl
?
styles
[
'ImgboxAtive'
]
:
''
].
join
(
' '
)
}
>
{
fileTypeDom
(
item
.
fileType
,
item
)
}
{
fileTypeDom
(
item
)
}
{
{
item
.
cheboxUrl
&&
item
.
cheboxUrl
&&
...
...
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