Преглед на файлове

1,精简优化WEBUI代码,取消对老版本浏览器如IE的兼容支持;2,页面下载文件还原到传统模式,不再使用workbuddy优化的到内存再一次保存的方案,看不到下载进度和速率;3,WEBUI服务版本更新到v0.0.2.0

niujiuru преди 22 минути
родител
ревизия
9423d95d1a

+ 1 - 1
web-ui.service/main.go

@@ -12,7 +12,7 @@ import (
 )
 
 var (
-	Version   = "0.0.1.0"
+	Version   = "0.0.2.0"
 	BuildTime = ""
 )
 

+ 19 - 7
web-ui.service/web/app.html

@@ -50,7 +50,7 @@
 <div id="loading-mask">
   <div class="loading-box">
     <div class="loading-dot"></div>
-    <div class="loading-text">页面加载中,请稍微...</div>
+    <div class="loading-text">页面加载中,请稍候...</div>
   </div>
 </div>
 
@@ -114,12 +114,6 @@
   </div>
 </div>
 
-<!-- 兼容层:顺序不可调换(fetch 依赖 Promise),且须在业务 JS 之前 -->
-<script src="static/js/promise.min.js?v={{V}}"></script>
-<script src="static/js/fetch.min.js?v={{V}}"></script>
-<script src="static/js/eventsource.min.js?v={{V}}"></script>
-<script src="static/js/compat.js?v={{V}}"></script>
-<script src="static/js/util.js?v={{V}}"></script>
 <script src="static/js/jsondlg.js?v={{V}}"></script>
 <script src="static/js/echarts.min.js?v={{V}}"></script>
 <script src="static/js/xterm.js?v={{V}}"></script>
@@ -136,6 +130,24 @@
 <script src="static/js/page7.js?v={{V}}"></script>
 <script src="static/js/page8.js?v={{V}}"></script>
 <script src="static/js/page9.js?v={{V}}"></script>
+<script>
+// 浏览器能力检测:缺少必需 API 则拒绝访问
+// 注意:必须置于 body 末尾
+(function () {
+    if (!window.fetch ||
+        !window.Promise ||
+        !window.AbortController ||
+        !Promise.prototype.finally ||
+        !window.WebSocket ||
+        !window.EventSource ||
+        !window.URL ||
+        !window.URL.createObjectURL) {
+        document.documentElement.innerHTML =
+            '<h2>浏览器不受支持</h2><p>请使用最新版 Chrome、Edge、Firefox 或 Safari 浏览器访问。</p>';
+        throw new Error("当前浏览器不受支持");
+    }
+})();
+</script>
 </body>
 
 </html>

+ 18 - 0
web-ui.service/web/login.html

@@ -44,6 +44,24 @@
 <script src="static/js/eventsource.min.js?v={{V}}"></script>
 <script src="static/js/compat.js?v={{V}}"></script>
 <script src="static/js/login.js?v={{V}}"></script>
+<script>
+// 浏览器能力检测:缺少必需 API 则拒绝访问
+// 注意:必须置于 body 末尾
+(function () {
+    if (!window.fetch ||
+        !window.Promise ||
+        !window.AbortController ||
+        !Promise.prototype.finally ||
+        !window.WebSocket ||
+        !window.EventSource ||
+        !window.URL ||
+        !window.URL.createObjectURL) {
+        document.documentElement.innerHTML =
+            '<h2>浏览器不受支持</h2><p>请使用最新版 Chrome、Edge、Firefox 或 Safari 浏览器访问。</p>';
+        throw new Error("当前浏览器不受支持");
+    }
+})();
+</script>
 </body>
 
 </html>

+ 6 - 6
web-ui.service/web/pages/page1.html

@@ -9,7 +9,7 @@
 <body>
 <div class="page1">
   <div class="page1-card page1-dash">
-    <div class="page1-header"><svg class="icon"><use href="#i-trend" xlink:href="#i-trend"/></svg> 运行总览</div>
+    <div class="page1-header"><svg class="icon"><use href="#i-trend"/></svg> 运行总览</div>
     <div class="dash-kpis">
       <div class="dash-kpi">
         <div class="dash-kpi-name">CPU 占用</div>
@@ -41,23 +41,23 @@
 
   <div class="page1-grid-1">
     <div class="page1-card">
-      <div class="page1-header"><svg class="icon"><use href="#i-cpu" xlink:href="#i-cpu"/></svg> CPU</div>
+      <div class="page1-header"><svg class="icon"><use href="#i-cpu"/></svg> CPU</div>
       <div id="cpu-chart" class="page1-chart"></div>
     </div>
 
     <div class="page1-card">
-      <div class="page1-header"><svg class="icon"><use href="#i-mem" xlink:href="#i-mem"/></svg> 内存</div>
+      <div class="page1-header"><svg class="icon"><use href="#i-mem"/></svg> 内存</div>
       <div id="mem-chart" class="page1-chart"></div>
     </div>
 
     <div class="page1-card">
-      <div class="page1-header"><svg class="icon"><use href="#i-disk" xlink:href="#i-disk"/></svg> 硬盘</div>
+      <div class="page1-header"><svg class="icon"><use href="#i-disk"/></svg> 硬盘</div>
       <div id="disk-chart" class="page1-chart"></div>
     </div>
   </div>
   <div class="page1-grid-2">
     <div class="page1-card">
-      <div class="page1-header"><svg class="icon"><use href="#i-trend" xlink:href="#i-trend"/></svg> 统计</div>
+      <div class="page1-header"><svg class="icon"><use href="#i-trend"/></svg> 统计</div>
       <div class="info-list">
         <div class="info-item">
           <span class="info-name">系统01分钟负载</span>
@@ -92,7 +92,7 @@
     </div>
 
     <div class="page1-card service-card">
-      <div class="page1-header"><svg class="icon"><use href="#i-box" xlink:href="#i-box"/></svg> 服务</div>
+      <div class="page1-header"><svg class="icon"><use href="#i-box"/></svg> 服务</div>
       <div class="info-list">
         <div class="info-item">
           <div class="info-info">

+ 3 - 3
web-ui.service/web/pages/page2.html

@@ -38,7 +38,7 @@
         <div class="card">
           <div class="card-header">
             <h2>网络接口</h2>
-            <button class="btn" title="点击刷新最新数据" onclick="getNetInfo1()"><svg class="icon"><use href="#i-refresh" xlink:href="#i-refresh"/></svg></button>
+            <button class="btn" title="点击刷新最新数据" onclick="getNetInfo1()"><svg class="icon"><use href="#i-refresh"/></svg></button>
           </div>
           <pre class="output" id="text1">点击刷新获取数据...</pre>
         </div>
@@ -46,7 +46,7 @@
         <div class="card">
           <div class="card-header">
             <h2>系统路由</h2>
-            <button class="btn" title="点击刷新最新数据" onclick="getNetInfo2()"><svg class="icon"><use href="#i-refresh" xlink:href="#i-refresh"/></svg></button>
+            <button class="btn" title="点击刷新最新数据" onclick="getNetInfo2()"><svg class="icon"><use href="#i-refresh"/></svg></button>
           </div>
           <pre class="output" id="text2">点击刷新获取数据...</pre>
         </div>
@@ -54,7 +54,7 @@
         <div class="card">
           <div class="card-header">
             <h2>域名解析</h2>
-            <button class="btn" title="点击刷新最新数据" onclick="getNetInfo3()"><svg class="icon"><use href="#i-refresh" xlink:href="#i-refresh"/></svg></button>
+            <button class="btn" title="点击刷新最新数据" onclick="getNetInfo3()"><svg class="icon"><use href="#i-refresh"/></svg></button>
           </div>
           <pre class="output" id="text3">点击刷新获取数据...</pre>
         </div>

+ 6 - 6
web-ui.service/web/pages/page9.html

@@ -30,7 +30,7 @@
               <h2>通信状态</h2>
               <button class="btn" title="点击查看服务器配置" onclick="viewCBDServerConfig()">
                 <svg class="icon">
-                  <use href="#i-json-file" xlink:href="#i-json-file"/>
+                  <use href="#i-json-file"/>
                 </svg>
               </button>
             </div>
@@ -58,7 +58,7 @@
               <h2>测试指令</h2>
               <button class="btn" id="p9CtrlCmdAuthBtn" title="点击授权解锁操作" onclick="enableP9CtrlCmdButtons()">
                 <svg class="icon">
-                  <use href="#i-unlock" xlink:href="#i-unlock"/>
+                  <use href="#i-unlock"/>
                 </svg>
               </button>
             </div>
@@ -119,7 +119,7 @@
               <h2>固件升级</h2>
               <button class="btn" id="p9UpgradeAuthBtn" title="点击授权解锁操作" onclick="enablePUpgradeButtons()">
                 <svg class="icon">
-                  <use href="#i-unlock" xlink:href="#i-unlock"/>
+                  <use href="#i-unlock"/>
                 </svg>
               </button>
             </div>
@@ -129,7 +129,7 @@
               <div class="firmware-item">
                 <strong class="firmware-name">
                   <svg class="icon">
-                    <use href="#i-firmware-monitor" xlink:href="#i-firmware-monitor"/>
+                    <use href="#i-firmware-monitor"/>
                   </svg>
                   串口屏
                 </strong>
@@ -142,7 +142,7 @@
               <div class="firmware-item">
                 <strong class="firmware-name">
                   <svg class="icon">
-                    <use href="#i-firmware-mcu" xlink:href="#i-firmware-mcu"/>
+                    <use href="#i-firmware-mcu"/>
                   </svg>
                   控制板
                 </strong>
@@ -163,7 +163,7 @@
               <span class="runtime-stamp" id="runtimeStamp">--</span>
               <button class="btn" title="点击刷新最新状态" onclick="refreshCBDRunStatus()">
                 <svg class="icon">
-                  <use href="#i-refresh" xlink:href="#i-refresh"/>
+                  <use href="#i-refresh"/>
                 </svg>
               </button>
             </div>

+ 0 - 145
web-ui.service/web/static/js/compat.js

@@ -1,145 +0,0 @@
-/**
- * compat.js — 老浏览器标准库补丁
- *
- * 本文件补的是 ES2015+ 的“语言标准库方法”,IE11 及同期浏览器没有:
- * String: padStart(ES2017) / startsWith / endsWith / includes(ES2015)
- * Array:  includes(ES2016)
- * Object: assign(ES2015)
- *
- * 注意:
- * 1. 文件用 ES5 语法书写(IE11 不认识箭头函数、let/const),
- *    但这指的是写法,不是补 ES5 的能力 —— 补的均是 ES2015+ 的方法。
- * 2. Promise(ES2015) / fetch / EventSource 属于运行时与平台 API,
- *    不在本文件,由同目录 promise.min.js、fetch.min.js、
- *    eventsource.min.js 提供;三者在加载时检测原生能力,存在则不覆盖。
- * 3. 本文件不依赖上述三者,但必须在业务 JS 之前加载。
- * 4. downloadBlobFile() 保留在 util.js,不放在这里。
- */
-(function () {
-    "use strict";
-
-    /* =========================================================
-     * String
-     * ========================================================= */
-
-    if (!String.prototype.padStart) {
-        String.prototype.padStart = function (targetLength, padString) {
-            var str = String(this);
-            var len = Number(targetLength) || 0;
-            var pad = padString === undefined ? " " : String(padString);
-            var need = len - str.length;
-            var result = "";
-
-            if (need <= 0) return str;
-            if (pad === "") return str;
-
-            while (result.length < need) {
-                result += pad;
-            }
-
-            return result.slice(0, need) + str;
-        };
-    }
-
-    if (!String.prototype.startsWith) {
-        String.prototype.startsWith = function (search, position) {
-            var str = String(this);
-            var pos = Number(position) || 0;
-            search = String(search);
-
-            if (pos < 0) pos = 0;
-
-            return str.substr(pos, search.length) === search;
-        };
-    }
-
-    if (!String.prototype.endsWith) {
-        String.prototype.endsWith = function (search, length) {
-            var str = String(this);
-            search = String(search);
-
-            if (length === undefined || length > str.length) {
-                length = str.length;
-            }
-
-            length = Number(length);
-            if (isNaN(length) || length < 0) length = 0;
-
-            return str.substring(length - search.length, length) === search;
-        };
-    }
-
-    if (!String.prototype.includes) {
-        String.prototype.includes = function (search, start) {
-            if (search instanceof RegExp) {
-                throw new TypeError("不支持将 RegExp 作为 includes 参数");
-            }
-
-            return String(this).indexOf(String(search), Number(start) || 0) !== -1;
-        };
-    }
-
-    /* =========================================================
-     * Array
-     * ========================================================= */
-
-    if (!Array.prototype.includes) {
-        Array.prototype.includes = function (search, fromIndex) {
-            var arr = Object(this);
-            var len = arr.length >>> 0;
-            var i = Number(fromIndex) || 0;
-
-            if (!len) return false;
-
-            // 按 ToInteger 向零截断,否则 fromIndex 为负小数时会从错误下标起扫
-            i = i < 0 ? Math.ceil(i) : Math.floor(i);
-
-            if (i < 0) {
-                i = Math.max(len + i, 0);
-            }
-
-            for (; i < len; i++) {
-                if (arr[i] === search ||
-                    (arr[i] !== arr[i] && search !== search)) {
-                    return true;
-                }
-            }
-
-            return false;
-        };
-    }
-
-    /* =========================================================
-     * Object
-     * ========================================================= */
-
-    if (!Object.assign) {
-        Object.assign = function (target) {
-            if (target == null) {
-                throw new TypeError("Object.assign 的目标不能为 null 或 undefined");
-            }
-
-            var to = Object(target);
-            var i;
-            var source;
-            var key;
-
-            for (i = 1; i < arguments.length; i++) {
-                source = arguments[i];
-
-                if (source == null) continue;
-
-                source = Object(source);
-
-                for (key in source) {
-                    if (Object.prototype.hasOwnProperty.call(source, key)) {
-                        to[key] = source[key];
-                    }
-                }
-            }
-
-            return to;
-        };
-    }
-})();
-

Файловите разлики са ограничени, защото са твърде много
+ 0 - 6
web-ui.service/web/static/js/eventsource.min.js


Файловите разлики са ограничени, защото са твърде много
+ 0 - 16
web-ui.service/web/static/js/fetch.min.js


+ 1 - 31
web-ui.service/web/static/js/page1.js

@@ -348,37 +348,7 @@ function switchAutoUpgrade(event, action) {
 }
 
 function downloadUpgradeLogFile(event) {
-    var btn = event.currentTarget;
-    btn.disabled = true;
-    fetch("/api/upgrade/logfile")
-        .then(function (r) {
-            if (!r.ok) {
-                throw new Error("HTTP " + r.status);
-            }
-            var disposition = r.headers.get("Content-Disposition");
-            var filename = "upgrade.log.tar.gz";
-            if (disposition) {
-                var match = disposition.match(/filename="?([^";]+)"?/);
-                if (match) {
-                    filename = match[1];
-                }
-            }
-            return r.blob().then(function (blob) {
-                return { blob: blob, filename: filename };
-            });
-        })
-        .then(function (res) {
-            downloadBlobFile(res.blob, res.filename);
-            alert("下载成功");
-        })
-        .catch(function (e) {
-            console.error("download failed:", e);
-            alert("下载失败: " + e.message);
-        })
-        .finally(function () {
-            btn.disabled = false;
-            btn.textContent = "下载升级日志";
-        });
+    downloadFile("/api/upgrade/logfile");
 }
 
 function startPublicAccess(event) {

+ 1 - 31
web-ui.service/web/static/js/page2.js

@@ -101,37 +101,7 @@ function getNetLogLevel() {
 }
 
 function downloadNetLogFile(event) {
-    var btn = event.currentTarget;
-    btn.disabled = true;
-    fetch("/api/network/logfile")
-        .then(function (r) {
-            if (!r.ok) {
-                throw new Error("HTTP " + r.status);
-            }
-            var disposition = r.headers.get("Content-Disposition");
-            var filename = "network.log.tar.gz";
-            if (disposition) {
-                var match = disposition.match(/filename="?([^";]+)"?/);
-                if (match) {
-                    filename = match[1];
-                }
-            }
-            return r.blob().then(function (blob) {
-                return { blob: blob, filename: filename };
-            });
-        })
-        .then(function (res) {
-            downloadBlobFile(res.blob, res.filename);
-            alert("下载成功");
-        })
-        .catch(function (e) {
-            console.error("download failed:", e);
-            alert("下载失败: " + e.message);
-        })
-        .finally(function () {
-            btn.disabled = false;
-            btn.textContent = "下载";
-        });
+    downloadFile("/api/network/logfile");
 }
 
 function restartNetService(event) {

+ 1 - 31
web-ui.service/web/static/js/page3.js

@@ -41,37 +41,7 @@ function getTimeLogLevel() {
 }
 
 function downloadTimeLogFile(event) {
-    var btn = event.currentTarget;
-    btn.disabled = true;
-    fetch("/api/time/logfile")
-        .then(function (r) {
-            if (!r.ok) {
-                throw new Error("HTTP " + r.status);
-            }
-            var disposition = r.headers.get("Content-Disposition");
-            var filename = "time.log.tar.gz";
-            if (disposition) {
-                var match = disposition.match(/filename="?([^";]+)"?/);
-                if (match) {
-                    filename = match[1];
-                }
-            }
-            return r.blob().then(function (blob) {
-                return { blob: blob, filename: filename };
-            });
-        })
-        .then(function (res) {
-            downloadBlobFile(res.blob, res.filename);
-            alert("下载成功");
-        })
-        .catch(function (e) {
-            console.error("download failed:", e);
-            alert("下载失败: " + e.message);
-        })
-        .finally(function () {
-            btn.disabled = false;
-            btn.textContent = "下载";
-        });
+    downloadFile("/api/time/logfile");
 }
 
 function restartTimeService(event) {

+ 1 - 31
web-ui.service/web/static/js/page4.js

@@ -41,37 +41,7 @@ function getGnssLogLevel() {
 }
 
 function downloadGnssLogFile(event) {
-    var btn = event.currentTarget;
-    btn.disabled = true;
-    fetch("/api/gnss/logfile")
-        .then(function (r) {
-            if (!r.ok) {
-                throw new Error("HTTP " + r.status);
-            }
-            var disposition = r.headers.get("Content-Disposition");
-            var filename = "gnss.log.tar.gz";
-            if (disposition) {
-                var match = disposition.match(/filename="?([^";]+)"?/);
-                if (match) {
-                    filename = match[1];
-                }
-            }
-            return r.blob().then(function (blob) {
-                return { blob: blob, filename: filename };
-            });
-        })
-        .then(function (res) {
-            downloadBlobFile(res.blob, res.filename);
-            alert("下载成功");
-        })
-        .catch(function (e) {
-            console.error("download failed:", e);
-            alert("下载失败: " + e.message);
-        })
-        .finally(function () {
-            btn.disabled = false;
-            btn.textContent = "下载";
-        });
+    downloadFile("/api/gnss/logfile");
 }
 
 function restartGnssService(event) {

+ 3 - 42
web-ui.service/web/static/js/page5.js

@@ -41,37 +41,7 @@ function getCameraLogLevel() {
 }
 
 function downloadCameraLogFile(event) {
-    var btn = event.currentTarget;
-    btn.disabled = true;
-    fetch("/api/camera/logfile")
-        .then(function (r) {
-            if (!r.ok) {
-                throw new Error("HTTP " + r.status);
-            }
-            var disposition = r.headers.get("Content-Disposition");
-            var filename = "camera.log.tar.gz";
-            if (disposition) {
-                var match = disposition.match(/filename="?([^";]+)"?/);
-                if (match) {
-                    filename = match[1];
-                }
-            }
-            return r.blob().then(function (blob) {
-                return { blob: blob, filename: filename };
-            });
-        })
-        .then(function (res) {
-            downloadBlobFile(res.blob, res.filename);
-            alert("下载成功");
-        })
-        .catch(function (e) {
-            console.error("download failed:", e);
-            alert("下载失败: " + e.message);
-        })
-        .finally(function () {
-            btn.disabled = false;
-            btn.textContent = "下载";
-        });
+    downloadFile("/api/camera/logfile");
 }
 
 function restartCameraService(event) {
@@ -375,7 +345,7 @@ function stopCameraPreview() {
         clearTimeout(cameraPreviewTimer);
         cameraPreviewTimer = null;
     }
-    setText("cvar1", "停止连怕中, 请稍后...", "page5");
+    setText("cvar1", "停止连拍中, 请稍后...", "page5");
 }
 
 function downloadCameraImage() {
@@ -384,16 +354,7 @@ function downloadCameraImage() {
         return;
     }
     var url = "/api/camera/getImage?file=" + encodeURIComponent(cameraCurrentFile) + "&download=1";
-    fetch(url)
-        .then(function (r) {
-            return r.blob();
-        })
-        .then(function (blob) {
-            downloadBlobFile(blob, "camera.jpg");
-        })
-        .catch(function () {
-            alert("下载失败");
-        });
+    downloadFile(url);
 }
 
 function initPage5() {

+ 1 - 31
web-ui.service/web/static/js/page6.js

@@ -41,37 +41,7 @@ function getAppInstallLogLevel() {
 }
 
 function downloadAppInstallLogFile(event) {
-    var btn = event.currentTarget;
-    btn.disabled = true;
-    fetch("/api/app-install/logfile")
-        .then(function (r) {
-            if (!r.ok) {
-                throw new Error("HTTP " + r.status);
-            }
-            var disposition = r.headers.get("Content-Disposition");
-            var filename = "app-install.log.tar.gz";
-            if (disposition) {
-                var match = disposition.match(/filename="?([^";]+)"?/);
-                if (match) {
-                    filename = match[1];
-                }
-            }
-            return r.blob().then(function (blob) {
-                return { blob: blob, filename: filename };
-            });
-        })
-        .then(function (res) {
-            downloadBlobFile(res.blob, res.filename);
-            alert("下载成功");
-        })
-        .catch(function (e) {
-            console.error("download failed:", e);
-            alert("下载失败: " + e.message);
-        })
-        .finally(function () {
-            btn.disabled = false;
-            btn.textContent = "下载";
-        });
+    downloadFile("/api/app-install/logfile");
 }
 
 function restartAppInstallService(event) {

+ 1 - 31
web-ui.service/web/static/js/page9.js

@@ -41,37 +41,7 @@ function getCBDLogLevel() {
 }
 
 function downloadCBDLogFile(event) {
-    var btn = event.currentTarget;
-    btn.disabled = true;
-    fetch("/api/cbd/logfile")
-        .then(function (r) {
-            if (!r.ok) {
-                throw new Error("HTTP " + r.status);
-            }
-            var disposition = r.headers.get("Content-Disposition");
-            var filename = "cbd.log.tar.gz";
-            if (disposition) {
-                var match = disposition.match(/filename="?([^";]+)"?/);
-                if (match) {
-                    filename = match[1];
-                }
-            }
-            return r.blob().then(function (blob) {
-                return { blob: blob, filename: filename };
-            });
-        })
-        .then(function (res) {
-            downloadBlobFile(res.blob, res.filename);
-            alert("下载成功");
-        })
-        .catch(function (e) {
-            console.error("download failed:", e);
-            alert("下载失败: " + e.message);
-        })
-        .finally(function () {
-            btn.disabled = false;
-            btn.textContent = "下载";
-        });
+    downloadFile("/api/cbd/logfile");
 }
 
 function restartCBDService(event) {

Файловите разлики са ограничени, защото са твърде много
+ 0 - 9
web-ui.service/web/static/js/promise.min.js


+ 9 - 0
web-ui.service/web/static/js/router.js

@@ -186,3 +186,12 @@ function setBtnStatus(id, enabled, page) {
     var btn = document.getElementById(id);
     if (btn) btn.disabled = !enabled;
 }
+
+function downloadFile(url) {
+    var a = document.createElement("a");
+    a.href = url;
+    a.download = "";
+    document.body.appendChild(a);
+    a.click();
+    document.body.removeChild(a);
+}

+ 0 - 25
web-ui.service/web/static/js/util.js

@@ -1,25 +0,0 @@
-// 通用小工具(被多个页面共用)
-
-/**
- * 统一文件下载入口。
- * IE10/11 走 msSaveOrOpenBlob(不支持 a[download]);现代浏览器走 a[download] + ObjectURL,下载完立即回收 URL。
- * 注意:此函数是唯一定义,勿在 compat.js 或其它文件重复声明(全局函数重复声明会静默覆盖)。
- * @param {Blob} blob
- * @param {string} filename
- */
-function downloadBlobFile(blob, filename) {
-    if (window.navigator && window.navigator.msSaveOrOpenBlob) {
-        window.navigator.msSaveOrOpenBlob(blob, filename);
-        return;
-    }
-    var url = URL.createObjectURL(blob);
-    var a = document.createElement("a");
-    a.href = url;
-    a.download = filename || "download";
-    document.body.appendChild(a);
-    a.click();
-    setTimeout(function () {
-        document.body.removeChild(a);
-        URL.revokeObjectURL(url);
-    }, 100);
-}