From f8957b0852da860f00406538e2f07cf7bbf26f3c Mon Sep 17 00:00:00 2001 From: 17792275749 <812100002@qq.com> Date: Mon, 13 Apr 2026 13:54:23 +0800 Subject: [PATCH] =?UTF-8?q?[AI=20Generated]:=20feat(Comp):=20=E4=BC=98?= =?UTF-8?q?=E5=8C=96WiFi=E8=8E=B7=E5=8F=96=E7=8A=B6=E6=80=81=E5=B1=95?= =?UTF-8?q?=E7=A4=BA=E3=80=81=E4=B8=8B=E5=8F=91=E5=A4=B1=E8=B4=A5=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E9=87=8D=E8=AF=95=E3=80=81=E5=90=8C=E6=AD=A5=E5=89=8D?= =?UTF-8?q?=E6=B8=85=E9=99=A4=E8=AE=BE=E5=A4=87=E7=94=A8=E6=88=B7=E6=95=B0?= =?UTF-8?q?=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../configureDevice_2/configureDevice_2.js | 7 +++++-- .../configureDevice_2/configureDevice_2.wxml | 2 +- .../configureDevice_3/configureDevice_3.js | 16 ++++++++-------- .../configureDevice_3/configureDevice_3.wxml | 9 +++++++-- pages/configureDevice/configureDevice.js | 4 ++-- 5 files changed, 23 insertions(+), 15 deletions(-) diff --git a/components/configureDevice_2/configureDevice_2.js b/components/configureDevice_2/configureDevice_2.js index bb91cfe..b441f43 100644 --- a/components/configureDevice_2/configureDevice_2.js +++ b/components/configureDevice_2/configureDevice_2.js @@ -250,8 +250,11 @@ Component({ syncIndex++; syncNext(); } else { - wx.hideLoading(); - wx.showToast({ title: "用户信息下发失败,请重试。", icon: "none" }); + // wx.hideLoading(); + // wx.showToast({ title: "用户信息下发失败,请重试。", icon: "none" }); + + // 失败自动重试当前用户 + syncNext(); } }); }; diff --git a/components/configureDevice_2/configureDevice_2.wxml b/components/configureDevice_2/configureDevice_2.wxml index 3df8a2f..a3ed9c8 100644 --- a/components/configureDevice_2/configureDevice_2.wxml +++ b/components/configureDevice_2/configureDevice_2.wxml @@ -1,7 +1,7 @@ - 智能蓝牙秤 + 智能蓝牙秤 型号:{{device.name}} diff --git a/components/configureDevice_3/configureDevice_3.js b/components/configureDevice_3/configureDevice_3.js index f405b95..9b27031 100644 --- a/components/configureDevice_3/configureDevice_3.js +++ b/components/configureDevice_3/configureDevice_3.js @@ -3,7 +3,8 @@ const app = getApp(); Component({ data: { progress: 0, - + // loading=正在获取,failed=获取失败,success=获取成功 + wifiStatus: 'loading', wifiList: [], selectWifi: null, @@ -23,21 +24,19 @@ Component({ // 组件的方法 methods: { initWifi() { - wx.showLoading({ title: "正在获取Wi-Fi列表...", mask: true }); + this.setData({ wifiStatus: 'loading' }); const activeProtocol = app.globalData.ppScale.activeProtocol; if (!activeProtocol) { - wx.hideLoading(); - wx.showToast({ title: '设备未连接,请重试', icon: 'none' }); + this.setData({ wifiStatus: 'failed' }); return; } activeProtocol.dataFindSurroundDevice((res) => { - wx.hideLoading(); if (!Array.isArray(res)) { - // 获取失败,自动重试 - this.initWifi(); + // 获取失败,显示失败状态,等待用户手动点击重试 + this.setData({ wifiStatus: 'failed' }); return; } - this.setData({ wifiList: res }); + this.setData({ wifiList: res, wifiStatus: 'success' }); }); }, @@ -45,6 +44,7 @@ Component({ reInitWifi() { this.setData({ progress: 0, + wifiStatus: 'loading', wifiList: [], selectWifi: null, selectWifiPWD: "" diff --git a/components/configureDevice_3/configureDevice_3.wxml b/components/configureDevice_3/configureDevice_3.wxml index f58830b..1438066 100644 --- a/components/configureDevice_3/configureDevice_3.wxml +++ b/components/configureDevice_3/configureDevice_3.wxml @@ -22,11 +22,16 @@ - + - 暂无WIFI数据,点击重新获取 + + 正在获取WiFi列表中... + + + 获取WiFi失败,点击重试 + diff --git a/pages/configureDevice/configureDevice.js b/pages/configureDevice/configureDevice.js index ba9dfa1..d4495c8 100644 --- a/pages/configureDevice/configureDevice.js +++ b/pages/configureDevice/configureDevice.js @@ -170,14 +170,14 @@ Page({ setTimeout(() => { const comp = this.selectComponent('#configureDevice3'); if (comp) comp.initWifi(); - }, 100); + }, 1000); } // 进入步骤3(OTA升级)时,等待组件渲染完成后由父页面显式触发升级 if (newIndex === 3) { setTimeout(() => { const comp = this.selectComponent('#configureDevice4'); if (comp) comp.startOtaUpgrade(); - }, 100); + }, 1000); } },