import { useState } from 'react'; import { buildPageUrlForWechatOpen, copyWechatOpenLink, isIosBrowser } from '../utils/wechat'; export function WechatOpenGuide({ disabled, onCopied, }: { disabled?: boolean; onCopied?: () => void; }) { const [guideOpen, setGuideOpen] = useState(false); const [copied, setCopied] = useState(false); const ios = isIosBrowser(); const handleOpen = async () => { const ok = await copyWechatOpenLink(); setCopied(ok); if (ok) onCopied?.(); setGuideOpen(true); }; return ( <> {guideOpen && (
setGuideOpen(false)} >
e.stopPropagation()}>

请在微信中打开

{copied ? (

链接已复制

) : (

未能自动复制,请手动复制下方链接

)} {ios ? (
  1. 点击浏览器右上角 ···
  2. 选择 在微信中打开
  3. 打开后即可使用微信一键登录
) : (
  1. 打开微信,将链接发给「文件传输助手」或任意聊天
  2. 在微信里点击该链接
  3. 打开后即可使用微信一键登录
)} e.currentTarget.select()} />
)} ); }