From c200f2e74850342ee597dbb7c918d0243b4c619b Mon Sep 17 00:00:00 2001 From: zhangjianjun Date: Fri, 17 Jul 2026 18:36:41 +0800 Subject: [PATCH] ud --- src/App.tsx | 6 ++++-- src/api/user.ts | 1 + src/index.css | 6 +++--- src/pages/Twins.tsx | 13 +++++++++---- 4 files changed, 17 insertions(+), 9 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index 6359bab..a07ed7a 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -10,6 +10,7 @@ import { getPackage } from './api/user.ts' // http://localhost:5173?token=c3f52a99-c519-427a-af05-364c5f3e59cc function App() { const [isConfigReady, setIsConfigReady] = useState(false) + const [packageLink, setPackageLink] = useState('') const [searchParams] = useSearchParams() const navigate = useNavigate() const [initialToken] = useState(() => searchParams.get('token')) @@ -24,9 +25,10 @@ function App() { navigate('/twins', { replace: true }) } - await getPackage() + const { data: packageInfo } = await getPackage() if (isMounted) { + setPackageLink(typeof packageInfo.link === 'string' ? packageInfo.link : '') setIsConfigReady(true) } } @@ -47,7 +49,7 @@ function App() { } /> } /> } /> - } /> + } /> } diff --git a/src/api/user.ts b/src/api/user.ts index 184570b..285aa0e 100644 --- a/src/api/user.ts +++ b/src/api/user.ts @@ -12,6 +12,7 @@ export type ServiceConfig = { } export type PackageInfo = { + link?: string [key: string]: unknown } diff --git a/src/index.css b/src/index.css index f4a58a9..11fda7e 100644 --- a/src/index.css +++ b/src/index.css @@ -557,7 +557,7 @@ p { } #Twins { - height: 100svh; + min-height: 100svh; .header { height: 248px; background: url('/images/app-twins/bg.png') no-repeat; @@ -622,12 +622,12 @@ p { } .card { - height: calc(100dvh - 178px); + min-height: calc(100dvh - 178px); padding: 20px 16px; border-radius: 30px 30px 0px 0px; background: #FFFFFF; - overflow: hidden; margin-top: -85px; + position: relative; .card-title { font-family: PingFang SC, PingFang SC; diff --git a/src/pages/Twins.tsx b/src/pages/Twins.tsx index 98d01d8..14236ee 100644 --- a/src/pages/Twins.tsx +++ b/src/pages/Twins.tsx @@ -2,7 +2,11 @@ import { useEffect, useState } from 'react' import { getConfig, getService } from '@/api/user' import { TEMP_TOKEN_STORAGE_KEY } from '@/utils/request' -function Twins() { +type TwinsProps = { + installUrl: string +} + +function Twins({ installUrl }: TwinsProps) { const [serviceUrl, setServiceUrl] = useState('') useEffect(() => { @@ -39,7 +43,7 @@ function Twins() { return (
- +
) } @@ -70,9 +74,10 @@ function Header() { type CardProps = { serviceUrl: string + installUrl: string } -function Card({ serviceUrl }: CardProps) { +function Card({ serviceUrl, installUrl }: CardProps) { const steps = [ { label: '步骤一', @@ -93,7 +98,7 @@ function Card({ serviceUrl }: CardProps) { "· 下载完成后,桌面会出现第二个微信图标;", ], linkName: "前往安装", - linkUrl: "", + linkUrl: installUrl, sideBg: "./images/app-twins/step2-side.png" } ]