hn-hlw-pc/public/hnhlw.html

60 lines
1.7 KiB
HTML
Raw Normal View History

2026-07-31 18:26:54 +08:00
<!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;
}
window.onload = function () {
const storeId = getQueryParam(location.href, 'storeId') || '';
const query = encodeURIComponent(`pages/home/home?storeId=${storeId}`);
const scheme = `alipays://platformapi/startapp?appId=2021004129669493&page=${query}`;
const href = `https://ds.alipay.com/?scheme=${encodeURIComponent(scheme)}`;
location.href = href;
// console.log(href);
// window.open(href, '_blank');
}
</script>
</body>
</html>