This commit is contained in:
Li1304553726 2025-02-23 20:35:26 +08:00
commit 794f574e3d
18 changed files with 134 additions and 14 deletions

View File

@ -37,4 +37,8 @@ export class GoodsController {
results: []
};
}
<<<<<<< HEAD
}
=======
}
>>>>>>> de6e632ec69dd408a6c4e85d5cda01a1aa8e8276

View File

@ -3,7 +3,18 @@ import { GoodsService } from './goods.service';
import { GoodsController } from './goods.controller';
@Module({
<<<<<<< HEAD
providers: [GoodsService],
controllers:[GoodsController]
})
export class GoodsModule {}
=======
providers: [GoodsService],
controllers: [GoodsController],
})
export class GoodsModule {}
>>>>>>> de6e632ec69dd408a6c4e85d5cda01a1aa8e8276

View File

@ -0,0 +1,7 @@
import { Injectable } from '@nestjs/common';
@Injectable()
export class GoodsService {
}

View File

@ -1,6 +1,10 @@
import { Injectable } from '@nestjs/common';
@Injectable()
<<<<<<< HEAD
export class GoodsService {}
=======
export class GoodsService {
}
>>>>>>> de6e632ec69dd408a6c4e85d5cda01a1aa8e8276

View File

@ -6,9 +6,9 @@ import { DepartmentModule } from '../department/department.module';
import { MessageController } from './message.controller';
@Module({
imports: [DepartmentModule],
providers: [MessageService, MessageRouter, TrpcService],
exports: [MessageService, MessageRouter],
controllers: [MessageController],
imports: [DepartmentModule], // 导入其他模块
providers: [MessageService, MessageRouter, TrpcService], // 注册服务器,可以被自己使用
exports: [MessageService, MessageRouter], // 导出服务器
controllers: [MessageController], // 注册控制器
})
export class MessageModule {}

View File

@ -34,7 +34,11 @@ import { GoodsModule } from '@server/models/goods/goods.module';
VisitModule,
WebSocketModule,
ResourceModule,
<<<<<<< HEAD
GoodsModule,
=======
GoodsModule
>>>>>>> de6e632ec69dd408a6c4e85d5cda01a1aa8e8276
],
controllers: [],
providers: [TrpcService, TrpcRouter, Logger],

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,3 +1,58 @@
<<<<<<< HEAD
import { api } from "@nice/client";
import { apiClient } from "@web/src/utils";
import { Button, Tag } from "antd";
import { useEffect, useMemo, useState } from "react";
function HomePage() {
// 使用 useQuery 钩子从 API 获取数据
const { data } = api.staff.findMany.useQuery({
take: 10
});
// 定义 counter 状态和更新函数
const [counter, setCounter] = useState<number>(0);
// 使用 useMemo 记忆化 counterText仅在 counter 变化时重新计算
const counterText = useMemo(() => {
return `当前计数为: ${counter}`;
}, [counter]);
const getData = async()=>{
const res = @wait apiClient.get(*/goods/hello*)
console.log(res)
}
// 使用 useEffect 在 data 变化时打印 data
useEffect(() => {
apiClient.get(/goods/hello)
}, [data]);
return (
<div className="p-2 space-y-2">
<Tag>{counterText}</Tag>
<div className="space-x-2">
<Button type="primary" onClick={() => setCounter(counter + 1)}>
1
</Button>
<Button danger onClick={() => setCounter(counter - 1)}>
1
</Button>
</div>
{/* 如果 data 存在,遍历并渲染每个项目的 username */}
{data?.map((item) => (
<div className="p-2 rounded border shadow" key={item.username}>
<Tag>{item.username}</Tag>
</div>
))}
</div>
);
}
export default HomePage;
=======
import { api } from "@nice/client"
import { apiClient } from "@web/src/utils"
import { Button, Tag } from "antd"
@ -43,3 +98,4 @@ function HomePage() {
}
// export { HomePage }
export default HomePage
>>>>>>> de6e632ec69dd408a6c4e85d5cda01a1aa8e8276

View File

@ -0,0 +1,34 @@
import React, { useEffect } from 'react';
import { api } from "@nice/client"
import { apiClient } from '@web/src/utils';
function PersonCard(){
const {data} = api.staff.findMany.useQuery({
take: 10
})
useEffect(()=>{
console.log(data)
},[data])
const getdata=async ()=>{
const res=await apiClient.get("/goods/hello")
console.log(res)
}
return (
<div>
{data?.map((i, index) => (
<div key={index} className="bg-white rounded-lg shadow-sm p-6 hover:shadow-md transition-shadow duration-300">
<div className="flex items-center">
<h3 className="text-lg font-semibold text-gray-900">{i.username}</h3>
</div>
</div>
))}
</div>
);
}
export default PersonCard;

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>,
children: [
{
index: true,
index: true, //默认为主页app进入第一次进入这个页面
element: <HomePage />,
},
],

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

View File

@ -245,13 +245,8 @@ model PostAncestry {
// 复合索引优化
// 索引建议
@@index([ancestorId]) // 针对祖先的查询
@@index([descendantId]) // 针对后代的查询
@@index([ancestorId, descendantId]) // 组合索引,用于查询特定的祖先-后代关系
@@index([relDepth]) // 根据关系深度的查询
@@map("post_ancestry")
}
}
model Message {
id String @id @default(cuid())
url String?
@ -328,9 +323,14 @@ model Resource {
@@index([type])
@@index([createdAt])
@@map("resource")
}
<<<<<<< HEAD
=======
>>>>>>> de6e632ec69dd408a6c4e85d5cda01a1aa8e8276
//商品表
model Goods {

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