diff --git a/projects/fastgpt/app/BdVidHandler.tsx b/projects/fastgpt/app/BdVidHandler.tsx new file mode 100644 index 0000000..fc5e914 --- /dev/null +++ b/projects/fastgpt/app/BdVidHandler.tsx @@ -0,0 +1,12 @@ +'use client'; + +export default function BdVidHandler() { + if (typeof window !== 'undefined') { + const urlParams = new URLSearchParams(window.location.search); + const bd_vid = urlParams.get('bd_vid'); + if (bd_vid) { + localStorage.setItem('bd_vid', bd_vid); + } + } + return null; +} \ No newline at end of file diff --git a/projects/fastgpt/app/layout.tsx b/projects/fastgpt/app/layout.tsx index eb6b707..8f01536 100644 --- a/projects/fastgpt/app/layout.tsx +++ b/projects/fastgpt/app/layout.tsx @@ -12,6 +12,7 @@ import { Analytics } from '@vercel/analytics/react'; import { Viewport } from 'next'; import { Inter as FontSans } from 'next/font/google'; import Script from 'next/script'; +import BdVidHandler from './BdVidHandler'; const fontSans = FontSans({ subsets: ['latin'], @@ -83,6 +84,7 @@ export default async function RootLayout({ + ); diff --git a/projects/fastgpt/components/home/CTAButton.tsx b/projects/fastgpt/components/home/CTAButton.tsx index d9e65f1..d8c566d 100644 --- a/projects/fastgpt/components/home/CTAButton.tsx +++ b/projects/fastgpt/components/home/CTAButton.tsx @@ -8,6 +8,11 @@ import { useEffect, useState } from 'react'; const CTAButton = ({ locale, stars: initialStars, showGithub = true }: { locale: any; stars: number, showGithub?: boolean }) => { const [stars, setStars] = useState(initialStars); + const [bd_vid, setBdVid] = useState(null); + + useEffect(() => { + setBdVid(typeof window !== 'undefined' ? localStorage.getItem('bd_vid') : null); + }, []); useEffect(() => { const getStars = async () => { @@ -42,7 +47,7 @@ const CTAButton = ({ locale, stars: initialStars, showGithub = true }: { locale: ) } - +