From 52c4a0b436dce447bb10a8cce9413f5a7e59fa4d Mon Sep 17 00:00:00 2001 From: fengerli <528575642@qq.com> Date: Wed, 30 Jul 2025 09:34:53 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=BE=E5=A4=87=E5=9B=BE=E7=89=87=E8=87=AA?= =?UTF-8?q?=E9=80=82=E5=BA=94=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/6170/allShare/index.vue | 4 +- pages/6170/deviceControl/index.vue | 79 ++++++++++++++++------------ pages/6170/shareDevices/index.vue | 4 +- pages/6170/shareManagement/index.vue | 2 +- pages/common/index/index.vue | 4 +- pages/common/send/index.vue | 2 +- 6 files changed, 53 insertions(+), 42 deletions(-) diff --git a/pages/6170/allShare/index.vue b/pages/6170/allShare/index.vue index 8d60e92..4cdfb9d 100644 --- a/pages/6170/allShare/index.vue +++ b/pages/6170/allShare/index.vue @@ -33,7 +33,7 @@ - + 设备:{{item.deviceName}} @@ -67,7 +67,7 @@ - + {{ tabs[activeTab].name === '我的分享' ? '确定停止分享该设备' : '确定移除他人分享给你的这台设备' }} diff --git a/pages/6170/deviceControl/index.vue b/pages/6170/deviceControl/index.vue index bf0db50..8c96320 100644 --- a/pages/6170/deviceControl/index.vue +++ b/pages/6170/deviceControl/index.vue @@ -12,7 +12,7 @@ - + @@ -23,7 +23,7 @@ - + 1小时 续航时间 @@ -61,7 +61,7 @@ - @@ -80,7 +80,7 @@ - + 激光模式 @@ -88,7 +88,7 @@ - + 开机画面 上传 @@ -143,22 +143,22 @@ 产品信息 - + 产品参数 - + 操作说明 - + 操作视频 - + @@ -178,9 +178,9 @@ - + - + 上传开机画面 @@ -204,9 +204,9 @@ - + - + 确认开启激光模式? @@ -220,7 +220,7 @@ - + @@ -255,9 +255,9 @@ secondaryMode: 'string', navBarHeight: 70 + uni.getSystemInfoSync().statusBarHeight, navTitle: "", - sliderValue: 50, + sliderValue: 30, lightModeA: false, - currentMainMode: '强光模式', + currentMainMode: '强光', lightModeB: false, lightModeC: false, //激光提示框 items: [], @@ -288,7 +288,8 @@ popupConfirmText: '确认', showUploadPopup: false, selectedImage: null, // 添加这个变量来存储选择的图片 - file: '' + file: '', + selectedItemIndex: 0 } }, computed: { @@ -319,22 +320,22 @@ if (type === 'main') { this.items = [{ text: '强光', - selected: this.currentMainMode === '强光模式', - image: '/static/images/sett.png' + selected: this.currentMainMode === '强光', // 修正匹配条件 + image: '/static/images/sett.png', }, { text: '弱光', - selected: this.currentMainMode === '弱光模式', + selected: this.currentMainMode === '弱光', image: '/static/images/sett.png' }, { text: '爆闪', - selected: this.currentMainMode === '爆闪模式', + selected: this.currentMainMode === '爆闪', image: '/static/images/bs.png' }, { text: '泛光', - selected: this.currentMainMode === '泛光模式', + selected: this.currentMainMode === '泛光', image: '/static/images/settt.png' }, ]; @@ -365,18 +366,28 @@ }, // 灯光模式的确认 handleSumbit() { - if (this.selectedItemIndex === null) return; - const selectedItem = this.items[this.selectedItemIndex]; - const instruction = this.modeInstructions[selectedItem.text]; - console.log(selectedItem, 'selectedItemselectedItem'); - this.selectedItemIndex = selectedItem.text; - if (instruction) { - const topic = `B/${this.itemInfo.deviceImei}`; - const message = JSON.stringify(instruction); - this.mqttClient.publish(topic, message); - console.log('已发送指令:', instruction); - } - this.lightModeA = false; + if (this.selectedItemIndex === null) return; + const selectedItem = this.items[this.selectedItemIndex]; + const instruction = this.modeInstructions[selectedItem.text]; + console.log(selectedItem, 'selectedItemselectedItem'); + // 修正这里的赋值错误,应该保存索引而不是文本 + this.selectedItemIndex = this.selectedItemIndex; + console.log(this.selectedItemIndex,'this.selectedItemIndexthis.selectedItemIndex'); + // if (instruction) { + // const topic = `B/${this.itemInfo.deviceImei}`; + // const message = JSON.stringify(instruction); + // // 确保mqttClient已连接 + // if (this.mqttClient && this.mqttClient.client && this.mqttClient.client.isConnected()) { + // this.mqttClient.publish(topic, message); + // console.log('已发送指令:', instruction); + // } else { + // uni.showToast({ + // title: 'MQTT未连接', + // icon: 'none' + // }); + // } + // } + this.lightModeA = false; }, // 上传开机画面 uploadStartup() { diff --git a/pages/6170/shareDevices/index.vue b/pages/6170/shareDevices/index.vue index 1ec3e4b..8766f08 100644 --- a/pages/6170/shareDevices/index.vue +++ b/pages/6170/shareDevices/index.vue @@ -4,7 +4,7 @@ - + 设备:{{itemInfo.deviceName}} @@ -48,7 +48,7 @@ - + 设备分享成功 diff --git a/pages/6170/shareManagement/index.vue b/pages/6170/shareManagement/index.vue index 46b862a..91e7a96 100644 --- a/pages/6170/shareManagement/index.vue +++ b/pages/6170/shareManagement/index.vue @@ -4,7 +4,7 @@ - + 用户名:{{item.deviceName}} diff --git a/pages/common/index/index.vue b/pages/common/index/index.vue index 3a135e9..ac6cf8a 100644 --- a/pages/common/index/index.vue +++ b/pages/common/index/index.vue @@ -31,7 +31,7 @@ - + 设备:{{item.deviceName}} @@ -49,7 +49,7 @@ 未连接 - + diff --git a/pages/common/send/index.vue b/pages/common/send/index.vue index 40534bf..3e85cb9 100644 --- a/pages/common/send/index.vue +++ b/pages/common/send/index.vue @@ -11,7 +11,7 @@ - + 设备:{{item.deviceName}}