1
0
forked from dyf/APP
Files
APP/pages/common/Msgs/deviceMsg.vue
2026-05-19 17:38:56 +08:00

75 lines
1.7 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<view class="maincontent contentBg">
<view>通知标题{{payload.title}}</view>
<view>设备信息{{device.deviceName}}</view>
<view>Mac地址{{device.deviceMac}}</view>
<view>设备IMEI{{device.deviceImei}}</view>
<view>通知详情{{payload.content}}</view>
</view>
</template>
<script>
import {deviceInfo} from '@/api/common/index.js';
export default {
data() {
return {
payload: {
device_mac: '',
device_imei: '',
content: '',
title: ''
},
device: {
"id": "",
"deviceName": "",
"deviceImei": "",
"deviceMac": "",
"communicationMode": null,
"devicePic": "",
"typeName": "",
"bluetoothName": "",
"deviceStatus": null,
"bindingTime": "",
"onlineStatus": null,
"battery": "",
"latitude": "",
"longitude": "",
"alarmStatus": null,
"detailPageUrl": ""
}
}
},
onLoad() {
var eventChannel = this.getOpenerEventChannel();
eventChannel.on('pushMsg', (res) => {
this.payload.content = res.data.content;
this.payload.title = res.data.payload.title;
this.payload.device_mac = res.data.payload.device_mac;
this.payload.device_imei = res.data.payload.device_imei;
this.getDevice();
});
},
methods: {
getDevice() {
deviceInfo({
pageNum: 1,
pageSize: 1,
deviceMac: this.payload.device_mac
}).then(res => {
if (res.code == 200) {
if (res.rows && res.rows.length) {
let device=res.rows[0];
this.device=device;
}
}
});
}
}
}
</script>
<style>
</style>