forward.html 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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 参数暂存到 sessionStorage,然后跳转到 SPA 根路径
  15. // 用于解决 history 路由模式下 nginx 无 SPA fallback 导致的 404 问题
  16. (function () {
  17. var search = window.location.search || '';
  18. var hash = window.location.hash || '';
  19. // 合并 query 和 hash 中的参数(兼容 form_post 可能的传递方式)
  20. var queryString = search.replace(/^\?/, '');
  21. if (hash && hash.indexOf('?') !== -1) {
  22. var hashQuery = hash.split('?')[1] || '';
  23. if (hashQuery) {
  24. queryString = queryString ? (queryString + '&' + hashQuery) : hashQuery;
  25. }
  26. }
  27. if (queryString) {
  28. try {
  29. sessionStorage.setItem('oauth_callback_params', queryString);
  30. } catch (e) {
  31. // sessionStorage 不可用时忽略,后续登录页会走正常流程
  32. }
  33. }
  34. // 跳转到 SPA 根路径,确保能加载到 index.html
  35. window.location.replace(window.location.origin + '/');
  36. })();
  37. </script>
  38. </body>
  39. </html>