|
@@ -1,9 +1,9 @@
|
|
|
import React, { useEffect, useState } from 'react'
|
|
|
import useRequest from '@ahooksjs/use-request/es'
|
|
|
import { Input, message, Modal } from 'antd'
|
|
|
-import { ColumnService, IMessageDetail } from 'Column/Column.service'
|
|
|
+import { ColumnService, IMessageDetail, IMsgChildrenList } 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 | IMsgChildrenList) => {
|
|
|
+ postMessageLike(item.MessageId, item.IsLikeCount ? 0 : 1)
|
|
|
+ }
|
|
|
+
|
|
|
+ // 点赞留言的接口
|
|
|
+ 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)
|
|
@@ -104,7 +121,10 @@ const ColumnContentMessage: React.FC<IColumnCenterProps> = props => {
|
|
|
)}
|
|
|
{massageList.length > 0 &&
|
|
|
massageList.map(item => (
|
|
|
- <div key={item.MessageId} className={styles['columndetail-message-list']}>
|
|
|
+ <div
|
|
|
+ key={item.MessageId}
|
|
|
+ className={`${styles[`columndetail-message-list`]} ${styles[item.Status === 0 ? 'no-disclosure' : '']}`}
|
|
|
+ >
|
|
|
<div className={styles['item-img-btn']}>
|
|
|
<div>
|
|
|
<img src={item.Headimgurl} />
|
|
@@ -112,11 +132,20 @@ const ColumnContentMessage: React.FC<IColumnCenterProps> = props => {
|
|
|
</div>
|
|
|
<div>
|
|
|
{item.Status === 0 ? (
|
|
|
- <DeleteOutlined className={styles['delete-icon']} onClick={() => deleceMessageHandler(item)} />
|
|
|
+ <div className={styles['delete-box']}>
|
|
|
+ <p>未公开之前仅自己可见</p>
|
|
|
+ <DeleteOutlined className={styles['delete-icon']} onClick={() => deleceMessageHandler(item)} />
|
|
|
+ </div>
|
|
|
) : (
|
|
|
<>
|
|
|
- <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)} />
|
|
|
+ )}
|
|
|
+ <span>{item.LikeCount}</span>
|
|
|
+ </div>
|
|
|
</>
|
|
|
)}
|
|
|
</div>
|
|
@@ -125,11 +154,21 @@ const ColumnContentMessage: React.FC<IColumnCenterProps> = props => {
|
|
|
{item.ChildList.length > 0 &&
|
|
|
item.ChildList.map(child => (
|
|
|
<div key={child.MessageId} className={styles['columndetail-messge-child-list']}>
|
|
|
- <div className={styles['item-img-btn']}>
|
|
|
+ <div className={styles['child-item-img-btn']}>
|
|
|
<div>
|
|
|
<img src={child.Headimgurl} />
|
|
|
<span>{child.CreateTime}</span>
|
|
|
</div>
|
|
|
+ <>
|
|
|
+ <div>
|
|
|
+ {child.IsLikeCount ? (
|
|
|
+ <LikeFilled className={styles['collect-icon']} onClick={() => likeMessageHandler(child)} />
|
|
|
+ ) : (
|
|
|
+ <LikeOutlined className={styles['collect-icon']} onClick={() => likeMessageHandler(child)} />
|
|
|
+ )}
|
|
|
+ <span>{child.LikeCount}</span>
|
|
|
+ </div>
|
|
|
+ </>
|
|
|
</div>
|
|
|
<div className={styles['columndetail-messge-content']}>{child.Content}</div>
|
|
|
</div>
|