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
fe54f9d5
Commit
fe54f9d5
authored
Sep 25, 2020
by
GuanHua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:资讯详情的收藏接口对接
parent
ae6a9d38
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
75 additions
and
9 deletions
+75
-9
detail.less
src/pages/lxMall/information/detail.less
+18
-2
detail.tsx
src/pages/lxMall/information/detail.tsx
+57
-7
No files found.
src/pages/lxMall/information/detail.less
View file @
fe54f9d5
...
...
@@ -78,8 +78,6 @@
&_main {
padding: 0 24px;
}
}
.information_detail_content {
...
...
@@ -87,8 +85,26 @@
padding: 20px 0;
}
.information_common_tag_list_wrap {
display: flex;
.information_common_tag_right {
.collection_state {
position: relative;
cursor: pointer;
color: var(--mall_main_color);
&>label {
margin-left: 4px;
cursor: pointer;
}
}
}
}
.information_common_tag_list {
display: flex;
flex: 1;
margin-bottom: 20px;
&_item {
...
...
src/pages/lxMall/information/detail.tsx
View file @
fe54f9d5
...
...
@@ -3,12 +3,15 @@ import BreadCrumbs from './components/breadCrumbs'
import
InformationRight
from
'./components/informationRight'
import
cx
from
'classnames'
import
{
Link
}
from
'umi'
import
{
message
}
from
'antd'
import
{
StarFilled
,
StarOutlined
}
from
'@ant-design/icons'
import
ImageBox
from
'@/components/ImageBox'
import
{
ClockCircleOutlined
,
EyeOutlined
}
from
'@ant-design/icons'
import
informationImg2
from
'@/assets/imgs/information_2.png'
import
{
PublicApi
}
from
'@/services/api'
import
{
GetManageContentInformationFindByIdResponse
}
from
'@/services/PassApi'
import
{
numFormat
}
from
'@/utils/numberFomat'
import
{
getAuth
}
from
'@/utils/auth'
import
moment
from
'moment'
import
styles
from
'./detail.less'
...
...
@@ -19,7 +22,7 @@ interface InformationDetailPropsType {
const
InformationDetail
:
React
.
FC
<
InformationDetailPropsType
>
=
(
props
)
=>
{
const
{
query
:
{
id
}
}
=
props
.
location
const
[
newsDetail
,
setNewsDetail
]
=
useState
<
GetManageContentInformationFindByIdResponse
>
()
let
collectFlg
=
true
useEffect
(()
=>
{
if
(
id
)
{
fetchNewsDetail
()
...
...
@@ -37,6 +40,43 @@ const InformationDetail: React.FC<InformationDetailPropsType> = (props) => {
})
}
const
handleCollection
=
()
=>
{
if
(
getAuth
())
{
if
(
collectFlg
)
{
collectFlg
=
false
const
status
=
newsDetail
.
collectStatus
?
false
:
true
let
param
=
{
informationId
:
newsDetail
.
id
,
status
}
PublicApi
.
postManageContentInformationCollect
(
param
).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
{
message
.
destroy
()
if
(
status
)
{
message
.
success
(
"收藏成功"
)
}
else
{
message
.
success
(
"取消收藏成功"
)
}
fetchNewsDetail
()
}
collectFlg
=
true
}).
catch
(()
=>
{
collectFlg
=
true
})
}
}
else
{
if
(
collectFlg
)
{
collectFlg
=
false
message
.
info
(
"请先进行登录"
)
setTimeout
(()
=>
{
collectFlg
=
true
window
.
location
.
replace
(
`/user/login?redirect=
${
btoa
(
encodeURIComponent
(
String
(
window
.
location
)))}
`
)
},
1500
);
}
}
}
return
(
<
div
className=
{
styles
.
information_detail
}
>
<
div
className=
{
styles
.
information_detail_container
}
>
...
...
@@ -68,12 +108,22 @@ const InformationDetail: React.FC<InformationDetailPropsType> = (props) => {
<
div
className=
{
styles
.
information_detail_content
}
>
<
div
dangerouslySetInnerHTML=
{
{
__html
:
newsDetail
.
content
}
}
></
div
>
</
div
>
<
div
className=
{
styles
.
information_common_tag_list
}
>
{
newsDetail
.
contentLabelList
&&
newsDetail
.
contentLabelList
.
map
((
labelItem
:
any
)
=>
(
<
div
className=
{
styles
.
information_common_tag_list_item
}
key=
{
`information_common_tag_list_item-${labelItem.id}`
}
>
{
labelItem
.
name
}
</
div
>
))
}
<
div
className=
{
styles
.
information_common_tag_list_wrap
}
>
<
div
className=
{
styles
.
information_common_tag_list
}
>
{
newsDetail
.
contentLabelList
&&
newsDetail
.
contentLabelList
.
map
((
labelItem
:
any
)
=>
(
<
div
className=
{
styles
.
information_common_tag_list_item
}
key=
{
`information_common_tag_list_item-${labelItem.id}`
}
>
{
labelItem
.
name
}
</
div
>
))
}
</
div
>
<
div
className=
{
styles
.
information_common_tag_right
}
>
<
div
className=
{
cx
(
styles
.
collection_state
)
}
onClick=
{
()
=>
handleCollection
()
}
>
{
newsDetail
.
collectStatus
?
<
StarFilled
/>
:
<
StarOutlined
/>
}
<
label
>
收藏
</
label
>
</
div
>
</
div
>
</
div
>
<
div
className=
{
styles
.
information_detail_split
}
></
div
>
<
div
className=
{
styles
.
information_detail_pagination
}
>
...
...
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