关闭灯光
This commit is contained in:
@ -29,3 +29,36 @@ export function deviceSendMessage(data) {
|
|||||||
data: 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>
|
<text class="info-label">定位信息</text>
|
||||||
<view class="info-value status-running" @click="gpsPosition">
|
<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">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>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
@ -194,7 +198,6 @@
|
|||||||
<image v-else mode="aspectFit" class="img"
|
<image v-else mode="aspectFit" class="img"
|
||||||
src="/static/images/6155/DeviceDetail/add.png"></image>
|
src="/static/images/6155/DeviceDetail/add.png"></image>
|
||||||
</view>
|
</view>
|
||||||
<!-- <view class="example_title">点击上传图片</view> -->
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- 按钮组 -->
|
<!-- 按钮组 -->
|
||||||
@ -237,7 +240,11 @@
|
|||||||
deviceDetail,
|
deviceDetail,
|
||||||
registerPersonInfo,
|
registerPersonInfo,
|
||||||
deviceSendMessage,
|
deviceSendMessage,
|
||||||
deviceShareId
|
deviceShareId,
|
||||||
|
lightModeSettings, //灯光模式设置
|
||||||
|
laserModeSettings, //激光模式设置
|
||||||
|
lightBrightnessSettings, //灯光亮度设置
|
||||||
|
mapReverseGeocoding //地图逆解析
|
||||||
} from '@/api/6170/deviceControl.js'
|
} from '@/api/6170/deviceControl.js'
|
||||||
import {
|
import {
|
||||||
getDeviceId
|
getDeviceId
|
||||||
@ -273,13 +280,7 @@
|
|||||||
code: '',
|
code: '',
|
||||||
},
|
},
|
||||||
deviceInfo: {},
|
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: [], // 存储当前设备的权限数组
|
activePermissions: [], // 存储当前设备的权限数组
|
||||||
isSharedDevice: false, // 标记是否来自分享
|
isSharedDevice: false, // 标记是否来自分享
|
||||||
isRightIconVisible: false,
|
isRightIconVisible: false,
|
||||||
@ -312,7 +313,19 @@
|
|||||||
},
|
},
|
||||||
// ***********进度条***********
|
// ***********进度条***********
|
||||||
onSliderChanging(e) {
|
onSliderChanging(e) {
|
||||||
|
console.log('这是我滑动的吗');
|
||||||
this.sliderValue = e.detail.value;
|
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) {
|
selectMode(type) {
|
||||||
this.modeType = type;
|
this.modeType = type;
|
||||||
@ -322,29 +335,36 @@
|
|||||||
text: '强光',
|
text: '强光',
|
||||||
selected: this.currentMainMode === '强光', // 修正匹配条件
|
selected: this.currentMainMode === '强光', // 修正匹配条件
|
||||||
image: '/static/images/sett.png',
|
image: '/static/images/sett.png',
|
||||||
|
instructValue: '1'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
text: '弱光',
|
text: '弱光',
|
||||||
selected: this.currentMainMode === '弱光',
|
selected: this.currentMainMode === '弱光',
|
||||||
image: '/static/images/sett.png'
|
image: '/static/images/rg.png',
|
||||||
|
instructValue: '2'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
text: '爆闪',
|
text: '爆闪',
|
||||||
selected: this.currentMainMode === '爆闪',
|
selected: this.currentMainMode === '爆闪',
|
||||||
image: '/static/images/bs.png'
|
image: '/static/images/bs.png',
|
||||||
|
instructValue: '3'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
text: '泛光',
|
text: '泛光',
|
||||||
selected: this.currentMainMode === '泛光',
|
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() {
|
toggleForm() {
|
||||||
this.isFormExpanded = !this.isFormExpanded;
|
this.isFormExpanded = !this.isFormExpanded;
|
||||||
},
|
},
|
||||||
@ -366,28 +386,59 @@
|
|||||||
},
|
},
|
||||||
// 灯光模式的确认
|
// 灯光模式的确认
|
||||||
handleSumbit() {
|
handleSumbit() {
|
||||||
if (this.selectedItemIndex === null) return;
|
if (this.selectedItemIndex === null) return;
|
||||||
const selectedItem = this.items[this.selectedItemIndex];
|
const selectedItem = this.items[this.selectedItemIndex];
|
||||||
const instruction = this.modeInstructions[selectedItem.text];
|
console.log(selectedItem, 'selectedItemselectedItem');
|
||||||
console.log(selectedItem, 'selectedItemselectedItem');
|
// 修正这里的赋值错误,应该保存索引而不是文本
|
||||||
// 修正这里的赋值错误,应该保存索引而不是文本
|
this.selectedItemIndex = this.selectedItemIndex;
|
||||||
this.selectedItemIndex = this.selectedItemIndex;
|
let data = {
|
||||||
console.log(this.selectedItemIndex,'this.selectedItemIndexthis.selectedItemIndex');
|
deviceld: this.deviceID,
|
||||||
// if (instruction) {
|
instructValue: selectedItem.instructValue
|
||||||
// const topic = `B/${this.itemInfo.deviceImei}`;
|
}
|
||||||
// const message = JSON.stringify(instruction);
|
lightModeSettings(data).then((res) => {
|
||||||
// // 确保mqttClient已连接
|
if (res.code == 200) {
|
||||||
// if (this.mqttClient && this.mqttClient.client && this.mqttClient.client.isConnected()) {
|
uni.showToast({
|
||||||
// this.mqttClient.publish(topic, message);
|
icon: 'none',
|
||||||
// console.log('已发送指令:', instruction);
|
title: res.msg
|
||||||
// } else {
|
})
|
||||||
// uni.showToast({
|
this.lightModeA = false;
|
||||||
// title: 'MQTT未连接',
|
} else {
|
||||||
// icon: 'none'
|
uni.showToast({
|
||||||
// });
|
icon: 'none',
|
||||||
// }
|
title: res.msg
|
||||||
// }
|
})
|
||||||
this.lightModeA = false;
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 激光模式
|
||||||
|
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() {
|
uploadStartup() {
|
||||||
@ -509,31 +560,9 @@
|
|||||||
})
|
})
|
||||||
|
|
||||||
},
|
},
|
||||||
// 激光确认框
|
|
||||||
handleBtn() {
|
|
||||||
this.lightModeC = false
|
|
||||||
},
|
|
||||||
//取消
|
|
||||||
handleDisagree() {
|
|
||||||
this.lightModeC = false
|
|
||||||
},
|
|
||||||
// 发送人员信息
|
// 发送人员信息
|
||||||
sendPersonnelInfo() {
|
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) {
|
if (!this.personnelInfo.unitName) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '单位名称不能为空',
|
title: '单位名称不能为空',
|
||||||
@ -703,7 +732,7 @@
|
|||||||
this.mqttClient.connect(() => {
|
this.mqttClient.connect(() => {
|
||||||
console.log('MQTT 连接成功,开始订阅主题');
|
console.log('MQTT 连接成功,开始订阅主题');
|
||||||
// 订阅来自设备的状态更新
|
// 订阅来自设备的状态更新
|
||||||
const statusTopic = `A/${this.itemInfo.deviceImei}`;
|
const statusTopic = `A/${this.itemInfo.nnnnnnnnnnnnnnnnnnn}`;
|
||||||
this.mqttClient.subscribe(statusTopic, (payload) => {
|
this.mqttClient.subscribe(statusTopic, (payload) => {
|
||||||
console.log(`收到来自 ${statusTopic} 的消息:`, payload);
|
console.log(`收到来自 ${statusTopic} 的消息:`, payload);
|
||||||
// uni.showModal({
|
// uni.showModal({
|
||||||
@ -711,6 +740,11 @@
|
|||||||
// content: payload,
|
// content: payload,
|
||||||
// showCancel: false
|
// showCancel: false
|
||||||
// });
|
// });
|
||||||
|
// ✅ 发送全局事件通知主页面更新
|
||||||
|
uni.$emit('deviceStatusUpdate', {
|
||||||
|
message: JSON.stringify(payload), // 消息内容
|
||||||
|
timestamp: new Date().getTime() // 时间戳
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
if (this.apiType === 'listA') {
|
if (this.apiType === 'listA') {
|
||||||
@ -721,7 +755,9 @@
|
|||||||
|
|
||||||
});
|
});
|
||||||
// 如果需要向调用页面返回数据,可以触发 'ack' 事件
|
// 如果需要向调用页面返回数据,可以触发 'ack' 事件
|
||||||
eventChannel.emit('ack', {})
|
eventChannel.emit('ack', {
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
},
|
},
|
||||||
onUnload() {
|
onUnload() {
|
||||||
@ -796,7 +832,6 @@
|
|||||||
width: 204rpx;
|
width: 204rpx;
|
||||||
height: 144rpx;
|
height: 144rpx;
|
||||||
margin-top: 30rpx;
|
margin-top: 30rpx;
|
||||||
object-fit: contain;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.dlIMG {
|
.dlIMG {
|
||||||
@ -1100,7 +1135,7 @@
|
|||||||
/* 弹窗主体 */
|
/* 弹窗主体 */
|
||||||
.agreement-popup {
|
.agreement-popup {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 40%;
|
height: 50%;
|
||||||
background-color: rgb(42, 42, 42);
|
background-color: rgb(42, 42, 42);
|
||||||
border-radius: 60rpx 60rpx 0rpx 0rpx;
|
border-radius: 60rpx 60rpx 0rpx 0rpx;
|
||||||
padding: 40rpx;
|
padding: 40rpx;
|
||||||
|
@ -5,17 +5,19 @@
|
|||||||
rightIcon="/static/images/add.png" @right-click="scan"></custom-navbar>
|
rightIcon="/static/images/add.png" @right-click="scan"></custom-navbar>
|
||||||
<view class="device-page" :style="{ paddingTop: navBarHeight + 'px' }">
|
<view class="device-page" :style="{ paddingTop: navBarHeight + 'px' }">
|
||||||
<!-- handleSend 发送信息 -->
|
<!-- handleSend 发送信息 -->
|
||||||
<scroll-view class="tab-bar" scroll-x="true" scroll-with-animation>
|
<view class="tab-bar-wrap">
|
||||||
<view class="tab-container">
|
<scroll-view class="tab-bar" scroll-x="true" scroll-with-animation>
|
||||||
<view v-for="(tab, index) in tabs" :key="index"
|
<view class="tab-container">
|
||||||
:class="['tab-item', activeTab === index ? 'active' : '']" @click="switchTab(tab,index)">
|
<view v-for="(tab, index) in tabs" :key="index"
|
||||||
{{tab.typeName}}
|
:class="['tab-item', activeTab === index ? 'active' : '']" @click="switchTab(tab,index)">
|
||||||
|
{{tab.typeName}}
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
</scroll-view>
|
||||||
|
<view class="tab-more" @click="allMore">
|
||||||
|
<image src="/static/images/more.png" mode="aspectFit" class="more"></image>
|
||||||
</view>
|
</view>
|
||||||
<view class="uniui-more">
|
</view>
|
||||||
<image @click="allMore" src="/static/images/more.png" mode="" class="more"></image>
|
|
||||||
</view>
|
|
||||||
</scroll-view>
|
|
||||||
<view class="sendFlex" v-if="activeTab && activeTab.id !== ''&& activeTabInfo.communicationMode==0">
|
<view class="sendFlex" v-if="activeTab && activeTab.id !== ''&& activeTabInfo.communicationMode==0">
|
||||||
<!-- <view class="callpolice">报警</view> -->
|
<!-- <view class="callpolice">报警</view> -->
|
||||||
<view class="Sendmessage" @click="location">位置</view>
|
<view class="Sendmessage" @click="location">位置</view>
|
||||||
@ -346,6 +348,7 @@
|
|||||||
});
|
});
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.onIntall();
|
this.onIntall();
|
||||||
|
this.getTab()
|
||||||
}, 500);
|
}, 500);
|
||||||
this.deleteShow = false
|
this.deleteShow = false
|
||||||
// 关闭所有滑动项
|
// 关闭所有滑动项
|
||||||
@ -439,9 +442,7 @@
|
|||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: "/pages/6155/deviceDetail",
|
url: "/pages/6155/deviceDetail",
|
||||||
events: {
|
events: {
|
||||||
ack: function(data) {
|
ack: function(data) {}
|
||||||
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
res.eventChannel.emit('detailData', {
|
res.eventChannel.emit('detailData', {
|
||||||
@ -450,14 +451,28 @@
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
onIntall() {
|
onIntall() {
|
||||||
this.page = 1;
|
this.page = 1;
|
||||||
this.finished = false;
|
this.finished = false;
|
||||||
this.getData(this.deviceType); // 重新加载第一页数据
|
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() {
|
onLoad() {
|
||||||
this.getTab()
|
this.getTab()
|
||||||
@ -472,6 +487,17 @@
|
|||||||
// 组件销毁前移除监听器
|
// 组件销毁前移除监听器
|
||||||
uni.$off('refreshDeviceList');
|
uni.$off('refreshDeviceList');
|
||||||
},
|
},
|
||||||
|
onShow() {
|
||||||
|
// 监听设备状态更新事件
|
||||||
|
uni.$on('deviceStatusUpdate', (data) => {
|
||||||
|
console.log('收到设备状态更新通知:', data);
|
||||||
|
this.updateDeviceStatus(data);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
onHide() {
|
||||||
|
// 页面隐藏时取消监听,避免内存泄漏
|
||||||
|
uni.$off('deviceStatusUpdate');
|
||||||
|
},
|
||||||
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
@ -498,11 +524,10 @@
|
|||||||
|
|
||||||
.tab-container {
|
.tab-container {
|
||||||
display: flex;
|
display: flex;
|
||||||
/* justify-content: space-around; */
|
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
margin-bottom: 40rpx;
|
margin-bottom: 40rpx;
|
||||||
/* min-width: 100%; */
|
padding-right: 80rpx;
|
||||||
/* 最小宽度 */
|
/* 预留更多按钮空间 */
|
||||||
}
|
}
|
||||||
|
|
||||||
.tab-item {
|
.tab-item {
|
||||||
@ -530,19 +555,26 @@
|
|||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.uniui-more {
|
.tab-bar-wrap {
|
||||||
|
display: flex;
|
||||||
|
/* 横向排列 */
|
||||||
|
align-items: baseline;
|
||||||
|
/* 垂直居中 */
|
||||||
position: relative;
|
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 {
|
.more {
|
||||||
width: 40rpx;
|
width: 40rpx;
|
||||||
height: 8rpx;
|
height: 8rpx;
|
||||||
/* position: absolute; */
|
|
||||||
/* right: 0rpx;
|
|
||||||
z-index: 100; */
|
|
||||||
float: right;
|
|
||||||
top: -95rpx
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.gprs {
|
.gprs {
|
||||||
|
@ -61,7 +61,7 @@
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
showView: false,
|
showView: false,
|
||||||
phone: '13058067817', //手机号码
|
phone: '13800138001', //手机号码
|
||||||
code: "", //验证码
|
code: "", //验证码
|
||||||
agreed: false,
|
agreed: false,
|
||||||
isCounting: 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