|
@@ -2,9 +2,10 @@ import React, { useContext } from "react"
|
|
|
import { DispatchMiniPageCreate } from "./drawerMini";
|
|
import { DispatchMiniPageCreate } from "./drawerMini";
|
|
|
import { useDrop } from "ahooks";
|
|
import { useDrop } from "ahooks";
|
|
|
import './global.less'
|
|
import './global.less'
|
|
|
-import { topImageContent, topVideoContent } from "./const";
|
|
|
|
|
|
|
+import { topImageContent, topShortVideoContent, topVideoContent } from "./const";
|
|
|
import { DeleteOutlined } from '@ant-design/icons';
|
|
import { DeleteOutlined } from '@ant-design/icons';
|
|
|
-
|
|
|
|
|
|
|
+import { Swiper, SwiperSlide } from 'swiper/react'
|
|
|
|
|
+import 'swiper/css'
|
|
|
import { ReactComponent as TopNullBack } from '../../../../public/svg/topNullBack.svg'
|
|
import { ReactComponent as TopNullBack } from '../../../../public/svg/topNullBack.svg'
|
|
|
import { ReactComponent as TopImgSvg } from '../../../../public/svg/topimg.svg'
|
|
import { ReactComponent as TopImgSvg } from '../../../../public/svg/topimg.svg'
|
|
|
import { ReactComponent as EditSvg } from '../../../../public/svg/edit.svg'
|
|
import { ReactComponent as EditSvg } from '../../../../public/svg/edit.svg'
|
|
@@ -16,8 +17,8 @@ import UploadLoad from "../../components/materialMould/uploadLoad";
|
|
|
const CenterTop: React.FC = () => {
|
|
const CenterTop: React.FC = () => {
|
|
|
|
|
|
|
|
/**************************************/
|
|
/**************************************/
|
|
|
- const { dragging, pageSpecs, setDragging, setPageSpecs, installActive, setTopUrl } = useContext(DispatchMiniPageCreate)!;
|
|
|
|
|
- const { pageElementsSpecList, globalElementsSpecList } = pageSpecs
|
|
|
|
|
|
|
+ const { dragging, pageSpecs, setDragging, setPageSpecs, installActive, setTopUrl, setTopShortVideoUrl } = useContext(DispatchMiniPageCreate)!;
|
|
|
|
|
+ const { pageElementsSpecList, globalElementsSpecList, pageType } = pageSpecs
|
|
|
const topSpec = pageElementsSpecList?.[0]
|
|
const topSpec = pageElementsSpecList?.[0]
|
|
|
/**************************************/
|
|
/**************************************/
|
|
|
|
|
|
|
@@ -30,6 +31,8 @@ const CenterTop: React.FC = () => {
|
|
|
newPageElementsSpecList[0] = { ...topImageContent, comptActive: true }
|
|
newPageElementsSpecList[0] = { ...topImageContent, comptActive: true }
|
|
|
} else if (key === 'TOP_VIDEO') {
|
|
} else if (key === 'TOP_VIDEO') {
|
|
|
newPageElementsSpecList[0] = { ...topVideoContent, comptActive: true }
|
|
newPageElementsSpecList[0] = { ...topVideoContent, comptActive: true }
|
|
|
|
|
+ } else if (key === 'TOP_SHORT_VIDEO') {
|
|
|
|
|
+ newPageElementsSpecList[0] = { ...topShortVideoContent, comptActive: true }
|
|
|
} else {
|
|
} else {
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
@@ -113,8 +116,38 @@ const CenterTop: React.FC = () => {
|
|
|
</div>
|
|
</div>
|
|
|
</section>
|
|
</section>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
+ case "TOP_SHORT_VIDEO":
|
|
|
|
|
+ return <div className={`compt componentType62 ${topSpec?.comptActive && 'comptActive'}`} onClick={(e) => { installActive(e, 0) }}>
|
|
|
|
|
+ <Swiper
|
|
|
|
|
+ direction="vertical"
|
|
|
|
|
+ slidesPerView={1}
|
|
|
|
|
+ spaceBetween={0}
|
|
|
|
|
+ style={{ height: '750px' }}
|
|
|
|
|
+ >
|
|
|
|
|
+ {topSpec?.data?.map((item, index) => <SwiperSlide key={index}>
|
|
|
|
|
+ <div className={'componentWrap'}>
|
|
|
|
|
+ <div className={'componentContent'} style={{ lineHeight: 'normal' }}>
|
|
|
|
|
+ {item?.url ? <div className="videoPlay">
|
|
|
|
|
+ <VideoNews src={item.url} style={{ display: 'block', width: '100%', margin: 0, height: 750 }} maskImgStyle={{ position: 'absolute', top: '50%', left: '50%', width: 40, height: 40, transform: 'translate(-50%, -50%)', zIndex: 10 }} />
|
|
|
|
|
+ </div> : <div className={'default'} style={{ width: 375, height: 750, margin: 0 }}>
|
|
|
|
|
+ <div className={'defaultIcon'} style={{ marginTop: 280 }}>
|
|
|
|
|
+ <TopVideoSvg />
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>}
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ {!item?.url && <div className={'comptUpload'} style={{ margin: 0 }}><UploadLoad
|
|
|
|
|
+ type='video'
|
|
|
|
|
+ uploadButton={<button style={{ marginTop: 360 }} className={'comptEditButton'}>上传视频</button>}
|
|
|
|
|
+ onChange={(value, videoInfo) => {
|
|
|
|
|
+ setTopShortVideoUrl(value, videoInfo, index)
|
|
|
|
|
+ }}
|
|
|
|
|
+ /></div>}
|
|
|
|
|
+ </SwiperSlide>)}
|
|
|
|
|
+ </Swiper>
|
|
|
|
|
+ </div>
|
|
|
default:
|
|
default:
|
|
|
- return <div className={`compt topComptArea ${dragging ? 'dragging' : ''}`} {...dropProps}>
|
|
|
|
|
|
|
+ return pageType === 'LANDING_PAGE' ? <div className={`compt topComptArea ${dragging ? 'dragging' : ''}`} {...dropProps}>
|
|
|
<TopNullBack />
|
|
<TopNullBack />
|
|
|
|
|
|
|
|
{dragging ? <div className="topAreaTitle" style={{ marginTop: 30 }}>
|
|
{dragging ? <div className="topAreaTitle" style={{ marginTop: 30 }}>
|
|
@@ -123,6 +156,15 @@ const CenterTop: React.FC = () => {
|
|
|
<p className={'topAreaTitle'}>顶部组件区</p>
|
|
<p className={'topAreaTitle'}>顶部组件区</p>
|
|
|
<div className={'desc'}>在左上方,选择顶部组件添加到此处</div>
|
|
<div className={'desc'}>在左上方,选择顶部组件添加到此处</div>
|
|
|
</>}
|
|
</>}
|
|
|
|
|
+ </div> : <div style={{ minHeight: 648 }} className={`compt topComptArea topShortVideo ${dragging ? 'dragging' : ''}`} {...dropProps}>
|
|
|
|
|
+ <TopNullBack />
|
|
|
|
|
+
|
|
|
|
|
+ {dragging ? <div className="topAreaTitle" style={{ marginTop: 30 }}>
|
|
|
|
|
+ 拖至此处
|
|
|
|
|
+ </div> : <>
|
|
|
|
|
+ <p className={'topAreaTitle'}>短视频组件区</p>
|
|
|
|
|
+ <div className={'desc'}>在左上方,选择顶部组件添加到此处</div>
|
|
|
|
|
+ </>}
|
|
|
</div>
|
|
</div>
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|