<template>
  <div class="newCreate">
    <a-form :form="form">
      <div class="moduler">
        <div class="moduler-title">计划名称</div>
        <div class="adName">
          <span>广告计划名称：</span> 
          <div class="nameList">
            <strong v-for="item in planInfo" :key="item.id" class="item">{{item.name+'('+item.id+')'}}</strong>
          </div>
        </div>
      </div>
      
      <!-- 设置投放位置 -->
      <div class="moduler">
        <div class="moduler-title">设置投放位置</div>
        <div class="ad-range">
          <div class="row-item">
            <div class="hint-item"></div>
            <div class="label-item">
              <div class="text-item">广告位置</div>
              <div class="required-item"></div>
            </div>
            <div class="input-item">
              <a-form-item>
                <a-radio-group v-model="adposition" @change="adPositionChange">
                  <a-radio-button value="smartInventorys">优选广告位</a-radio-button>
                  <a-radio-button value="inventoryTypes">按媒体指定位置</a-radio-button>
                  <a-radio-button value="sceneInventorys">按场景指定位置</a-radio-button>
                </a-radio-group>
              </a-form-item>
              <div style="width: 400px; margin-top: 24px;" v-show="adposition=='inventoryTypes'">
                <div class="inventory-tags-lists-header">
                  <a-checkbox :indeterminate="indeterminate" :checked="checkAll" @change="onCheckAllChange">
                  </a-checkbox>
                  <div class="inventory-tags-lists-name"><strong>APP名称</strong></div>
                </div>
                <div class="inventory-tags-lists-container">
                  <a-checkbox-group v-model="checkedList" :options="plainOptions" @change="onChange" />
                </div>
              </div>
              <div style="width: 400px; margin-top: 24px;" v-show="adposition=='sceneInventorys'">
                <div class="inventory-tags-lists-header">
                  <div class="inventory-tags-lists-name" style="padding-left:15px"><strong>位置选择</strong></div>
                </div>
                <div class="inventory-tags-lists-container">
                  <a-radio-group  v-model=sceneInventory>
                    <a-radio :style="radioStyle" value="VIDEO_SCENE">沉浸式竖版视频场景广告位</a-radio>
                    <a-radio :style="radioStyle" value="FEED_SCENE">信息流场景广告位</a-radio>
                    <a-radio :style="radioStyle" value="TAIL_SCENE">视频后贴和尾帧场景广告位</a-radio>
                  </a-radio-group>
                </div>
              </div>
            </div><div class=""></div>
          </div>

        </div>
      </div>
      <!-- 制作创意 -->
      <div class="moduler">
        <div class="moduler-title">制作创意</div>
        <div class="ad-range">
          <div class="row-item">
            <div class="hint-item"></div>
            <div class="label-item">
              <div class="text-item">创意方式</div>
              <div class="required-item"></div>
            </div>
            <div class="input-item">
              <a-form-item>
                <a-radio-group v-decorator="['creativeWay', { initialValue:'customCreativity' }]">
                  <a-radio-button value="proceduralCreativity" :disabled="creativeWayDisable">程序化创意</a-radio-button>
                  <a-radio-button value="customCreativity" :disabled="creativeWayDisable">自定义创意</a-radio-button>
                </a-radio-group>
              </a-form-item>
            </div>
          </div>

          <div class="row-item" v-if="getFormData('creativeWay')=='proceduralCreativity'">
            <div class="hint-item"></div>
            <div class="label-item">
              <div class="text-item">素材添加方式</div>
              <div class="required-item"></div>
            </div>
            <div class="input-item">
              <a-form-item>
                <a-radio-group v-decorator="['materialAddType', { initialValue:'customUpload' }]">
                  <a-radio-button value="customUpload">自定义上传</a-radio-button>
                  <a-tooltip>
                    <template slot="title">暂未开启该功能</template>
                    <a-radio-button value="chooseProgramCreativePackage" :disabled="true">选择程序化创意包</a-radio-button>
                  </a-tooltip>
                </a-radio-group>
              </a-form-item>
            </div>
          </div>

          <div class="row-item">
            <div class="hint-item"></div>
            <div class="label-item">
              <div class="text-item">创意内容</div>
              <div class="required-item"></div>
            </div>
            <!-- <div class="input-item">
              <a-form-item>
                <p v-if="getFormData('creativeWay')=='customCreativity'">创意个数： <strong>{{}}/10</strong></p>
                <p v-else>
                  <span>图片创意个数： <strong>{{}}/10</strong></span>
                  <span>视频创意个数： <strong>{{}}/6</strong></span>
                </p>
                <div class="bui-tabs-scroll">
                  <a-tabs
                    :style="{ height: '500px',width:'700px',border:'1px solid #ccc',overflow:'auto',padding:'0 15px 10px'}">
                    <a-tab-pane v-for="i in 10" :key="i" :tab="`Tab-${i}`">
                      <div class="no">
                      </div>
                      <a-button type='primary' @click="addCreate">
                        <a-icon type="plus" />添加创意
                      </a-button>
                    </a-tab-pane>
                  </a-tabs>
                </div>
              </a-form-item>
            </div> -->
            <material ref="material" :creativeType="getFormData('creativeWay')"></material>
          </div>

          <div class="row-item">
            <div class="hint-item"></div>
            <div class="label-item">
              <div class="text-item">品牌主页</div>
              <div class="required-item"></div>
            </div>
            <div class="input-item">
              <a-form-item>
                <a-radio-group v-decorator="['deliveryRange', { initialValue:'DEFAULT' }]">
                  <a-radio-button value="DEFAULT">不开启</a-radio-button>
                  <a-radio-button value="UNION">开启抖音主页</a-radio-button>
                </a-radio-group>
              </a-form-item>
            </div>
          </div>

          <div class="row-item">
            <div class="hint-item"></div>
            <div class="label-item">
              <div class="text-item">应用下载详情页</div>
              <div class="required-item"></div>
            </div>
            <div class="input-item">
              <a-form-item>
                <a-input v-decorator="['webUrl', {rules:validationRules.url}]" />
              </a-form-item>
            </div>
          </div>

          <div class="row-item">
            <div class="hint-item"></div>
            <div class="label-item">
              <div class="text-item">行动号召</div>
              <div class="required-item"></div>
            </div>
            <div class="input-item">
              <a-form-item>
                <a-select v-decorator="[
                'actionText', // 给表单赋值或拉取表单时，该input对应的key
                { rules: [{ required: true, message: '该选项必须填写' }] }
              ]" showSearch style="width: 480px">
                  <a-select-option :value="item" v-for="(item,i) in actionTextList" :key="i">
                    {{item}}
                  </a-select-option>
                </a-select>
              </a-form-item>
            </div>
          </div>

          <div class="row-item">
            <div class="hint-item"></div>
            <div class="label-item">
              <div class="text-item">应用名</div>
              <div class="required-item"></div>
            </div>
            <div class="input-item">
              <a-form-item>
                <a-input placeholder="请输入2-10个字的应用名，" :maxLength='10' v-decorator="['appName', {rules:validationRules.name}]" />
              </a-form-item>
            </div>
          </div>

          <div class="row-item">
            <div class="hint-item"></div>
            <div class="label-item">
              <div class="text-item">副标题</div>
              <!-- <div class="required-item"></div> -->
            </div>
            <div class="input-item">
              <a-form-item>
                <a-input placeholder="请输入2-12个字的副标题，" :maxLength='12' v-decorator="['advancedCreativeTitle']" />
              </a-form-item>
            </div>
          </div>

          <div class="row-item">
            <div class="hint-item"></div>
            <div class="label-item">
              <div class="text-item">广告评论</div>
              <div class="required-item"></div>
            </div>
            <div class="input-item">
              <a-form-item>
                <a-radio-group v-decorator="['isCommentDisable', { initialValue:0 }]">
                  <a-radio-button :value="0">关闭</a-radio-button>
                  <a-radio-button :value="1">开启</a-radio-button>
                </a-radio-group>
              </a-form-item>
            </div>
          </div>

          <div class="row-item">
            <div class="hint-item"></div>
            <div class="label-item">
              <div class="text-item">创意展示</div>
              <div class="required-item"></div>
            </div>
            <div class="input-item">
              <a-form-item>
                <a-radio-group v-decorator="['creativeDisplayMode', { initialValue:'CREATIVE_DISPLAY_MODE_CTR' }]">
                  <a-radio-button value="CREATIVE_DISPLAY_MODE_CTR">优选模式</a-radio-button>
                  <a-radio-button value="CREATIVE_DISPLAY_MODE_RANDOM">轮播模式</a-radio-button>
                </a-radio-group>
              </a-form-item>
            </div>
          </div>

        </div>
      </div>
      <!-- 创意分类 -->
      <div class="moduler">
        <div class="moduler-title">创意分类</div>
        <div class="ad-range">
          <div class="row-item">
            <div class="hint-item"></div>
            <div class="label-item">
              <div class="text-item">创意分类</div>
              <div class="required-item"></div>
            </div>
            <div class="input-item">
              <a-form-item>
                <a-cascader :options="createOptions" v-model="thirdIndustryIds" :fieldNames="fieldNames"  placeholder="请选择创意分类" @change="createChange" />
              </a-form-item>
            </div>
          </div>
          <div class="row-item">
            <div class="hint-item"></div>
            <div class="label-item">
              <div class="text-item">创意标签</div>
              <div class="required-item"></div>
            </div>
            <div class="input-item">
              <a-form-item>
                <!-- <a-input v-model="createTip" @keyup.enter="onSubmit"></a-input>
                <div v-if="createTipList.length>0">
                  <template v-for="(tag, index) in createTipList">
                    <a-tooltip v-if="tag.length > 20" :key="tag" :title="tag">
                      <a-tag :key="tag" :closable="index !== 0" :afterClose="() => handleClose(tag)">
                        {{ `${tag.slice(0, 20)}...` }}
                      </a-tag>
                    </a-tooltip>
                    <a-tag v-else :key="tag" :closable="true" :afterClose="() => handleClose(tag)">
                      {{ tag }}
                    </a-tag>
                  </template>
                </div> -->


                 <a-select mode="tags" style="width: 100%" placeholder="按空格生成标签" v-model="createTipList" :token-separators="[' ']" >
                  
                </a-select>
              </a-form-item>
            </div>
          </div>

        </div>
      </div>
      <!-- 监测链接 -->
      <div class="moduler">
        <div class="moduler-title">监测链接</div>
        <div class="ad-range">
          <div class="row-item">
            <div class="hint-item"></div>
            <div class="label-item">
              <div class="text-item">展示</div>
              <!-- <div class="required-item"></div> -->
            </div>
            <div class="input-item">
              <a-form-item>
                <a-input v-decorator="['trackUrl']" />
              </a-form-item>
            </div>
          </div>
          <div class="row-item">
            <div class="hint-item"></div>
            <div class="label-item">
              <div class="text-item">点击</div>
              <!-- <div class="required-item"></div> -->
            </div>
            <div class="input-item">
              <a-form-item>
                <a-input v-decorator="['actionTrackUrl']" />
              </a-form-item>
            </div>
          </div>
          <div class="row-item">
            <div class="hint-item"></div>
            <div class="label-item">
              <div class="text-item">视频播放</div>
              <!-- <div class="required-item"></div> -->
            </div>
            <div class="input-item">
              <a-form-item>
                <a-input v-decorator="['videoPlayTrackUrl']" />
              </a-form-item>
            </div>
          </div>
          <div class="row-item">
            <div class="hint-item"></div>
            <div class="label-item">
              <div class="text-item">视频播完</div>
              <!-- <div class="required-item"></div> -->
            </div>
            <div class="input-item">
              <a-form-item>
                <a-input v-decorator="['videoPlayDoneTrackUrl']" />
              </a-form-item>
            </div>
          </div>
          <div class="row-item">
            <div class="hint-item"></div>
            <div class="label-item">
              <div class="text-item">视频有效播放</div>
              <!-- <div class="required-item"></div> -->
            </div>
            <div class="input-item">
              <a-form-item>
                <a-input v-decorator="['videoPlayEffectiveTrackUrl']" />
              </a-form-item>
            </div>
          </div>


        </div>
      </div>

      <div class="moduler">
        <!-- <div class="moduler-title"></div> -->
        <div>
          当前账户：
          <strong>{{accountInfo.title}}</strong>
        </div>
      </div>
      <!-- 操作 -->
      <div class="moduler">
        <!-- <div class="moduler-title">计划名称</div> -->
        <div class="opt">
          <a-button type="default" style="margin-right:15px" @click="goBack">取消</a-button>
          <a-button type="primary" style="margin-right:15px" @click="goSave" :loading="loading">立即创建</a-button>
        </div>
      </div>
    </a-form>
      <div class="infoModal">
         <a-modal v-model="visible" title="提示"  @ok="handleOk" :keyboard='false' :maskClosable='false'>
            <ul>
              <li v-for="(item,index) in errorInfo" :key="index">
                  <span>第{{index+1}}条：</span>{{item.message}}
              </li>
            </ul>
            <template slot="footer">
              <a-button key="back" @click="handleCancel">
                返回本页
              </a-button>
              <a-button key="submit" type="primary"  @click="handleOk">
                返回头条批量页面
              </a-button>
            </template>
          </a-modal>
      </div>
  </div>
</template>

<script>
  import moment from 'moment'
  import {
    getAction,
    postAction,
    downFile,
    downFilePost
  } from '@/api/manage'
  import material from './components/material'

  import qs from 'qs'
  const plainOptions = [{
      value: 'INVENTORY_FEED',
      label: '今日头条'
    },
    {
      value: 'INVENTORY_VIDEO_FEED',
      label: '西瓜视频'
    },
    {
      value: 'INVENTORY_AWEME_FEED',
      label: '抖音'
    },
    {
      value: 'INVENTORY_HOTSOON_FEED',
      label: '抖音火山版'
    },
    {
      value: 'INVENTORY_UNION_SLOT',
      label: '穿山甲'
    },
  ];

  export default {
    data() {
      return {
        planInfo: [],
        groupInfo: {},
        accountInfo: {},
        createTip: "",
        createTipList: [],
        actionTextList: [],
        radioStyle: {
          display: 'block',
          height: '30px',
          lineHeight: '30px',
          padding: '0 15px'
        },
        checkedList: [],
        indeterminate: false,
        checkAll: false,
        plainOptions,
        form: this.$form.createForm(this),
        positionvalue: undefined,
        validationRules: {
          url: [         
            {          
              required: true,
              validator: this.validateURL,
            },
          ],
          name:[{
            required: true,
            message:'应用名必须填写',
          }],
          bid:[{
            required: true,
            message:'出价信息必须填写',
            // validator: this.validateBid,
          }]
        },
        createType: undefined, //创意分类的页面
        createOptions: [], //创意分类的数组
        fieldNames: {
          label: 'name',
          value: 'id',
          children: 'children'
        },
        thirdIndustryId:undefined,
        thirdIndustryIds:undefined,
        adposition:'smartInventorys',
        sceneInventory:'VIDEO_SCENE',

        errorInfo:[],
        visible:false,
        loading:false,

        creativeWayDisable:false,//创意方式是否禁用
        currentCreateData:{}, //   编辑当前的创意的数据
      }
    },
    components: {
      material
    },
    methods: {
      handleChange(){
        console.log(this.createTipList)
      },
      handleOk(e) {
          this.visible=false;
          this.$router.push('/modules/BatchCreate/TouTiaoBatch')
          this.$bus.$emit('remove', '/modules/BatchCreate/newCreate')
          localStorage.removeItem('groupInfo')
          localStorage.removeItem('planInfo')
          localStorage.removeItem('accountInfo')
      },
      handleCancel(e) {
        this.visible = false;
      },
      handleClose(removedTag) {
        const tags = this.createTipList.filter(tag => tag !== removedTag)
        this.createTipList = tags
      },
      onSubmit() {
        //   this.createTip
        if (this.createTip != '') {
          console.log(this.createTip.split(/\s+/))
          if (this.createTipList.length > 20) {
            this.$message.error('最多只能建立20个创意标签')
          } else {
            this.createTipList.push(...this.createTip.split(/\s+/))
          }
          this.createTip = ''
        }
      },
      onChange(checkedList) {
        this.indeterminate = !!checkedList.length && checkedList.length < plainOptions.length;
        this.checkAll = checkedList.length === plainOptions.length;
      },
      onCheckAllChange(e) {
        let valueOption = [];
        this.plainOptions.forEach((item) => {
          valueOption.push(item.value)
        })
        Object.assign(this, {
          checkedList: e.target.checked ? valueOption : [],
          indeterminate: false,
          checkAll: e.target.checked,
        });
      },
      // tab切换
      tabcallback() {

      },
      // 添加创意
      addCreate() {

      },
      createChange(value){
        console.log(value);
        this.thirdIndustryId=value[2]
       
        console.log(this.form.getFieldsValue())
      },
      // //获取表单的某一个属性值
      getFormData(className) {
        return this.form.getFieldValue(className)
      },
      // 广告位置选择改变
      adPositionChange(val) {
        console.log(val)
        // if (val.target.value == 'smartInventorys') {
        //   this.form.setFieldsValue({
        //     smartInventory: 1,
        //     inventoryType: [],
        //   })
        // } else if (val.target.value == 'inventoryTypes') {
        //   this.form.setFieldsValue({
        //     smartInventory: 0,
        //     inventoryType: this.checkedList,
        //   })
        // } else if (val.target.value == 'sceneInventorys') {
        //   this.form.setFieldsValue({
        //     smartInventory: 0,
        //     inventoryType: [],
        //   })
        //   console.log(this.getFormData('sceneInventory'))
        // }

      },
      // 注册表单的字段
      initFormValue() {
        // this.form.getFieldDecorator('inventoryType')
        // this.form.getFieldDecorator('smartInventory')
        // this.form.getFieldDecorator('thirdIndustryId')
        // this.form.getFieldDecorator('sceneInventory')
      },
      // 验证网址
      IsURL(res) {
        //   var strRegex = /^([hH][tT]{2}[pP]:\/\/|[hH][tT]{2}[pP][sS]:\/\/|www\.)(([A-Za-z0-9-~]+)\.)+([A-Za-z0-9-~\/])+$/
        var strRegex =
          /^([hH][tT]{2}[pP]:\/\/|[hH][tT]{2}[pP][sS]:\/\/)(([A-Za-z0-9-~]+)\.)+([A-Za-z0-9-~\/])+(.+[A-Za-z0-9-~\/])+$/
        var re = new RegExp(strRegex)
        // console.log(re.test(res))
        if (re.test(res)) {
          return true
        } else {
          return false
        }
      },
      validateURL(rule, value, callback) {
        // console.log(rule, value, callback);

        if (this.IsURL(value)) {
          callback()
        } else if (value && !this.IsURL(value)) {
          callback('链接地址无法访问，请正确输入')
        } else {
          //     callback('下载链接必须填写')
        }
      },
      goBack() {
        this.$router.replace('/modules/BatchCreate/TouTiaoBatch')
        localStorage.removeItem('groupInfo');
        localStorage.removeItem('planInfo');
        localStorage.removeItem('accountInfo');
        this.$bus.$emit('remove', '/modules/BatchCreate/newCreate')
      },
      goSave() {
        this.$nextTick(() => {
          var dataCreatives = this.$refs.material.HorizontalLargeImageListBig.concat(
            this.$refs.material.HorizontalLargeImageListHeng,
            this.$refs.material.HorizontalLargeImageListShu,
            this.$refs.material.HorizontalLargeImageListZu,
            this.$refs.material.HorizontalLargeImageListSmall,
            this.$refs.material.HorizontalLargeImageListBigShu
          )

          console.log(dataCreatives, this.$refs.material.titleData)
          this.form.validateFields((err, values) => {
            if (!err) {
              var params = {
                ...values
              }
              this.loading=true;
              // params.thirdIndustryId = params.thirdIndustryId.pop()
              var dataCreatives = this.$refs.material.HorizontalLargeImageListBig.concat(
                this.$refs.material.HorizontalLargeImageListHeng,
                this.$refs.material.HorizontalLargeImageListShu,
                this.$refs.material.HorizontalLargeImageListZu,
                this.$refs.material.HorizontalLargeImageListSmall,
                this.$refs.material.HorizontalLargeImageListBigShu
              )
              console.log('Received values of form: ', values)
              console.log(dataCreatives)
              if (this.getFormData('creativeWay') == 'proceduralCreativity') {
                //   params.titles = this.titleData
                params.titles = this.$refs.material.titleData
              }
                values.thirdIndustryId=this.thirdIndustryId;

                if (this.adposition == 'smartInventorys') {
                  values.smartInventory=1;                 
                } else if (this.adposition == 'inventoryTypes') {
                  values.inventoryType=this.checkedList
                } else if (this.adposition == 'sceneInventorys') {                 
                  values.sceneInventory=this.sceneInventory                 
                }
                values.adKeywords=this.createTipList;

                let adIds=[];
               
                let postUrl=''
                if(this.currentCreateData.adId){
                    postUrl='/ctop/byteDanceCreative/updateCreative'
                    adIds[0]=this.planInfo[0].id
                }else{
                  postUrl='/bytedance/batch/create/creative';
                   this.planInfo.forEach(item=>{
                    adIds.push(item.id)
                  })
                }
                postAction(postUrl, {
                  accountId:this.accountInfo.value,
                  adIds,
                  ...values,
                  creatives: dataCreatives
                }).then((res) => {
                  console.log(res)
                  if (res.success) {
                    this.errorInfo=res.data;
                    this.loading=false;
                    this.visible=true;
                    // res.data.forEach((item)=>{
                    //   this.$message.error(item.message)
                    // })

                  } else {
                    this.loading=false;
                  }
                })
            } else {

              // console.log(err)
              this.$message.error('请正确填写必填项目')
            }
          })

        })
      },
      
     
    },
    mounted() {
      this.initFormValue();

      getAction('/bytedance/batch/industry/list').then(res => {
        this.createOptions = res.data

      })
      this.$bus.$emit('remove', '/modules/BatchCreate/newPlan')
      let planInfo = localStorage.getItem('planInfo')
     
      if (planInfo!='') {
        this.planInfo = JSON.parse(planInfo)
      }
      
      console.log(this.planInfo)
      let groupInfo = localStorage.getItem('groupInfo')
   
      if (groupInfo!=null) {
        this.groupInfo = JSON.parse(groupInfo)
      }
      let accountInfo = localStorage.getItem('accountInfo')
 
      if (accountInfo!=null) {
        this.accountInfo = JSON.parse(accountInfo)
      }

      getAction('/bytedance/batch/action/text', {
        accountId: "1649600126891015",
        landType: "APP"
      }).then(res => {
        if (res.code == '0') {
          this.actionTextList = res.data
        } else {
          this.actionTextList = []
        }

      })
      this.$nextTick(()=>{

        if(this.accountInfo.value&&this.planInfo[0].id){
            postAction('/ctop/byteDanceCreative/detail',qs.stringify({
              planId:this.planInfo[0].id,
              accountId:this.accountInfo.value
            })).then(res=>{
              console.log(res);
              if(res.success){
                if(res.data!=null){
                  this.creativeWayDisable=true;
                  // 编辑当前的创意的数据
                  this.currentCreateData=res.data
                    this.form.setFieldsValue({
                      ...res.data
                    })
                    this.sceneInventory=res.data.sceneInventory;
                    if(res.data.smartInventory){
                      this.adposition='smartInventorys'
                    }else if(res.data.sceneInventory){
                      this.adposition='sceneInventorys';
                      this.sceneInventory=res.data.sceneInventory
                    }else if(res.data.inventoryType.length>0){
                      this.adposition='inventoryTypes';
                      this.checkedList=res.data.inventoryType;
                      this.onChange(this.checkedList)
                    }

                    this.createTipList=res.data.adKeywords;
                    let thirdIndustryArr=[];
                    thirdIndustryArr[0]=(res.data.thirdIndustryId+'').substring(0,4);
                    thirdIndustryArr[1]=(res.data.thirdIndustryId+'').substring(0,6);
                    thirdIndustryArr[2]=(res.data.thirdIndustryId+'').substring(0,8);

                   
                    thirdIndustryArr=thirdIndustryArr.map(item=>{
                      return item*1
                    })
                     console.log(thirdIndustryArr)
                    this.thirdIndustryId=res.data.thirdIndustryId;
                    this.thirdIndustryIds=thirdIndustryArr;

                    if(res.data.title_list){
                      this.form.setFieldsValue({
                        creativeWay:'proceduralCreativity'
                      })
                      this.$refs.material.titleData=res.data.title_list
                    }else{
                      this.form.setFieldsValue({
                        creativeWay:'customCreativity'
                      })

                    }

                     var dataCreatives = this.$refs.material.HorizontalLargeImageListBig.concat(
                      this.$refs.material.HorizontalLargeImageListHeng,
                      this.$refs.material.HorizontalLargeImageListShu,
                      this.$refs.material.HorizontalLargeImageListZu,
                      this.$refs.material.HorizontalLargeImageListSmall,
                      this.$refs.material.HorizontalLargeImageListBigShu
                    )
                    res.data.creatives.forEach(item=>{
                      if(item.imageMode=="CREATIVE_IMAGE_MODE_VIDEO_VERTICAL"){
                          item.showElse=true;
                          item.many=5
                          this.$refs.material.HorizontalLargeImageListHeng.push(item)
                      }else if(item.imageMode=="CREATIVE_IMAGE_MODE_VIDEO"){    
                          item.showElse=true;
                          item.many=5                  
                          this.$refs.material.HorizontalLargeImageListShu.push(item)
                      }
                    })
                    if(this.$refs.material.HorizontalLargeImageListShu.length>0){
                      this.$refs.material.HorizontalLargeImageList=this.$refs.material.HorizontalLargeImageListShu;
                      this.$refs.material.materialType='CREATIVE_IMAGE_MODE_VIDEO'
                    }else if(this.$refs.material.HorizontalLargeImageListHeng.length>0){
                      this.$refs.material.HorizontalLargeImageList=this.$refs.material.HorizontalLargeImageListHeng;
                      this.$refs.material.materialType='CREATIVE_IMAGE_MODE_VIDEO_VERTICAL'
                    }
                    

                   
                    console.log(this.$refs.material, this.$refs.material.titleData)
                }
              }          
            })
        }
              
      })
    },
  }
</script>

<style lang="scss">
.newCreate{
  .ant-btn-danger {
    background-color: #ff4d4f !important; 
  }
}

  .ant-tooltip-inner,
  .ant-tooltip,
  .ant-tooltip-arrow::before {
    background-color: #fff;
    color: #333;
  }

  .ant-tooltip-inner {
    span {
      display: block;
    }
  }

  .ant-tooltip {
    max-width: 450px;
  }

  .newCreate {
    .ant-radio-button-wrapper {
      min-width: 80px;
      text-align: center;
    }

    .ant-form-item {
      -webkit-box-sizing: border-box;
      box-sizing: border-box;
      margin: 0;
      padding: 0;
      color: rgba(0, 0, 0, 0.65);
      font-size: 14px;
      font-variant: tabular-nums;
      line-height: 1.5;
      list-style: none;
      -webkit-font-feature-settings: 'tnum';
      font-feature-settings: 'tnum';
      vertical-align: top;
    }

    .directedBody {
      .ant-form-item {
        margin-bottom: 20px;
      }
    }

    .ant-checkbox-wrapper,
    .ant-checkbox-group-item {
      display: block;
      padding: 5px 15px;
    }

    .ant-checkbox-wrapper:first-child {
      padding: 0 15px 5px;
    }
  }
</style>
<style lang="scss" scoped>
  .newCreate {
    font-family: PingFangSC-Regular, tahoma, arial, 'Hiragino Sans GB', 'Microsoft yahei', sans-serif;
    color: #333;

    ul,
    li {
      margin: 0;
      padding: 0;
    }

    .moduler {
      background: #fff;
      margin-bottom: 16px;
      position: relative;
      padding: 32px 24px 48px 32px;
      border-radius: 4px;
      box-shadow: 0px 1px 6px 0px rgba(0, 0, 0, 0.05);

      .moduler-title {
        display: flex;
        align-items: center;
        font-size: 22px;
        margin-bottom: 20px;
      }

      .row-item {
        display: flex;
        justify-content: flex-start;
        align-items: center;
        margin-bottom: 32px;
      }

      .row-item:last-of-type {
        margin-bottom: 0;
      }

      .row-item .hint-item {
        width: 24px;
        min-width: 24px;
        align-self: flex-start;
        line-height: 20px;
        height: 20px;
        margin-top: 5px;
      }

      .row-item .label-item {
        position: relative;
        align-items: flex-start;
        align-self: flex-start;
        line-height: 20px;
        height: 20px;
        margin-top: 7px;
        width: 80px;
        min-width: 80px;

        .text-item {
          font-size: 14px;
          width: 60px;
        }
      }

      .row-item .required-item {
        width: 4px;
        height: 4px;
        border-radius: 2px;
        background: #f45858;
        position: absolute;
        right: 10px;
        top: 50%;
        transform: translateY(-50%);
      }

      .row-item .input-item {
        min-width: 480px;
        position: relative;

        // height: 35px;
        .tip {
          font-size: 12px;
          color: tomato;
        }

        .inventory-tags-lists-header {
          background-color: #F8F9FA;
          border: 1px solid #E4E9ED;
          height: 36px;
          line-height: 33px;
          border-radius: 4px 4px 0 0;
          font-weight: bold;
          display: flex;
        }

        .inventory-tags-lists-container {
          border: 1px solid #E4E9ED;
          margin-top: -1px;
          height: 100%;
          padding: 4px 0px;
          border-radius: 0 0 4px 4px;
        }

        .inventory-tags-lists-item {
          width: 100%;
          height: 37px;
          line-height: 37px;
          padding-left: 12px;
          padding-right: 12px;
          display: flex;
          font-size: 14px;
          color: #333;
        }
      }
    }

    .opt {
      text-align: right;
    }
    .adName{
      display: flex;
      .nameList{
        width: 90%;
      }
      .item{
        display: inline-block;
        width: 30%;
        margin-left: 15px;
        margin-bottom: 10px;
      }
    }
  }
</style>