Files
bodyWeight/components/replaceNetwork_1/replaceNetwork_1.js
T
17792275749 de8fa1fca8 [AI Generated]: refactor(*): 保活定时器与连接清理逻辑收口至 app.js,修复 null 安全与注释错误
- 新增 app.startKeepAlive/stopKeepAlive/cleanupConnection,bus 监听自动控制保活与断联清理
- Blue.stop() 收入 cleanupConnection,页面 onHide/onUnload 统一调用
- 修复 replaceNetwork.js seviceList 可能为 undefined 导致崩溃
- 修复 configureDevice_2.js device.mac 为 null 时崩溃
- 修复 replaceNetwork_1.js activeProtocol 无 null 检查及 wifiList 容错
- 修正 configureDevice_4.js 超时注释(3分钟→30秒)
2026-04-08 14:56:48 +08:00

45 lines
1.1 KiB
JavaScript

const app = getApp();
Component({
data: {
wifiList: []
},
// 生命周期方法
lifetimes: {
attached() {
},
detached() {
}
},
// 组件的方法
methods: {
getWiFiList() {
wx.showLoading({
title: "正在获取Wi-Fi列表...",
mask: true
});
const activeProtocol = app.globalData.ppScale.activeProtocol;
if (!activeProtocol) {
wx.hideLoading();
wx.showToast({ title: '设备未连接,请重试', icon: 'none' });
return;
}
activeProtocol.dataFindSurroundDevice((res) => {
console.log("connectedDevice ===》dataFindSurroundDevice", res);
wx.hideLoading();
this.setData({ wifiList: Array.isArray(res) ? res : [] });
});
},
selectDevice(e) {
this.triggerEvent('wifiEvent', {
status: true,
data: e.currentTarget.dataset.item
});
}
}
});