|
@@ -3,7 +3,7 @@ import useRequest from '@ahooksjs/use-request/es'
|
|
|
import { Input, message, Modal } from 'antd'
|
|
|
import { ColumnService, IMessageDetail } from 'Column/Column.service'
|
|
|
|
|
|
-import { LikeOutlined, DeleteOutlined } from '@ant-design/icons'
|
|
|
+import { LikeOutlined, DeleteOutlined, LikeFilled } from '@ant-design/icons'
|
|
|
import styles from '../css/ColumnMessage.module.scss'
|
|
|
interface IColumnCenterProps {
|
|
|
detailId: number
|
|
@@ -30,6 +30,8 @@ const ColumnContentMessage: React.FC<IColumnCenterProps> = props => {
|
|
|
onSuccess: res => {
|
|
|
res.data.Success ? message.success(res.data.Msg) : message.error(res.data.Msg || res.data.ErrMsg)
|
|
|
setInputShow(false)
|
|
|
+ setMessageContent('')
|
|
|
+ getColumnSpecialList(pageSize, currentIndex, detailId)
|
|
|
}
|
|
|
})
|
|
|
|
|
@@ -41,7 +43,7 @@ const ColumnContentMessage: React.FC<IColumnCenterProps> = props => {
|
|
|
setMassageList(res.List)
|
|
|
}
|
|
|
})
|
|
|
- // deleceMessageHandler
|
|
|
+ // 删除留言的按钮
|
|
|
const deleceMessageHandler = (item: IMessageDetail) => {
|
|
|
Modal.confirm({
|
|
|
title: '提醒',
|
|
@@ -64,6 +66,21 @@ const ColumnContentMessage: React.FC<IColumnCenterProps> = props => {
|
|
|
getColumnSpecialList(pageSize, currentIndex, detailId)
|
|
|
}
|
|
|
})
|
|
|
+
|
|
|
+ // 留言的点赞
|
|
|
+ const likeMessageHandler = (item: IMessageDetail) => {
|
|
|
+ postMessageLike(item.MessageId, item.Status === 0 ? 1 : 0)
|
|
|
+ }
|
|
|
+
|
|
|
+ // 点赞留言的接口
|
|
|
+ const { run: postMessageLike } = useRequest(ColumnService.postMessageLike, {
|
|
|
+ manual: true,
|
|
|
+ onSuccess: res => {
|
|
|
+ res.data.Success ? message.success(res.data.Msg) : message.error(res.data.Msg || res.data.ErrMsg)
|
|
|
+ getColumnSpecialList(pageSize, currentIndex, detailId)
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
useEffect(() => {
|
|
|
if (detailId) {
|
|
|
getColumnSpecialList(pageSize, currentIndex, detailId)
|
|
@@ -111,12 +128,19 @@ const ColumnContentMessage: React.FC<IColumnCenterProps> = props => {
|
|
|
<span>{item.CreateTime}</span>
|
|
|
</div>
|
|
|
<div>
|
|
|
- {item.Status === 0 ? (
|
|
|
+ {item.Status !== 0 ? (
|
|
|
<DeleteOutlined className={styles['delete-icon']} onClick={() => deleceMessageHandler(item)} />
|
|
|
) : (
|
|
|
<>
|
|
|
- <LikeOutlined className={styles['collect-icon']} />
|
|
|
- <span>{item.LikeCount}</span>
|
|
|
+ <div>
|
|
|
+ {item.IsLikeCount ? (
|
|
|
+ <LikeFilled className={styles['collect-icon']} onClick={() => likeMessageHandler(item)} />
|
|
|
+ ) : (
|
|
|
+ <LikeOutlined className={styles['collect-icon']} onClick={() => likeMessageHandler(item)} />
|
|
|
+ )}
|
|
|
+ {/* <LikeOutlined className={styles['collect-icon']} onClick={() => likeMessageHandler(item)} /> */}
|
|
|
+ <span>{item.LikeCount}</span>
|
|
|
+ </div>
|
|
|
</>
|
|
|
)}
|
|
|
</div>
|