60 lines
1.7 KiB
HTML
60 lines
1.7 KiB
HTML
|
|
<!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>
|