123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581 |
- <style>
- .chouzhen span {
- display: inline-block;
- }
- .check-video .ant-tabs-nav-container {
- text-align: center;
- font-size: 20px;
- }
- </style>
- <style scoped lang="scss">
- .actor-photo-list {
- display: flex;
- padding-left: 0;
- li {
- width: 20%;
- margin: 10px;
- position: relative;
- height: 380px;
- border: 1px solid #f2f2f2;
- list-style: none;
- padding: 10px;
- img,
- video {
- width: 100%;
- }
- }
- }
- .chouzhen {
- border-style: solid;
- border-width: 1px;
- border-color: #e4e4e4;
- width: calc(20% - 10px);
- padding: 10px;
- margin-right: 10px;
- margin-bottom: 10px;
- display: flex;
- align-items: center;
- background: #fff;
- position: relative;
- z-index: 99;
- float: left
- }
- li.chouzhen.first:before {
- font-size: 12px;
- content: "首帧";
- position: absolute;
- top: 7px;
- left: 5px;
- width: 36px;
- height: 20px;
- color: rgb(255, 255, 255);
- line-height: 20px;
- text-align: center;
- background: rgba(0, 0, 0, 0.5);
- border-radius: 2px;
- }
- .actor-photo-list {
- display: flex;
- padding-left: 0;
- li {
- width: 25%;
- margin: 10px;
- position: relative;
- height: 250px;
- border: 1px solid #f2f2f2;
- list-style: none;
- img,
- video {
- width: 100%;
- margin-top: auto;
- margin-bottom: auto;
- top: 0;
- bottom: 0;
- position: absolute;
- max-height: 250px;
- }
- }
- }
- </style>
- <template>
- <a-card :body-style="{ padding: '24px 32px' }" :bordered="false" class="only-step3">
- <a-tabs style="width:50%;margin:0 auto" type="editable-card" hideAdd @edit="remove">
- <a-tab-pane v-for="(pane, bestIndex) in pans" :tab="pane.tab" :key="pane.key" v-model="pansKey" disabled
- :closable="pane.closable" class="shishishis">
- <a-form @submit="handleSubmit" :form="form" style="margin-top:20px" :hideRequiredMark="true">
- <a-form-item label="广告组名称" :labelCol="labelCol" :wrapperCol="wrapperCol">
- <a-input v-model="pane.tab" readonly></a-input>
- </a-form-item>
- <a-form-item label="素材类型" :labelCol="labelCol" :wrapperCol="wrapperCol">
- <a-radio-group buttonStyle="solid" v-decorator="['creativeMaterialType', { initialValue: '1' }]">
- <a-radio-button value="1">竖版视频</a-radio-button>
- <a-radio-button value="2">横版视频</a-radio-button>
- </a-radio-group>
- </a-form-item>
- <a-form-item label="创意内容" :labelCol="labelCol">
- <a-layout>
- <a-layout-content style="padding:10px;">
- <a-row>
- <a-col :span="24" v-for="(item, index) of pane.list" :key="index">
- <a-card title :ref="item">
- <a-icon type="close" style="float:right;cursor: pointer;"
- @click="deleteCreative(bestIndex, index)" />
- <div style="clear:both"></div>
- <div class="dynamically_add_form_item">
- <a-form-item label="">
- <a @click="getVideoList('video', index, item, bestIndex)">选择视频</a>
- <a @click="uploadVideo(index,bestIndex)" style="margin-left:10px">上传视频</a>
- <br />
- <video :src="item.videoList.url" controls="controls" style="width:25%"
- v-if="item.videoList"></video>
- </a-form-item>
- <div class="downLoad" style="overflow:auto">
- <ul class="actor-photo-list"
- :style="{ width: item.imageUrlList.length>4?25 * item.imageUrlList.length + '%':'100%' }"
- v-if="item.imageUrlList.length > 0">
- <a-checkbox-group v-model="item.checkArrImage"
- style="width:100%; display: flex;padding-left: 0;" @change="onChangeCheckImage">
- <li v-for="(item, index) of item.imageUrlList" :key="index">
- <a-checkbox :value="item.code" style="position:absolute;z-index: 100"></a-checkbox><img
- class="video" :src="item.url" />
- </li>
- </a-checkbox-group>
- </ul>
- </div>
- <a-form-item label="">
- <a @click="getVideoList('image', index, item, bestIndex)">选择封面</a>
- <a @click="uploadImages(index,bestIndex)" style="margin-left:10px">上传封面</a>
- <a @click="showImages(index,bestIndex)" v-if="item.chouzhenShow"
- style="margin-left:10px">推荐封面</a>
- <br />
- <span v-for="(item,deleteIndex) of item.imageList" style="position:relative;">
- <img :src="item.url" style="width:18%;margin:1%;" :key="item.url" />
- <a-icon type="close-circle" @click="deleteData(index,bestIndex,deleteIndex)"
- style="position: absolute;right: 0px;" />
- </span>
- </a-form-item>
- <a-form-item label="广告语">
- <a @click="showTitle(index,bestIndex)">推荐广告语</a>
- <a-textarea class="rending" placeholder="请输入广告语" v-model.trim="item.description"
- :autosize="{ minRows: 2, maxRows: 6 }"></a-textarea>
- <a-tag v-for="(itemTag,indexTag) of tags" :key="indexTag"
- @click="getChange(item, itemTag, index)">{{itemTag.name}}</a-tag>
- </a-form-item>
- <a-form-item label="创意标题">
- <a-input v-model="item.name"></a-input>
- </a-form-item>
- </div>
- </a-card>
- </a-col>
- </a-row>
- <div :style="{ marginBottom: '16px' }">
- <a-button @click="addCreative(bestIndex)" :disabled="contentAll>=15||listCheck">
- 添加创意</a-button>
- </div>
- </a-layout-content>
- </a-layout>
- </a-form-item>
- <a-form-item label="行动号召" :labelCol="labelCol" :wrapperCol="wrapperCol">
- <a-select v-decorator="['actionBarText', { rules: [{ required: true, message: '行动号召按钮文案' }] }]" showSearch
- allowClear placeholder="选择行动号召按钮文案" optionFilterProp="children" :filterOption="filterOption">
- <a-select-option v-for="appModel in appList" :key="appModel.id" :value="appModel.actionBarText">
- {{ appModel.actionBarText }}
- </a-select-option>
- </a-select>
- </a-form-item>
- <a-form-item label="下载详情" :labelCol="labelCol" :wrapperCol="wrapperCol">
- <a-select v-decorator="['siteId' ]" showSearch allowClear placeholder="选择应用下载详情页"
- optionFilterProp="children" :filterOption="filterOption">
- <a-select-option v-for="appModel in siteList" :key="appModel.id" :value="appModel.actionBarText">
- {{ appModel.actionBarText }}
- </a-select-option>
- </a-select>
- </a-form-item>
- <a-form-item label="监测链接" :labelCol="labelCol" :wrapperCol="wrapperCol">
- <a-input v-if="pane.bid_type == 6" v-decorator="[
- 'clickTrackUrl',
- {
- rules: [
- { message: '请输入第三方检测链接' },
- { validator: handleConfirmValue }
- ]
- }
- ]" placeholder="请输入第三方检测链接">
- </a-input>
- <a-input v-else v-decorator="[
- 'clickTrackUrl',
- {
- rules: [
- { message: '请输入第三方检测链接' }
- ]
- }
- ]" placeholder="请输入第三方检测链接">
- </a-input>
- </a-form-item>
- </a-form>
- </a-tab-pane>
- </a-tabs>
- <a-form-item :wrapperCol="{ span: 24 }" style="text-align: center">
- <a-button type="primary" @click="handleSubmit" :loading="loading">提交</a-button>
- </a-form-item>
- <checkMatemal ref="check" @showVideo="showData"></checkMatemal>
- <a-modal :maskClosable="false" v-model="visible" title="广告创意创建情况">
- <div>
- 创建成功:{{ allForm.success.length }}条
- <div style="margin-top:20px">
- <p v-for="(item, index) of allForm.success" :key="index">
- <span>名称:{{ item.creativeName }}</span>
- </p>
- </div>
- <br />
- 创建失败:{{ allForm.fail.length }}条
- <div style="margin-top:20px">
- <p v-for="(item, index) of allForm.fail" :key="index">
- <span>名称:{{ item.creativeName }}</span><br />
- <span>错误信息:{{ item.failMessage }}</span>
- </p>
- </div>
- </div>
- <template slot="footer">
- <!-- <a-button key="back" @click="handleCancel">关闭</a-button> -->
- <a-button key="submit" type="primary" @click="handleOk">
- 返回列表
- </a-button>
- </template>
- </a-modal>
- <a-modal :maskClosable="false" title="封面上传" @cancel="closeImage" @afterClose="closeImage" v-model="addImageVisible">
- <template slot="footer">
- <a-button key="back" @click="closeImage">取消</a-button>
- <a-button key="submit" type="primary" @click="handleOkImage" :loading="loadingImage">
- 确定
- </a-button>
- </template>
- <a-form-item label="" class="add-image-material">
- <upload-to-ali style="width:100%" v-model="urlListImage.url" :customDomain="customDomain" :multiple="true"
- preview :region="region" :bucket="bucket" :accept="acceptImage" :max="15" :size="2048"
- :accessKeyId="accessKeyId" :accessKeySecret="accessKeySecret" :before-upload="fileWater" :dir="dirImg"
- @delete='deleteImage' @loaded="overUploadImage"></upload-to-ali>
- <span v-if="material.filter(item => item == false).length > 0 && urlListImage.url.length > 0"
- style="color:red">上传素材的尺寸不符,请修改(<span v-for="(item, index) of material" :key="index"
- v-show="!item">第{{ index + 1 }}张</span>出错)</span>
- <span v-else-if="urlListImage.url.length > 0 && material.filter(item => item == false).length == 0"
- style="color:green">上传成功</span>
- </a-form-item>
- </a-modal>
- <a-modal :maskClosable="false" title="视频上传" @cancel="closeVideo" @afterClose="closeVideo" v-model="addVideoVisible">
- <template slot="footer">
- <a-button key="back" @click="closeVideo">取消</a-button>
- <a-button key="submit" type="primary" @click="handleOkVideo" :loading="loadingVideo">
- 确定
- </a-button>
- </template>
- <a-form-item label="" class="add-image-material">
- <upload-to-ali v-model="urlList.url" :customDomain="customDomain" preview :region="region" :bucket="bucket"
- :accept="acceptVideo" :max="10" :size="1024000" :accessKeyId="accessKeyId" :accessKeySecret="accessKeySecret"
- :before-upload="file" :dir="dirVideo" @loaded="overUpload">
- </upload-to-ali>
- <span v-if="messageTip" style="color:red">{{messageTip}}</span>
- </a-form-item>
- </a-modal>
- <a-modal :maskClosable="false" title="抽帧展示" v-model="chouzhen" width="60%">
- <template slot="footer">
- <a-button key="back" @click="chouzhen=false">关闭</a-button>
- <a-button key="submit" type="primary" @click="handleOkChouzhen">
- 确定
- </a-button>
- </template>
- <a-button type="primary" @click="onCheckAllChange">
- 全选
- </a-button>
- <!-- </a-checkbox> -->
- <ul v-if="chouzhenList.length>0" style="height:600px;overflow:auto;padding-left:0">
- <a-checkbox-group v-model="checkList" @change="onChange">
- <li v-for="(item,index) of chouzhenList" :key="index" class="chouzhen" :class="{'first':index == 0}">
- <img :src="item.url" alt="" style="width:100%">
- <a-checkbox :value="item.signature" style="position:absolute;z-index: 100;right:0;top:0;"></a-checkbox>
- </li>
- </a-checkbox-group>
- </ul>
- </a-modal>
- <a-modal :maskClosable="false" title="选择素材" v-model="visibleMatemal" @ok="handleOkShow" :width="1000">
- <a-tabs type="card" @change="callback" v-model="active" class="check-video">
- <a-tab-pane :tab="item.label" v-for="item of tab" :key="item.value">
- <a-range-picker name="buildTime" style="width: 400px;margin:10px 0" v-model="time" />
- <ul v-if="dataSource.length>0" style="overflow:auto;padding-left:0">
- <a-checkbox-group v-model="checkVideo" @change="onChangeVideo">
- <li v-for="(item,index) of dataSource" :key="index" class="chouzhen">
- <img :src="item.coverUrl" alt="" style="width:100%" @click="matemalVideo(item,index)">
- <!-- <video class="video" :src="item.url" controls="controls" style="width:100%">
- 您的浏览器不支持 video 标签。
- </video> -->
- <a-checkbox :value="item" style="position:absolute;z-index: 100;right:0;top:0;"></a-checkbox>
- </li>
- </a-checkbox-group>
- </ul>
- </a-tab-pane>
- </a-tabs>
- <!-- <ul class="actor-photo-list">
- <a-checkbox-group v-model="checkArr" style="width:100%; display: flex;padding-left: 0;"
- @change="onChangeCheck">
- <li v-for="(item, index) of dataSource" :key="index">
- <a-checkbox :value="item" style="position:absolute;z-index:100;padding-right:30px">
- </a-checkbox>
- </li>
- </a-checkbox-group>
- </ul> -->
- <div style="text-align:right">
- <a-pagination size="small" :showTotal="ipagination.showTotal" style="float:right" v-if="dataSource.length > 0"
- showQuickJumper :pageSize.sync="ipagination.pageSize" :total="ipagination.total" v-model="ipagination.current"
- @change="getDataSource" />
- </div>
- </a-modal>
- <a-modal title="查看视频" v-model="visibleVideo" :width="300" :footer="null">
- <video class="video" :src="videoUrlShow" controls="controls" style="width:100%">
- 您的浏览器不支持 video 标签。
- </video>
- </a-modal>
- <a-modal title="推荐标题" v-model="titleVisible" :width="1000" :footer="null">
- <a-row :gutter="10">
- <a-col :sm="10" style="margin-bottom: 20px;z-index: 10">
- <a-card class="search-box" style="min-height:500px">
- <div style="margin-bottom:30px">
- <span style="display:inline-block;width:80px">行业</span>
- <a-cascader style="margin-top: 1rem;width:300px" v-model="dataOne" :options="options"
- :showSearch="{ filter }" expandTrigger="hover" @change="onChangeTitle" placeholder="请选择行业">
- <a-icon type="smile" slot="suffixIcon" class="test" />
- </a-cascader>
- </div>
- <div style="margin-bottom:30px">
- <span style="display:inline-block;width:80px">关键词</span>
- <a-input placeholder="请输入关键词" v-model="value" style="width: 300px" />
- </div>
- <span style="display:inline-block;width:80px;float:left"></span>
- <a-button type="primary" @click="searchQuery" :disabled="value == ''">生成</a-button>
- </a-card>
- </a-col>
- <a-col :sm="14" style="margin-bottom: 20px;z-index: 10">
- <a-card class="search-box" style="over-flow:auto">
- <a-list size="large" bordered :dataSource="title">
- <a-list-item slot="renderItem" slot-scope="item">
- <a slot="actions" @click="okTitle(item)">选择</a>
- {{ item }}</a-list-item>
- </a-list>
- </a-card>
- </a-col>
- </a-row>
- </a-modal>
- </a-card>
- </template>
- <script>
- import {
- getAction,
- postAction
- } from '@/api/manage'
- import {
- mapGetters
- } from 'vuex'
- import UploadToAli from '@femessage/upload-to-ali'
- import moment from 'moment'
- import VuePreview from 'vue-preview'
- import jq from 'jquery'
- import {
- stopOtherVideo,
- closeAllVideoFun
- } from '@/utils/videoControl' // 停止除当前外的其他视频播放,及停止所有视频播放的方法
- import checkMatemal from './stepModule/checkMatemal'
- import BMF from 'browser-md5-file'
- let nowIndex = 0
- let bestIndex = 0
- let showRemove = false
- export default {
- name: 'BaseForm',
- components: {
- UploadToAli,
- VuePreview,
- checkMatemal
- },
- data() {
- return {
- titleVisible: false,
- options: [],
- data: [],
- value: '',
- dataOne: [],
- title: [],
- tags: [],
- visibleMatemal: false,
- visibleVideo: false,
- videoUrlShow: "",
- time: [],
- channelType: 0,
- checkVideo: [],
- dataSource: [],
- tab: [{
- value: 0,
- label: "内部"
- }, {
- value: 1,
- label: "外部"
- }],
- active: 0,
- ipagination: {
- current: 1,
- pageSize: 5,
- // pageSizeOptions: ['10', '20', '30'],
- showTotal: (total, range) => {
- return range[0] + '-' + range[1] + ' 共' + total + '条'
- },
- showQuickJumper: true,
- // showSizeChanger: true,
- total: 0,
- onChange: current => {
- // 切换分页时的回调,
- // 当在页面定义change事件时,切记要把此处的事件清除,因为这两个事件重叠了,可能到时候会导致一些莫名的bug
- this.ipagination.current = current
- }
- },
- chouzhen: false,
- chouzhenList: [],
- checkList: [],
- indeterminate: true,
- checkAll: false,
- pans: [],
- pansKey: '',
- addImageVisible: false,
- addVideoVisible: false,
- loadingVideo: false,
- loadingImage: false,
- allForm: {
- videoList: '',
- imageList: [],
- fail: [],
- success: [],
- },
- form: this.$form.createForm(this),
- list: [],
- vertical: 'vertical',
- appList: [],
- siteList: [],
- labelCol: {
- lg: {
- span: 4
- },
- sm: {
- span: 6
- },
- xs: {
- span: 4
- },
- md: {
- span: 4
- }
- },
- wrapperCol: {
- lg: {
- span: 18
- },
- sm: {
- span: 18
- },
- xs: {
- span: 14
- },
- md: {
- span: 14
- }
- },
- visible: false,
- loading: false,
- imageUrlList: [],
- checkAllImage: false,
- checkArrImage: [],
- content: 0,
- urlListImage: {
- url: [],
- md5: []
- },
- urlList: {
- url: '',
- md5: "",
- photoId: ""
- },
- imageArrList: [],
- material: [],
- creativeCopywriter: '',
- customDomain: '',
- region: 'oss-cn-beijing',
- bucket: 'ctop-media',
- acceptVideo: 'video/mpeg,video/mp4',
- acceptImage: 'image/jpeg,image/jpg',
- accessKeyId: 'LTAIbNbqWzSOklQV',
- accessKeySecret: '1rkPz7JNoXk8sJevPaeYHWqfkQXBGh',
- messageTip: null
- }
- },
- methods: {
- showTitle(index, bestIndex) {
- nowIndex = index
- bestIndex = bestIndex
- this.titleVisible = true;
- this.getHangye()
- },
- okTitle(item) {
- this.pans[bestIndex].list[nowIndex].description = item
- this.titleVisible = false;
- this.dataOne = []
- this.value = ""
- this.title = []
- },
- searchQuery() {
- // /ctop/creativeTitle/titleSuggestion
- console.log(this.value)
- getAction('/ctop/creativeTitle/titleSearch', {
- firstCategory: this.dataOne[0],
- secondCategory: this.dataOne[1],
- keywords: this.value
- }).then(res => {
- console.log(res)
- this.title = res.result ? res.result : []
- })
- // firstCategory,secondCategory,keywords
- },
- getHangye() {
- getAction('/ctop/creativeTitle/getTitleLabel', '').then(res => {
- console.log(res)
- if (res.success) {
- this.options = res.result.map(item => {
- return {
- label: item.label,
- value: item.value,
- children: item.children.length > 0 ? [{
- label: '不限',
- value: 0
- }].concat(item.children) : [{
- label: '不限',
- value: 0
- }]
- }
- })
- this.options = [{
- label: '不限',
- value: 0
- }].concat(this.options)
- if (this.dataOne.length > 0) {
- return
- } else {
- this.dataOne = [0]
- }
- }
- })
- },
- onChangeTitle(value, selectedOptions) {
- console.log(value, selectedOptions)
- this.dataOne = value
- this.value = ''
- this.title = []
- },
- filter(inputValue, path) {
- return path.some(option => option.label.toLowerCase().indexOf(inputValue.toLowerCase()) > -1)
- },
- handleSearch(value) {
- if (this.dataOne.length > 0) {
- const str = {
- firstCategory: this.dataOne[0],
- secondCategory: this.dataOne[1],
- keyword: value
- }
- getAction('/ctop/creativeTitle/titleSuggestion', str).then(d => {
- const result = d.result ? d.result : []
- this.data = result.map(item => {
- return {
- value: item,
- text: item
- }
- })
- })
- } else {
- this.data = []
- return
- }
- },
- matemalVideo(item) {
- this.visibleVideo = true
- this.videoUrlShow = item.url
- },
- onChange(checkedList) {
- this.indeterminate = !!checkedList.length && checkedList.length < this.chouzhenList.length;
- this.checkAll = checkedList.length === this.chouzhenList.length;
- },
- onCheckAllChange(e) {
- if (this.checkAll) {
- this.checkList = []
- } else {
- this.checkList = this.chouzhenList.map(item => {
- return item.signature
- })
- }
- this.checkAll = !this.checkAll
- },
- onCheckAllImageChange(index, item) {
- if (this.pans[index].list[item.key].checkAllImage) {
- this.pans[index].list[item.key].checkArrImage = []
- } else {
- this.pans[index].list[item.key].checkArrImage = this.pans[index].list[item.key].imageUrlList.map(item => {
- return item.code
- })
- }
- this.pans[index].list[item.key].checkAllImage = !this.pans[index].list[item.key].checkAllImage
- },
- onChangeCheckImage(checkedList) {
- },
- handleConfirmValue(rule, value, callback) {
- if (/(http|https):\/\/([\w.]+\/?)\S*/.test(value) && value.length < 10000) {
- callback()
- } else {
- callback('链接不能为空且开头为http://或https://,并且长度小于10000')
- }
- },
- showData(item, type) {
- var index = this.pans.findIndex(item => item.key === this.pansKey)
- // this.pans[index].list[item.key].imageList = []
- if (type == 'video') {
- this.pans[index].list[item.key].videoList = item.video
- getAction('/kuaishou/batch/getCreativeCopywriter', {
- code: item.video.signature,
- accountId: localStorage.getItem('accountId')
- }).then(res => {
- if (res.success) {
- this.pans[index].list[item.key].description =
- res.result ? res.result.creativeCopywriter : ''
- }
- })
- getAction('/ctop/MaterialImageInfo/list', {
- videoId: item.video.signature
- }).then(res => {
- // console.log(res)
- if (res.success) {
- this.pans[index].list[item.key].imageUrlList = res.result
- this.pans[index].list[item.key].checkArrImage = res.result.map(item => {
- return item.code
- })
- }
- })
- var params = {
- videoSignature: item.video.signature,
- pageSize: 20,
- pageNo: 1
- }
- getAction('/cutFrame/material/list', params).then(res => {
- console.log(res)
- if (res.success) {
- if (res.result.records.length > 0) {
- this.pans[index].list[item.key].chouzhenShow = true
- } else {
- this.pans[index].list[item.key].chouzhenShow = false
- }
- }
- })
- } else {
- // this.pans[index].list[item.key].imageList.push(...item.image)
- if (item.image.length + this.contentAll > 15) {
- this.$message.error('当前选择封面' + item.image.length + '张,最多可选择' + (15 - this.contentAll) + '张')
- return
- } else {
- this.pans[index].list[item.key].imageList.push(...item.image)
- this.chouzhen = false
- this.chouzhenList = []
- this.checkList = []
- this.checkAll = false
- }
- }
- },
- getData(className) {
- return this.form.getFieldValue(className)
- },
- onChangeVideo() {
- if (this.checkVideo.length > 1) {
- this.checkVideo.shift()
- }
- },
- callback(key) {
- this.channelType = key
- this.checkVideo = []
- this.ipagination.current = 1
- this.time = []
- // var params = {}
- // params.channelType = key
- // params.accountId = localStorage.getItem('accountId')
- // params.materialType = this.getData('creativeMaterialType')
- // params.pageSize = this.ipagination.pageSize
- // params.pageNo = this.ipagination.current
- // this.showVideoList('/kuaishou/batch/getVideoList', params)
- },
- getDataSource(page, pageSize) {
- this.ipagination.current = page
- var params = {}
- params.accountId = localStorage.getItem('accountId')
- params.materialType = this.getData('creativeMaterialType')
- params.pageSize = this.ipagination.pageSize
- params.pageNo = page
- params.channelType = this.channelType
- if (this.time.length > 0) {
- params.startDate = moment(this.time[0]).format('YYYY-MM-DD')
- params.endDate = moment(this.time[1]).format('YYYY-MM-DD')
- }
- this.showVideoList('/kuaishou/batch/getVideoList', params)
- },
- showVideoList(url, params) {
- this.dataSource = []
- getAction(url, params).then(res => {
- if (res.success) {
- this.dataSource = res.result.records
- this.ipagination.total = res.result.total
- }
- })
- },
- getVideoList(type, index, item, bestIndex) {
- if (type == 'video') {
- nowIndex = index
- bestIndex = bestIndex
- this.visibleMatemal = true
- this.checkVideo = []
- this.active = 0
- this.time = []
- this.channelType = 0
- // var params = {}
- // params.accountId = localStorage.getItem('accountId')
- // params.materialType = this.getData('creativeMaterialType')
- // params.pageSize = this.ipagination.pageSize
- // params.pageNo = this.ipagination.current
- // params.params.channelType = 0 = 0
- // this.showVideoList('/kuaishou/batch/getVideoList', params)
- } else {
- this.$refs.check.showCheck(
- this.getData('creativeMaterialType'),
- '/kuaishou/batch/getImageList',
- item.imageList,
- type,
- index
- )
- }
- },
- remove(targetKey) {
- let activeKey = this.pansKey
- let lastIndex
- this.pans.forEach((pane, i) => {
- if (pane.key === targetKey) {
- lastIndex = i - 1
- }
- })
- const panes = this.pans.filter(pane => pane.key !== targetKey)
- if (panes.length && activeKey === targetKey) {
- if (lastIndex >= 0) {
- activeKey = panes[lastIndex].key
- } else {
- activeKey = panes[0].key
- }
- }
- this.pans = panes
- this.pansKey = activeKey
- this.form.resetFields()
- if (this.pans.length == 0) {
- this.$bus.$emit('remove', '/account/stepForm')
- } else {
- this.addCreative(0)
- }
- },
- handleOk() {
- if (this.allForm.fail.length == 0) {
- this.remove(this.pansKey)
- if (localStorage.getItem('originality')) {
- this.$router.replace({
- path: '/account/originality'
- })
- } else {
- this.$router.replace({
- path: '/account/accountIndex'
- })
- }
- this.visible = false
- } else {
- this.visible = false
- }
- },
- handleCancel(e) {
- this.visible = false
- },
- handleSubmit(e) {
- e.preventDefault()
- var index = this.pans.findIndex(item => item.key === this.pansKey)
- var data = this.pans[index].list.map(item => {
- return item.imageList.length + item.imageUrlList.length
- })
- if (this.contentAll > 15) {
- this.$message.error('封面最多15张')
- return
- }
- this.form.validateFields((err, values) => {
- if (!err) {
- this.loading = true
- var dataJson = this.pans[index].list.map(item => {
- return {
- description: item.description,
- imageArr: item.imageList.map((ele, index) => {
- return {
- signature: ele.signature,
- name: index + 1 + '-' + item.name
- }
- }),
- imageArrTwo: item.checkArrImage.map((ele, index) => {
- return {
- signature: ele,
- name: (item.imageList.length + index + 1) + '-' + item.name
- }
- }),
- photoId: item.videoList.photoId,
- name: item.name
- }
- })
- var allJson = dataJson.map(item => {
- return {
- description: item.description,
- imageArr: item.imageArr.concat(item.imageArrTwo).length > 0 ? item.imageArr.concat(item
- .imageArrTwo) : [{
- name: item.name
- }],
- photoId: item.photoId
- }
- })
- var params = {
- dataJson: allJson,
- ...values,
- unitId: this.pansKey,
- accountId: localStorage.getItem('accountId')
- }
- postAction('/kuaishou/batch/createCreative', params).then(res => {
- if (res.success) {
- this.visible = true
- this.allForm.fail = res.result.fail
- this.allForm.success = res.result.success
- this.loading = false
- } else {
- this.loading = false
- this.$message.error(res.message)
- }
- })
- }
- })
- },
- nextStep() {
- var that = this
- setTimeout(function () {
- that.$emit('nextStep')
- }, 1500)
- },
- prevStep() {
- this.$emit('prevStep')
- },
- addCreative(index) {
- this.pans[index].list.push({
- videoList: '',
- imageList: [],
- name: this.getData('creativeMaterialType') == '1' ?
- '自定义创意_竖版视频_' +
- Math.random()
- .toString(36)
- .substr(2, 4) : '自定义创意_横版视频_' +
- Math.random()
- .toString(36)
- .substr(2, 4),
- description: '',
- creativeMaterialType: '1',
- actionBarText: '',
- imageUrlList: [],
- checkArrImage: [],
- checkAllImage: false,
- chouzhenShow: false
- })
- },
- deleteCreative(bestIndex, index) {
- this.pans[bestIndex].list.splice(index, 1)
- },
- filterOption(input, option) {
- return option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
- },
- uploadVideo(index, bestIndex) {
- console.log(index, bestIndex)
- nowIndex = index
- bestIndex = bestIndex
- this.addVideoVisible = true
- },
- handleOkChouzhen(e) {
- var arr = []
- for (let i = 0; i < this.chouzhenList.length; i++) {
- for (let j = 0; j < this.checkList.length; j++) {
- if (this.chouzhenList[i].signature == this.checkList[j]) {
- arr.push(this.chouzhenList[i])
- }
- }
- }
- if (arr.length + this.contentAll > 15) {
- this.$message.error('当前选择封面' + arr.length + '张,最多可选择' + (15 - this.contentAll) + '张')
- return
- } else {
- this.pans[bestIndex].list[nowIndex].imageList.push(...arr)
- this.chouzhen = false
- this.chouzhenList = []
- this.checkList = []
- this.checkAll = false
- }
- },
- showImages(index, bestIndex) {
- this.chouzhen = true
- this.chouzhenList = []
- nowIndex = index
- bestIndex = bestIndex
- var params = {
- videoSignature: this.pans[bestIndex].list[index].videoList.signature,
- pageSize: 20,
- pageNo: 1
- }
- getAction('/cutFrame/material/list', params).then(res => {
- console.log(res)
- if (res.success) {
- this.chouzhenList.push(...res.result.records)
- }
- })
- },
- uploadImages(index, bestIndex) {
- nowIndex = index
- bestIndex = bestIndex
- this.addImageVisible = true
- this.loadingImage = false
- },
- closeImage() {
- this.addImageVisible = false
- this.urlListImage = {
- url: [],
- md5: [],
- }
- this.imageArrList = []
- nowIndex = 0
- bestIndex = 0
- this.loadingImage = false
- },
- closeVideo() {
- this.addVideoVisible = false
- this.urlList = {
- url: "",
- md5: "",
- photoId: ""
- }
- nowIndex = 0
- bestIndex = 0
- this.messageTip = null
- },
- handleOkImage(e) {
- this.loadingImage = true
- var params = {
- accountId: localStorage.getItem('accountId'),
- uploadImageArr: this.imageArrList
- }
- postAction("/kusiShouUpload/image", params).then(res => {
- if (res.success) {
- if (res.result.length + this.contentAll > 15) {
- this.$message.error('当前上传封面' + res.result.length + '张,最多可上传' + (15 - this.contentAll) + '张')
- this.loadingImage = false
- return
- } else {
- this.pans[bestIndex].list[nowIndex].imageList.push(...res.result)
- this.closeImage()
- this.loadingImage = false
- }
- } else {
- this.$message.error('封面上传失败')
- this.loadingImage = false
- }
- })
- },
- deleteImage(url) {
- console.log(url, this.urlListImage.url)
- var index = this.imageArrList.findIndex(v => v.url === url)
- this.imageArrList.splice(index, 1)
- console.log(index)
- },
- overUploadImage(urlAll) {
- var that = this
- that.material = []
- that.imageArrList = []
- var img
- if (urlAll.length > 0) {
- for (var i = 0; i < this.urlListImage.url.length; i++) {
- that.imageArrList.push({
- signature: this.urlListImage.md5[i],
- url: this.urlListImage.url[i],
- })
- img = new Image()
- img.src = this.urlListImage.url[i]
- if (img.complete) {
- // 打印
- if (img.width == 720) {
- if (img.height == 1280) {
- that.material.push(true)
- } else {
- that.material.push(false)
- }
- } else if (img.width == 1080) {
- if (img.height == 1920) {
- that.material.push(true)
- } else {
- that.material.push(false)
- }
- } else if (img.width == 1280) {
- if (img.height == 720) {
- that.material.push(true)
- } else {
- that.material.push(false)
- }
- } else if (img.width == 1920) {
- if (img.height == 1080) {
- that.material.push(true)
- } else {
- that.material.push(false)
- }
- } else {
- that.material.push(false)
- }
- } else {
- img.onload = () => {
- if (img.width == 720) {
- if (img.height == 1280) {
- that.material.push(true)
- } else {
- that.material.push(false)
- }
- } else if (img.width == 1080) {
- if (img.height == 1920) {
- that.material.push(true)
- } else {
- that.material.push(false)
- }
- } else if (img.width == 1280) {
- if (img.height == 720) {
- that.material.push(true)
- } else {
- that.material.push(false)
- }
- } else if (img.width == 1920) {
- if (img.height == 1080) {
- that.material.push(true)
- } else {
- that.material.push(false)
- }
- } else {
- that.material.push(false)
- }
- }
- }
- }
- }
- },
- fileWater(file) {
- var bmf = new BMF()
- var that = this
- // this.urlListImage = {
- // url: [],
- // md5: []
- // }
- return new Promise(function (resolve, reject) {
- for (let i = 0; i < file.length; i++) {
- bmf.md5(file[i], (err, md5) => {
- // that.urlListImage.name.push(file[i].name)
- that.urlListImage.md5.push(md5)
- resolve()
- })
- }
- })
- },
- overUpload(urlAll) {
- console.log(this.urlList)
- },
- file(file) {
- var bmf = new BMF()
- var that = this
- return new Promise(function (resolve, reject) {
- bmf.md5(file[0], (err, md5) => {
- getAction('/kusiShouUpload/checkVideo', {
- signature: md5,
- accountId: localStorage.getItem('accountId')
- }).then(res => {
- if (res.code == 0) {
- if (res.result.isExistence) {
- showRemove = res.result.isExistence
- that.urlList.md5 = res.result.signature
- that.urlList.url = res.result.videoUrl
- that.urlList.photoId = res.result.photoId
- reject()
- } else {
- showRemove = res.result.isExistence
- that.urlList.md5 = md5
- resolve()
- }
- } else {
- reject()
- }
- })
- })
- })
- },
- handleOkVideo(e) {
- this.loadingVideo = true
- if (showRemove) {
- this.pans[bestIndex].list[nowIndex].videoList = {
- photoId: this.urlList.photoId,
- url: this.urlList.url
- }
- this.loadingVideo = false
- var params = {
- videoSignature: this.urlList.md5,
- pageSize: 20,
- pageNo: 1
- }
- getAction('/cutFrame/material/list', params).then(res => {
- console.log(res)
- if (res.success) {
- if (res.result.records.length > 0) {
- this.pans[bestIndex].list[nowIndex].chouzhenShow = true
- } else {
- this.pans[bestIndex].list[nowIndex].chouzhenShow = false
- }
- }
- })
- this.closeVideo()
- } else {
- var params = {
- url: this.urlList.url,
- type: this.getData('creativeMaterialType'),
- signature: this.urlList.md5,
- accountId: localStorage.getItem('accountId')
- }
- postAction("/kusiShouUpload/video", params).then(res => {
- console.log(res)
- if (res.success) {
- this.pans[bestIndex].list[nowIndex].videoList = {
- photoId: res.result.photoId,
- url: this.urlList.url
- }
- this.loadingVideo = false
- this.closeVideo()
- } else {
- this.messageTip = res.message
- this.loadingVideo = false
- this.urlList = {
- url: "",
- md5: "",
- photoId: ""
- }
- nowIndex = 0
- bestIndex = 0
- }
- })
- }
- },
- deleteData(index, bestIndex, deleteIndex) {
- this.pans[index].list[bestIndex].imageList.splice(deleteIndex, 1)
- },
- handleOkShow(e) {
- //
- this.pans[bestIndex].list[nowIndex].imageList = []
- getAction('/kuaishou/batch/getCreativeCopywriter', {
- code: this.checkVideo[0].signature,
- accountId: localStorage.getItem('accountId')
- }).then(res => {
- if (res.success) {
- this.pans[bestIndex].list[nowIndex].description =
- res.result ? res.result.creativeCopywriter : ''
- }
- })
- getAction('/ctop/MaterialImageInfo/list', {
- videoId: this.checkVideo[0].signature
- }).then(res => {
- // console.log(res)
- if (res.success) {
- this.pans[bestIndex].list[nowIndex].imageUrlList = res.result
- this.pans[bestIndex].list[nowIndex].checkArrImage = res.result.map(item => {
- return item.code
- })
- }
- })
- this.pans[bestIndex].list[nowIndex].videoList = this.checkVideo[0]
- this.visibleMatemal = false
- this.ipagination.current = 1
- var params = {
- videoSignature: this.checkVideo[0].signature,
- pageSize: 20,
- pageNo: 1
- }
- getAction('/cutFrame/material/list', params).then(res => {
- console.log(res)
- if (res.success) {
- if (res.result.records.length > 0) {
- this.pans[bestIndex].list[nowIndex].chouzhenShow = true
- } else {
- this.pans[bestIndex].list[nowIndex].chouzhenShow = false
- }
- }
- })
- },
- judge(item) {
- var re = /[(.*?)]/g
- var array = []
- var temp
- while ((temp = re.exec(item.text))) {
- array.push(temp[1])
- }
- console.log(array)
- item.countTag = array.length
- },
- getChange(item, tag, index) {
- console.log(item)
- this.judge(item)
- var node = document.getElementsByClassName('rending')[index]
- var v = '[' + tag.name + ']'
- if (document.selection) {
- //IE
- node.focus()
- var sel = document.selection.createRange()
- sel.text = v
- sel.select()
- item.description = v
- } else if (node.selectionStart || node.selectionStart == '0') {
- //MOZILLA/GOOGLE
- var startPos = node.selectionStart
- var endPos = node.selectionEnd
- var restoreTop = node.scrollTop
- node.value = node.value.substring(0, startPos) + v + node.value.substring(endPos, node.value.length)
- if (restoreTop > 0) {
- node.scrollTop = restoreTop
- }
- item.text = node.value
- node.focus()
- node.selectionStart = startPos + v.length
- node.selectionEnd = startPos + v.length
- item.description = node.value
- } else {
- //OTHER
- node.value += v
- item.text = node.value
- node.focus()
- item.description = node.value
- }
- },
- },
- computed: {
- dirImg() {
- let date = new Date()
- let y = date.getFullYear()
- let MM = date.getMonth() + 1
- MM = MM < 10 ? '0' + MM : MM
- let d = date.getDate()
- d = d < 10 ? '0' + d : d
- return 'image/' + y + '-' + MM + '-' + d + '/'
- },
- dirVideo() {
- let date = new Date()
- let y = date.getFullYear()
- let MM = date.getMonth() + 1
- MM = MM < 10 ? '0' + MM : MM
- let d = date.getDate()
- d = d < 10 ? '0' + d : d
- return 'video/' + y + '-' + MM + '-' + d + '/'
- },
- contentAll() {
- var count, arr = []
- if (this.pans[0].list.length > 0) {
- for (let i = 0; i < this.pans[0].list.length; i++) {
- arr.push(...this.pans[0].list[i].checkArrImage, ...this.pans[0].list[i].imageList)
- }
- return arr.length + this.content
- } else {
- return 0
- }
- },
- listCheck() {
- if (this.pans[0].list.length > 0) {
- if (this.pans[0].list[this.pans[0].list.length - 1].imageUrlList.length == 0 && this.pans[0].list[this.pans[0]
- .list.length - 1]
- .imageList.length == 0) {
- return true
- } else {
- return false
- }
- } else {
- return false
- }
- }
- },
- watch: {
- time(n, o) {
- console.log(n)
- if (n.length > 0) {
- var params = {}
- params.accountId = localStorage.getItem('accountId')
- params.materialType = this.getData('creativeMaterialType')
- params.pageSize = this.ipagination.pageSize
- params.pageNo = 1
- params.channelType = this.channelType
- params.startDate = moment(n[0]).format('YYYY-MM-DD')
- params.endDate = moment(n[1]).format('YYYY-MM-DD')
- this.showVideoList('/kuaishou/batch/getVideoList', params)
- } else {
- var params = {}
- params.accountId = localStorage.getItem('accountId')
- params.materialType = this.getData('creativeMaterialType')
- params.pageSize = this.ipagination.pageSize
- params.pageNo = 1
- params.channelType = this.channelType
- this.ipagination.current = 1
- this.showVideoList('/kuaishou/batch/getVideoList', params)
- }
- },
- visibleVideo(n, o) {
- if (!n) {
- closeAllVideoFun()
- }
- }
- },
- mounted: function () {
- if (localStorage.getItem('pans')) {
- this.pans = JSON.parse(localStorage.getItem('pans')).map(item => {
- return {
- ...item,
- list: []
- }
- })
- this.pansKey = this.pans[0].key
- this.$nextTick(() => {
- this.addCreative(0)
- })
- getAction('/kuaishou/batch/checkCreativeCount', {
- unitId: this.pansKey,
- accountId: localStorage.getItem('accountId')
- }).then(res => {
- console.log(res)
- this.content = res.result
- })
- getAction('/kuaishou/batch/getActionBarText', {
- campaignId: localStorage.getItem('campaignId') ? localStorage.getItem('campaignId') : localStorage
- .getItem('advertisingGroupKey')
- }).then(res => {
- if (res.success) {
- this.appList = res.result
- }
- })
- getAction('/kuaishou/batch/getPageList', {
- accountId: localStorage.getItem('accountId'),
- appId: localStorage.getItem('appId'),
- viewComp: 7
- }).then(res => {
- if (res.success) {
- console.log(res)
- this.siteList = res.result
- }
- })
- }
- getAction('/kuaishou/batch/creativeWord', {
- accountId: localStorage.getItem('accountId')
- }).then(res => {
- if (res.success) {
- this.tags = res.result
- }
- })
- }
- }
- </script>
- <style lang="scss">
- .select_all {
- margin-bottom: 10px;
- }
- .ant_modal_body_container {
- .ant-modal-body {
- max-height: 650px;
- overflow-y: scroll;
- .image_item_container {
- margin: 0 -10px;
- width: 100%;
- .image_item {
- display: inline-block;
- width: 20%;
- padding: 0 10px;
- box-sizing: border-box;
- margin-bottom: 20px;
- .label_item {
- display: block;
- cursor: pointer;
- }
- .item_img {
- width: 100%;
- margin-bottom: 10px;
- }
- .item_text {
- height: 42px;
- overflow: hidden;
- margin-bottom: 0;
- }
- .item_checkbox {
- margin-bottom: 0;
- }
- .video {
- width: 100%;
- }
- }
- }
- }
- .video_item_container {
- .video {
- width: 100%;
- }
- }
- }
- // 多选框
- .checkbox_item_container {
- .item_ul {
- margin: 0 -10px;
- .item_li {
- width: 20%;
- float: left;
- padding: 0 10px;
- box-sizing: border-box;
- .item:hover i {
- display: block;
- cursor: pointer;
- }
- .item {
- position: relative;
- i {
- display: none;
- }
- video {
- width: 100%;
- min-height: 255px;
- }
- .checkbox_item {
- display: block;
- .ant-checkbox {
- display: inline-block;
- }
- span {
- display: block;
- padding: 0;
- .item_txt {
- text-align: left;
- height: 42px;
- overflow: hidden;
- }
- }
- }
- }
- }
- }
- }
- // @media (min-width: 1024px){
- // .checkbox_item_container {
- // width:70%
- // }
- // } /*>=1024的设备*/
- // @media (min-width: 1100px) {
- // .checkbox_item_container {
- // width:70%
- // }
- // } /*>=1100的设备*/
- @media (min-width: 1280px) {
- .checkbox_item_container_size {
- width: 70%;
- }
- }
- /*>=1280的设备*/
- // @media (min-width: 1366px) {
- // }
- // @media (min-width: 1440px) {
- // }
- // @media (min-width: 1680px) {
- // }
- @media (min-width: 1920px) {
- .checkbox_item_container_size {
- width: 50%;
- }
- }
- </style>
|