| 123456789101112131415161718192021222324252627282930313233343536373839 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8" />
- <meta http-equiv="X-UA-Compatible" content="IE=edge" />
- <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
- <link rel="icon" href="/favicon.ico" />
- <title>Daytask</title>
- </head>
- <body>
- <div id="app"></div>
- <script>
- // 在 Vue 加载前处理 Zalo OAuth 回调参数
- // 因为使用 hash 路由,当 Zalo 回调到 /login?code=xxx 时
- // 页面会重定向到 /#/login,导致 query 参数丢失
- // 所以需要在页面加载时立即保存这些参数
- (function() {
- var urlParams = new URLSearchParams(window.location.search);
- var code = urlParams.get('code');
- var state = urlParams.get('state');
- if (code) {
- // 保存 Zalo 回调的 code 到 sessionStorage
- sessionStorage.setItem('zalo_oauth_code', code);
- if (state) {
- sessionStorage.setItem('zalo_oauth_state', state);
- }
- console.log('Zalo OAuth code saved:', code);
- // 重定向到 hash 路由的登录页,去掉 URL 中的参数
- window.location.href = window.location.origin + '/#/login';
- }
- })();
- </script>
- <script type="module" src="/src/main.ts"></script>
- </body>
- </html>
|