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); } },