import { useEffect, useState } from 'react'
import { getConfig, getService } from '@/api/user'
import { TEMP_TOKEN_STORAGE_KEY } from '@/utils/request'
type TwinsProps = {
installUrl: string
}
function Twins({ installUrl }: TwinsProps) {
const [serviceUrl, setServiceUrl] = useState('')
useEffect(() => {
let isMounted = true
async function initTwinsConfig() {
try {
const { data: config } = await getConfig()
if (config.token) {
window.sessionStorage.setItem(TEMP_TOKEN_STORAGE_KEY, config.token)
}
const { data: service } = await getService()
const nextServiceUrl = service['kf.address']
if (isMounted && typeof nextServiceUrl === 'string') {
setServiceUrl(nextServiceUrl)
}
} catch {
if (isMounted) {
setServiceUrl('')
}
}
}
initTwinsConfig()
return () => {
isMounted = false
}
}, [])
return (
)
}
function Header() {
return (
iPhone双开微信
专享 TestFlight 内测试版 | 无
需越狱 | 无封号风险
安全问题
无封号风险
)
}
type CardProps = {
serviceUrl: string
installUrl: string
}
function Card({ serviceUrl, installUrl }: CardProps) {
const steps = [
{
label: '步骤一',
title: "下载 TestFlight 应用",
desc: [
"· 若已安装,请跳过此步;",
"· 未安装请点击下方按钮前往App Store下载;",
],
linkName: "前往下载",
linkUrl: "https://apps.apple.com/us/app/testflight/id899247664?l=zh-Hans-CN",
sideBg: "./images/app-twins/step1-side.png"
},
{
label: '步骤二',
title: "安装双开微信",
desc: [
"· 点击下方按钮,自动跳转安装您的专属微信",
"· 下载完成后,桌面会出现第二个微信图标;",
],
linkName: "前往安装",
linkUrl: installUrl,
sideBg: "./images/app-twins/step2-side.png"
}
]
return (
仅需两步 · 30秒完成安装
{
steps.map((step, index) => (
{step.label}
{step.title}
{
step.desc.map((descItem, descIndex) => (
{descItem}
))
}
{step.linkName}
))
}
客服1对1
指导安装
)
}
export default Twins