From e6f63c537608c9c8bdc77e45a03125176bea280f Mon Sep 17 00:00:00 2001
From: xieb <vip_xiaobin810@163.com>
Date: Tue, 26 Sep 2023 11:31:33 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/demo' into demo

---
 src/components/GMap.vue                            |   26 +++++++++++--
 src/pages/page-web/projects/project_list/index.vue |   14 ++++++-
 src/pages/page-web/projects/wayline.vue            |    5 +-
 src/components/Jessibuca/Jessibuca.vue             |    4 +
 src/pages/page-web/projects/tsa.vue                |    1 
 src/pages/page-web/projects/workspace.vue          |    8 +++-
 src/pages/page-web/projects/devices.vue            |    2 
 src/pages/page-web/projects/implement.vue          |    2 
 8 files changed, 48 insertions(+), 14 deletions(-)

diff --git a/src/components/GMap.vue b/src/components/GMap.vue
index 83938f5..7d7e941 100644
--- a/src/components/GMap.vue
+++ b/src/components/GMap.vue
@@ -373,7 +373,7 @@
       </div>
       <a-row class="p5" v-if="showMonitor" justify="center" align="middle">
         <!-- <a-spin :spinning="spinning"> -->
-          <Jessibuca v-if="airPortUrl" :videoUrl="airPortUrl" width="100%" height="300px" />
+          <Jessibuca v-if="airPortUrl" @timeout="airTimeout" :videoUrl="airPortUrl" width="100%" height="300px" />
         <!-- </a-spin> -->
       </a-row>
       <!--  飞机-->
@@ -406,7 +406,7 @@
               </a-button>
             </a-col>
             <a-col span="11">
-              <a-button :disabled="deviceInfo.device?.mode_code == 14 || !deviceInfo.device?true:false" :class="[openDroneControl?'active-color':'unactive-color']" class="width-100" type="primary"  size="small"
+              <a-button :class="[openDroneControl?'active-color':'unactive-color']" class="width-100" type="primary"  size="small"
                 @click="openDeviceSetting">
                 操作
               </a-button>
@@ -417,7 +417,7 @@
       <!-- 飞机直播 -->
       <a-row class="p5" v-if="showAircraft">
         <!-- <a-spin :spinning="spinning"> -->
-          <Jessibuca v-if="aircraftUrl" :videoUrl="aircraftUrl" width="100%" height="300px" />
+          <Jessibuca v-if="aircraftUrl" @timeout="flyTimeout" :videoUrl="aircraftUrl" width="100%" height="300px" />
         <!-- </a-spin> -->
       </a-row>
       <!-- 飞机图标信息 -->
@@ -905,8 +905,24 @@
           message.error(error)
         })
     }
+    // 机场视频超时说明可能直播被关闭需要重新开启直播
+    const airTimeout = () => {
+      try {
+        onStart()
+      } catch (e) {
+        onClose()
+      }
+    }
+    const flyTimeout = () => {
+      try {
+        flyOnStart()
+      } catch (e) {
+        closeFly()
+      }
+    }
     // 设备开始播放
     const onStart = async () => {
+      airPortUrl.value = ''
       const videoId = droneList.value[droneIndex.value].value + '/' + cameraList.value[cameraIndex.value].value + '/' + videoList.value[videoIndex.value].value
       const streamId = droneList.value[droneIndex.value].value + '-' + cameraList.value[cameraIndex.value].value + '-' + videoList.value[videoIndex.value].value
       const liveURL = config.rtmpURL + streamId
@@ -1315,7 +1331,9 @@
       closeOsdWindow,
       openDroneControl,
       openFlySetting,
-      openDeviceSetting
+      openDeviceSetting,
+      airTimeout,
+      flyTimeout
     }
   }
 })
diff --git a/src/components/Jessibuca/Jessibuca.vue b/src/components/Jessibuca/Jessibuca.vue
index 618d06d..2a98fc4 100644
--- a/src/components/Jessibuca/Jessibuca.vue
+++ b/src/components/Jessibuca/Jessibuca.vue
@@ -3,7 +3,7 @@
 </template>
 
 <script setup lang="ts">
-import { onMounted, onUnmounted, ref, defineProps } from 'vue'
+import { onMounted, onUnmounted, ref, defineProps, defineEmits } from 'vue'
 import Jessibuca from '../../../public/jessibuca/jessibuca'
 const props = defineProps({
   videoUrl: {
@@ -19,6 +19,7 @@
     default: '200px'
   }
 })
+const emits = defineEmits(['timeout'])
 let jessibuca: null | Jessibuca = null
 const container = ref(null)
 const buffer = ref(null)
@@ -107,6 +108,7 @@
 
   jessibuca.on('timeout', function () {
     console.log('timeout')
+    emits('timeout')
   })
 
   jessibuca.on('start', function () {
diff --git a/src/pages/page-web/projects/devices.vue b/src/pages/page-web/projects/devices.vue
index 8e267d3..cde515a 100644
--- a/src/pages/page-web/projects/devices.vue
+++ b/src/pages/page-web/projects/devices.vue
@@ -279,7 +279,7 @@
 }
 type Pagination = TableState['pagination']
 
-const workspaceId = computed(() => store.state.common.projectId)
+const workspaceId = computed(() => store.state.common.projectId || localStorage.getItem(ELocalStorageKey.WorkspaceId))
 const editableData: UnwrapRef<Record<string, Device>> = reactive({})
 const current = ref([EDeviceTypeName.Aircraft])
 
diff --git a/src/pages/page-web/projects/implement.vue b/src/pages/page-web/projects/implement.vue
index d8845e8..fb7199c 100644
--- a/src/pages/page-web/projects/implement.vue
+++ b/src/pages/page-web/projects/implement.vue
@@ -216,7 +216,7 @@
 
 const route = useRoute()
 const store = useMyStore()
-const workspaceId = ref(localStorage.getItem(ELocalStorageKey.WorkspaceId)!)
+const workspaceId = computed(() => store.state.common.projectId || localStorage.getItem(ELocalStorageKey.WorkspaceId))
 const hmsVisible = new Map<string, boolean>()
 const deviceInfo = computed(() => store.state.deviceState.deviceInfo)
 const dockInfo = computed(() => store.state.deviceState.dockInfo)
diff --git a/src/pages/page-web/projects/project_list/index.vue b/src/pages/page-web/projects/project_list/index.vue
index c3ea927..3cb1aa5 100644
--- a/src/pages/page-web/projects/project_list/index.vue
+++ b/src/pages/page-web/projects/project_list/index.vue
@@ -1,6 +1,6 @@
 <template>
     <div class="project_list">
-        <div class="left_content">
+        <div :class="[isHidden? 'w50' : 'left_content']">
             <router-view />
         </div>
         <div class="right_content">
@@ -29,6 +29,11 @@
 import Devices from '/@/pages/page-web/projects/devices.vue'
 import { EBizCode, ERouterName } from '/@/types'
 import { getRoot } from '/@/root'
+const route = useRoute()
+const isHidden = computed(() => {
+  const flag = !!route.meta?.hidden
+  return flag
+})
 const root = getRoot()
 </script>
 
@@ -38,7 +43,12 @@
     transition: width 0.2s ease;
     height: 100%;
     width: 100%;
-
+    .w50 {
+        width: 50px;
+        max-height: 100vh;
+        background-color: black;
+        color: $text-white-basic !important;
+    }
     .left_content {
         width: 370px;
         max-height: 100vh;
diff --git a/src/pages/page-web/projects/tsa.vue b/src/pages/page-web/projects/tsa.vue
index 59d1997..6815794 100644
--- a/src/pages/page-web/projects/tsa.vue
+++ b/src/pages/page-web/projects/tsa.vue
@@ -282,7 +282,6 @@
 
 const { appContext } = getCurrentInstance()
 const global = appContext.config.globalProperties
-const route = useRoute()
 // const simpleImage = Empty.PRESENTED_IMAGE_SIMPLE
 const store = useMyStore()
 const username = ref(localStorage.getItem(ELocalStorageKey.Username))
diff --git a/src/pages/page-web/projects/wayline.vue b/src/pages/page-web/projects/wayline.vue
index c6df563..b0bd873 100644
--- a/src/pages/page-web/projects/wayline.vue
+++ b/src/pages/page-web/projects/wayline.vue
@@ -113,7 +113,7 @@
 })
 
 const root = getRoot()
-const workspaceId = computed(() => store.state.common.projectId)
+const workspaceId = computed(() => store.state.common.projectId || localStorage.getItem(ELocalStorageKey.WorkspaceId))
 const deleteTip = ref(false)
 const deleteWaylineId = ref<string>('')
 const canRefresh = ref(true)
@@ -134,6 +134,7 @@
     pagination.page++
     getWaylines()
   }, 1000)
+  console.log(workspaceId.value)
 })
 
 function getWaylines () {
@@ -279,7 +280,7 @@
     fileData.append('file', file, file.name)
     await importKmzFile(workspaceId.value, fileData).then((res) => {
       if (res.code === 0) {
-        message.success(`${file.name} file uploaded successfully`)
+        message.success(`${file.name} 文件上传成功`)
         canRefresh.value = true
         pagination.total = 0
         pagination.page = 1
diff --git a/src/pages/page-web/projects/workspace.vue b/src/pages/page-web/projects/workspace.vue
index a34e25a..7ec0794 100644
--- a/src/pages/page-web/projects/workspace.vue
+++ b/src/pages/page-web/projects/workspace.vue
@@ -2,7 +2,7 @@
   <div class="project-app-wrapper">
     <div class="left">
       <Sidebar />
-      <div class="main-content uranus-scrollbar dark">
+      <div class="main-content uranus-scrollbar dark" v-if="!isHidden">
         <router-view />
       </div>
     </div>
@@ -104,7 +104,11 @@
       break
   }
 }
-
+const route = useRoute()
+const isHidden = computed(() => {
+  const flag = !!route.meta?.hidden
+  return flag
+})
 const webSorketUrl = getWebsocketUrl() + '&workspace-id=' + workspace_id.value
 // 监听ws 消息
 useConnectWebSocket(messageHandler, webSorketUrl)

--
Gitblit v1.9.3