提交 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 },
{
id: number;
description: string;
mediaVO: null;
show: number;
userBaseInfo: {
nickName: string;
userImg: string;
userName: null;
phone: string;
uid: string;
userImg: string;
userName: string;
};
show: number;
id: number;
}[]
userAccountId: number;
dynamicPublishTime: string;
checkStatus: 0 | 1 | 2;
}
>;
//论坛-删除
export type deleteForumType = InterFunction<{ dynamicId: number }, any>;
......@@ -44,3 +48,8 @@ export type likeUserInfoType = InterFunction<
{ dynamicId: number },
{ nickName: string; userImg: string; userName: string }[]
>;
// 论坛-审核
export type checkDynamicType = InterFunction<
{ dynamicId: number; status: number },
NonNullable<unknown>
>;
import {
checkDynamicType,
deleteForumType,
forumDetailType,
forumListType,
......@@ -23,4 +24,7 @@ export class ForumManageAPI {
// 论坛-点赞人信息
static getLikeUserInfoList: likeUserInfoType = (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';
import { ColumnsType } from 'antd/es/table';
import { useEffect, useState } from 'react';
import DynamicDetailModal from './components/dynamicDetailModal';
import { ForumManageAPI } from '../../../api';
import { InterDataType, InterReqListType, PaginationProps } from '../../../api/interface';
import { forumDetailType, forumListType } from '../../../api/interface/forumManageType';
import { ForumManageAPI } from '~/api';
import { InterDataType, InterListType, InterReqListType, PaginationProps } from '~/api/interface';
import { forumDetailType, forumListType } from '~/api/interface/forumManageType';
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>;
//论坛详情返回类型
......@@ -44,6 +51,12 @@ const DynamicList = () => {
),
},
{
title: '审核状态',
align: 'center',
dataIndex: 'checkStatus',
render: (text: number) => checkStatusList.find((i) => i.value === text)?.label || text,
},
{
title: '用户UID',
align: 'center',
render: (_text: string, record) => <div>{record.userBaseInfo?.uid || ''}</div>,
......@@ -54,18 +67,41 @@ const DynamicList = () => {
render: (_text: string, record) => <div>{record.userBaseInfo?.phone || ''}</div>,
},
{
title: '发布时间',
align: 'center',
dataIndex: 'dynamicPublishTime',
},
{
title: '操作',
align: 'center',
fixed: 'right',
width: 180,
render: (_text: string, record) => (
<>
<Button
type='link'
onClick={() => handleCheckStatus(record)}
disabled={record.checkStatus !== 0}
>
审核
</Button>
<Button type='link' onClick={() => lookDynamicDetail(record)}>
查看详情
详情
</Button>
<Button type='link' onClick={() => deleteForumClick(record)}>
强制删除
<Button
type='link'
onClick={() => deleteForumClick(record)}
danger
disabled={record.checkStatus === 0}
>
删除
</Button>
<Button type='link' onClick={() => hiddenForumClick(record)}>
{record.show ? '恢复显示' : '强制隐藏'}
<Button
type='link'
onClick={() => hiddenForumClick(record)}
disabled={record.checkStatus === 0}
>
{record.show ? '显示' : '隐藏'}
</Button>
</>
),
......@@ -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(() => {
getDynamicList();
}, []);
......@@ -163,6 +222,7 @@ const DynamicList = () => {
<div className='dynamic-list'>
<SearchBox search={searchColumnsData} searchData={searchSuccess} />
<Table
size={'small'}
bordered
columns={tableColumns}
dataSource={tableData}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论