连接ws
This commit is contained in:
@ -18,8 +18,10 @@ VITE_APP_BASE_API = 'http://192.168.110.180:8899'
|
|||||||
#曾涛
|
#曾涛
|
||||||
# VITE_APP_BASE_API = 'http://192.168.110.171:8899'
|
# VITE_APP_BASE_API = 'http://192.168.110.171:8899'
|
||||||
|
|
||||||
# 无人机接口地址
|
# ws
|
||||||
|
VITE_APP_BASE_WS_API = 'ws://192.168.110.149:8899/resource/websocket'
|
||||||
|
|
||||||
|
# 无人机接口地址
|
||||||
VITE_APP_BASE_DRONE_API = 'http://58.17.134.85:9512'
|
VITE_APP_BASE_DRONE_API = 'http://58.17.134.85:9512'
|
||||||
|
|
||||||
# 应用访问路径 例如使用前缀 /admin/
|
# 应用访问路径 例如使用前缀 /admin/
|
||||||
|
@ -4,11 +4,24 @@ import CesiumImageLabelEntity from '../js/CesiumImageLabelEntity.js';
|
|||||||
import CesiumFlyToRoamingController from '../js/CesiumFlyToRoamingController.js';
|
import CesiumFlyToRoamingController from '../js/CesiumFlyToRoamingController.js';
|
||||||
import { setSelect, getSelectList, getGps } from '@/api/projectScreen/index.ts'
|
import { setSelect, getSelectList, getGps } from '@/api/projectScreen/index.ts'
|
||||||
import videoDialog from "./video.vue"
|
import videoDialog from "./video.vue"
|
||||||
|
import { getToken } from '@/utils/auth';
|
||||||
const defaultExpandedKeys = [1, 2, 3] //默认展开第一级节点
|
const defaultExpandedKeys = [1, 2, 3] //默认展开第一级节点
|
||||||
const defaultCheckedKeys = ref([]) //默认选中节点
|
const defaultCheckedKeys = ref([]) //默认选中节点
|
||||||
const data = ref([]);
|
const data = ref([]);
|
||||||
const deviceId = ref('');
|
const deviceId = ref('');
|
||||||
const videoDialogRef = ref(null);
|
const videoDialogRef = ref(null);
|
||||||
|
let token = 'Bearer '+ getToken()
|
||||||
|
let ws = new ReconnectingWebSocket( import.meta.env.VITE_APP_BASE_WS_API + '?Authorization='+token+'&clientid='+import.meta.env.VITE_APP_CLIENT_ID);
|
||||||
|
// 连接ws
|
||||||
|
const connectWs = () => {
|
||||||
|
ws.onopen = (e) => {
|
||||||
|
console.log('this.gateWay', e);
|
||||||
|
// ws.send(JSON.stringify(message));
|
||||||
|
ws.onmessage = (e) => {
|
||||||
|
console.log('ws', e);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
isHide:{
|
isHide:{
|
||||||
type:Boolean,
|
type:Boolean,
|
||||||
@ -214,6 +227,8 @@ function stopRoaming() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
// 连接ws
|
||||||
|
connectWs();
|
||||||
// 获取选中节点
|
// 获取选中节点
|
||||||
getCheckedNode();
|
getCheckedNode();
|
||||||
// 获取GPS数据
|
// 获取GPS数据
|
||||||
|
Reference in New Issue
Block a user