2031
This commit is contained in:
parent
62bd20c906
commit
10dda20662
|
@ -1,10 +1,45 @@
|
||||||
import { api } from "@nice/client"
|
import { api, useStaff } from "@nice/client"
|
||||||
import { useEffect } from "react"
|
import { useAuth } from "@web/src/providers/auth-provider";
|
||||||
|
import { Button, Tag } from "antd";
|
||||||
|
import { useEffect, useMemo, useState } from "react";
|
||||||
|
function HomePage(){
|
||||||
|
const {data} = api.staff.findMany.useQuery({
|
||||||
|
take: 10
|
||||||
|
})
|
||||||
|
const {user,}=useAuth()
|
||||||
|
const {update,create}=useStaff()
|
||||||
|
const [counter, setCounter] = useState(0)
|
||||||
|
const counterText=useMemo(()=>{
|
||||||
|
return `当前计数为:${counter}`
|
||||||
|
},[counter])
|
||||||
|
// const test=async ()=>{
|
||||||
|
|
||||||
export default function HomePage() {
|
// await update.mutateAsync({
|
||||||
const { data } = api.staff.findMany.useQuery({ take: 10 })
|
// where: {
|
||||||
|
// username: user?.username
|
||||||
|
// },
|
||||||
|
// data: {
|
||||||
|
// username: "test"
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
// }
|
||||||
useEffect(()=>{
|
useEffect(()=>{
|
||||||
console.log(data)
|
console.log(data)
|
||||||
},[data])
|
},[data])
|
||||||
return <>Home</>
|
|
||||||
|
return <div className="p-2 space-y-2">
|
||||||
|
<Tag>当前计数为:{counter}</Tag>
|
||||||
|
<div className="p-z space-x-2">
|
||||||
|
<Button type="primary" onClick={()=>{setCounter(counter + 1)}}>加1</Button>
|
||||||
|
<Button danger onClick={()=>{setCounter(counter - 1)}}>减1</Button>
|
||||||
|
</div>
|
||||||
|
{
|
||||||
|
data?.map(i=>{
|
||||||
|
return <div className="p-2 rounded border shadow"><Tag>i.username</Tag></div>
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
export default HomePage;
|
||||||
|
// export {HomePage};//main-route那里也需要加括号
|
|
@ -6,7 +6,7 @@ export const MainRoute: CustomRouteObject = {
|
||||||
element: <MainLayout></MainLayout>,
|
element: <MainLayout></MainLayout>,
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
index: true,
|
index: true, //默认为主页,app进入第一次进入这个页面
|
||||||
element: <HomePage />,
|
element: <HomePage />,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|
|
@ -27,7 +27,8 @@ server {
|
||||||
# 压缩HTTP版本
|
# 压缩HTTP版本
|
||||||
gzip_http_version 1.1;
|
gzip_http_version 1.1;
|
||||||
# 压缩的文件类型
|
# 压缩的文件类型
|
||||||
gzip_types text/plain
|
gzip_types
|
||||||
|
text/plain
|
||||||
text/css
|
text/css
|
||||||
application/json
|
application/json
|
||||||
application/javascript
|
application/javascript
|
||||||
|
|
|
@ -6,7 +6,8 @@
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "echo \"Error: no test specified\" && exit 1",
|
"test": "echo \"Error: no test specified\" && exit 1",
|
||||||
"dev": "pnpm run --parallel dev",
|
"dev": "pnpm run --parallel dev",
|
||||||
"db:clear": "pnpm --filter common run db:clear"
|
"db:clear": "pnpm --filter common run db:clear",
|
||||||
|
"studio": "pnpm --filter common run studio"
|
||||||
},
|
},
|
||||||
"keywords": [],
|
"keywords": [],
|
||||||
"author": "insiinc",
|
"author": "insiinc",
|
||||||
|
|
Loading…
Reference in New Issue