获取审核通过、待审核的数据

This commit is contained in:
宇阳
2024-10-06 20:21:00 +08:00
parent 2ae72c6ea7
commit b2441b06aa
4 changed files with 31 additions and 12 deletions

View File

@@ -15,7 +15,21 @@ export const editLinkDataAPI = (data: Web) => Request<Web>("PATCH", "/link", { d
export const getLinkDataAPI = (id?: number) => Request<Web>("GET", `/link/${id}`) export const getLinkDataAPI = (id?: number) => Request<Web>("GET", `/link/${id}`)
// 获取网站列表 // 获取网站列表
export const getLinkListAPI = (data?: QueryData) => getListAPI<Web>("/link", data) export const getLinkListAPI = (data?: QueryData) => Request<Web[]>("POST", `/link/list`, {
data: { ...data?.query },
params: {
sort: data?.sort,
}
})
// 分页获取评论列表
export const getLinkPagingAPI = (data?: QueryData) => Request<Paginate<Web[]>>("POST", `/link/paging`, {
data: { ...data?.query },
params: {
sort: data?.sort,
...data?.pagination
}
})
// 获取网站类型列表 // 获取网站类型列表
export const getLinkTypeListAPI = () => { export const getLinkTypeListAPI = () => {

View File

@@ -111,8 +111,8 @@ const WallPage = () => {
const query: FilterWall = { const query: FilterWall = {
key: values.content, key: values.content,
cateId: values.cateId, cateId: values.cateId,
startDate: values.createTime ? values.createTime[0].valueOf() + '' : undefined, startDate: values?.createTime?.[0]?.valueOf()?.toString(),
endDate: values.createTime ? values.createTime[1].valueOf() + '' : undefined, endDate: values?.createTime?.[1]?.valueOf()?.toString(),
} }
const { data } = await getWallListAPI({ query }); const { data } = await getWallListAPI({ query });

View File

@@ -10,14 +10,18 @@ import link from './image/link.svg'
import { Web } from "@/types/app/web" import { Web } from "@/types/app/web"
import dayjs from 'dayjs'; import dayjs from 'dayjs';
type Menu = "comment" | "link" | "wall"
export default () => { export default () => {
const activeSty = "bg-[#f9f9ff] text-primary" const activeSty = "bg-[#f9f9ff] text-primary"
const [active, setActive] = useState(1) const [active, setActive] = useState<Menu>("link")
const [linkList, setLinkList] = useState<Web[]>([]) const [linkList, setLinkList] = useState<Web[]>([])
const getLinkList = async () => { const getLinkList = async () => {
const { data } = await getLinkListAPI() const { data } = await getLinkListAPI({ query: { status: 0 } })
setLinkList((data as Web[]).filter(item => item.auditStatus === 0)) console.log(data, 444);
setLinkList(data as Web[])
} }
useEffect(() => { useEffect(() => {
getLinkList() getLinkList()
@@ -54,24 +58,24 @@ export default () => {
<div className="w-2/12 min-h-96 pr-4 border-r border-[#eee]"> <div className="w-2/12 min-h-96 pr-4 border-r border-[#eee]">
<ul className="space-y-1"> <ul className="space-y-1">
<li <li
className={`flex items-center w-full py-3 px-4 hover:bg-[#f9f9ff] hover:text-primary ${active === 0 ? activeSty : ''} rounded-md text-base cursor-pointer transition-colors`} className={`flex items-center w-full py-3 px-4 hover:bg-[#f9f9ff] hover:text-primary ${active === "comment" ? activeSty : ''} rounded-md text-base cursor-pointer transition-colors`}
onClick={() => setActive(0)} onClick={() => setActive("comment")}
> >
<img src={comment} alt="" className="w-8 mr-4" /> <img src={comment} alt="" className="w-8 mr-4" />
<span></span> <span></span>
</li> </li>
<li <li
className={`flex items-center w-full py-3 px-4 hover:bg-[#f9f9ff] hover:text-primary ${active === 1 ? activeSty : ''} rounded-md text-base cursor-pointer transition-colors`} className={`flex items-center w-full py-3 px-4 hover:bg-[#f9f9ff] hover:text-primary ${active === "link" ? activeSty : ''} rounded-md text-base cursor-pointer transition-colors`}
onClick={() => setActive(1)} onClick={() => setActive("link")}
> >
<img src={link} alt="" className="w-8 mr-4" /> <img src={link} alt="" className="w-8 mr-4" />
<span></span> <span></span>
</li> </li>
<li <li
className={`flex items-center w-full py-3 px-4 hover:bg-[#f9f9ff] hover:text-primary ${active === 2 ? activeSty : ''} rounded-md text-base cursor-pointer transition-colors`} className={`flex items-center w-full py-3 px-4 hover:bg-[#f9f9ff] hover:text-primary ${active === "wall" ? activeSty : ''} rounded-md text-base cursor-pointer transition-colors`}
onClick={() => setActive(2)} onClick={() => setActive("wall")}
> >
<img src={info} alt="" className="w-8 mr-4" /> <img src={info} alt="" className="w-8 mr-4" />
<span></span> <span></span>

View File

@@ -22,6 +22,7 @@ interface Page {
interface FilterData { interface FilterData {
key?: string, key?: string,
content?: string, content?: string,
status?: 0 | 1,
startDate?: string, startDate?: string,
endDate?: string endDate?: string
} }