提交 2ca9cf20 作者: ZhangLingKun

功能:论坛动态审核

上级 7096d47a
import { InterFunction, InterItemFunction } from '~/api/interface'; import { InterFunction, InterListFunction } from '~/api/interface';
//论坛-列表 //论坛-列表
export type forumListType = InterItemFunction< export type forumListType = InterListFunction<
{ keyword?: string }, { keyword?: string },
{ {
id: number;
description: string; description: string;
mediaVO: null;
show: number;
userBaseInfo: { userBaseInfo: {
nickName: string; nickName: string;
userImg: string;
userName: null;
phone: string; phone: string;
uid: string; uid: string;
userImg: string;
userName: string;
}; };
show: number; userAccountId: number;
id: number; dynamicPublishTime: string;
}[] checkStatus: 0 | 1 | 2;
}
>; >;
//论坛-删除 //论坛-删除
export type deleteForumType = InterFunction<{ dynamicId: number }, any>; export type deleteForumType = InterFunction<{ dynamicId: number }, any>;
...@@ -44,3 +48,8 @@ export type likeUserInfoType = InterFunction< ...@@ -44,3 +48,8 @@ export type likeUserInfoType = InterFunction<
{ dynamicId: number }, { dynamicId: number },
{ nickName: string; userImg: string; userName: string }[] { nickName: string; userImg: string; userName: string }[]
>; >;
// 论坛-审核
export type checkDynamicType = InterFunction<
{ dynamicId: number; status: number },
NonNullable<unknown>
>;
import { import {
checkDynamicType,
deleteForumType, deleteForumType,
forumDetailType, forumDetailType,
forumListType, forumListType,
...@@ -23,4 +24,7 @@ export class ForumManageAPI { ...@@ -23,4 +24,7 @@ export class ForumManageAPI {
// 论坛-点赞人信息 // 论坛-点赞人信息
static getLikeUserInfoList: likeUserInfoType = (params) => static getLikeUserInfoList: likeUserInfoType = (params) =>
axios.get('/release/backstage/forum/likeUserInfo', { params }); axios.get('/release/backstage/forum/likeUserInfo', { params });
// 动态审核
static checkDynamic: checkDynamicType = (params) =>
axios.get('/release/backstage/forum/checkDynamic', { params });
} }
...@@ -3,13 +3,20 @@ import { Button, message, Modal, Table, Tooltip } from 'antd'; ...@@ -3,13 +3,20 @@ import { Button, message, Modal, Table, Tooltip } from 'antd';
import { ColumnsType } from 'antd/es/table'; import { ColumnsType } from 'antd/es/table';
import { useEffect, useState } from 'react'; import { useEffect, useState } from 'react';
import DynamicDetailModal from './components/dynamicDetailModal'; import DynamicDetailModal from './components/dynamicDetailModal';
import { ForumManageAPI } from '../../../api'; import { ForumManageAPI } from '~/api';
import { InterDataType, InterReqListType, PaginationProps } from '../../../api/interface'; import { InterDataType, InterListType, InterReqListType, PaginationProps } from '~/api/interface';
import { forumDetailType, forumListType } from '../../../api/interface/forumManageType'; import { forumDetailType, forumListType } from '~/api/interface/forumManageType';
import './index.scss'; import './index.scss';
// 动态审核状态
const checkStatusList = [
{ label: '审核中', value: 0 },
{ label: '审核通过', value: 1 },
{ label: '审核不通过', value: 2 },
];
//论坛列表返回类型 //论坛列表返回类型
type forumType = InterDataType<forumListType>['list']; type forumType = InterListType<forumListType>;
//论坛列表参数类型 //论坛列表参数类型
type forumParameters = InterReqListType<forumListType>; type forumParameters = InterReqListType<forumListType>;
//论坛详情返回类型 //论坛详情返回类型
...@@ -44,6 +51,12 @@ const DynamicList = () => { ...@@ -44,6 +51,12 @@ const DynamicList = () => {
), ),
}, },
{ {
title: '审核状态',
align: 'center',
dataIndex: 'checkStatus',
render: (text: number) => checkStatusList.find((i) => i.value === text)?.label || text,
},
{
title: '用户UID', title: '用户UID',
align: 'center', align: 'center',
render: (_text: string, record) => <div>{record.userBaseInfo?.uid || ''}</div>, render: (_text: string, record) => <div>{record.userBaseInfo?.uid || ''}</div>,
...@@ -54,18 +67,41 @@ const DynamicList = () => { ...@@ -54,18 +67,41 @@ const DynamicList = () => {
render: (_text: string, record) => <div>{record.userBaseInfo?.phone || ''}</div>, render: (_text: string, record) => <div>{record.userBaseInfo?.phone || ''}</div>,
}, },
{ {
title: '发布时间',
align: 'center',
dataIndex: 'dynamicPublishTime',
},
{
title: '操作', title: '操作',
align: 'center', align: 'center',
fixed: 'right',
width: 180,
render: (_text: string, record) => ( render: (_text: string, record) => (
<> <>
<Button
type='link'
onClick={() => handleCheckStatus(record)}
disabled={record.checkStatus !== 0}
>
审核
</Button>
<Button type='link' onClick={() => lookDynamicDetail(record)}> <Button type='link' onClick={() => lookDynamicDetail(record)}>
查看详情 详情
</Button> </Button>
<Button type='link' onClick={() => deleteForumClick(record)}> <Button
强制删除 type='link'
onClick={() => deleteForumClick(record)}
danger
disabled={record.checkStatus === 0}
>
删除
</Button> </Button>
<Button type='link' onClick={() => hiddenForumClick(record)}> <Button
{record.show ? '恢复显示' : '强制隐藏'} type='link'
onClick={() => hiddenForumClick(record)}
disabled={record.checkStatus === 0}
>
{record.show ? '显示' : '隐藏'}
</Button> </Button>
</> </>
), ),
...@@ -155,7 +191,30 @@ const DynamicList = () => { ...@@ -155,7 +191,30 @@ const DynamicList = () => {
} }
}); });
}; };
// 是否确认审核
const handleCheckStatus = (record: forumType[0]) => {
Modal.confirm({
title: `确认审核`,
content: `请确认是否审核通过?通过后动态将展示在论坛列表`,
okText: '审核通过',
cancelText: '审核不通过',
onOk: async () => {
const res = await ForumManageAPI.checkDynamic({ dynamicId: record.id, status: 1 });
if (res && res.code === '200') {
message.success('操作成功');
paginationChange(pagination.pageNo, pagination.pageSize);
}
},
onCancel: async () => {
const res = await ForumManageAPI.checkDynamic({ dynamicId: record.id, status: 2 });
if (res && res.code === '200') {
message.success('操作成功');
paginationChange(pagination.pageNo, pagination.pageSize);
}
},
});
};
// 组件挂载
useEffect(() => { useEffect(() => {
getDynamicList(); getDynamicList();
}, []); }, []);
...@@ -163,6 +222,7 @@ const DynamicList = () => { ...@@ -163,6 +222,7 @@ const DynamicList = () => {
<div className='dynamic-list'> <div className='dynamic-list'>
<SearchBox search={searchColumnsData} searchData={searchSuccess} /> <SearchBox search={searchColumnsData} searchData={searchSuccess} />
<Table <Table
size={'small'}
bordered bordered
columns={tableColumns} columns={tableColumns}
dataSource={tableData} dataSource={tableData}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论