|
|
@@ -1,12 +1,19 @@
|
|
|
-import React, { useState } from 'react'
|
|
|
+import React, { useMemo, useState } from 'react'
|
|
|
import styles from './index.module.scss'
|
|
|
import Z1titie from '@/components/Z1titie'
|
|
|
import history from '@/utils/history'
|
|
|
import { Mask } from 'antd-mobile'
|
|
|
+import playIcon from './images/play.png'
|
|
|
+import closeIcon from './images/icon-guanbi.png'
|
|
|
+import classNames from 'classnames'
|
|
|
|
|
|
function A4scene() {
|
|
|
+ const [curIndex, setCurIndex] = useState(0)
|
|
|
const [visible, setVisible] = useState(false)
|
|
|
- const [videoPath, setVideoPath] = useState('')
|
|
|
+
|
|
|
+ const detail = useMemo(() => {
|
|
|
+ return VIDEO_LIST[curIndex]
|
|
|
+ }, [curIndex])
|
|
|
|
|
|
return (
|
|
|
<div
|
|
|
@@ -15,24 +22,22 @@ function A4scene() {
|
|
|
>
|
|
|
<Z1titie
|
|
|
title='使用场景'
|
|
|
- backFu={() => {
|
|
|
- history.push('/show')
|
|
|
- }}
|
|
|
+ toHome={() => history.push('/?mask=1')}
|
|
|
/>
|
|
|
|
|
|
+ <div className='A4sceneCover' style={{ backgroundImage: `url(${serverUrl}${detail.coverPath})` }}>
|
|
|
+ <div className='A4sceneCoverFooter'>
|
|
|
+ <p>{detail.name}</p>
|
|
|
+ <img src={playIcon} alt='play' onClick={() => setVisible(true)} />
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div className='A4sceneDesc' dangerouslySetInnerHTML={{ __html: detail?.desc }} />
|
|
|
+
|
|
|
<ul className='A4sceneList'>
|
|
|
- {VIDEO_LIST.map(item => (
|
|
|
- <li className='A4sceneCard'
|
|
|
- key={item.name}
|
|
|
- style={{ backgroundImage: `url(${serverUrl}${item.coverPath})` }}
|
|
|
- onClick={() => {
|
|
|
- setVisible(true)
|
|
|
- setVideoPath(serverUrl + item.videoPath)
|
|
|
- }}
|
|
|
- >
|
|
|
- <div className='A4sceneCardFt'>
|
|
|
- <p>{item.name}</p>
|
|
|
- </div>
|
|
|
+ {VIDEO_LIST.map((item, index) => (
|
|
|
+ <li className={classNames(curIndex === index ? 'A4sceneListAc' : '')} key={index} onClick={() => setCurIndex(index)}>
|
|
|
+ <p>{item.name}</p>
|
|
|
</li>
|
|
|
))}
|
|
|
</ul>
|
|
|
@@ -42,7 +47,14 @@ function A4scene() {
|
|
|
destroyOnClose
|
|
|
onMaskClick={() => setVisible(false)}
|
|
|
>
|
|
|
- <video src={videoPath} controls autoPlay />
|
|
|
+ <video
|
|
|
+ src={serverUrl + detail.videoPath}
|
|
|
+ controls
|
|
|
+ autoPlay
|
|
|
+ playsInline
|
|
|
+ />
|
|
|
+
|
|
|
+ <img src={closeIcon} alt='close' onClick={() => setVisible(false)} />
|
|
|
</Mask>
|
|
|
</div>
|
|
|
)
|