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
黄庭坚
jinfa-platform
Commits
4dc0334d
Commit
4dc0334d
authored
Oct 25, 2021
by
前端-李俊鑫
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 新增商城资讯收藏
parent
340271e4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
140 additions
and
0 deletions
+140
-0
mallInformation.tsx
src/pages/systemSetting/collection/mallInformation.tsx
+140
-0
No files found.
src/pages/systemSetting/collection/mallInformation.tsx
0 → 100644
View file @
4dc0334d
import
React
,
{
useEffect
,
useState
}
from
'react'
import
cx
from
'classnames'
import
{
Pagination
,
message
,
Modal
}
from
'antd'
import
{
PageHeaderWrapper
}
from
'@ant-design/pro-layout'
;
import
{
StarFilled
,
EyeOutlined
,
ClockCircleOutlined
}
from
'@ant-design/icons'
import
{
PublicApi
}
from
'@/services/api'
import
{
numFormat
}
from
'@/utils/numberFomat'
import
{
INFO_CENTER_URL
}
from
'@/constants'
import
moment
from
'moment'
import
styles
from
'./index.less'
const
Information
:
React
.
FC
=
()
=>
{
const
[
list
,
setList
]
=
useState
([])
const
[
current
,
setCurrent
]
=
useState
<
number
>
(
1
)
const
[
pageSize
,
setPageSize
]
=
useState
<
number
>
(
10
)
const
[
totalCount
,
setTotalCount
]
=
useState
<
number
>
(
0
)
useEffect
(()
=>
{
fetchCollectInformationList
()
},
[
current
])
/**
* 获取收藏的资讯列表
*/
const
fetchCollectInformationList
=
()
=>
{
const
param
:
any
=
{
current
,
pageSize
}
PublicApi
.
getManageMemberInformationCollectList
(
param
).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
{
setList
(
res
.
data
.
data
)
setTotalCount
(
res
.
data
.
totalCount
)
}
})
}
const
handleChange
=
(
page
)
=>
{
setCurrent
(
page
)
}
const
linkToDetail
=
(
detail
)
=>
{
if
(
detail
.
status
===
2
)
{
const
el
=
document
.
createElement
(
'a'
)
el
.
href
=
detail
.
url
;
el
.
target
=
'_blank'
;
el
.
id
=
detail
.
id
if
(
!
document
.
getElementById
(
detail
.
id
))
{
document
.
body
.
appendChild
(
el
);
}
el
.
click
()
}
else
{
message
.
destroy
()
message
.
info
(
"该文章已下架"
)
}
}
const
handleCancelCollect
=
(
detail
)
=>
{
Modal
.
confirm
({
centered
:
true
,
className
:
styles
.
mallComfirm
,
content
:
`是否要取消收藏?`
,
onOk
:
()
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
const
param
=
{
informationId
:
detail
.
id
,
status
:
false
}
PublicApi
.
postManageMemberInformationCollect
(
param
).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
{
// fetchPurchaseList()
fetchCollectInformationList
()
resolve
(
true
)
}
else
{
reject
()
}
}).
catch
(()
=>
{
reject
()
})
})
}
})
}
return
(
<
PageHeaderWrapper
>
<
div
className=
{
styles
.
information_list
}
>
{
list
&&
list
.
map
((
item
,
index
)
=>
(
<
div
className=
{
styles
.
information_list_item
}
key=
{
`information_list_item_${index}`
}
>
<
div
className=
{
cx
(
styles
.
information_list_item_item
,
styles
.
morehalf
)
}
>
<
div
className=
{
styles
.
information_header_info
}
>
<
div
className=
{
styles
.
information_header_info_logo
}
>
<
img
src=
{
item
.
imageUrl
}
/>
</
div
>
<
div
className=
{
styles
.
information_header_info_content
}
>
<
div
className=
{
styles
.
information_header_info_content_name
}
onClick=
{
()
=>
linkToDetail
(
item
)
}
>
<
span
>
{
item
.
title
}
</
span
>
</
div
>
<
div
className=
{
styles
.
information_header_info_content_about
}
>
<
div
className=
{
styles
.
information_header_info_content_about_item
}
>
<
ClockCircleOutlined
/>
<
span
>
{
moment
(
item
.
createTime
).
format
(
"YYYY-MM-DD HH:mm"
)
}
</
span
>
</
div
>
<
div
className=
{
styles
.
information_header_info_content_about_item
}
>
<
EyeOutlined
/>
<
span
>
{
numFormat
(
item
.
readCount
)
}
</
span
>
</
div
>
</
div
>
</
div
>
</
div
>
</
div
>
<
div
className=
{
cx
(
styles
.
information_list_item_item
)
}
>
<
span
className=
{
styles
.
date
}
>
{
moment
(
item
.
collectTime
).
format
(
"YYYY-MM-DD HH:mm"
)
}
</
span
>
</
div
>
<
div
className=
{
cx
(
styles
.
information_list_item_item
,
styles
.
float_right
)
}
>
<
div
className=
{
cx
(
styles
.
collection_state
)
}
onClick=
{
()
=>
handleCancelCollect
(
item
)
}
>
<
StarFilled
/>
<
label
>
收藏
</
label
>
</
div
>
</
div
>
</
div
>
))
}
</
div
>
{
totalCount
>
0
&&
(
<
div
className=
{
styles
.
pagination_wrap
}
>
<
Pagination
showSizeChanger=
{
false
}
current=
{
current
}
total=
{
totalCount
}
pageSize=
{
pageSize
}
onChange=
{
handleChange
}
/>
</
div
>
)
}
</
PageHeaderWrapper
>
)
}
export
default
Information
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