|
|
@@ -1,29 +1,14 @@
|
|
|
<template>
|
|
|
<div class="part-box h-full">
|
|
|
<div class="part-box-wrapper h-full">
|
|
|
- <UseFullscreen v-slot="{ toggle, isFullscreen }">
|
|
|
- <div class="tour-video-box screen-full-target h-full flex justify-center items-center">
|
|
|
- <!-- <template v-if="tourId"> -->
|
|
|
- <!-- <div class="w-full h-full flex flex-justify-center flex-items-center">
|
|
|
- <pub-video
|
|
|
- :newClass="'tour-video' + currentActive"
|
|
|
- :style="{ maxWidth: '100%', maxHeight: '100%', aspectRatio: 16 / 9 }"
|
|
|
- />
|
|
|
- </div> -->
|
|
|
- <pub-video-new :newClass="'t-video' + currentActive" />
|
|
|
- <!-- 工具面板 -->
|
|
|
- <!-- <operation-panel
|
|
|
- :index="currentActive"
|
|
|
- z-98
|
|
|
- :op-class="'tour-video' + currentActive"
|
|
|
- uuid="uuid"
|
|
|
- /> -->
|
|
|
- <!-- </template> -->
|
|
|
+ <UseFullscreen class="h-full" v-slot="{ toggle, isFullscreen }">
|
|
|
+ <div class="part-video-box relative screen-full-target h-full">
|
|
|
+ <pub-video-new :newClass="'p-video' + currentActive" />
|
|
|
<!-- 操作按钮 -->
|
|
|
- <div class="tour-main-btn-box" absolute top-10px right-10px flex flex-row-reverse z-999>
|
|
|
+ <div class="part-main-btn-box" absolute top-10px right-10px flex flex-row-reverse z-999>
|
|
|
<!-- 全屏按钮 -->
|
|
|
<div
|
|
|
- class="tour-main-all-screen screen-full-trigger"
|
|
|
+ class="part-main-all-screen screen-full-trigger"
|
|
|
cursor-pointer
|
|
|
ml-1
|
|
|
alt="全屏按钮"
|
|
|
@@ -56,7 +41,10 @@
|
|
|
@click="closeVideo(currentActive)"
|
|
|
/>
|
|
|
</div>
|
|
|
- <div v-if="!playerObj" class="flex flex-justify-center flex-items-center h-full">
|
|
|
+ <div
|
|
|
+ v-if="!playerObj"
|
|
|
+ class="absolute top-0 bottom-0 right-0 left-0 flex flex-justify-center flex-items-center"
|
|
|
+ >
|
|
|
<span style="animation: fadeIn 0.8s alternate infinite">请双击全景画面</span>
|
|
|
</div>
|
|
|
<div
|
|
|
@@ -73,7 +61,7 @@
|
|
|
<script setup>
|
|
|
import { NSpin } from 'naive-ui'
|
|
|
import { useOutsideSystemStore } from '@/stores/modules/system.js'
|
|
|
- import { uuid } from '@/utils'
|
|
|
+ import { uuid, getAutofitScale } from '@/utils'
|
|
|
import { omatVideoPlayer } from '@/assets/js/video-lib/flv/omatVideoPlayer'
|
|
|
import { UseFullscreen } from '@vueuse/components'
|
|
|
|
|
|
@@ -86,79 +74,47 @@
|
|
|
const tourId = ref('')
|
|
|
const clearCom = inject('clearCom')
|
|
|
let playerObj = null
|
|
|
- const videoList = computed(() => useSystem.videoList)
|
|
|
|
|
|
- const tempArr = ref([
|
|
|
- // {
|
|
|
- // x: 158,
|
|
|
- // y: 259,
|
|
|
- // show: true,
|
|
|
- // key: uuid()
|
|
|
- // },
|
|
|
- // {
|
|
|
- // x: 731,
|
|
|
- // y: 374,
|
|
|
- // show: false,
|
|
|
- // key: uuid()
|
|
|
- // },
|
|
|
- // {
|
|
|
- // x: 1358,
|
|
|
- // y: 444,
|
|
|
- // show: false,
|
|
|
- // key: uuid()
|
|
|
- // },
|
|
|
- // {
|
|
|
- // x: 2201,
|
|
|
- // y: 642,
|
|
|
- // show: false,
|
|
|
- // key: uuid()
|
|
|
- // }
|
|
|
- ])
|
|
|
let tempArrI = 0
|
|
|
let tempArrT = null
|
|
|
const loading = ref(false)
|
|
|
- const videoClick = async (item, index) => {
|
|
|
- if (playerObj) return
|
|
|
- if (item.id) {
|
|
|
- closeWorker(index)
|
|
|
+ const videoUrl = computed(() => useSystem.videoUrl)
|
|
|
+ const videoClick = async () => {
|
|
|
+ if (playerObj) {
|
|
|
+ closeWorker()
|
|
|
}
|
|
|
- tourId.value = props.data.id
|
|
|
|
|
|
- tempArr.value =
|
|
|
- props.data?.route.map((path) => ({
|
|
|
- ...path,
|
|
|
- z: 0,
|
|
|
- show: false,
|
|
|
- key: uuid()
|
|
|
- })) || []
|
|
|
nextTick(() => {
|
|
|
- const url = videoList.value.pano_view.replace('{14}', useSystem.deviceInfo.id)
|
|
|
loading.value = true
|
|
|
|
|
|
try {
|
|
|
// await useSystem.getDeviceInfo()
|
|
|
console.log('websocket请求')
|
|
|
playerObj = omatVideoPlayer(
|
|
|
- '.t-video' + props.currentActive,
|
|
|
- url,
|
|
|
+ '.p-video' + props.currentActive,
|
|
|
+ videoUrl.value,
|
|
|
() => {
|
|
|
- const videoDom = document.querySelector('.t-video' + props.currentActive)
|
|
|
- console.log(videoDom.style.transform)
|
|
|
+ const videoDom = document.querySelector('.p-video' + props.currentActive)
|
|
|
+ console.log(useSystem.partObj)
|
|
|
+ setTimeout(() => {
|
|
|
+ videoDom.style.width = videoDom.videoWidth + 'px'
|
|
|
+ const { width, height } = videoDom.getBoundingClientRect()
|
|
|
+ const { PartCenterY: py, PartCenterX: px } = useSystem.partObj
|
|
|
+ const [x, y] = [
|
|
|
+ px < 237 ? 0 : px > width ? width : px - 237,
|
|
|
+ py < 132 ? 0 : py > height ? height : py - 132
|
|
|
+ ]
|
|
|
+ videoDom.style.transform = `translate(${-x}px, ${-y}px)`
|
|
|
|
|
|
- videoDom.style.transform = `scale(3) translate(${-tempArr.value[tempArrI].x}px, ${-tempArr.value[tempArrI].y}px)`
|
|
|
- loading.value = false
|
|
|
- tempArrT = setInterval(() => {
|
|
|
- if (tempArrI < tempArr.value.length - 1) {
|
|
|
- ++tempArrI
|
|
|
- } else {
|
|
|
- tempArrI = 0
|
|
|
- }
|
|
|
- videoDom.style.transform = `scale(3) translate(${-tempArr.value[tempArrI].x}px, ${-tempArr.value[tempArrI].y}px)`
|
|
|
- }, tempArr.value[tempArrI].duration * 1000)
|
|
|
+ loading.value = false
|
|
|
+ }, 200)
|
|
|
},
|
|
|
{
|
|
|
- enableZoom: false,
|
|
|
- enableDrag: false
|
|
|
+ enableZoom: false, // 启用缩放
|
|
|
+ enableDrag: false, // 启用拖动
|
|
|
+ minScale: 1, // 最小缩放比例
|
|
|
+ maxScale: 6, // 最大缩放比例
|
|
|
+ dragSpeed: 1.9 // 拖动速度
|
|
|
}
|
|
|
)
|
|
|
} catch (error) {
|
|
|
@@ -173,17 +129,26 @@
|
|
|
// 关闭线程
|
|
|
const closeWorker = (index) => {
|
|
|
if (!playerObj) return
|
|
|
- clearInterval(tempArrT)
|
|
|
playerObj?.destroyed()
|
|
|
playerObj = null
|
|
|
}
|
|
|
+ const init = () => {
|
|
|
+ videoClick()
|
|
|
+ }
|
|
|
|
|
|
- onMounted(() => {
|
|
|
- videoClick(props.data, props.currentActive)
|
|
|
- })
|
|
|
+ watch(
|
|
|
+ () => useSystem.partObj,
|
|
|
+ () => {
|
|
|
+ if (props.currentActive !== useSystem.winActive) return
|
|
|
+ init()
|
|
|
+ },
|
|
|
+ { deep: true }
|
|
|
+ )
|
|
|
|
|
|
onBeforeUnmount(() => {
|
|
|
closeWorker()
|
|
|
})
|
|
|
+
|
|
|
+ defineExpose({ init })
|
|
|
</script>
|
|
|
<style scoped lang="scss"></style>
|