关闭灯光
This commit is contained in:
@ -29,3 +29,36 @@ export function deviceSendMessage(data) {
|
||||
data: data
|
||||
})
|
||||
}
|
||||
// 灯光模式设置
|
||||
export function lightModeSettings(data) {
|
||||
return request({
|
||||
url: `/app/device/lightModeSettings`,
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
// 激光模式设置
|
||||
export function laserModeSettings(data) {
|
||||
return request({
|
||||
url: `/app/device/laserModeSettings`,
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
// 灯光亮度设置
|
||||
|
||||
export function lightBrightnessSettings(data) {
|
||||
return request({
|
||||
url: `/app/device/lightBrightnessSettings`,
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
// 地图逆解析
|
||||
export function mapReverseGeocoding(data) {
|
||||
return request({
|
||||
url: `/app/device/mapReverseGeocoding`,
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
@ -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;
|
||||
|
@ -5,17 +5,19 @@
|
||||
rightIcon="/static/images/add.png" @right-click="scan"></custom-navbar>
|
||||
<view class="device-page" :style="{ paddingTop: navBarHeight + 'px' }">
|
||||
<!-- handleSend 发送信息 -->
|
||||
<scroll-view class="tab-bar" scroll-x="true" scroll-with-animation>
|
||||
<view class="tab-container">
|
||||
<view v-for="(tab, index) in tabs" :key="index"
|
||||
:class="['tab-item', activeTab === index ? 'active' : '']" @click="switchTab(tab,index)">
|
||||
{{tab.typeName}}
|
||||
<view class="tab-bar-wrap">
|
||||
<scroll-view class="tab-bar" scroll-x="true" scroll-with-animation>
|
||||
<view class="tab-container">
|
||||
<view v-for="(tab, index) in tabs" :key="index"
|
||||
:class="['tab-item', activeTab === index ? 'active' : '']" @click="switchTab(tab,index)">
|
||||
{{tab.typeName}}
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<view class="tab-more" @click="allMore">
|
||||
<image src="/static/images/more.png" mode="aspectFit" class="more"></image>
|
||||
</view>
|
||||
<view class="uniui-more">
|
||||
<image @click="allMore" src="/static/images/more.png" mode="" class="more"></image>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
<view class="sendFlex" v-if="activeTab && activeTab.id !== ''&& activeTabInfo.communicationMode==0">
|
||||
<!-- <view class="callpolice">报警</view> -->
|
||||
<view class="Sendmessage" @click="location">位置</view>
|
||||
@ -346,6 +348,7 @@
|
||||
});
|
||||
setTimeout(() => {
|
||||
this.onIntall();
|
||||
this.getTab()
|
||||
}, 500);
|
||||
this.deleteShow = false
|
||||
// 关闭所有滑动项
|
||||
@ -439,9 +442,7 @@
|
||||
uni.navigateTo({
|
||||
url: "/pages/6155/deviceDetail",
|
||||
events: {
|
||||
ack: function(data) {
|
||||
|
||||
}
|
||||
ack: function(data) {}
|
||||
},
|
||||
success: (res) => {
|
||||
res.eventChannel.emit('detailData', {
|
||||
@ -450,14 +451,28 @@
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
onIntall() {
|
||||
this.page = 1;
|
||||
this.finished = false;
|
||||
this.getData(this.deviceType); // 重新加载第一页数据
|
||||
},
|
||||
updateDeviceStatus(data) {
|
||||
// 只更新 communicationMode == 0 的设备
|
||||
this.deviceList = this.deviceList.map(item => {
|
||||
console.log(item,'item2222');
|
||||
if (item.communicationMode === 0) {
|
||||
// 这里根据消息内容更新设备状态
|
||||
// 示例:如果消息包含特定字段,则更新设备状态
|
||||
return {
|
||||
...item,
|
||||
//status: data.message.status || item.status, // 假设消息中有status字段
|
||||
lastUpdate: data.timestamp // 更新时间戳
|
||||
};
|
||||
}
|
||||
return item;
|
||||
});
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
this.getTab()
|
||||
@ -472,6 +487,17 @@
|
||||
// 组件销毁前移除监听器
|
||||
uni.$off('refreshDeviceList');
|
||||
},
|
||||
onShow() {
|
||||
// 监听设备状态更新事件
|
||||
uni.$on('deviceStatusUpdate', (data) => {
|
||||
console.log('收到设备状态更新通知:', data);
|
||||
this.updateDeviceStatus(data);
|
||||
});
|
||||
},
|
||||
onHide() {
|
||||
// 页面隐藏时取消监听,避免内存泄漏
|
||||
uni.$off('deviceStatusUpdate');
|
||||
},
|
||||
|
||||
}
|
||||
</script>
|
||||
@ -498,11 +524,10 @@
|
||||
|
||||
.tab-container {
|
||||
display: flex;
|
||||
/* justify-content: space-around; */
|
||||
cursor: pointer;
|
||||
margin-bottom: 40rpx;
|
||||
/* min-width: 100%; */
|
||||
/* 最小宽度 */
|
||||
padding-right: 80rpx;
|
||||
/* 预留更多按钮空间 */
|
||||
}
|
||||
|
||||
.tab-item {
|
||||
@ -530,19 +555,26 @@
|
||||
font-size: 28rpx;
|
||||
}
|
||||
|
||||
.uniui-more {
|
||||
.tab-bar-wrap {
|
||||
display: flex;
|
||||
/* 横向排列 */
|
||||
align-items: baseline;
|
||||
/* 垂直居中 */
|
||||
position: relative;
|
||||
width: 100%;
|
||||
/* 可选(若需要绝对定位 fallback) */
|
||||
}
|
||||
|
||||
.tab-more {
|
||||
margin-left: 10rpx;
|
||||
/* 与Tab的间距 */
|
||||
display: flex;
|
||||
align-items: center;
|
||||
background: linear-gradient(-88.60deg, rgba(18, 18, 18, 1), rgba(18, 18, 18, 0) 100%);
|
||||
}
|
||||
|
||||
.more {
|
||||
width: 40rpx;
|
||||
height: 8rpx;
|
||||
/* position: absolute; */
|
||||
/* right: 0rpx;
|
||||
z-index: 100; */
|
||||
float: right;
|
||||
top: -95rpx
|
||||
}
|
||||
|
||||
.gprs {
|
||||
|
@ -61,7 +61,7 @@
|
||||
data() {
|
||||
return {
|
||||
showView: false,
|
||||
phone: '13058067817', //手机号码
|
||||
phone: '13800138001', //手机号码
|
||||
code: "", //验证码
|
||||
agreed: false,
|
||||
isCounting: false,
|
||||
|
BIN
static/images/close.png
Normal file
BIN
static/images/close.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 474 B |
BIN
static/images/rg.png
Normal file
BIN
static/images/rg.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 597 B |
Reference in New Issue
Block a user