This commit is contained in:
zhangjianjun 2026-07-28 15:05:17 +08:00
parent ea2fff5339
commit 15b047dfdd
1 changed files with 15 additions and 2 deletions

View File

@ -30,6 +30,20 @@ function normalizeQrLinkCode (scene?: string) {
} }
} }
function buildWebViewUrl (linkCode: string, mpCode: string, options: Record<string, string>) {
const queryParams = new URLSearchParams()
Object.entries(options).forEach(([key, value]) => {
if (typeof value === 'string') {
queryParams.set(key, value)
}
})
queryParams.set('mpCode', mpCode)
return `https://nb.zuom8.cn${LINK_PREFIX}${encodeURIComponent(linkCode)}?${queryParams.toString()}`
}
export default function Index () { export default function Index () {
const [url, setUrl] = useState('') const [url, setUrl] = useState('')
@ -70,8 +84,7 @@ export default function Index () {
const wxCode = await Taro.login() const wxCode = await Taro.login()
console.log('Page loaded.', LINK_PREFIX, linkCode, wxCode) setUrl(buildWebViewUrl(linkCode, wxCode.code, options))
setUrl(`https://nb.zuom8.cn${LINK_PREFIX}${encodeURIComponent(linkCode)}?mpCode=${encodeURIComponent(wxCode.code)}`)
}) })
return ( return (