hn-hlw-pc/public/hnhlw.html
2026-08-12 15:20:29 +08:00

73 lines
2.1 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>海宁互联网医院</title>
</head>
<body>
<script>
function getQueryParam(url, paramName) {
// 方案1:使用原生 API(现代浏览器)
if (typeof URLSearchParams !== 'undefined') {
try {
const urlObj = new URL(url);
return urlObj.searchParams.get(paramName);
} catch (e) {
// URL 构造失败,继续降级
}
}
// 方案2:正则匹配(兼容性好)
const pattern = new RegExp('[?&]' + paramName + '=([^&#]*)', 'i');
const match = url.match(pattern);
if (match) {
return decodeURIComponent(match[1]);
}
// 方案3:手动解析(最兼容)
const queryStart = url.indexOf('?');
if (queryStart === -1) return null;
const queryString = url.substring(queryStart + 1);
const params = queryString.split('&');
for (let param of params) {
const [key, value] = param.split('=');
if (key === paramName) {
return decodeURIComponent(value || '');
}
}
return null;
}
function getPageQuery() {
const type = getQueryParam(location.href, 'type') || '';
if (type === 'ybAuth') {
const id = getQueryParam(location.href, 'id') || ''
return encodeURIComponent(`pages/consult/self-auth/auth-action?id=${id}`);
} else if (type === 'store') {
const storeId = getQueryParam(location.href, 'storeId') || '';
return encodeURIComponent(`pages/home/home?storeId=${storeId}`);
}
return ''
}
window.onload = function () {
const query = getPageQuery()
const scheme = `alipays://platformapi/startapp?appId=2021004129669493${query ? '&page=' : ''}${query}`;
const href = `https://ds.alipay.com/?scheme=${encodeURIComponent(scheme)}`;
location.href = href;
// console.log(href);
// window.open(href, '_blank');
}
</script>
</body>
</html>