moshaorui 2 ヶ月 前
コミット
765fb3e857
1 ファイル変更13 行追加13 行削除
  1. 13 13
      public/static/js/script.js

+ 13 - 13
public/static/js/script.js

@@ -257,18 +257,18 @@ $(document).ready(function() {
     var checkDownloadStatus = function() {
         var intervalId = setInterval(function() {
             console.log('checkDownloadStatus ....');
-            // $.ajax({
-            //     url: '/download-status',
-            //     method: 'GET',
-            //     dataType: 'json',
-            //     success: function(response) {
-            //         console.log(response);
-            //         if (response.status == 0 || response.status == 2) {
-            //             clearInterval(intervalId);
-            //             layer.close(loadIndex); // 关闭加载层
-            //         }
-            //     }
-            // });
+            $.ajax({
+                url: '/download-status',
+                method: 'GET',
+                dataType: 'json',
+                success: function(response) {
+                    console.log(response);
+                    if (response.status == 0 || response.status == 2) {
+                        clearInterval(intervalId);
+                        layer.close(loadIndex); // 关闭加载层
+                    }
+                }
+            });
         }, 1000); // 每秒请求一次
     }
 
@@ -459,7 +459,7 @@ $(document).ready(function() {
             method: 'GET',
             dataType: 'json',
             success: function(response) {
-                if (response.status == 0) {
+                if (response.status == 0 || response.status == 2) {
                     downdHref();
                     checkDownloadStatus();
                 }