This commit is contained in:
weiyida 2025-02-23 20:31:20 +08:00
parent 62bd20c906
commit 10dda20662
11 changed files with 53 additions and 16 deletions

0
apps/web/nginx.conf Normal file → Executable file
View File

0
apps/web/src/App.css Normal file → Executable file
View File

View File

@ -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";
export default function HomePage() { import { useEffect, useMemo, useState } from "react";
const { data } = api.staff.findMany.useQuery({ take: 10 }) function HomePage(){
useEffect(() => { 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 ()=>{
// await update.mutateAsync({
// where: {
// username: user?.username
// },
// data: {
// username: "test"
// }
// })
// }
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那里也需要加括号

0
apps/web/src/app/main/layout/index.tsx Normal file → Executable file
View File

View File

0
apps/web/src/components/common/input/InputList.tsx Normal file → Executable file
View File

2
apps/web/src/routes/main-route.tsx Normal file → Executable file
View File

@ -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 />,
}, },
], ],

0
apps/web/src/utils/index.ts Normal file → Executable file
View File

View File

@ -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
@ -90,8 +91,8 @@ server {
add_header 'Access-Control-Allow-Origin' '$http_origin' always; add_header 'Access-Control-Allow-Origin' '$http_origin' always;
add_header 'Access-Control-Allow-Credentials' 'true' always; add_header 'Access-Control-Allow-Credentials' 'true' always;
add_header 'Access-Control-Allow-Methods' 'GET, OPTIONS' always; add_header 'Access-Control-Allow-Methods' 'GET, OPTIONS' always;
add_header 'Access-Control-Allow-Headers' add_header 'Access-Control-Allow-Headers'
'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization'
always; always;
} }
# 内部认证服务位置 # 内部认证服务位置
@ -110,4 +111,4 @@ server {
proxy_set_header Host $host; proxy_set_header Host $host;
proxy_set_header X-Query-Params $query_string; proxy_set_header X-Query-Params $query_string;
} }
} }

View File

@ -5,8 +5,9 @@
"main": "index.js", "main": "index.js",
"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",

0
packages/config/src/index.ts Normal file → Executable file
View File