关闭灯光
This commit is contained in:
@ -48,7 +48,11 @@
|
||||
<text class="info-label">定位信息</text>
|
||||
<view class="info-value status-running" @click="gpsPosition">
|
||||
<view class="info-value status-running">114.72 30.28</view>
|
||||
<view class="info-value status-running">深圳市龙华区富源晟</view>
|
||||
<view class="info-value status-running">
|
||||
<uni-icons @click="toggleForm" type="location" size="17"
|
||||
color="rgba(255, 255, 255, 0.8)" style="vertical-align: bottom;" />
|
||||
深圳市龙华区富源晟
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
@ -194,7 +198,6 @@
|
||||
<image v-else mode="aspectFit" class="img"
|
||||
src="/static/images/6155/DeviceDetail/add.png"></image>
|
||||
</view>
|
||||
<!-- <view class="example_title">点击上传图片</view> -->
|
||||
</view>
|
||||
</view>
|
||||
<!-- 按钮组 -->
|
||||
@ -237,7 +240,11 @@
|
||||
deviceDetail,
|
||||
registerPersonInfo,
|
||||
deviceSendMessage,
|
||||
deviceShareId
|
||||
deviceShareId,
|
||||
lightModeSettings, //灯光模式设置
|
||||
laserModeSettings, //激光模式设置
|
||||
lightBrightnessSettings, //灯光亮度设置
|
||||
mapReverseGeocoding //地图逆解析
|
||||
} from '@/api/6170/deviceControl.js'
|
||||
import {
|
||||
getDeviceId
|
||||
@ -273,13 +280,7 @@
|
||||
code: '',
|
||||
},
|
||||
deviceInfo: {},
|
||||
modeInstructions: {
|
||||
'关灯': [1, 0, 0, 0, 0],
|
||||
'强光': [1, 1, 0, 0, 0],
|
||||
'弱光': [1, 2, 0, 0, 0],
|
||||
'爆闪': [1, 3, 0, 0, 0],
|
||||
'泛光': [1, 4, 0, 0, 0]
|
||||
},
|
||||
|
||||
activePermissions: [], // 存储当前设备的权限数组
|
||||
isSharedDevice: false, // 标记是否来自分享
|
||||
isRightIconVisible: false,
|
||||
@ -312,7 +313,19 @@
|
||||
},
|
||||
// ***********进度条***********
|
||||
onSliderChanging(e) {
|
||||
console.log('这是我滑动的吗');
|
||||
this.sliderValue = e.detail.value;
|
||||
let data = {
|
||||
deviceld: this.deviceID,
|
||||
instructValue: this.sliderValue + '.00'
|
||||
}
|
||||
lightBrightnessSettings(data).then((res) => {
|
||||
if (res.code == 200) {
|
||||
|
||||
} else {
|
||||
|
||||
}
|
||||
})
|
||||
},
|
||||
selectMode(type) {
|
||||
this.modeType = type;
|
||||
@ -322,29 +335,36 @@
|
||||
text: '强光',
|
||||
selected: this.currentMainMode === '强光', // 修正匹配条件
|
||||
image: '/static/images/sett.png',
|
||||
instructValue: '1'
|
||||
},
|
||||
{
|
||||
text: '弱光',
|
||||
selected: this.currentMainMode === '弱光',
|
||||
image: '/static/images/sett.png'
|
||||
image: '/static/images/rg.png',
|
||||
instructValue: '2'
|
||||
},
|
||||
{
|
||||
text: '爆闪',
|
||||
selected: this.currentMainMode === '爆闪',
|
||||
image: '/static/images/bs.png'
|
||||
image: '/static/images/bs.png',
|
||||
instructValue: '3'
|
||||
},
|
||||
{
|
||||
text: '泛光',
|
||||
selected: this.currentMainMode === '泛光',
|
||||
image: '/static/images/settt.png'
|
||||
image: '/static/images/settt.png',
|
||||
instructValue: '4'
|
||||
},
|
||||
{
|
||||
text: '关闭',
|
||||
selected: this.currentMainMode === '关闭',
|
||||
image: '/static/images/close.png',
|
||||
instructValue: '0'
|
||||
},
|
||||
];
|
||||
}
|
||||
},
|
||||
// 激光模式
|
||||
lasermode() {
|
||||
this.lightModeC = true
|
||||
},
|
||||
// 人员信息登录
|
||||
toggleForm() {
|
||||
this.isFormExpanded = !this.isFormExpanded;
|
||||
},
|
||||
@ -366,28 +386,59 @@
|
||||
},
|
||||
// 灯光模式的确认
|
||||
handleSumbit() {
|
||||
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;
|
||||
if (this.selectedItemIndex === null) return;
|
||||
const selectedItem = this.items[this.selectedItemIndex];
|
||||
console.log(selectedItem, 'selectedItemselectedItem');
|
||||
// 修正这里的赋值错误,应该保存索引而不是文本
|
||||
this.selectedItemIndex = this.selectedItemIndex;
|
||||
let data = {
|
||||
deviceld: this.deviceID,
|
||||
instructValue: selectedItem.instructValue
|
||||
}
|
||||
lightModeSettings(data).then((res) => {
|
||||
if (res.code == 200) {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: res.msg
|
||||
})
|
||||
this.lightModeA = false;
|
||||
} else {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: res.msg
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
// 激光模式
|
||||
lasermode() {
|
||||
this.lightModeC = true
|
||||
},
|
||||
// 激光确认框提交
|
||||
handleBtn() {
|
||||
let data = {
|
||||
deviceld: this.deviceID,
|
||||
instructValue: 1
|
||||
}
|
||||
laserModeSettings(data).then((res) => {
|
||||
if (res.code == 200) {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: res.msg
|
||||
})
|
||||
this.lightModeC = false
|
||||
} else {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: res.msg
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
},
|
||||
//激光取消
|
||||
handleDisagree() {
|
||||
this.lightModeC = false
|
||||
},
|
||||
// 上传开机画面
|
||||
uploadStartup() {
|
||||
@ -509,31 +560,9 @@
|
||||
})
|
||||
|
||||
},
|
||||
// 激光确认框
|
||||
handleBtn() {
|
||||
this.lightModeC = false
|
||||
},
|
||||
//取消
|
||||
handleDisagree() {
|
||||
this.lightModeC = false
|
||||
},
|
||||
|
||||
// 发送人员信息
|
||||
sendPersonnelInfo() {
|
||||
// if (!this.mqttClient || !this.mqttClient.client.isConnected()) {
|
||||
// uni.showToast({
|
||||
// title: 'MQTT未连接',
|
||||
// icon: 'none'
|
||||
// });
|
||||
// return;
|
||||
// }
|
||||
// const topic = `device/command/${this.deviceID}/personnel`;
|
||||
// const message = JSON.stringify(this.personnelInfo);
|
||||
// this.mqttClient.publish(topic, message);
|
||||
// uni.showToast({
|
||||
// title: '人员信息已发送',
|
||||
// icon: 'success'
|
||||
// });
|
||||
|
||||
if (!this.personnelInfo.unitName) {
|
||||
uni.showToast({
|
||||
title: '单位名称不能为空',
|
||||
@ -703,7 +732,7 @@
|
||||
this.mqttClient.connect(() => {
|
||||
console.log('MQTT 连接成功,开始订阅主题');
|
||||
// 订阅来自设备的状态更新
|
||||
const statusTopic = `A/${this.itemInfo.deviceImei}`;
|
||||
const statusTopic = `A/${this.itemInfo.nnnnnnnnnnnnnnnnnnn}`;
|
||||
this.mqttClient.subscribe(statusTopic, (payload) => {
|
||||
console.log(`收到来自 ${statusTopic} 的消息:`, payload);
|
||||
// uni.showModal({
|
||||
@ -711,6 +740,11 @@
|
||||
// content: payload,
|
||||
// showCancel: false
|
||||
// });
|
||||
// ✅ 发送全局事件通知主页面更新
|
||||
uni.$emit('deviceStatusUpdate', {
|
||||
message: JSON.stringify(payload), // 消息内容
|
||||
timestamp: new Date().getTime() // 时间戳
|
||||
});
|
||||
});
|
||||
});
|
||||
if (this.apiType === 'listA') {
|
||||
@ -721,7 +755,9 @@
|
||||
|
||||
});
|
||||
// 如果需要向调用页面返回数据,可以触发 'ack' 事件
|
||||
eventChannel.emit('ack', {})
|
||||
eventChannel.emit('ack', {
|
||||
|
||||
})
|
||||
|
||||
},
|
||||
onUnload() {
|
||||
@ -796,7 +832,6 @@
|
||||
width: 204rpx;
|
||||
height: 144rpx;
|
||||
margin-top: 30rpx;
|
||||
object-fit: contain;
|
||||
}
|
||||
|
||||
.dlIMG {
|
||||
@ -1100,7 +1135,7 @@
|
||||
/* 弹窗主体 */
|
||||
.agreement-popup {
|
||||
width: 100%;
|
||||
height: 40%;
|
||||
height: 50%;
|
||||
background-color: rgb(42, 42, 42);
|
||||
border-radius: 60rpx 60rpx 0rpx 0rpx;
|
||||
padding: 40rpx;
|
||||
|
Reference in New Issue
Block a user