From 2c4e87910deb31eab9d173ac80fb4599763f1700 Mon Sep 17 00:00:00 2001 From: Ryan <865833921@qq.com> Date: Fri, 25 Apr 2025 16:53:48 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BF=9B=E5=BA=A6=E6=98=BE=E7=A4=BA=E5=AE=8C?= =?UTF-8?q?=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../entry/src/main/ets/pages/RCPReconnection.ets | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/NetworkReconnection/entry/src/main/ets/pages/RCPReconnection.ets b/NetworkReconnection/entry/src/main/ets/pages/RCPReconnection.ets index 75900d2..4d1adb6 100644 --- a/NetworkReconnection/entry/src/main/ets/pages/RCPReconnection.ets +++ b/NetworkReconnection/entry/src/main/ets/pages/RCPReconnection.ets @@ -90,11 +90,9 @@ export struct RCPReconnection { createRCPSession(): rcp.Session { const customHttpEventsHandler: rcp.HttpEventsHandler = { onDownloadProgress: (totalSize: number, transferredSize: number) => { - if (this.contentLength === -1) { - this.contentLength = totalSize; - } + this.contentLength = totalSize; this.downloadSize = transferredSize; - this.process = Math.floor(this.downloadSize / this.contentLength * 100); + this.process = this.contentLength === 0 ? 0 : Math.floor(this.downloadSize / this.contentLength * 100); }, onDataEnd: () => { -- Gitee