From 31b7e874bac09e8a82c938c75e36452580dfddd6 Mon Sep 17 00:00:00 2001
From: chenyao <1219716595@qq.com>
Date: Wed, 26 Feb 2025 17:41:00 +0800
Subject: [PATCH] 统一换成Vant组件和修改列表点击事件范围

---
 src/views/components/ptzControl.vue |   32 ++++++++++++++------------------
 1 files changed, 14 insertions(+), 18 deletions(-)

diff --git a/src/views/components/ptzControl.vue b/src/views/components/ptzControl.vue
index 458f8c0..e8bead5 100644
--- a/src/views/components/ptzControl.vue
+++ b/src/views/components/ptzControl.vue
@@ -38,7 +38,7 @@
 </template>
 
 <script lang="ts" setup>
-import { ElMessage } from 'element-plus'
+import { showNotify } from 'vant';
 import { Refresh } from '@element-plus/icons-vue';
 import { ControlSource, EModeCode } from '@/types/device'
 import { CameraMode } from '@/types/live-stream'
@@ -49,7 +49,6 @@
 import { useDroneControlWsEvent } from '@/utils/websocket/drone-ws-control'
 import cesiumOperation from '@/utils/cesium-tsa.js';
 import { useMyStore } from '@/store'
-import { fa } from 'element-plus/es/locale';
 
 const { loadLAYER } = cesiumOperation()
 
@@ -163,11 +162,11 @@
   }
 
   if (isActionComplete.value) {
-    ElMessage.warning('当前相机动作暂未完成,请勿点击!!')
+    showNotify({ type: 'warning', message: '当前相机动作暂未完成,请勿点击!' })
     return
   }
   if (payloadSelectInfo.camera?.recording_state) {
-    ElMessage.warning('当前摄像头正在录制视频,请先结束视频录制!!')
+    showNotify({ type: 'warning', message: '当前摄像头正在录制视频,请先结束视频录制' })
     return
   }
 
@@ -191,7 +190,7 @@
 const curTaskCameraPhoto =  (time:any) => {
   isActionComplete.value = true
 
-  ElMessage({
+  showNotify({
     message: '请稍后,正在拍摄中。。。',
     duration: 2000,
   })
@@ -231,9 +230,9 @@
   authPayload(props.osdVisible.dockSn, payloadSelectInfo.payloadIndex).then(
     (payloadRes:any) => {
       if (payloadRes.code !== 0)
-        return ElMessage.error('获得有效载荷控制失败,请稍后重试!!')
+        return showNotify({ type: 'danger', message: '获得有效载荷控制失败,请稍后重试!' })
       payloadControlSource.value = ControlSource.A
-      ElMessage.success('成功获得有效载荷控制')
+      showNotify({ type: 'success', message: '成功获得有效载荷控制' })
     },
   )
 }
@@ -243,14 +242,12 @@
     return
   }
   if (isActionComplete.value) {
-    ElMessage.warning('当前相机动作暂未完成,请勿点击!!')
+    showNotify({ type: 'warning', message: '当前相机动作暂未完成,请勿点击!' })
     return
   }
 
   if (payloadSelectInfo.camera?.recording_state) {
-    return ElMessage.warning(
-      '当前摄像头正在录制视频,请勿重复点击!!',
-    )
+    return showNotify({ type: 'warning', message: '当前摄像头正在录制视频,请勿重复点击!' })
   }
 
   if (payloadSelectInfo.camera?.camera_mode !== CameraMode.Video) {
@@ -273,7 +270,7 @@
   const curStartCameraRecording = (time:any) => {
     isActionComplete.value = true
 
-    ElMessage({
+    showNotify({
       message: '请稍后,正在开启视频录制。。。',
       duration: 2000,
     })
@@ -282,8 +279,8 @@
       startCameraRecording(props.osdVisible.dockSn, payloadSelectInfo.payloadIndex)
         .then((res) => {
           if (res.code !== 0)
-            return ElMessage.warning('开始录制失败,请稍后重试!!')
-          ElMessage.success('开始录制成功')
+            return showNotify({ type: 'warning', message: '开始录制失败,请稍后重试!' })
+          showNotify({ type: 'success', message: '开始录制成功!' })
           // 开始录像
           isCameraRecording.value = true
           isActionComplete.value = false
@@ -299,15 +296,15 @@
     return
   }
   if (isActionComplete.value) {
-    ElMessage.warning('当前相机动作暂未完成,请勿点击!!')
+    showNotify({ type: 'warning', message: '当前相机动作暂未完成,请勿点击!' })
     return
   }
   isActionComplete.value = true
   stopCameraRecording(props.osdVisible.dockSn, payloadSelectInfo.payloadIndex)
     .then((res) => {
       if (res.code !== 0)
-        return ElMessage.warning('停止录制失败,请稍后重试!!')
-      ElMessage.success('停止录制成功')
+        return showNotify({ type: 'warning', message: '停止录制失败,请稍后重试!' })
+      showNotify({ type: 'success', message: '停止录制成功' })
       // 停止录像
       isCameraRecording.value = false
       isActionComplete.value = false
@@ -330,7 +327,6 @@
     if (zoom_factor.value <= 2) {
       zoom_factor.value = 2
     }
-    console.log('9999', zoom_factor.value)
   }
   switchLivestream({
     video_id: `${props.osdVisible.dockSn}/${payloadSelectInfo.payloadIndex}/normal-0`,

--
Gitblit v1.9.3