page1.html 1.1 KB

1234567891011121314151617181920212223242526272829
  1. <!DOCTYPE html>
  2. <html lang="zh-CN">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>扫码绑定简历 - 页面1</title>
  6. <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
  7. </head>
  8. <body class="p-3">
  9. <div class="container">
  10. <h1>扫码绑定简历</h1>
  11. <p>请使用手机扫描二维码后进行绑定,等待绑定结果……</p>
  12. <!-- 显示用户的 UUID -->
  13. <div class="alert alert-info">您的标识: <strong>{{.UUID}}</strong></div>
  14. </div>
  15. <script>
  16. var uuid = "{{.UUID}}";
  17. // 建立 SSE 连接,监听后端绑定事件
  18. var source = new EventSource("/events?uuid=" + encodeURIComponent(uuid));
  19. source.addEventListener('bind', function(e) {
  20. var data = JSON.parse(e.data);
  21. // 当绑定后自动跳转到页面2,将 uuid 和 resume_id 作为参数传递
  22. window.location.href = "/page2?uuid=" + encodeURIComponent(uuid) + "&resume_id=" + encodeURIComponent(data.resume_id);
  23. }, false);
  24. source.onerror = function(e) {
  25. console.error("SSE error", e);
  26. };
  27. </script>
  28. </body>
  29. </html>