This commit is contained in:
zhangjianjun 2026-07-09 17:58:54 +08:00
parent 5e0bc6116d
commit 40a6f6ae7b
4 changed files with 27 additions and 8 deletions

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 9.3 KiB

View File

@ -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 (
<Routes>
<Route path="/" element={<Navigate to="/pay" replace />} />
<Route path="/" element={<Navigate to="/twins" replace />} />
<Route path="/pay" element={<PayPage />} />
<Route path="/pay-result" element={<PayResultPage />} />
<Route path="/twins" element={<Twins />} />
@ -49,7 +54,7 @@ function App() {
path="/404"
element={<PlaceholderPage path="/404" title="404" description="页面不存在" />}
/>
<Route path="*" element={<Navigate to="/pay" replace />} />
<Route path="*" element={<Navigate to="/twins" replace />} />
</Routes>
)
}

View File

@ -5,7 +5,14 @@ export type UserConfig = {
[key: string]: unknown
}
// goods
export function getConfig() {
return get<ApiResponse<UserConfig>>('/api/user/config')
}
export function getService() {
return get<ApiResponse<UserConfig>>('/api/weixin/service')
}
export function getPackage({package_name}: {package_name: string}) {
return get<ApiResponse<Package>>('/api/package')
}

View File

@ -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 (
<div className="card">
<div className="card-title">
@ -84,10 +92,10 @@ function Card() {
))
}
</div>
<div className="contact-us">
<a className="contact-us" href="" >
<img src="./images/app-twins/icon-concat.png" alt="客服1对1指导安装"></img>
<span>11<br/></span>
</div>
</a>
</div>
)
}