forward.html 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. <!DOCTYPE html>
  2. <html lang="zh-CN">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7. <title>登录中...</title>
  8. </head>
  9. <body>
  10. <div style="display:flex;align-items:center;justify-content:center;height:100vh;font-family:sans-serif;color:#666">
  11. 正在跳转登录页...
  12. </div>
  13. <script>
  14. // OAuth 回调中转页:将 URL 参数带到登录页 hash 路由中
  15. // 用于解决 history 路由模式下 nginx 无 SPA fallback 导致的 404 问题
  16. // 同时兼容 hash 路由模式:参数放在 #/login? 后面
  17. (function () {
  18. var search = window.location.search || '';
  19. var hash = window.location.hash || '';
  20. // 合并 query 和 hash 中的参数
  21. var queryString = search.replace(/^\?/, '');
  22. if (hash && hash.indexOf('?') !== -1) {
  23. var hashQuery = hash.split('?')[1] || '';
  24. if (hashQuery) {
  25. queryString = queryString ? (queryString + '&' + hashQuery) : hashQuery;
  26. }
  27. }
  28. // 跳转到登录页,参数放在 hash 路由后面,兼容 hash 模式
  29. var target = window.location.origin + '/#/login';
  30. if (queryString) {
  31. target += '?' + queryString;
  32. }
  33. window.location.replace(target);
  34. })();
  35. </script>
  36. </body>
  37. </html>