Bläddra i källkod

Merge branch 'develop' of http://git.zanxiangnet.com/wjx/ad-manage

wjx 2 år sedan
förälder
incheckning
331f19d973

BIN
public/image/play.png


+ 16 - 5
src/components/FileBoxAD/index.tsx

@@ -10,6 +10,8 @@ import SortModal from "./components/fileModal/sortModal"
 import { EyeOutlined } from "@ant-design/icons"
 import ImgsModal from "./components/imgsModal"
 import MoveTo from "./components/moveTo"
+import VideoNews from "@/pages/launchSystemNew/components/newsModal/videoNews"
+import { getVideoImgUrl } from "@/utils/utils"
 
 interface News {
     id: number,
@@ -403,7 +405,7 @@ function FlieBox(props: Props) {
                                         }}
                                     />
                                 } else if (mediaType === 'VIDEO') {
-                                    El = <video src={item.url} style={{ width: 130, height: 100 }} controls />
+                                    El = <VideoNews src={item.url} />
                                 } else if (mediaType === 'PAGE') {
                                     switch (topPageElements?.elementType) {
                                         case 'TOP_IMAGE':
@@ -445,10 +447,19 @@ function FlieBox(props: Props) {
                                             break
                                         case 'TOP_VIDEO':
                                             topName = "顶部视频"
-                                            El = <div className={style.pageVideo}>
-                                                <div className={style.pagePreview} onClick={(e) => { e.stopPropagation(); setPage && setPage(1, item.id) }}><EyeOutlined /> 预览</div>
-                                                <video src={topPageElements?.topVideoSpec?.videoUrl} style={{ width: 130, height: 100 }} />
-                                            </div>
+                                            El = <Image
+                                                src={getVideoImgUrl(topPageElements?.topVideoSpec?.videoUrl)}
+                                                preview={{ visible: false, maskClassName: style.maskClass }}
+                                                onClick={(e) => {
+                                                    e.stopPropagation()
+                                                    let className = (e.target as any).className
+                                                    if (className === 'ant-image-mask-info') {
+                                                        setPage && setPage(1, item.id)
+                                                    } else {
+                                                        changeClickFile(e, item, isAll, noFile)
+                                                    }
+                                                }}
+                                            />
                                             break
                                     }
                                 }

+ 11 - 10
src/pages/launchSystemNew/components/addLandingPage/index.tsx

@@ -43,6 +43,7 @@ import {
 import { useModel } from 'umi'
 import SelectCloud from '../selectCloud'
 import { getTypeKey, replaceSpecialTxt, txtLength } from '@/utils/utils'
+import VideoNews from '../newsModal/videoNews'
 
 const { Option } = Select;
 
@@ -472,17 +473,17 @@ function AddLandingPage(props: Props) {
                         elementType === 'TOP_VIDEO' ? <>
                             <div className={`compt componentType61 ${content[0]?.comptActive && 'comptActive'}`} onClick={(e) => { installActive(e, 0) }}>
                                 <div className={'componentWrap'}>
-                                    <div className={'componentContent'}>
+                                    <div className={'componentContent'} style={{ lineHeight: 'normal' }}>
                                         {
                                             videoUrl ? <div className="videoPlay">
-                                                <video src={videoUrl} style={{ display: 'block', width: '100%', margin: 0 }} />
-                                                <span></span>
-                                            </div>
-                                                : <div className={'default'} style={{ width: 375, height: 300, margin: 0 }}>
-                                                    <div className={'defaultIcon'} style={{ marginTop: 80 }}>
-                                                        <Topvideo />
-                                                    </div>
+                                                {/* <video src={videoUrl} style={{ display: 'block', width: '100%', margin: 0 }} />
+                                                <span></span> */}
+                                                <VideoNews src={videoUrl} style={{ display: 'block', width: '100%', margin: 0, height: '100%' }} 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: 300, margin: 0 }}>
+                                                <div className={'defaultIcon'} style={{ marginTop: 80 }}>
+                                                    <Topvideo />
                                                 </div>
+                                            </div>
                                         }
 
                                     </div>
@@ -654,7 +655,7 @@ function AddLandingPage(props: Props) {
             if (length === 2) {
                 let imageTextItem = selectCon?.imageTextItem[goodsCount]
                 imageTextItem.subElemType = value
-                switch(value) {
+                switch (value) {
                     case 'GH':
                         imageTextItem.content = JSON.parse(JSON.stringify(ghITItemContent))
                         break;
@@ -665,7 +666,7 @@ function AddLandingPage(props: Props) {
             } else if (length === 1) {
                 let imageTextItem = selectCon?.imageTextItem[0]
                 imageTextItem.subElemType = value
-                switch(value) {
+                switch (value) {
                     case 'GH':
                         imageTextItem.content = JSON.parse(JSON.stringify(ghITItemContent))
                         break;

+ 10 - 0
src/pages/launchSystemNew/components/addLandingPage/index1.less

@@ -815,6 +815,16 @@
     height: 46px;
     background-size: 46px;
   }
+
+  >div {
+    display: block !important;
+    border-radius: 0 !important;
+    
+    .ant-image{
+      display: block;
+    }
+  }
+  
 }
 
 .floatButtonWrapper {

+ 2 - 5
src/pages/launchSystemNew/components/lookLanding/index.tsx

@@ -8,6 +8,7 @@ import '../addLandingPage/index1.less'
 import { UserAddOutlined } from "@ant-design/icons";
 import { useModel } from "umi";
 import { getTypeKey } from "@/utils/utils";
+import VideoNews from "../newsModal/videoNews";
 
 type Props = {
     visible?: boolean,
@@ -68,9 +69,6 @@ function LookLanding(props: Props) {
         }
     }, [id])
 
-    console.log('content---->', content)
-
-
     // 顶部组件
     const topCon = useMemo(() => {
 
@@ -112,8 +110,7 @@ function LookLanding(props: Props) {
                                         <div className={'componentContent'}>
                                             {
                                                 videoUrl && <div className="videoPlay">
-                                                    <video src={videoUrl} style={{ display: 'block', width: '100%', margin: 0 }} />
-                                                    <span></span>
+                                                    <VideoNews src={videoUrl} style={{ display: 'block', width: '100%', margin: 0, height: '100%' }} maskImgStyle={{ position: 'absolute', top: '50%', left: '50%', width: 40, height: 40, transform: 'translate(-50%, -50%)', zIndex: 10 }}/>
                                                 </div>
                                             }
                                         </div>

+ 42 - 0
src/pages/launchSystemNew/components/newsModal/index.less

@@ -0,0 +1,42 @@
+.imgNews {
+    display: inline-block;
+    overflow: hidden;
+    position: relative;
+    border-radius: 6px;
+
+    &>div {
+        .img {
+            width: 130px;
+            height: 100px;
+            cursor: pointer;
+            object-fit: contain;
+        }
+    }
+
+    .mask {
+        position: absolute;
+        width: 100%;
+        height: 100%;
+        top: 0;
+        left: 0;
+        background-color: rgba(0, 0, 0, .1);
+        display: flex;
+        justify-content: center;
+        align-items: center;
+
+        &>img {
+            width: 20px;
+            height: 20px;
+            display: inline-block;
+            cursor: pointer;
+        }
+    }
+}
+
+.video {
+    width: 100%;
+    max-width: 320px;
+    max-height: 600px;
+    display: block;
+    margin: auto;
+}

+ 3 - 0
src/pages/launchSystemNew/components/newsModal/index1.less

@@ -0,0 +1,3 @@
+.imgNews .ant-image {
+    display: block;
+}

+ 39 - 0
src/pages/launchSystemNew/components/newsModal/videoNews.tsx

@@ -0,0 +1,39 @@
+import React, { useState } from "react"
+import style from './index.less'
+import { Image, ImageProps, Modal } from 'antd'
+import { getVideoImgUrl } from "@/utils/utils"
+import play from "../../../../../public/image/play.png"
+import { CloseOutlined } from '@ant-design/icons';
+import './index1.less'
+
+interface Props extends ImageProps {
+    maskBodyStyle?: React.CSSProperties
+    maskImgStyle?: React.CSSProperties
+}
+
+const VideoNews: React.FC<Props> = ({ preview = false, src, maskBodyStyle, maskImgStyle, ...data }) => {
+
+    /*****************************/
+    const [toPlay, setToPlay] = useState<boolean>(false)
+    /*****************************/
+
+    return <>
+        <div className={`${style.imgNews} imgNews`} onClick={(e) => { e.stopPropagation(); }}>
+            <Image src={src ? getVideoImgUrl(src) : 'error'} preview={false} {...data} className={style.img}/>
+            <div className={style.mask} style={maskBodyStyle}>
+                <img src={play} style={maskImgStyle} onClick={(e) => { e.stopPropagation(); e.preventDefault(); setToPlay(true) }} />
+            </div>
+        </div>
+        {toPlay && <Modal
+            visible={toPlay}
+            bodyStyle={{ backgroundColor: 'rgba(0,0,0,0.8)', overflow: 'hidden', borderRadius: 6 }}
+            footer={null}
+            closeIcon={<CloseOutlined style={{ color: '#FFF' }}/>}
+            onCancel={() => setToPlay(false)}
+        >
+            <video className={style.video} style={{ borderRadius: 6 }} src={src} autoPlay controls>您的浏览器不支持 video 标签。</video>
+        </Modal>}
+    </>
+}
+
+export default React.memo(VideoNews)

+ 7 - 4
src/pages/launchSystemNew/launchManage/createAd/ad/modal/leadAd.tsx

@@ -111,7 +111,7 @@ function LeadAdModal(props: Props) {
                             }
                         }
                         break;
-                        case 'siteSetPackage':   // 处理分版位出价
+                    case 'siteSetPackage':   // 处理分版位出价
                         if (newValues[key]?.length > 0) {
                             let newSiteSetPackage: SiteSetPackageDataProps[] = JSON.parse(JSON.stringify(newValues[key]))
                             if (!newValues?.bidAmountAdjustmentEnabled) {
@@ -269,7 +269,7 @@ function LeadAdModal(props: Props) {
                 setState({ ...state, isShowTime: ['1'] })
             }
         } else {
-            form.setFieldsValue({ 
+            form.setFieldsValue({
                 adgroupName: '广告_销售线索',
                 date: moment().startOf('day').add(2, 'M'),
                 optimizationGoal: "OPTIMIZATIONGOAL_ECOMMERCE_ORDER",
@@ -464,6 +464,9 @@ function LeadAdModal(props: Props) {
                 {!automaticSiteEnabled && <Form.Item name='siteSet' noStyle rules={[{ required: true, message: '请输入选择广告版位!' }]}>
                     <Checkbox.Group style={{ width: '100%' }} onChange={(e) => { bidModeChange({ bidMode: 'BID_MODE_OCPM' }); setSiteSetHandle(e as string[]) }}>
                         <Row>
+                            {/* <Col span={4}>
+                                <Checkbox value="SITE_SET_CHANNELS">微信视频号</Checkbox>
+                            </Col> */}
                             <Col span={4}>
                                 <Checkbox value="SITE_SET_MOMENTS">微信朋友圈</Checkbox>
                             </Col>
@@ -545,7 +548,7 @@ function LeadAdModal(props: Props) {
                 dateType === '1' ? <Form.Item name='date' rules={[{ required: true, message: '请选择日期' }]}>
                     <RangePicker style={{ marginLeft: 177 }} disabledDate={disabledDate}></RangePicker>
                 </Form.Item> : <Form.Item name='date' style={{ marginLeft: 177 }} rules={[{ required: true, message: '请选择日期' }]}>
-                    <DatePickers disabledDate={disabledDate}/>
+                    <DatePickers disabledDate={disabledDate} />
                 </Form.Item>
             }
             <Form.Item label={<strong>投放时段</strong>}>
@@ -565,7 +568,7 @@ function LeadAdModal(props: Props) {
             <Form.Item label={<strong>出价方式<Tooltip title='出价方式不同将影响自定义人群,行为兴趣意向等某些功能无法使用'><ExclamationCircleOutlined style={{ color: '#e91e63', marginLeft: 5 }} /></Tooltip></strong>} name='bidMode' rules={[{ required: true, message: '请选择出价方式' }]}>
                 <Radio.Group onChange={(e) => {
                     console.log(e.target.value);
-                    
+
                     if (e.target.value === "BID_MODE_CPM" || e.target.value === "BID_MODE_CPC") {
                         form.setFieldsValue({
                             optimizationGoal: null,

+ 3 - 0
src/pages/launchSystemNew/launchManage/createAd/ad/modal/wechat.tsx

@@ -445,6 +445,9 @@ function WeChatAdModal(props: Props) {
                 {!automaticSiteEnabled && <Form.Item name='siteSet' noStyle rules={[{ required: true, message: '请输入选择广告版位!' }]}>
                     <Checkbox.Group style={{ width: '100%' }} onChange={(e) => { bidModeChange({ bidMode: 'BID_MODE_OCPM' }); setSiteSetHandle(e as string[]) }}>
                         <Row>
+                            {/* <Col span={5}>
+                                <Checkbox value="SITE_SET_CHANNELS">微信视频号</Checkbox>
+                            </Col> */}
                             <Col span={5}>
                                 <Checkbox value="SITE_SET_MOMENTS">微信朋友圈</Checkbox>
                             </Col>

+ 10 - 7
src/pages/launchSystemNew/launchManage/createAd/creative/modal/index.tsx

@@ -112,6 +112,7 @@ function CreativePup(props: Props) {
         list: [],//素材
         max: 1,//素材数量
     })//图片素材配置
+    const [templateStyleS, setTemplateStyleS] = useState<string>('')
     const [imgType, setimgType] = useState<'single' | 'many'>('single')
     const [conversionList, setConversionList] = useState<any>(null)
     let pageType = Form.useWatch('pageType', form)
@@ -305,10 +306,11 @@ function CreativePup(props: Props) {
                 if (!res) {
                     return
                 }
-                // 
+                let templateStyle = ''
                 Object.values(res)?.forEach((arr: any) => {
                     newData.push(arr)
                     Array.isArray(arr) && arr?.forEach((item: any) => {
+                        templateStyle += item?.adcreativeTemplateStyle
                         if (newArr.length > 0) {//假如已存在ID,需要过滤相同
                             if (outAdcreativeTemplateIdFun(item.adcreativeTemplateId) && newArr.every((i: { adcreativeTemplateId: any }) => i.adcreativeTemplateId !== item.adcreativeTemplateId)) {//不重复的添加
                                 newArr.push(item)
@@ -320,6 +322,7 @@ function CreativePup(props: Props) {
                         }
                     })
                 })
+                setTemplateStyleS(templateStyle)
                 /*****暂时排除激励和banner有问题******/
                 if (siteSet.some((i: string) => i === 'SITE_SET_MOMENTS')) {
                     newArr = newArr.filter((item: { adcreativeTemplateId: number }) => item.adcreativeTemplateId !== 910 && item.adcreativeTemplateId !== 925 && item.adcreativeTemplateId !== 2107 && item.adcreativeTemplateId !== 2109)
@@ -412,10 +415,10 @@ function CreativePup(props: Props) {
     const typeChange = useCallback((adcreativeElementsType) => {
         if (adcreativeElementsType && adcreative_template_list?.length > 0) {
             let adcreativeTemplateIdArr = adcreative_template_list?.filter(item => item.adcreativeTemplateStyle === adcreativeElementsType)
-            console.log('typeChange====>', adcreativeTemplateIdArr[0].adcreativeTemplateId)
-            getTemplate(adcreativeTemplateIdArr[0].adcreativeTemplateId)
-            form.setFieldsValue({ adcreativeTemplateId: adcreativeTemplateIdArr[0].adcreativeTemplateId })
-
+            if (adcreativeTemplateIdArr?.length > 0) {
+                getTemplate(adcreativeTemplateIdArr[0].adcreativeTemplateId)
+                form.setFieldsValue({ adcreativeTemplateId: adcreativeTemplateIdArr[0].adcreativeTemplateId })
+            }
         }
     }, [adcreative_template_list])
 
@@ -701,8 +704,8 @@ function CreativePup(props: Props) {
                     let value = e.target.value
                     typeChange(value)
                 }}>
-                    <Radio.Button value="视频">视频</Radio.Button>
-                    <Radio.Button value="图片">图片</Radio.Button>
+                    <Radio.Button value="视频" disabled={!templateStyleS?.includes('视频')}>视频</Radio.Button>
+                    <Radio.Button value="图片" disabled={!templateStyleS?.includes('图片')}>图片</Radio.Button>
                 </Radio.Group>
             </Form.Item>
 

+ 5 - 4
src/pages/launchSystemNew/launchManage/createAd/creativeCL/index.tsx

@@ -8,6 +8,7 @@ import AdcreativeCol from "../adcreativeCol"
 import CreativePup from "./modal"
 import Material from "./modal/material"
 import Copywriting from "./modal/copywriting"
+import VideoNews from "@/pages/launchSystemNew/components/newsModal/videoNews"
 
 
 type Props = {
@@ -90,16 +91,16 @@ const CreativeCL: React.FC<Props> = (props) => {
                             if (keys?.length > 1) {
                                 return <div key={index} className={style.otherGroup}>
                                     {keys?.includes('imageUrl') && <div className={style.group}><img src={item.imageUrl} /></div>}
-                                    {keys?.includes('videoUrl') && <div className={style.group}><video src={item.videoUrl} /></div>}
-                                    {keys?.includes('shortVideo1Url') && <div className={style.group}><video src={item.shortVideo1Url} /></div>}
+                                    {keys?.includes('videoUrl') && <div className={style.group}><VideoNews src={item.videoUrl} style={{ display: 'block', width: '100%', margin: 0, height: '100%' }}/></div>}
+                                    {keys?.includes('shortVideo1Url') && <div className={style.group}><VideoNews src={item.shortVideo1Url} style={{ display: 'block', width: '100%', margin: 0, height: '100%' }}/></div>}
                                 </div>
                             } else {
                                 if (keys?.includes('imageUrl')) {
                                     return <div key={index} className={style.group}><img src={item.imageUrl} /></div>
                                 } else if (keys?.includes('videoUrl')) {
-                                    return <div key={index} className={style.group}><video src={item.videoUrl} /></div>
+                                    return <div key={index} className={style.group}><VideoNews src={item.videoUrl} style={{ display: 'block', width: '100%', margin: 0, height: '100%' }}/></div>
                                 } else if (keys?.includes('shortVideo1Url')) {
-                                    return <div key={index} className={style.group}><video src={item.shortVideo1Url} /></div>
+                                    return <div key={index} className={style.group}><VideoNews src={item.shortVideo1Url} style={{ display: 'block', width: '100%', margin: 0, height: '100%' }}/></div>
                                 }
                             }
                             return null

+ 10 - 8
src/pages/launchSystemNew/launchManage/createAd/creativeCL/modal/index.tsx

@@ -98,12 +98,12 @@ function CreativePup(props: Props) {
         list: [],//素材
         max: 1,//素材数量
     })//图片素材配置
+    const [templateStyleS, setTemplateStyleS] = useState<string>('')
     const [conversionList, setConversionList] = useState<any>(null)
     let pageType = Form.useWatch('pageType', form)
     let adcreativeTemplateId = Form.useWatch('adcreativeTemplateId', form)
     let actionBtn = Form.useWatch('actionBtn', form)
     // let siteSet = Form.useWatch('siteSet', form)
-    let overrideCanvasHeadOption = Form.useWatch('overrideCanvasHeadOption', form)
     let adcreativeElementsType = Form.useWatch('adcreativeElementsType', form)
     let dataShow = Form.useWatch('dataShow', form)
     let conversionDataType = Form.useWatch('conversionDataType', form)
@@ -291,10 +291,11 @@ function CreativePup(props: Props) {
                 if (!res) {
                     return
                 }
-                // 
+                let templateStyle = ''
                 Object.values(res)?.forEach((arr: any) => {
                     newData.push(arr)
                     Array.isArray(arr) && arr?.forEach((item: any) => {
+                        templateStyle += item?.adcreativeTemplateStyle
                         if (newArr.length > 0) {//假如已存在ID,需要过滤相同
                             if (outAdcreativeTemplateIdFun(item.adcreativeTemplateId) && newArr.every((i: { adcreativeTemplateId: any }) => i.adcreativeTemplateId !== item.adcreativeTemplateId)) {//不重复的添加
                                 newArr.push(item)
@@ -306,6 +307,7 @@ function CreativePup(props: Props) {
                         }
                     })
                 })
+                setTemplateStyleS(templateStyle)
                 /*****暂时排除激励和banner有问题******/
                 if (siteSet.some((i: string) => i === 'SITE_SET_MOMENTS')) {
                     newArr = newArr.filter((item: { adcreativeTemplateId: number }) => item.adcreativeTemplateId !== 910 && item.adcreativeTemplateId !== 925 && item.adcreativeTemplateId !== 2107 && item.adcreativeTemplateId !== 2109)
@@ -411,10 +413,10 @@ function CreativePup(props: Props) {
     const typeChange = useCallback((adcreativeElementsType) => {
         if (adcreativeElementsType && adcreative_template_list?.length > 0) {
             let adcreativeTemplateIdArr = adcreative_template_list?.filter(item => item.adcreativeTemplateStyle === adcreativeElementsType)
-            console.log('typeChange====>', adcreativeTemplateIdArr[0].adcreativeTemplateId)
-            getTemplate(adcreativeTemplateIdArr[0].adcreativeTemplateId)
-            form.setFieldsValue({ adcreativeTemplateId: adcreativeTemplateIdArr[0].adcreativeTemplateId })
-
+            if (adcreativeTemplateIdArr?.length > 0) {
+                getTemplate(adcreativeTemplateIdArr[0].adcreativeTemplateId)
+                form.setFieldsValue({ adcreativeTemplateId: adcreativeTemplateIdArr[0].adcreativeTemplateId })
+            }
         }
     }, [adcreative_template_list])
 
@@ -668,8 +670,8 @@ function CreativePup(props: Props) {
                     let value = e.target.value
                     typeChange(value)
                 }}>
-                    <Radio.Button value="视频">视频</Radio.Button>
-                    <Radio.Button value="图片">图片</Radio.Button>
+                    <Radio.Button value="视频" disabled={!templateStyleS?.includes('视频')}>视频</Radio.Button>
+                    <Radio.Button value="图片" disabled={!templateStyleS?.includes('图片')}>图片</Radio.Button>
                 </Radio.Group>
             </Form.Item>
 

+ 11 - 2
src/pages/launchSystemNew/launchManage/createAd/creativeCL/modal/material.tsx

@@ -6,6 +6,7 @@ import { Button, Form, message, Modal, Radio, Space, Switch, Image, Popconfirm }
 import React, { useEffect, useState } from "react"
 import { useModel } from "umi"
 import styles from './index.less'
+import { getVideoImgUrl } from "@/utils/utils"
 
 interface Props {
     value?: any[]
@@ -65,7 +66,7 @@ const Material: React.FC<Props> = (props) => {
 
     const getVideoCapture = useAjax((params) => get_tools_video_capture(params))
     /**************************/
-
+    
     // 回填
     useEffect(() => {
         if (visible) {
@@ -395,7 +396,12 @@ const Material: React.FC<Props> = (props) => {
                             }
                             form.setFieldsValue({ materials: materialsNew })
                         } else {
-                            let newMaterials = content?.map((item: any) => ({ [materialConfig.type]: item?.url }))
+                            let newMaterials = content?.map((item: any) => {
+                                if (materialConfig.type === 'video' && material.length === 2) {
+                                    return { [materialConfig.type]: item?.url, image: getVideoImgUrl(item?.url) }
+                                }
+                                return { [materialConfig.type]: item?.url }
+                            })
                             if (newMaterials.length > 0) {
                                 if (materials?.every((item: any) => !item)) { // 没设置过
                                     form.setFieldsValue({ materials: newMaterials })
@@ -435,6 +441,9 @@ const Material: React.FC<Props> = (props) => {
                                         item[materialConfig.type] = content[0]?.url
                                         return { ...item }
                                     } else {
+                                        if (materialConfig.type === 'video' && material.length === 2) {
+                                            return { [materialConfig.type]: content[0]?.url, image: getVideoImgUrl(content[0]?.url) }
+                                        }
                                         return { [materialConfig.type]: content[0]?.url }
                                     }
                                 }

+ 2 - 0
src/pages/launchSystemNew/launchManage/createAd/index.less

@@ -248,6 +248,8 @@
   justify-content: space-between;
   gap: 5px;
   margin-bottom: 10px;
+  border-radius: 6px;
+  overflow: hidden;
 
   >div {
     flex: 1;

+ 2 - 1
src/pages/launchSystemNew/launchManage/createAd/index.tsx

@@ -31,6 +31,7 @@ import moment from "moment"
 import { getAccountListApi, getGroupListApi } from "@/services/launchAdq/subgroup"
 import TacticsS from "./tacticsS"
 import UserTactics from "./tacticsS/userTactics"
+import VideoNews from "../../components/newsModal/videoNews"
 
 const CreateAd: React.FC = () => {
 
@@ -1215,7 +1216,7 @@ const CreateAd: React.FC = () => {
                                                                             {item?.topSliderSpec?.imageUrlList?.map((url: string, index: number) => <Image width={70} src={url} style={{ borderRadius: 8 }} key={'TOP_SLIDER' + index} />)}
                                                                         </Space>
                                                                     case 'TOP_VIDEO':
-                                                                        return <video src={item?.topVideoSpec?.videoUrl} width={150} controls key={index}></video>
+                                                                        return <VideoNews src={item?.topVideoSpec?.videoUrl}/>
                                                                 }
                                                             })}</div>
                                                         </div>

+ 2 - 1
src/services/launchAdq/enum.ts

@@ -211,7 +211,8 @@ export enum SiteSetEnum {
   'SITE_SET_TENCENT_NEWS' = '腾讯新闻',
   'SITE_SET_TENCENT_VIDEO' = '腾讯视频',
   'SITE_SET_WECHAT' = '微信公众号与小程序',
-  'SITE_SET_WECHAT_PLUGIN' = '微信新闻插件'
+  'SITE_SET_WECHAT_PLUGIN' = '微信新闻插件',
+  'SITE_SET_CHANNELS' = '微信视频号'
 }
 /***/
 /**出价方式*/

+ 11 - 0
src/utils/utils.ts

@@ -186,4 +186,15 @@ export const getArrDifference = (arr1: any[], arr2: any[]) => {
   return arr1.concat(arr2).filter((v, i, arr) => {
     return arr.indexOf(v) === arr.lastIndexOf(v);
   });
+}
+
+/**
+ * 拼接oss参数获取视频首针图
+ * @param videoUrl t_0 0秒的视频截图 t_10000 10秒的视频截图帧
+ */
+export const getVideoImgUrl = (videoUrl: string) => {
+  if (['.mp4', '.swf', '.flv', '.rm', '.ram', '.mov', '.mpg', '.mpeg', '.wmv', '.avi'].some(item => videoUrl.includes(item))) {
+    return videoUrl + "?x-oss-process=video/snapshot,t_0,f_jpg,w_0,h_0,m_fast,ar_auto"
+  }
+  return videoUrl
 }