From a773823c3fb0ea6991416af2e4ee628d2fd0f783 Mon Sep 17 00:00:00 2001 From: fengerli <528575642@qq.com> Date: Thu, 14 Aug 2025 14:39:10 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=AE=9E=E6=97=B6=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E8=AE=BE=E5=A4=87=EF=BC=8C=E5=89=8D=E7=AB=AF=E5=8F=96?= =?UTF-8?q?=E6=B6=88=E6=8E=89=E8=B6=85=E6=97=B6=E7=8A=B6=E6=80=81=EF=BC=8C?= =?UTF-8?q?=E6=A0=B9=E6=8D=AE=E6=9C=8D=E5=8A=A1=E7=9A=84=E8=B6=85=E6=97=B6?= =?UTF-8?q?=E6=9D=A5=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/6170/callPolice/index.vue | 6 +----- pages/6170/deviceControl/index.vue | 28 +++++++++++++--------------- pages/common/send/index.vue | 6 +----- 3 files changed, 15 insertions(+), 25 deletions(-) diff --git a/pages/6170/callPolice/index.vue b/pages/6170/callPolice/index.vue index 9f99630..948c023 100644 --- a/pages/6170/callPolice/index.vue +++ b/pages/6170/callPolice/index.vue @@ -86,10 +86,9 @@ * 获取设备状态(带自动轮询) * @param {number} val - 功能模式 * @param {string} batchId - 批次ID - * @param {number} [maxRetries=30] - 最大重试次数(约30秒) * @param {number} [interval=1000] - 轮询间隔(毫秒) */ - async getdeviceSTatus(val, batchId, maxRetries = 30, interval =2000) { + async getdeviceSTatus(val, batchId, interval =800) { let retries = 0; const checkStatus = async () => { try { @@ -107,9 +106,6 @@ case 'OK': return res; // 成功完成 case 'ACTIVE': - if (++retries >= maxRetries) { - throw new Error('操作超时'); - } await new Promise(r => setTimeout(r, interval)); return checkStatus(); // 继续轮询 case 'FAILED': diff --git a/pages/6170/deviceControl/index.vue b/pages/6170/deviceControl/index.vue index 5701f81..2d01980 100644 --- a/pages/6170/deviceControl/index.vue +++ b/pages/6170/deviceControl/index.vue @@ -355,10 +355,9 @@ * 获取设备状态(带自动轮询) * @param {number} val - 功能模式 * @param {string} batchId - 批次ID - * @param {number} [maxRetries=30] - 最大重试次数(约30秒) * @param {number} [interval=1000] - 轮询间隔(毫秒) */ - async getdeviceSTatus(val, batchId, maxRetries = 30, interval = 2000) { + async getdeviceSTatus(val, batchId, interval = 800) { let retries = 0; const checkStatus = async () => { try { @@ -376,9 +375,6 @@ case 'OK': return res; // 成功完成 case 'ACTIVE': - if (++retries >= maxRetries) { - throw new Error('操作超时'); - } await new Promise(r => setTimeout(r, interval)); return checkStatus(); // 继续轮询 case 'FAILED': @@ -392,7 +388,6 @@ throw error; } }; - return checkStatus(); }, filterChinese(e) { @@ -767,36 +762,39 @@ // 获取设备状态 const statusRes = await this.getdeviceSTatus(1); if (statusRes.data.functionAccess === 'OK') { - // 两个操作都成功,重置状态并显示成功提示 + uni.hideLoading(); // ✅ 只有成功才关闭 this.selectedImage = ''; this.file = null; - this.lightModeB = false; - uni.showToast({ - title: responseData.msg, - icon: 'success', - }); + this.popupType = 'logo'; + this.showPopupFlag = true; + this.popupMessage = '上传成功'; + this.lightModeB = false } } catch (error) { + uni.hideLoading(); uni.showToast({ title: error.message, icon: 'none' }); } } else { + uni.hideLoading(); uni.showToast({ title: responseData.msg, icon: 'none' }); } } catch (e) { + uni.hideLoading(); uni.showToast({ - title: error.message, + title: e.message, icon: 'none' }); - } finally { - uni.hideLoading(); } + // finally { + // uni.hideLoading(); + // } } }) }, diff --git a/pages/common/send/index.vue b/pages/common/send/index.vue index 9d96e68..370cf1c 100644 --- a/pages/common/send/index.vue +++ b/pages/common/send/index.vue @@ -75,10 +75,9 @@ * 获取设备状态(带自动轮询) * @param {number} val - 功能模式 * @param {string} batchId - 批次ID - * @param {number} [maxRetries=30] - 最大重试次数(约30秒) * @param {number} [interval=1000] - 轮询间隔(毫秒) */ - async getdeviceSTatus(val, batchId, maxRetries = 30, interval = 2000) { + async getdeviceSTatus(val, batchId, interval = 800) { let retries = 0; const checkStatus = async () => { try { @@ -96,9 +95,6 @@ case 'OK': return res; // 成功完成 case 'ACTIVE': - if (++retries >= maxRetries) { - throw new Error('操作超时'); - } await new Promise(r => setTimeout(r, interval)); return checkStatus(); // 继续轮询 case 'FAILED':