Skip to content

Commit 38c6357

Browse files
committed
redirect
1 parent 9eb2001 commit 38c6357

File tree

3 files changed

+45
-11
lines changed

3 files changed

+45
-11
lines changed

404.html

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<!DOCTYPE html>
2+
<html lang="zh-CN">
3+
<head>
4+
<meta charset="utf-8">
5+
<title>重定向中...</title>
6+
<script>
7+
(function() {
8+
const pathname = window.location.pathname;
9+
10+
// 如果路径以 /en 或 /cn 开头,重定向到 openmoss.ai
11+
if (pathname.startsWith('/en') || pathname.startsWith('/cn')) {
12+
window.location.href = 'https://openmoss.ai' + pathname + window.location.search + window.location.hash;
13+
return;
14+
}
15+
16+
// 其他路径重定向到主页,保留 hash 部分
17+
// 这样可以支持 SPA 的 hash 路由
18+
const redirect = window.location.origin + '/#' + pathname + window.location.search + window.location.hash;
19+
window.location.replace(redirect);
20+
})();
21+
</script>
22+
</head>
23+
<body>
24+
<p>正在重定向...</p>
25+
</body>
26+
</html>
27+

assets/js/spa.js

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,13 @@
1717
}
1818

1919
function init() {
20+
// 处理真实路径 /en/* 和 /cn/* 的重定向
21+
const pathname = window.location.pathname;
22+
if (pathname.startsWith('/en') || pathname.startsWith('/cn')) {
23+
window.location.href = 'https://openmoss.ai' + pathname + window.location.search + window.location.hash;
24+
return;
25+
}
26+
2027
if (!window.SPA_DATA) {
2128
console.error('SPA_DATA 未加载');
2229
return;
@@ -383,12 +390,12 @@
383390
`;
384391
} else {
385392
return `
386-
<div class="member-card">
387-
${member.photo ? `<img src="${member.photo}" alt="${name}" class="member-photo">` : ''}
393+
<div class="member-card">
394+
${member.photo ? `<img src="${member.photo}" alt="${name}" class="member-photo">` : ''}
388395
<h4 class="member-name">${name}</h4>
389-
${showTitle && member.title ? `<p class="member-title">${member.title[currentLang] || member.title.zh || member.title}</p>` : ''}
390-
</div>
391-
`;
396+
${showTitle && member.title ? `<p class="member-title">${member.title[currentLang] || member.title.zh || member.title}</p>` : ''}
397+
</div>
398+
`;
392399
}
393400
}).join('');
394401
}

index.html

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,19 @@
55
<meta charset="utf-8">
66
<meta name="viewport" content="width=device-width, initial-scale=1">
77
<title>OpenMOSS</title>
8-
<link rel="icon" type="image/png" href="assets/img/openmoss-logo.png">
8+
<link rel="icon" type="image/png" href="/assets/img/openmoss-logo.png">
99
<meta name="description" content="OpenMOSS Team - 邱锡鹏教授领导的人工智能研究团队">
1010
<link rel="preconnect" href="https://fonts.googleapis.com">
1111
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
1212
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap" rel="stylesheet">
13-
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.0/css/all.min.css" integrity="sha512-gO9FwZP1781OeR3SiPtK0aGpG99nmHn7+O+kO5RAwOB1p5MNDoAuCEi0aKBslZx2drXr/7L0KleKX2ND/qY1KQ==" crossorigin="anonymous" referrerpolicy="no-referrer" />
14-
<link rel="stylesheet" href="assets/css/style.css?v=20251103a">
13+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.0/css/all.min.css" crossorigin="anonymous" referrerpolicy="no-referrer" />
14+
<link rel="stylesheet" href="/assets/css/style.css?v=20251103a">
1515
</head>
1616
<body>
1717
<div id="app"></div>
1818

19-
<script src="assets/js/i18n.js"></script>
20-
<script src="assets/js/content-data.js"></script>
21-
<script src="assets/js/team-data.js"></script> <script src="assets/js/spa.js"></script>
19+
<script src="/assets/js/i18n.js"></script>
20+
<script src="/assets/js/content-data.js"></script>
21+
<script src="/assets/js/team-data.js"></script> <script src="/assets/js/spa.js"></script>
2222
</body>
2323
</html>

0 commit comments

Comments
 (0)