mirror of https://github.com/sunface/rust-course
parent
00bc3406c7
commit
17f627846e
@ -0,0 +1,38 @@
|
|||||||
|
import { Box, useToast } from "@chakra-ui/react"
|
||||||
|
import Card from "components/card"
|
||||||
|
|
||||||
|
import Sidebar from "layouts/sidebar/sidebar"
|
||||||
|
import React, { useEffect, useState } from "react"
|
||||||
|
import { adminLinks } from "src/data/links"
|
||||||
|
import { requestApi } from "utils/axios/request"
|
||||||
|
import PageContainer1 from "layouts/page-container1"
|
||||||
|
|
||||||
|
const PostsPage = () => {
|
||||||
|
const [reports, setReports]= useState([])
|
||||||
|
const toast = useToast()
|
||||||
|
const getConfig = async () => {
|
||||||
|
const res = await requestApi.get(`/admin/reports`)
|
||||||
|
console.log(res.data)
|
||||||
|
setReports(res.data)
|
||||||
|
}
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
getConfig()
|
||||||
|
}, [])
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<PageContainer1>
|
||||||
|
<Box display="flex">
|
||||||
|
<Sidebar routes={adminLinks} title="管理员" />
|
||||||
|
<Card ml="4" p="6" width="100%">
|
||||||
|
|
||||||
|
|
||||||
|
</Card>
|
||||||
|
</Box>
|
||||||
|
</PageContainer1>
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
export default PostsPage
|
||||||
|
|
@ -0,0 +1,19 @@
|
|||||||
|
package models
|
||||||
|
|
||||||
|
import "time"
|
||||||
|
|
||||||
|
type Report struct {
|
||||||
|
ID int `json:"id"`
|
||||||
|
TargetID string `json:"target_id"`
|
||||||
|
Reporter *UserSimple
|
||||||
|
Status int `json:"status"`
|
||||||
|
Created time.Time `json:"created"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type Reports []*Report
|
||||||
|
|
||||||
|
func (t Reports) Len() int { return len(t) }
|
||||||
|
func (t Reports) Swap(i, j int) { t[i], t[j] = t[j], t[i] }
|
||||||
|
func (t Reports) Less(i, j int) bool {
|
||||||
|
return t[i].Created.Unix() > t[j].Created.Unix()
|
||||||
|
}
|
Loading…
Reference in new issue