feat(equipment): 实现设备管理页面,新增运维模式与配对/补传弹框
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.7
parent
3a67b26ed6
commit
eaec08a6e4
@@ -1,66 +1,79 @@
|
||||
// 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: ''
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad() {
|
||||
|
||||
/** 取消配对:使用小程序自带 showModal */
|
||||
onTapUnpair() {
|
||||
wx.showModal({
|
||||
title: '取消配对',
|
||||
content: '是否确认取消配对当前设备?',
|
||||
cancelText: '取消',
|
||||
confirmText: '确定',
|
||||
confirmColor: '#F24439'
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady() {
|
||||
|
||||
/** 底部操作:数据补传 / 设备连接 弹 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请勿离开...'
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {
|
||||
|
||||
onCloseLoading() {
|
||||
this.setData({ loadingShow: false })
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide() {
|
||||
|
||||
onTapAdd() {
|
||||
// 添加设备(待接入)
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload() {
|
||||
|
||||
/** 关闭运维模式 */
|
||||
onCloseOps() {
|
||||
// 关闭运维模式(待接入)
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage() {
|
||||
|
||||
/** 取消全部配对 */
|
||||
onUnpairAll() {
|
||||
wx.showModal({
|
||||
title: '取消全部配对',
|
||||
content: '是否确认取消全部设备的配对?',
|
||||
cancelText: '取消',
|
||||
confirmText: '确定',
|
||||
confirmColor: '#F24439'
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user