perf: ui
This commit is contained in:
3
src/api/system.ts
Normal file
3
src/api/system.ts
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
import { GET, POST, PUT } from './request';
|
||||||
|
|
||||||
|
export const getFilling = () => GET<{ beianText: string }>('/system/getFiling');
|
||||||
11
src/pages/api/system/getFiling.ts
Normal file
11
src/pages/api/system/getFiling.ts
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
// Next.js API route support: https://nextjs.org/docs/api-routes/introduction
|
||||||
|
import type { NextApiRequest, NextApiResponse } from 'next';
|
||||||
|
import { jsonRes } from '@/service/response';
|
||||||
|
|
||||||
|
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
|
||||||
|
jsonRes(res, {
|
||||||
|
data: {
|
||||||
|
beianText: process.env.SAFE_BEIAN_TEXT || ''
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -3,6 +3,8 @@ import { Card, Box, Link } from '@chakra-ui/react';
|
|||||||
import Markdown from '@/components/Markdown';
|
import Markdown from '@/components/Markdown';
|
||||||
import { useMarkdown } from '@/hooks/useMarkdown';
|
import { useMarkdown } from '@/hooks/useMarkdown';
|
||||||
import { useRouter } from 'next/router';
|
import { useRouter } from 'next/router';
|
||||||
|
import { getFilling } from '@/api/system';
|
||||||
|
import { useQuery } from '@tanstack/react-query';
|
||||||
|
|
||||||
const Home = () => {
|
const Home = () => {
|
||||||
const { inviterId } = useRouter().query as { inviterId: string };
|
const { inviterId } = useRouter().query as { inviterId: string };
|
||||||
@@ -14,6 +16,8 @@ const Home = () => {
|
|||||||
}
|
}
|
||||||
}, [inviterId]);
|
}, [inviterId]);
|
||||||
|
|
||||||
|
const { data: { beianText = '' } = {} } = useQuery(['init'], getFilling);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box p={[5, 10]}>
|
<Box p={[5, 10]}>
|
||||||
<Card p={5} lineHeight={2}>
|
<Card p={5} lineHeight={2}>
|
||||||
@@ -21,11 +25,12 @@ const Home = () => {
|
|||||||
</Card>
|
</Card>
|
||||||
|
|
||||||
<Card p={5} mt={4} textAlign={'center'}>
|
<Card p={5} mt={4} textAlign={'center'}>
|
||||||
<Box>
|
{beianText && (
|
||||||
<Link href="https://beian.miit.gov.cn/" target="_blank">
|
<Link href="https://beian.miit.gov.cn/" target="_blank">
|
||||||
浙ICP备2023011255号-1
|
{beianText}
|
||||||
</Link>
|
</Link>
|
||||||
</Box>
|
)}
|
||||||
|
|
||||||
<Box>Made by FastGpt Team.</Box>
|
<Box>Made by FastGpt Team.</Box>
|
||||||
</Card>
|
</Card>
|
||||||
</Box>
|
</Box>
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ const RegisterForm = ({ setPageType, loginSuccess }: Props) => {
|
|||||||
{!!errors.username && errors.username.message}
|
{!!errors.username && errors.username.message}
|
||||||
</FormErrorMessage>
|
</FormErrorMessage>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
<FormControl mt={5} isInvalid={!!errors.username}>
|
<FormControl mt={8} isInvalid={!!errors.username}>
|
||||||
<Flex>
|
<Flex>
|
||||||
<Input
|
<Input
|
||||||
flex={1}
|
flex={1}
|
||||||
@@ -121,7 +121,7 @@ const RegisterForm = ({ setPageType, loginSuccess }: Props) => {
|
|||||||
{!!errors.code && errors.code.message}
|
{!!errors.code && errors.code.message}
|
||||||
</FormErrorMessage>
|
</FormErrorMessage>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
<FormControl mt={5} isInvalid={!!errors.password}>
|
<FormControl mt={8} isInvalid={!!errors.password}>
|
||||||
<Input
|
<Input
|
||||||
type={'password'}
|
type={'password'}
|
||||||
placeholder="新密码"
|
placeholder="新密码"
|
||||||
@@ -142,7 +142,7 @@ const RegisterForm = ({ setPageType, loginSuccess }: Props) => {
|
|||||||
{!!errors.password && errors.password.message}
|
{!!errors.password && errors.password.message}
|
||||||
</FormErrorMessage>
|
</FormErrorMessage>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
<FormControl mt={5} isInvalid={!!errors.password2}>
|
<FormControl mt={8} isInvalid={!!errors.password2}>
|
||||||
<Input
|
<Input
|
||||||
type={'password'}
|
type={'password'}
|
||||||
placeholder="确认密码"
|
placeholder="确认密码"
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ const RegisterForm = ({ setPageType, loginSuccess }: Props) => {
|
|||||||
{!!errors.username && errors.username.message}
|
{!!errors.username && errors.username.message}
|
||||||
</FormErrorMessage>
|
</FormErrorMessage>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
<FormControl mt={5} isInvalid={!!errors.username}>
|
<FormControl mt={8} isInvalid={!!errors.username}>
|
||||||
<Flex>
|
<Flex>
|
||||||
<Input
|
<Input
|
||||||
flex={1}
|
flex={1}
|
||||||
@@ -129,7 +129,7 @@ const RegisterForm = ({ setPageType, loginSuccess }: Props) => {
|
|||||||
{!!errors.code && errors.code.message}
|
{!!errors.code && errors.code.message}
|
||||||
</FormErrorMessage>
|
</FormErrorMessage>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
<FormControl mt={5} isInvalid={!!errors.password}>
|
<FormControl mt={8} isInvalid={!!errors.password}>
|
||||||
<Input
|
<Input
|
||||||
type={'password'}
|
type={'password'}
|
||||||
placeholder="密码"
|
placeholder="密码"
|
||||||
@@ -150,7 +150,7 @@ const RegisterForm = ({ setPageType, loginSuccess }: Props) => {
|
|||||||
{!!errors.password && errors.password.message}
|
{!!errors.password && errors.password.message}
|
||||||
</FormErrorMessage>
|
</FormErrorMessage>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
<FormControl mt={5} isInvalid={!!errors.password2}>
|
<FormControl mt={8} isInvalid={!!errors.password2}>
|
||||||
<Input
|
<Input
|
||||||
type={'password'}
|
type={'password'}
|
||||||
placeholder="确认密码"
|
placeholder="确认密码"
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ const Login = ({ isPcDevice }: { isPcDevice: boolean }) => {
|
|||||||
height="100%"
|
height="100%"
|
||||||
w={'100%'}
|
w={'100%'}
|
||||||
maxW={'1240px'}
|
maxW={'1240px'}
|
||||||
maxH={['auto', '660px']}
|
maxH={['auto', 'max(660px,80vh)']}
|
||||||
backgroundColor={'#fff'}
|
backgroundColor={'#fff'}
|
||||||
alignItems={'center'}
|
alignItems={'center'}
|
||||||
justifyContent={'center'}
|
justifyContent={'center'}
|
||||||
|
|||||||
@@ -44,6 +44,13 @@ const InputDataModal = ({
|
|||||||
*/
|
*/
|
||||||
const sureImportData = useCallback(
|
const sureImportData = useCallback(
|
||||||
async (e: FormData) => {
|
async (e: FormData) => {
|
||||||
|
if (e.a.length + e.q.length >= 3000) {
|
||||||
|
toast({
|
||||||
|
title: '总长度超长了',
|
||||||
|
status: 'warning'
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
setImporting(true);
|
setImporting(true);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -66,7 +73,11 @@ const InputDataModal = ({
|
|||||||
q: ''
|
q: ''
|
||||||
});
|
});
|
||||||
onSuccess();
|
onSuccess();
|
||||||
} catch (err) {
|
} catch (err: any) {
|
||||||
|
toast({
|
||||||
|
title: err?.message || '出现了点意外~',
|
||||||
|
status: 'error'
|
||||||
|
});
|
||||||
console.log(err);
|
console.log(err);
|
||||||
}
|
}
|
||||||
setImporting(false);
|
setImporting(false);
|
||||||
@@ -121,8 +132,8 @@ const InputDataModal = ({
|
|||||||
<Box flex={1} mr={[0, 4]} mb={[4, 0]} h={['230px', '100%']}>
|
<Box flex={1} mr={[0, 4]} mb={[4, 0]} h={['230px', '100%']}>
|
||||||
<Box h={'30px'}>{'匹配的知识点'}</Box>
|
<Box h={'30px'}>{'匹配的知识点'}</Box>
|
||||||
<Textarea
|
<Textarea
|
||||||
placeholder={'匹配的知识点。这部分内容会被搜索,请把控内容的质量。最多 1500 字。'}
|
placeholder={'匹配的知识点。这部分内容会被搜索,请把控内容的质量。总和最多 3000 字。'}
|
||||||
maxLength={1500}
|
maxLength={3000}
|
||||||
resize={'none'}
|
resize={'none'}
|
||||||
h={'calc(100% - 30px)'}
|
h={'calc(100% - 30px)'}
|
||||||
{...register(`q`, {
|
{...register(`q`, {
|
||||||
@@ -134,9 +145,9 @@ const InputDataModal = ({
|
|||||||
<Box h={'30px'}>补充知识</Box>
|
<Box h={'30px'}>补充知识</Box>
|
||||||
<Textarea
|
<Textarea
|
||||||
placeholder={
|
placeholder={
|
||||||
'补充知识。这部分内容不会被搜索,但会作为"匹配的知识点"的内容补充,你可以讲一些细节的内容填写在这里。最多 1500 字。'
|
'补充知识。这部分内容不会被搜索,但会作为"匹配的知识点"的内容补充,你可以讲一些细节的内容填写在这里。总和最多 3000 字。'
|
||||||
}
|
}
|
||||||
maxLength={1500}
|
maxLength={3000}
|
||||||
resize={'none'}
|
resize={'none'}
|
||||||
h={'calc(100% - 30px)'}
|
h={'calc(100% - 30px)'}
|
||||||
{...register('a')}
|
{...register('a')}
|
||||||
|
|||||||
Reference in New Issue
Block a user