11 files modified
1 files added
| | |
| | | VITE_API_URL = 'http://192.168.1.133:6789' |
| | | VITE_WS_API_URL = 'ws://192.168.1.133:6789/api/v1/ws' |
| | | # VITE_API_URL = 'http://192.168.1.133:6789' |
| | | # VITE_WS_API_URL = 'ws://192.168.1.133:6789/api/v1/ws' |
| | | # VITE_APP_ENVIRONMENT=DEV |
| | | # VITE_BASE_API = '/drone-api' |
| | | |
| | | VITE_API_URL = 'http://171.34.76.171:8880/drone' |
| | | VITE_WS_API_URL = 'ws://171.34.76.171:8882/ws' |
| | | VITE_APP_ENVIRONMENT=DEV |
| | | VITE_BASE_API = '/drone-api' |
| | |
| | | <!-- |
| | | * @Author: husq 931347610@qq.com |
| | | * @Date: 2023-08-22 09:55:39 |
| | | * @LastEditors: husq 931347610@qq.com |
| | | * @LastEditTime: 2023-09-18 10:47:02 |
| | | * @FilePath: \Cloud-API-Demo-Web\index.html |
| | | * @LastEditors: GuLiMmo 2820890765@qq.com |
| | | * @LastEditTime: 2023-11-27 13:55:34 |
| | | * @FilePath: /drone-web/index.html |
| | | * @Description: |
| | | * |
| | | * Copyright (c) 2023 by ${git_name_email}, All Rights Reserved. |
| | |
| | | <meta name="viewport" content="width=device-width, initial-scale=1.0" /> |
| | | <title>无人机操作系统</title> |
| | | <script src="./jessibuca/jessibuca.js"></script> |
| | | <script src="./apiConfig.js"></script> |
| | | </head> |
| | | <body> |
| | | <div id="demo-app"></div> |
| | |
| | | "lint": "eslint --fix" |
| | | }, |
| | | "dependencies": { |
| | | "@turf/turf": "^6.5.0", |
| | | "@amap/amap-jsapi-loader": "^1.0.1", |
| | | "@ant-design/icons-vue": "^6.0.1", |
| | | "@turf/turf": "^6.5.0", |
| | | "@vitejs/plugin-legacy": "^1.6.2", |
| | | "agora-rtc-sdk-ng": "^4.12.1", |
| | | "ant-design-vue": "^2.2.8", |
| New file |
| | |
| | | |
| | | /** |
| | | * @description: 可修改api,如果为空则是默认api |
| | | */ |
| | | const baseUrl = { |
| | | // 基础请求接口 |
| | | apiBaseUrl: '', |
| | | // websocket请求接口 |
| | | wsBaseUrl: '', |
| | | // MediaPanel请求接口 |
| | | mediaPanelPrefix: '' |
| | | } |
| | | /** |
| | | * @description: 可修改mqtt配置,如果为空则是默认配置 |
| | | */ |
| | | const mqttConfig = { |
| | | clientId: '', |
| | | username: '', |
| | | password: '', |
| | | host: '', |
| | | protocol: '', |
| | | port: '' |
| | | } |
| | | |
| | | window.globalApiConfig = { |
| | | baseUrl, |
| | | mqttConfig |
| | | } |
| | |
| | | import { ELocalStorageKey, ERouterName, EUserType } from '/@/types/enums' |
| | | export * from './type' |
| | | |
| | | const { baseUrl: { apiBaseUrl } } = window.globalApiConfig |
| | | |
| | | const REQUEST_ID = 'X-Request-Id' |
| | | function getAuthToken () { |
| | | return localStorage.getItem(ELocalStorageKey.Token) |
| | |
| | | headers: { |
| | | 'Content-Type': 'application/json', |
| | | }, |
| | | baseURL: import.meta.env.VITE_BASE_API, |
| | | baseURL: apiBaseUrl || import.meta.env.VITE_BASE_API, |
| | | // timeout: 12000, |
| | | }) |
| | | |
| | |
| | | distance?:number |
| | | } |
| | | |
| | | export const flyByArea = async function (sn:string,dockPoint:Point,jsonPath:any,radius:number,deviceSn:string,payloadIndex:string): Promise<IWorkspaceResponse<any>> { |
| | | export const flyByArea = async function (sn:string, dockPoint:Point, jsonPath:any, radius:number, deviceSn:string, payloadIndex:string): Promise<IWorkspaceResponse<any>> { |
| | | const url = `${HTTP_PREFIX}/workspaces/${sn}/jobs/${deviceSn}/flyByArea` |
| | | const result = await request.post(url,{dockPoint:dockPoint,jsonPath:jsonPath,radius:radius,payloadIndex:payloadIndex}) |
| | | const result = await request.post(url, { dockPoint: dockPoint, jsonPath: jsonPath, radius: radius, payloadIndex: payloadIndex }) |
| | | return result.data |
| | | } |
| | | |
| | |
| | | |
| | | type Key = ColumnProps['key']; |
| | | |
| | | const { baseUrl: { mediaPanelPrefix } } = window.globalApiConfig |
| | | |
| | | const workspaceId = localStorage.getItem(ELocalStorageKey.WorkspaceId)! |
| | | const loading = ref(false) |
| | | const showVideo = ref(false) |
| | | const videoPlayerId = ref('videoPlayerId') |
| | | // 文件前缀 |
| | | const prefix = 'https://dev.jxpskj.com:8026/cloud-bucket' |
| | | // const prefix = 'https://dev.jxpskj.com:8026/cloud-bucket' |
| | | const prefix = mediaPanelPrefix || 'https://dev.jxpskj.com:8026/cloud-bucket' |
| | | // 搜索栏配置项 |
| | | const searchPanelOptions = reactive({ |
| | | size: 'large', |
| | |
| | | IClientOptions, |
| | | } from 'mqtt' |
| | | |
| | | const { mqttConfig: { clientId, username, password, host, protocol, port } } = window.globalApiConfig |
| | | |
| | | export const OPTIONS: IClientOptions = { |
| | | clean: true, // true: 清除会话, false: 保留会话 |
| | | connectTimeout: 10000, // mqtt 超时时间 |
| | | resubscribe: true, // 断开重连后,再次订阅原订阅 |
| | | reconnectPeriod: 10000, // 重连间隔时间: 5s |
| | | keepalive: 5, // 心跳间隔时间:1s |
| | | clientId: 'DroneWeb', |
| | | username: 'root', |
| | | password: 'root', |
| | | host: '182.106.212.58', |
| | | protocol: 'ws', |
| | | port: 35675, |
| | | clientId: clientId || 'DroneWeb', |
| | | username: username || 'root', |
| | | password: password || 'root', |
| | | host: host || '182.106.212.58', |
| | | protocol: protocol || 'ws', |
| | | port: port || 35675, |
| | | } |
| | |
| | | <span>返回上一页</span> |
| | | </div> |
| | | <li |
| | | v-for="(position, index) in tragetPointArr" |
| | | v-for="(item, index) in tragetPointArr" |
| | | :key="index" |
| | | :class="{ selectedColor : index === selectedPoint }" |
| | | @click="tragetPointClick(position, index)"> |
| | | @click="tragetPointClick(item.position, index)"> |
| | | <div class="graph"> |
| | | <div class="left" :style="{borderTopColor: index === selectedPoint ? '#FF9900' : '#2D8CF0'}"></div> |
| | | <div class="right">{{ index + 1 }}</div> |
| | | </div> |
| | | <div class="graph-right"></div> |
| | | <div class="graph-right"> |
| | | <div v-for="(event, index) in item.eventList" :key="index" class="s-event-icon"> |
| | | <img :src="event.icon" alt="icon" /> |
| | | </div> |
| | | </div> |
| | | </li> |
| | | </ul> |
| | | </a-spin> |
| | |
| | | import { getRoot } from '/@/root' |
| | | import * as Cesium from 'cesium' |
| | | import { cesiumOperation } from '/@/hooks/use-cesium-tsa' |
| | | import { stat } from 'fs' |
| | | import axios from 'axios' |
| | | import JSZIP from 'jszip' |
| | | // 初始化jszip |
| | | const JsZip = new JSZIP() |
| | | |
| | | const getResource = (name: string) => { |
| | | return new URL(`/src/assets/icons/${name}`, import.meta.url).href |
| | | } |
| | | |
| | | const projectWayLine = ref<HTMLDivElement>() |
| | | |
| | |
| | | const { removeById, addClickEvent, getEntityById } = cesiumOperation() |
| | | |
| | | const isPointListOpen = ref<boolean>(false) |
| | | const tragetPointArr = ref<Cesium.Cartesian3[]>([]) |
| | | const tragetPointArr = ref<{ |
| | | position: Cesium.Cartesian3, |
| | | eventList: string[] |
| | | }[]>([]) |
| | | const selectedPoint = ref<number | null>(null) |
| | | |
| | | // 对应事件 |
| | | const eventList: any = reactive<{ |
| | | key: string, |
| | | name: string, |
| | | icon?: string |
| | | }[]>([ |
| | | { |
| | | key: 'takePhoto', |
| | | name: '单拍', |
| | | icon: getResource('waylinetool/camera.png'), |
| | | }, |
| | | { |
| | | key: 'startRecord', |
| | | name: '开始录像', |
| | | icon: getResource('waylinetool/camera-on.png'), |
| | | }, |
| | | { |
| | | key: 'stopRecord', |
| | | name: '结束录像', |
| | | icon: getResource('waylinetool/camera-off.png'), |
| | | }, |
| | | { |
| | | key: 'focus', |
| | | name: '对焦' |
| | | }, |
| | | { |
| | | key: 'zoom', |
| | | name: '变焦', |
| | | icon: getResource('waylinetool/fd.png'), |
| | | }, |
| | | { |
| | | key: 'customDirName', |
| | | name: '创建新文件夹', |
| | | icon: getResource('waylinetool/create-file.png'), |
| | | }, |
| | | { |
| | | key: 'gimbalRotate', |
| | | name: '旋转云台' |
| | | }, |
| | | { |
| | | key: 'rotateYaw', |
| | | name: '飞行器偏航' |
| | | }, |
| | | { |
| | | key: 'hover', |
| | | name: '悬停等待', |
| | | icon: getResource('waylinetool/xt.png'), |
| | | }, |
| | | { |
| | | key: 'gimbalEvenlyRotate', |
| | | name: '航段间均匀转动云台pitch角' |
| | | }, |
| | | { |
| | | key: 'orientedShoot', |
| | | name: '精准复拍动作' |
| | | } |
| | | ]) |
| | | |
| | | onMounted(() => { |
| | | const parent = document.getElementsByClassName('scrollbar').item(0)?.parentNode as HTMLDivElement |
| | |
| | | getWayLineFile(workspaceId.value, wayline.id).then(res => { |
| | | store.commit('SET_SELECT_WAYLINE_INFO', wayline) |
| | | initKmlFile(res.data) |
| | | store.commit('SET_WAYLINE_KMZPATH', res.data) |
| | | }).finally(() => { |
| | | loading.value = false |
| | | }) |
| | |
| | | outlineColor: Cesium.Color.BLACK, |
| | | }) |
| | | cartesianArr.push(entity.position._value) |
| | | tragetPointArr.value[i] = { |
| | | position: entity.position._value, |
| | | eventList: [] |
| | | } |
| | | } |
| | | tragetPointArr.value = cartesianArr |
| | | const stripe = createStripe() |
| | | // tragetPointArr.value = cartesianArr |
| | | // const stripe = createStripe() |
| | | const lineEntity = global.$viewer.entities.add({ |
| | | name: 'entityLine', |
| | | id: 'kmzLine', |
| | |
| | | global.$viewer.flyTo(lineEntity, { |
| | | offset: new Cesium.HeadingPitchRange(0, -90, 8000) |
| | | }) |
| | | |
| | | // 解析kmz文件 |
| | | readKmzFile(file) |
| | | }) |
| | | } |
| | | |
| | | // 点击目标点 |
| | | function tragetPointClick (position: Cesium.Cartesian3, index: number) { |
| | | selectedPoint.value = index |
| | | store.commit('SET_WAYLINE_INFO', { |
| | |
| | | return stripe |
| | | } |
| | | |
| | | /** |
| | | * @description: 获取kmz文件中的内容 |
| | | * @param {*} kmzPath kmz文件地址 |
| | | * @return {*} void |
| | | */ |
| | | const readKmzFile = (kmzPath: string) => { |
| | | // 使用axios读取文件 |
| | | return axios.get(kmzPath, { responseType: 'arraybuffer' }) |
| | | .then(fileRes => fileRes.data) |
| | | .then(kmzData => JsZip.loadAsync(kmzData)) // 解压kmz文件 |
| | | .then(kmzZip => { |
| | | // 通过文件名找到 KML 文件 |
| | | const kmlFile = kmzZip.file(/\.kml$/i)[0] |
| | | return kmlFile.async('text') |
| | | }).then(kml => { |
| | | // 查找航点标签reg |
| | | const regx = /<Placemark>([\s\S]*?)<\/Placemark>/g |
| | | // 查找事件组reg |
| | | const actionGroupReg = /<wpml:actionGroup>([\s\S]*?)<\/wpml:actionGroup>/g |
| | | // 查找单个事件reg |
| | | const actionRegx = /<wpml:action>([\s\S]*?)<\/wpml:action>/g |
| | | // 当前kmz文件航点 |
| | | const kmlPoints = kml.match(regx) |
| | | kmlPoints?.forEach((point: string, index: number) => { |
| | | // 当前点的事件组 |
| | | const ponitAction = point.match(actionGroupReg) |
| | | const eventArr: string[] = [] |
| | | if (ponitAction) { |
| | | // 当前事件 |
| | | const actions = ponitAction[0].match(actionRegx) |
| | | actions?.forEach(action => { |
| | | eventList.forEach((item: any) => { |
| | | action.includes(item.key) && eventArr.push(item) |
| | | }) |
| | | }) |
| | | tragetPointArr.value[index].eventList = eventArr |
| | | } |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | const openEditModal = (wayline: any) => { |
| | | currentWayLine.value = wayline |
| | | editVisible.value = true |
| | |
| | | } |
| | | .graph-right { |
| | | width: calc(100% - 40px); |
| | | height: 30px; |
| | | border-bottom: 1px solid #4f4f4f; |
| | | display: flex; |
| | | align-items: center; |
| | | .s-event-icon { |
| | | width: 25px; |
| | | height: 25px; |
| | | display: flex; |
| | | justify-content: center; |
| | | align-items: center; |
| | | img { |
| | | width: 70%; |
| | | } |
| | | } |
| | | } |
| | | &:hover { |
| | | background-color: #3C3C3C; |
| | |
| | | clientId: '', // mqtt 连接 唯一客户端id, |
| | | waylineTool: { |
| | | isShow: false as boolean, |
| | | wayline: {} as any |
| | | wayline: {} as any, |
| | | kmzPath: '' as string |
| | | } |
| | | }) |
| | | |
| | |
| | | }, |
| | | // 设置wayline中的信息 |
| | | SET_WAYLINE_INFO (state, { isShow, wayline }) { |
| | | state.waylineTool = { |
| | | isShow, |
| | | wayline |
| | | } |
| | | state.waylineTool.isShow = isShow |
| | | state.waylineTool.wayline = wayline |
| | | }, |
| | | SET_WAYLINE_KMZPATH (state, kmzPath) { |
| | | state.waylineTool.kmzPath = kmzPath |
| | | } |
| | | } |
| | | |
| | |
| | | /// <reference types="vite/client" /> |
| | | export {} |
| | | declare global { |
| | | interface Window { |
| | | globalApiConfig: any |
| | | } |
| | | } |
| | |
| | | import { ELocalStorageKey } from '/@/types/enums' |
| | | import { CURRENT_CONFIG } from '/@/api/http/config' |
| | | |
| | | const { baseUrl: { wsBaseUrl } } = window.globalApiConfig |
| | | |
| | | const user = localStorage.getItem('user_info') |
| | | export function getWebsocketUrl () { |
| | | const token: string = localStorage.getItem(ELocalStorageKey.Token) || '' as string |
| | | // const url = CURRENT_CONFIG.websocketURL |
| | | const url = import.meta.env.VITE_WS_API_URL + '?x-auth-token=' + encodeURI(token) |
| | | const url = (wsBaseUrl || import.meta.env.VITE_WS_API_URL) + '?x-auth-token=' + encodeURI(token) |
| | | return url |
| | | } |
| | | |