// pages/equipment/equipment.ts Page({ data: { devices: [ { id: 1, name: '家庭蓝牙体脂秤 S1', status: '已连接', connected: true, model: 'BS-A100', serial: 'BL2024A00158', }, { id: 2, name: '家庭蓝牙体脂秤 S1', status: '未连接', connected: false, model: 'BW-B200', serial: 'BL2024B00321', } ], loadingShow: true, loadingTitle: '正在连接设备', loadingContent: '请确保设备处于开启状态\n请勿离开...' }, /** 取消配对:使用小程序自带 showModal */ onTapUnpair() { wx.showModal({ title: '取消配对', content: '是否确认取消配对当前设备?', cancelText: '取消', confirmText: '确定', confirmColor: '#F24439' }) }, /** 底部操作:数据补传 / 设备连接 弹 loading */ onTapAction(e: WechatMiniprogram.TouchEvent) { const action = e.currentTarget.dataset.action as string if (action === '数据补传') { this.setData({ loadingShow: true, loadingTitle: '正在获取设备本地未上传数据', loadingContent: '请稍等...' }) } else if (action === '设备连接') { this.setData({ loadingShow: true, loadingTitle: '正在连接设备', loadingContent: '请确保设备处于开启状态\n请勿离开...' }) } }, onCloseLoading() { this.setData({ loadingShow: false }) }, onTapAdd() { // 添加设备(待接入) }, /** 关闭运维模式 */ onCloseOps() { // 关闭运维模式(待接入) }, /** 取消全部配对 */ onUnpairAll() { wx.showModal({ title: '取消全部配对', content: '是否确认取消全部设备的配对?', cancelText: '取消', confirmText: '确定', confirmColor: '#F24439' }) } })