|
|
|
@ -73,7 +73,7 @@
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
<script setup lang="ts">
|
|
|
|
|
import { onMounted, ref, onBeforeUnmount, reactive, watch } from 'vue';
|
|
|
|
|
import { onMounted, ref, onBeforeUnmount, reactive, watch, computed } from 'vue';
|
|
|
|
|
import {
|
|
|
|
|
SelectComponent,
|
|
|
|
|
AirportInformation,
|
|
|
|
@ -122,12 +122,16 @@
|
|
|
|
|
const connectCallback = () => {
|
|
|
|
|
connected.value = true;
|
|
|
|
|
};
|
|
|
|
|
const topicUrl = computed(() => {
|
|
|
|
|
return 'thing/product/' + airPortInfo.sn + '/osd'
|
|
|
|
|
})
|
|
|
|
|
const topicUAVUrl = computed(() => {
|
|
|
|
|
return 'thing/product/' + UAVinfo.sn + '/osd'
|
|
|
|
|
})
|
|
|
|
|
onMounted(() => {
|
|
|
|
|
destroyConnection();
|
|
|
|
|
createConnection(connectCallback);
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
const topicUrl = 'thing/product/' + airPortInfo.sn + '/osd';
|
|
|
|
|
const topicUAVUrl = 'thing/product/' + UAVinfo.sn + '/osd';
|
|
|
|
|
// 接收消息
|
|
|
|
|
getClient().on('message', (topic, message) => {
|
|
|
|
|
const rs = JSON.parse(message);
|
|
|
|
@ -137,11 +141,11 @@
|
|
|
|
|
message: rs,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
if (topic == topicUAVUrl) {
|
|
|
|
|
if (topic == topicUAVUrl.value) {
|
|
|
|
|
if (rs.data.latitude && rs.data.longitude) {
|
|
|
|
|
uavTrack.value = rs.data;
|
|
|
|
|
}
|
|
|
|
|
} else if (topic == topicUrl) {
|
|
|
|
|
} else if (topic == topicUrl.value) {
|
|
|
|
|
if (rs.data.latitude && rs.data.longitude) {
|
|
|
|
|
airPort.value.latitude = rs.data.latitude;
|
|
|
|
|
airPort.value.longitude = rs.data.longitude;
|
|
|
|
|