shaogen1995 1 year ago
parent
commit
16d286335e

+ 5 - 0
Code/public/myData/myData.js

@@ -621,6 +621,11 @@ const banquetHotArr = [
   }
 ]
 
+if (window.location.href.includes('?u=unity')) {
+  console.log('车骑拜谒热点信息:', visitHotArr)
+  console.log('主客宴请热点信息:', banquetHotArr)
+}
+
 // 乐舞百戏热点信息(后面的更多模块也会复用)
 const danceHotArr = [
   {

+ 5 - 0
Code/src/pages/A2visit/PanoVideo/Hot2/index.module.scss

@@ -54,6 +54,11 @@
             width: 100%;
             height: 100%;
           }
+          video {
+            object-fit: cover;
+            width: 100%;
+            height: 100%;
+          }
         }
 
         .adm-image {

+ 29 - 7
Code/src/pages/A2visit/PanoVideo/Hot2/index.tsx

@@ -1,4 +1,4 @@
-import React, { useCallback, useMemo, useState } from 'react'
+import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'
 import styles from './index.module.scss'
 import { VisitHotDataType } from '@/types'
 import classNames from 'classnames'
@@ -27,6 +27,16 @@ function Hot2({ closeFu, data, name }: Props) {
     setFlooInd(ind)
   }, [])
 
+  const videoRef = useRef<HTMLVideoElement>(null)
+
+  useEffect(() => {
+    if (acData.type && acData.type === 'video') {
+      setTimeout(() => {
+        if (videoRef.current) videoRef.current.play()
+      }, 100)
+    }
+  }, [acData.type])
+
   return (
     <div id='HotOpCss' className={styles.Hot2}>
       <div className='h2Main' style={{ backgroundImage: `url(${baseURL}visit/hot2bj.png)` }}>
@@ -39,13 +49,25 @@ function Hot2({ closeFu, data, name }: Props) {
 
         <div className={classNames('h2TuWen', data.length <= 1 ? 'h2TuWenDuo' : '')}>
           {/* 图片 */}
-          {acData.type && acData.type === 'model' ? (
+          {acData.type ? (
             <div className='H2model' style={{ height: acData.txt ? '200px' : '280px' }}>
-              <iframe
-                title={name}
-                src={`${baseURL}modelLoding/model.html?u=${acData.imgArr[0]}`}
-                frameBorder='0'
-              ></iframe>
+              {acData.type === 'model' ? (
+                <iframe
+                  title={name}
+                  src={`${baseURL}modelLoding/model.html?u=${acData.imgArr[0]}`}
+                  frameBorder='0'
+                ></iframe>
+              ) : (
+                <video
+                  ref={videoRef}
+                  src={baseURL + acData.imgArr[0]}
+                  controls
+                  playsInline
+                  muted
+                  webkit-playsinline='true'
+                  x5-video-player-type='h5'
+                ></video>
+              )}
             </div>
           ) : (
             acData.imgArr.map((url, index) => <LazyImg src={baseURL + url} key={index} />)

+ 1 - 1
Code/src/types/api/layot.d.ts

@@ -15,7 +15,7 @@ export type VisitHotDataType = {
   name: string
   txt: string
   imgArr: string[]
-  type?: 'model'
+  type?: 'model' | 'video'
 }[]
 
 export type PlowHotType = {