juanboy

waiting.html page built

  1 +<!DOCTYPE html>
  2 +<html lang="zh">
  3 +<head>
  4 + <meta charset="UTF-8">
  5 + <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6 + <title>处理中</title>
  7 + <style>
  8 + body {
  9 + font-family: Arial, sans-serif;
  10 + background-color: #f4f4f4;
  11 + display: flex;
  12 + justify-content: center;
  13 + align-items: center;
  14 + height: 100vh;
  15 + margin: 0;
  16 + }
  17 + .container {
  18 + text-align: center;
  19 + width: 600px; /* 调整容器宽度与 main.html 一致 */
  20 + background-color: #fff;
  21 + padding: 50px;
  22 + border-radius: 15px;
  23 + box-shadow: 0 0 15px rgba(0, 0, 0, 0.1); /* 与 main.html 相同的阴影效果 */
  24 + display: flex;
  25 + flex-direction: column;
  26 + align-items: center; /* 水平居中 */
  27 + }
  28 + h1 {
  29 + font-size: 28px; /* 与 main.html 标题保持一致 */
  30 + margin-bottom: 20px;
  31 + }
  32 + p {
  33 + font-size: 18px; /* 与 main.html 副标题大小一致 */
  34 + color: #888;
  35 + margin-top: 20px;
  36 + }
  37 + .loading-icon {
  38 + margin-top: 20px;
  39 + width: 50px; /* 调整图标大小 */
  40 + height: 50px;
  41 + border: 5px solid #f3f3f3;
  42 + border-radius: 50%;
  43 + border-top: 5px solid #4caf50;
  44 + animation: spin 1s linear infinite;
  45 + }
  46 + @keyframes spin {
  47 + 0% { transform: rotate(0deg); }
  48 + 100% { transform: rotate(360deg); }
  49 + }
  50 + </style>
  51 +</head>
  52 +<body>
  53 + <div class="container">
  54 + <h1>处理中,请稍候...</h1>
  55 + <div class="loading-icon"></div>
  56 + <p>您的文件正在分析中,请稍等片刻。</p>
  57 + </div>
  58 +
  59 + <script>
  60 + function checkStatus() {
  61 + fetch('{{ url_for('check_status', filename=filename) }}')
  62 + .then(response => response.json())
  63 + .then(data => {
  64 + if (data.status === 'success') {
  65 + // 成功,跳转到成功页面,并传递文件名以获取统计信息
  66 + window.location.href = "{{ url_for('upload_success') }}?filename=" + encodeURIComponent('{{ filename }}');
  67 + } else if (data.status === 'failure') {
  68 + // 失败,跳转到失败页面,并传递文件名以获取统计信息
  69 + window.location.href = "{{ url_for('upload_failure') }}?filename=" + encodeURIComponent('{{ filename }}');
  70 + } else {
  71 + // 继续等待
  72 + setTimeout(checkStatus, 2000);
  73 + }
  74 + })
  75 + .catch(error => {
  76 + console.error('Error:', error);
  77 + setTimeout(checkStatus, 2000);
  78 + });
  79 + }
  80 +
  81 + document.addEventListener('DOMContentLoaded', function() {
  82 + checkStatus();
  83 + });
  84 + </script>
  85 +</body>
  86 +</html>