main
lvchenpeng 2 months ago
parent 407f39c290
commit 1c95013899

@ -6,7 +6,7 @@ import {Anchor, Button, Card, Image} from "antd";
import {RightCircleOutlined, LikeFilled, WechatFilled, HomeFilled, DribbbleSquareFilled, CopyFilled, MedicineBoxFilled, IeCircleFilled, IdcardFilled, HourglassFilled, InsuranceFilled} from "@ant-design/icons"; import {RightCircleOutlined, LikeFilled, WechatFilled, HomeFilled, DribbbleSquareFilled, CopyFilled, MedicineBoxFilled, IeCircleFilled, IdcardFilled, HourglassFilled, InsuranceFilled} from "@ant-design/icons";
// import Link from "next/link"; // import Link from "next/link";
import request from '@/app/request'; import request from '@/app/request';
import Title from "@/app/(main)/discover/components/Title"; import Title from "../discover/components/Title";
const stList = [ const stList = [
{ {

@ -154,19 +154,9 @@ const AssistantCard = memo<AssistantCardProps>(
} }
return ( return (
<Flexbox className={cx(styles.container, className)} gap={24} style={style}> <Flexbox className={cx(styles.container, className)} gap={24} style={style} {...rest}>
{!isCompact && ( {!isCompact && <CardBanner avatar={avatar} />}
<div
onClick={() => {
router.push(href);
}}
>
<CardBanner avatar={avatar} />
</div>
)}
<Flexbox gap={12} padding={16}> <Flexbox gap={12} padding={16}>
<Link href={href}>
<Flexbox gap={12}>
<Flexbox <Flexbox
align={isCompact ? 'flex-start' : 'flex-end'} align={isCompact ? 'flex-start' : 'flex-end'}
gap={16} gap={16}
@ -225,34 +215,32 @@ const AssistantCard = memo<AssistantCardProps>(
<Paragraph className={styles.desc} ellipsis={{ rows: 2 }}> <Paragraph className={styles.desc} ellipsis={{ rows: 2 }}>
{description} {description}
</Paragraph> </Paragraph>
</Flexbox>
</Link>
<Flexbox gap={6} horizontal style={{ flexWrap: 'wrap' }}> <Flexbox gap={6} horizontal style={{ flexWrap: 'wrap', justifyContent: "space-between" }}>
{showCategory && categoryItem ? ( <div onClick={(e) => {e.stopPropagation()}} style={{width: '85%'}}>
<Link href={urlJoin('/discover/assistants', categoryItem.key)}> {showCategory && categoryItem ? (
<Tag icon={categoryItem.icon} style={{ margin: 0 }}> <Tag icon={categoryItem.icon} style={{ margin: 0 }}>
{categoryItem.label} {categoryItem.label}
</Tag> </Tag>
</Link> ) : (
) : ( tags
tags .slice(0, 4)
.slice(0, 4) .filter(Boolean)
.filter(Boolean) .map((tag: string, index) => {
.map((tag: string, index) => { // const url = qs.stringifyUrl({
// const url = qs.stringifyUrl({ // query: { q: tag, type: 'assistants' },
// query: { q: tag, type: 'assistants' }, // url: '/discover/search',
// url: '/discover/search', // });
// }); return (
return ( <Tag key={index} style={{ margin: '0 5' }}>{startCase(tag).trim()}</Tag>
<Tag key={index} style={{ margin: '0 5' }}>{startCase(tag).trim()}</Tag> // <Link href={url} key={index}>
// <Link href={url} key={index}> // <Link key={index}>
// <Link key={index}> // <Tag style={{ margin: 0 }}>{startCase(tag).trim()}</Tag>
// <Tag style={{ margin: 0 }}>{startCase(tag).trim()}</Tag> // </Link>
// </Link> );
); })
}) )}
)} </div>
</Flexbox> </Flexbox>
</Flexbox> </Flexbox>
</Flexbox> </Flexbox>

@ -38,46 +38,46 @@ const List = memo<ListProps>(({ category, mobile, searchKeywords, items = [] })
}; };
}, [stData, mobile]); }, [stData, mobile]);
// useEffect(() => { useEffect(() => {
// const fetchData = async() => { const fetchData = async() => {
// if(category === "collect") { if(category === "collect") {
// const res = await request({ const res = await request({
// method: "get", method: "get",
// params: { params: {
// userid: userId userid: userId
// }, },
// url: "/flxai/api/robot/appaiassistant/getAllAiAssistant" url: "/flxai/api/robot/appaiassistant/getAllAiAssistant"
// }) })
// setStData(res?.data.map((item)=> { setStData(res?.data.map((item)=> {
// item.classify = 'collect'; item.classify = 'collect';
// return item return item
// })) }))
// } else { } else {
// const res = await request({ const res = await request({
// method: "get", method: "get",
// params: { params: {
// userid: userId userid: userId
// }, },
// url: "/flxai/api/robot/appaiassistant/getAllAiAssistant" url: "/flxai/api/robot/appaiassistant/getAllAiAssistant"
// }) })
// const array2Object = {}; const array2Object = {};
// res?.data?.forEach((item) => { res?.data?.forEach((item) => {
// array2Object[item.identifier] = item; array2Object[item.identifier] = item;
// }); });
// setStData(stData?.map((item)=> { setStData(stData?.map((item)=> {
// const matchingItem = array2Object[item.identifier]; const matchingItem = array2Object[item.identifier];
// if (matchingItem) { if (matchingItem) {
// matchingItem.status = '1'; matchingItem.status = '1';
// return matchingItem return matchingItem
// } else { } else {
// item.status = '0'; item.status = '0';
// return item return item
// } }
// })) }))
// } }
// }; };
// fetchData(); fetchData();
// }, []); // 空数组[]意味着仅在组件挂载时调用一次 }, []); // 空数组[]意味着仅在组件挂载时调用一次
const handleClickCard = (item) => { const handleClickCard = (item) => {
console.log(item) console.log(item)
@ -93,13 +93,15 @@ const List = memo<ListProps>(({ category, mobile, searchKeywords, items = [] })
data={all} data={all}
initialItemCount={24} initialItemCount={24}
itemContent={(_, item) => ( itemContent={(_, item) => (
<Card <div onClick={() => handleClickCard(item)} key={item.identifier}>
href={urlJoin('/discover/assistant/', item.identifier)} <Card
key={item.identifier} // href={urlJoin('/discover/assistant/', item.identifier)}
showCategory key={item.identifier}
variant={'compact'} showCategory
{...item} variant={'compact'}
/> {...item}
/>
</div>
)} )}
style={{ style={{
minHeight: '75vh', minHeight: '75vh',
@ -117,7 +119,11 @@ const List = memo<ListProps>(({ category, mobile, searchKeywords, items = [] })
<Grid maxItemWidth={280} rows={4}> <Grid maxItemWidth={280} rows={4}>
{all?.map((item) => ( {all?.map((item) => (
// <Link href={urlJoin('/discover/assistant/', item.identifier)} key={item.identifier}> // <Link href={urlJoin('/discover/assistant/', item.identifier)} key={item.identifier}>
<Card key={item.identifier} onClick={() => handleClickCard(item)} showCategory={!category} {...item} />
<div onClick={() => handleClickCard(item)} key={item.identifier}>
<Card key={item.identifier} showCategory={!category} {...item} />
</div>
// <Card key={item.identifier} onClick={() => handleClickCard(item)} showCategory={!category} {...item} />
// </Link> // </Link>
))} ))}
</Grid> </Grid>
@ -127,12 +133,14 @@ const List = memo<ListProps>(({ category, mobile, searchKeywords, items = [] })
<Title>{t('assistants.recentSubmits')}</Title> <Title>{t('assistants.recentSubmits')}</Title>
<Grid maxItemWidth={280} rows={4}> <Grid maxItemWidth={280} rows={4}>
{recent.map((item) => ( {recent.map((item) => (
<Card <div onClick={() => handleClickCard(item)} key={item.identifier}>
href={urlJoin('/discover/assistant/', item.identifier)} <Card
key={item.identifier} // href={urlJoin('/discover/assistant/', item.identifier)}
showCategory={!category} key={item.identifier}
{...item} showCategory={!category}
/> {...item}
/>
</div>
))} ))}
</Grid> </Grid>
{last && last?.length > 0 && ( {last && last?.length > 0 && (
@ -142,13 +150,15 @@ const List = memo<ListProps>(({ category, mobile, searchKeywords, items = [] })
data={last} data={last}
initialItemCount={12} initialItemCount={12}
itemContent={(_, item) => ( itemContent={(_, item) => (
<Card <div onClick={() => handleClickCard(item)} key={item.identifier}>
href={urlJoin('/discover/assistant/', item.identifier)} <Card
key={item.identifier} // href={urlJoin('/discover/assistant/', item.identifier)}
showCategory={!category} key={item.identifier}
variant={'compact'} showCategory={!category}
{...item} variant={'compact'}
/> {...item}
/>
</div>
)} )}
style={{ style={{
minHeight: '75vh', minHeight: '75vh',

@ -143,8 +143,11 @@ const ModelCard = memo<ModelCardProps>(({ className,socialData, meta, identifier
return; return;
} }
}; };
const handleClickCard = (item) => {
console.log(item)
}
return ( return (
<Flexbox className={cx(styles.container, className)} gap={24} key={identifier}> <Flexbox className={cx(styles.container, className)} gap={24} key={identifier} {...rest}>
<Flexbox <Flexbox
gap={12} gap={12}
padding={16} padding={16}

@ -28,56 +28,58 @@ const List = memo<ListProps>(({ category, searchKeywords, items = [] }) => {
const userId = getUserId(useUserStore.getState()) const userId = getUserId(useUserStore.getState())
const [stData, setStData] = useState(items) const [stData, setStData] = useState(items)
// useEffect(() => { useEffect(() => {
// const fetchData = async() => { const fetchData = async() => {
// if(category === "collect") { if(category === "collect") {
// const res = await request({ const res = await request({
// method: "get", method: "get",
// params: { params: {
// userid: userId userid: userId
// }, },
// url: "/flxai/api/robot/appaimodel/getAllAiModel", url: "/flxai/api/robot/appaimodel/getAllAiModel",
// }) })
// setStData(res?.data.map((item)=> { setStData(res?.data.map((item)=> {
// item.classify = 'collect'; item.classify = 'collect';
// return item return item
// })) }))
// // items = res.data; // items = res.data;
// // items = items.map((item)=> { // items = items.map((item)=> {
// // item.classify = 'collect'; // item.classify = 'collect';
// // return item // return item
// // }) // })
// } else { } else {
// const res = await request({ const res = await request({
// method: "get", method: "get",
// params: { params: {
// userid: userId userid: userId
// }, },
// url: "/flxai/api/robot/appaimodel/getAllAiModel", url: "/flxai/api/robot/appaimodel/getAllAiModel",
// }) })
// const array2Object = {}; const array2Object = {};
// res?.data?.forEach(item => { res?.data?.forEach(item => {
// array2Object[item.identifier] = item; array2Object[item.identifier] = item;
// }); });
// setStData(stData.map((item)=> { setStData(stData.map((item)=> {
// const matchingItem = array2Object[item.identifier]; const matchingItem = array2Object[item.identifier];
// if (matchingItem) { if (matchingItem) {
// matchingItem.status = '1'; matchingItem.status = '1';
// return matchingItem return matchingItem
// } else { } else {
// item.status = '0'; item.status = '0';
// return item return item
// } }
// })) }))
// } }
// }; };
// fetchData(); fetchData();
// }, []); // 空数组[]意味着仅在组件挂载时调用一次 }, []); // 空数组[]意味着仅在组件挂载时调用一次
const handleClickCard = (item) => { const handleClickCard = (item) => {
console.log(item) console.log(item)
// console.log(router)
router.push(urlJoin('/discover/model/', item.identifier)) router.push(urlJoin('/discover/model/', item.identifier))
} }
if (searchKeywords) { if (searchKeywords) {
if (!stData || stData?.length === 0) return <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />; if (!stData || stData?.length === 0) return <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />;
return ( return (
@ -87,7 +89,10 @@ const List = memo<ListProps>(({ category, searchKeywords, items = [] }) => {
data={stData} data={stData}
initialItemCount={24} initialItemCount={24}
itemContent={(_, item) => ( itemContent={(_, item) => (
<Card onClick={() => handleClickCard(item)} showCategory {...item} /> // <Card href={urlJoin('/discover/model/', item.identifier)} showCategory {...item} />
<div onClick={() => handleClickCard(item)} key={item.identifier}>
<Card key={item.identifier} showCategory {...item} />
</div>
)} )}
style={{ style={{
minHeight: '75vh', minHeight: '75vh',
@ -105,7 +110,10 @@ const List = memo<ListProps>(({ category, searchKeywords, items = [] }) => {
<Grid maxItemWidth={280} rows={4}> <Grid maxItemWidth={280} rows={4}>
{stData.map((item) => ( {stData.map((item) => (
// <Link href={urlJoin('/discover/assistant/', item.identifier)} key={item.identifier}> // <Link href={urlJoin('/discover/assistant/', item.identifier)} key={item.identifier}>
<Card style={{boxShadow: "1px 0px 12px 0px rgba(42, 77, 255, 0.19)"}} key={item.identifier} onClick={() => handleClickCard(item)} showCategory={!category} {...item} /> // <Card style={{boxShadow: "1px 0px 12px 0px rgba(42, 77, 255, 0.19)"}} key={item.identifier} onClick={() => handleClickCard(item)} showCategory={!category} {...item} />
<div onClick={() => handleClickCard(item)} key={item.identifier}>
<Card key={item.identifier} showCategory={!category} {...item} />
</div>
// </Link> // </Link>
))} ))}
</Grid> </Grid>
@ -118,7 +126,10 @@ const List = memo<ListProps>(({ category, searchKeywords, items = [] }) => {
initialItemCount={24} initialItemCount={24}
itemContent={(_, item) => ( itemContent={(_, item) => (
// <Link href={urlJoin('/discover/model/', item.identifier)} key={item.identifier}> // <Link href={urlJoin('/discover/model/', item.identifier)} key={item.identifier}>
<Card style={{boxShadow: "1px 0px 12px 0px rgba(42, 77, 255, 0.19)"}} key={item.identifier} onClick={() => handleClickCard(item)} showCategory={!category} {...item} /> // <Card style={{boxShadow: "1px 0px 12px 0px rgba(42, 77, 255, 0.19)"}} onClick={() => handleClickCard(item)} key={item.identifier} showCategory={!category} {...item} />
<div onClick={() => handleClickCard(item)} key={item.identifier}>
<Card key={item.identifier} showCategory={!category} {...item} />
</div>
// </Link> // </Link>
)} )}
style={{ style={{

@ -35,47 +35,47 @@ const List = memo<ListProps>(({ category, mobile, searchKeywords, items = [] })
}; };
}, [stData, mobile]); }, [stData, mobile]);
// useEffect(() => { useEffect(() => {
// const fetchData = async() => { const fetchData = async() => {
// if(category === "collect") { if(category === "collect") {
// const res = await request({ const res = await request({
// method: "get", method: "get",
// params: { params: {
// userid: userId userid: userId
// }, },
// url: "/flxai/api/robot/appaiplugin/getAllAiPlugin", url: "/flxai/api/robot/appaiplugin/getAllAiPlugin",
// }) })
// setStData(res?.data.map((item)=> { setStData(res?.data.map((item)=> {
// item.classify = 'collect'; item.classify = 'collect';
// return item return item
// })) }))
// } else { } else {
// const res = await request({ const res = await request({
// method: "get", method: "get",
// params: { params: {
// userid: userId userid: userId
// }, },
// url: "/flxai/api/robot/appaiplugin/getAllAiPlugin", url: "/flxai/api/robot/appaiplugin/getAllAiPlugin",
// }) })
// const array2Object = {}; const array2Object = {};
// res?.data?.forEach((item) => { res?.data?.forEach((item) => {
// array2Object[item.identifier] = item; array2Object[item.identifier] = item;
// }); });
// // console.log('chajian22222222222222222222222222222--------------') // console.log('chajian22222222222222222222222222222--------------')
// setStData(stData.map((item)=> { setStData(stData.map((item)=> {
// const matchingItem = array2Object[item.identifier]; const matchingItem = array2Object[item.identifier];
// if (matchingItem) { if (matchingItem) {
// matchingItem.status = '1'; matchingItem.status = '1';
// return matchingItem return matchingItem
// } else { } else {
// item.status = '0'; item.status = '0';
// return item return item
// } }
// })) }))
// } }
// }; };
// fetchData(); fetchData();
// }, []); // 空数组[]意味着仅在组件挂载时调用一次 }, []); // 空数组[]意味着仅在组件挂载时调用一次
// console.log('chajian999999999999999--------------',stData) // console.log('chajian999999999999999--------------',stData)
@ -92,13 +92,14 @@ const List = memo<ListProps>(({ category, mobile, searchKeywords, items = [] })
data={all} data={all}
initialItemCount={24} initialItemCount={24}
itemContent={(_, item) => ( itemContent={(_, item) => (
<Card <div onClick={() => handleClickCard(item)} key={item.identifier}>
showCategory <Card
variant={'compact'} showCategory
{...item} variant={'compact'}
href={urlJoin('/discover/plugin/', item.identifier)} {...item}
key={item.identifier} key={item.identifier}
/> />
</div>
)} )}
style={{ style={{
minHeight: '75vh', minHeight: '75vh',
@ -114,10 +115,11 @@ const List = memo<ListProps>(({ category, mobile, searchKeywords, items = [] })
<> <>
<Title tag={all.length}></Title> <Title tag={all.length}></Title>
<Grid maxItemWidth={280} rows={4}> <Grid maxItemWidth={280} rows={4}>
{all?.map((item) => ( {all?.map((item,index) => (
// <Link href={urlJoin('/discover/assistant/', item.identifier)} key={item.identifier}> // <div onClick={() => handleClickCard(item)}>测试接口</div>
<Card key={item.identifier} onClick={() => handleClickCard(item)} showCategory={!category} {...item} /> <div onClick={() => handleClickCard(item)} key={item.identifier}>
// </Link> <Card key={item.identifier} showCategory={!category} {...item} />
</div>
))} ))}
</Grid> </Grid>
</> </>
@ -126,7 +128,10 @@ const List = memo<ListProps>(({ category, mobile, searchKeywords, items = [] })
<Title>{t('plugins.recentSubmits')}</Title> <Title>{t('plugins.recentSubmits')}</Title>
<Grid maxItemWidth={280} rows={4}> <Grid maxItemWidth={280} rows={4}>
{recent?.map((item) => ( {recent?.map((item) => (
<Card key={item.identifier} onClick={() => handleClickCard(item)} showCategory={!category} {...item} /> // <Card key={item.identifier} onClick={() => handleClickCard(item)} showCategory={!category} {...item} />
<div onClick={() => handleClickCard(item)} key={item.identifier}>
<Card key={item.identifier} showCategory={!category} {...item} />
</div>
))} ))}
</Grid> </Grid>
{last && last?.length > 0 && ( {last && last?.length > 0 && (
@ -136,7 +141,10 @@ const List = memo<ListProps>(({ category, mobile, searchKeywords, items = [] })
data={last} data={last}
initialItemCount={12} initialItemCount={12}
itemContent={(_, item) => ( itemContent={(_, item) => (
<Card key={item.identifier} onClick={() => handleClickCard(item)} showCategory={!category} variant={'compact'} {...item} /> // <Card key={item.identifier} onClick={() => handleClickCard(item)} showCategory={!category} variant={'compact'} {...item} />
<div onClick={() => handleClickCard(item)} key={item.identifier}>
<Card key={item.identifier} showCategory={!category} {...item} />
</div>
)} )}
style={{ style={{
minHeight: '75vh', minHeight: '75vh',

@ -45,7 +45,7 @@ const StoreSearchBar = memo<StoreSearchBarProps>(({ mobile, onBlur, onFocus, ...
const activeType = activeKey === DiscoverTab.Home ? DiscoverTab.Assistants : activeKey; const activeType = activeKey === DiscoverTab.Home ? DiscoverTab.Assistants : activeKey;
const userId = getUserId(useUserStore.getState()) const userId = getUserId(useUserStore.getState())
console.log(userId,'storeSearch3333333333333----')
useEffect(() => { useEffect(() => {
if (!pathname.includes('/discover/search')) return; if (!pathname.includes('/discover/search')) return;
// 使用 useQueryState 时,当 handleSearch 为空时无法回跳 // 使用 useQueryState 时,当 handleSearch 为空时无法回跳

@ -23,9 +23,6 @@ const Layout = async ({ children }: PropsWithChildren) => {
width={'100%'} width={'100%'}
> >
<Flexbox gap={24} horizontal style={{ position: 'relative' }} width={'100%'}> <Flexbox gap={24} horizontal style={{ position: 'relative' }} width={'100%'}>
<CategoryContainer top={32}>
<Category />
</CategoryContainer>
<Flexbox flex={1} gap={16}> <Flexbox flex={1} gap={16}>
{children} {children}
</Flexbox> </Flexbox>

@ -16,6 +16,7 @@ const AssistantsResult = async ({
q: string; q: string;
userid: string; userid: string;
}) => { }) => {
console.log(userid,'222222')
const res = await request({ const res = await request({
method: "get", method: "get",
params: { params: {

@ -25,7 +25,7 @@ type Props = PageProps<
const getSharedProps = async (props: Props) => { const getSharedProps = async (props: Props) => {
const searchParams = await props.searchParams; const searchParams = await props.searchParams;
const { q, type = 'assistants' } = searchParams; const { q, type = 'assistants',userid } = searchParams;
const { isMobile, locale: hl } = await RouteVariants.getVariantsFromProps(props); const { isMobile, locale: hl } = await RouteVariants.getVariantsFromProps(props);
const { t, locale } = await translation('metadata', searchParams?.hl || hl); const { t, locale } = await translation('metadata', searchParams?.hl || hl);
return { return {
@ -34,6 +34,7 @@ const getSharedProps = async (props: Props) => {
q, q,
t, t,
type, type,
userid,
}; };
}; };
@ -51,6 +52,7 @@ export const generateMetadata = async (props: Props) => {
const Page = async (props: Props) => { const Page = async (props: Props) => {
const { locale, t, q, type, isMobile,userid } = await getSharedProps(props); const { locale, t, q, type, isMobile,userid } = await getSharedProps(props);
console.log(userid,'search88888888888888----')
if (!q) redirect(urlJoin(`/discover`, type)); if (!q) redirect(urlJoin(`/discover`, type));
const keywords = decodeURIComponent(q); const keywords = decodeURIComponent(q);

@ -25,6 +25,7 @@ export const config = {
'/discover(.*)', '/discover(.*)',
'/chat', '/chat',
'/chat(.*)', '/chat(.*)',
'/applicationset(.*)',
'/changelog(.*)', '/changelog(.*)',
'/settings(.*)', '/settings(.*)',
'/files', '/files',

Loading…
Cancel
Save