This commit is contained in:
make
2025-04-11 23:56:23 +08:00
parent 9350a2afff
commit bc92b44086
37 changed files with 246 additions and 216 deletions

View File

@@ -81,16 +81,16 @@ function handleRedirect() {
if (isMobile()) {
// 移动端逻辑
if (strCurrentPath.startsWith('/pc/')) {
if (strCurrentPath.startsWith(strPcPath)) {
// 如果路径包含 "/pc/",去除 "/pc/"
const newPath = strCurrentPath.replace('/pc/', '/'); // 去除 "/pc/"
const newPath = strCurrentPath.replace(strPcPath, '/'); // 去除 "/pc/"
window.location.href = `${strCurrentHost}${newPath}`;
}
} else {
// PC 端逻辑
if (!strCurrentPath.startsWith('/pc/')) {
if (!strCurrentPath.startsWith(strPcPath)) {
// 如果路径不包含 "/pc/",添加 "/pc/"
window.location.href = `${strCurrentHost}/pc${strCurrentPath}`;
window.location.href = `${strCurrentHost}${strPcPath}${strCurrentPath}`;
}
}
}