diff --git a/public/favicon.svg b/public/favicon.svg deleted file mode 100644 index 6893eb1..0000000 --- a/public/favicon.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/App.tsx b/src/App.tsx index b3a3476..cca2816 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -7,20 +7,25 @@ import Twins from './pages/Twins.tsx' import PlaceholderPage from './components/PlaceholderPage.tsx' // http://localhost:5173?token=c3f52a99-c519-427a-af05-364c5f3e59cc +// ?package=com.btys.btwx function App() { const [isConfigReady, setIsConfigReady] = useState(false) const [searchParams] = useSearchParams() const navigate = useNavigate() const [initialToken] = useState(() => searchParams.get('token')) + const [initialPackage] = useState(() => searchParams.get('package')) useEffect(() => { let isMounted = true async function initConfig() { + if(initialPackage) { + window.localStorage.setItem('package', initialPackage || '') + } if (initialToken) { window.localStorage.setItem('token', initialToken || '') } else if(!window.localStorage.getItem('token')) { - navigate('/404', { replace: true }) + navigate('/twins', { replace: true }) } if (isMounted) { @@ -41,7 +46,7 @@ function App() { return ( - } /> + } /> } /> } /> } /> @@ -49,7 +54,7 @@ function App() { path="/404" element={} /> - } /> + } /> ) } diff --git a/src/api/user.ts b/src/api/user.ts index 118b88a..9627fee 100644 --- a/src/api/user.ts +++ b/src/api/user.ts @@ -5,7 +5,14 @@ export type UserConfig = { [key: string]: unknown } -// goods export function getConfig() { return get>('/api/user/config') } + +export function getService() { + return get>('/api/weixin/service') +} + +export function getPackage({package_name}: {package_name: string}) { + return get>('/api/package') +} \ No newline at end of file diff --git a/src/pages/Twins.tsx b/src/pages/Twins.tsx index ccf752d..f0bce87 100644 --- a/src/pages/Twins.tsx +++ b/src/pages/Twins.tsx @@ -1,3 +1,4 @@ +import { useEffect } from "react" function Twins() { return ( @@ -42,7 +43,7 @@ function Card() { "· 未安装请点击下方按钮前往App Store下载;", ], linkName: "前往下载", - linkUrl: "", + linkUrl: "https://apps.apple.com/us/app/testflight/id899247664?l=zh-Hans-CN", sideBg: "./images/app-twins/step1-side.png" }, { @@ -57,6 +58,13 @@ function Card() { sideBg: "./images/app-twins/step2-side.png" } ] + useEffect(() => { + const packageName = window.localStorage.getItem('package') + console.log("packageName", packageName) + if(packageName) { + + } + }, []) return ( @@ -84,10 +92,10 @@ function Card() { )) } - + 客服1对1指导安装 - + ) }