From 51b98df4cbdfe96dac948f9e0bc3cf25a76d50b9 Mon Sep 17 00:00:00 2001 From: archer <545436317@qq.com> Date: Tue, 18 Jul 2023 20:39:22 +0800 Subject: [PATCH] perf: ui --- client/src/components/Avatar/index.tsx | 2 +- client/src/components/Layout/index.tsx | 2 +- client/src/components/PageContainer/index.tsx | 7 +-- client/src/pages/api/user/getBill.ts | 4 +- .../src/pages/app/detail/components/API.tsx | 59 +++++++++++-------- .../pages/app/detail/components/Settings.tsx | 2 +- .../components/edit/components/ChatTest.tsx | 12 +--- .../edit/components/TemplateList.tsx | 29 ++++----- client/src/pages/app/detail/index.tsx | 8 +-- .../pages/app/list/component/CreateModal.tsx | 11 ++-- client/src/pages/kb/list/index.tsx | 8 +++ .../src/pages/number/components/BillTable.tsx | 8 +-- client/src/pages/number/index.tsx | 5 +- 13 files changed, 83 insertions(+), 74 deletions(-) diff --git a/client/src/components/Avatar/index.tsx b/client/src/components/Avatar/index.tsx index ab45d8c0c..27f7e271e 100644 --- a/client/src/components/Avatar/index.tsx +++ b/client/src/components/Avatar/index.tsx @@ -9,7 +9,7 @@ const Avatar = ({ w = '30px', ...props }: ImageProps) => { fallbackSrc={LOGO_ICON} fallbackStrategy={'onError'} borderRadius={'50%'} - objectFit={'cover'} + objectFit={'contain'} alt="" w={w} h={w} diff --git a/client/src/components/Layout/index.tsx b/client/src/components/Layout/index.tsx index c6103cdb9..3f3c1e11d 100644 --- a/client/src/components/Layout/index.tsx +++ b/client/src/components/Layout/index.tsx @@ -86,7 +86,7 @@ const Layout = ({ children }: { children: JSX.Element }) => { {children} ) : ( - + {children} diff --git a/client/src/components/PageContainer/index.tsx b/client/src/components/PageContainer/index.tsx index 8959e0516..2dac29221 100644 --- a/client/src/components/PageContainer/index.tsx +++ b/client/src/components/PageContainer/index.tsx @@ -6,12 +6,11 @@ const PageContainer = ({ children, ...props }: BoxProps) => { return ( {children} diff --git a/client/src/pages/api/user/getBill.ts b/client/src/pages/api/user/getBill.ts index d870ddf45..fbdfed323 100644 --- a/client/src/pages/api/user/getBill.ts +++ b/client/src/pages/api/user/getBill.ts @@ -27,8 +27,8 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse) const where = { userId, time: { - $gte: new Date(dateStart).setHours(0, 0, 0, 0), - $lte: new Date(dateEnd).setHours(23, 59, 59, 999) + $gte: dateStart, + $lte: dateEnd } }; diff --git a/client/src/pages/app/detail/components/API.tsx b/client/src/pages/app/detail/components/API.tsx index fba9c3c08..0bc0d161f 100644 --- a/client/src/pages/app/detail/components/API.tsx +++ b/client/src/pages/app/detail/components/API.tsx @@ -3,6 +3,7 @@ import { Box, Divider, Flex, useTheme, Button, Skeleton, useDisclosure } from '@ import { useCopyData } from '@/utils/tools'; import dynamic from 'next/dynamic'; import MyIcon from '@/components/Icon'; +import { useGlobalStore } from '@/store/global'; const APIKeyModal = dynamic(() => import('@/components/APIKeyModal'), { ssr: false @@ -19,13 +20,15 @@ const API = ({ appId }: { appId: string }) => { } = useDisclosure(); const [isLoaded, setIsLoaded] = useState(false); + const { isPc } = useGlobalStore(); + useEffect(() => { setBaseUrl(`${location.origin}/api/openapi`); }, []); return ( - + AppId: { {appId} - copyData(baseUrl, '已复制 API 地址')} - > - - API服务器 - - - {baseUrl} - - - - + {isPc && ( + <> + copyData(baseUrl, '已复制 API 地址')} + > + + API服务器 + + + {baseUrl} + + + + + )} + - +