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':