朱鑫波 4 yıl önce
ebeveyn
işleme
c5603d2349

+ 60 - 9
src/views/modules/kuaishouapp/batchCreation/creat/creatUnit.vue

@@ -87,7 +87,7 @@
         :label="campaignType == 3 ? ' ' : '链接'"
         :labelCol="{ lg: { span: 7 }, sm: { span: 7 } }"
         :wrapperCol="{ lg: { span: 10 }, sm: { span: 17 } }"
-        v-if="campaignType != 2"
+        v-if="campaignType == 3||campaignType == 4||campaignType == 5||campaignType == 6||campaignType == 7"
         :class="{ 'else-label': campaignType == 3 }"
       >
         <a-input
@@ -517,7 +517,7 @@
         <a-radio-group
           buttonStyle="solid"
           v-decorator="['creativeMaterialType', { initialValue: '1' }]"
-          @change="changeType(item)"
+          @change="changeType()"
         >
           <a-radio-button value="1">竖版视频</a-radio-button>
           <a-radio-button value="2">横版视频</a-radio-button>
@@ -558,12 +558,20 @@
         :labelCol="{ lg: { span: 7 }, sm: { span: 7 } }"
         :wrapperCol="{ lg: { span: 10 }, sm: { span: 17 } }"
       >
+      <!-- v-model.trim="allForm.description" -->
+      <!-- @keyup="getData('description')?getData('description')=this.value.replace(/^ +| +$/g,'')" -->
         <a @click="showTitle()">推荐广告语</a>
         <div class="step4-else" style="display: inline-block; position: relative; border-radius: 4px; width: 100%; border: 1px solid #d9d9d9;">
           <a-textarea
             class="rending"
             placeholder="请输入广告语"
-            v-model.trim="allForm.description"
+             v-decorator="['description',{ rules: [{ required: true, message: '广告语必填' }] }]"
+             @keyup="getData('description')?form.setFieldsValue({
+                description: getData('description').replace(/\s/g,'')
+              }):null"
+            @change="getData('description')?form.setFieldsValue({
+                description: getData('description').replace(/\s/g,'')
+              }):null"
             :autosize="{ minRows: 2, maxRows: 6 }"
             :max-length="30"
           ></a-textarea>
@@ -581,7 +589,7 @@
               margin-bottom: 0;
             "
           >
-            {{ allForm.description.length + '/30' }}
+            {{ (getData('description')?getData('description').length:0) + '/30' }}
           </p>
         </div>
         <br />
@@ -752,7 +760,11 @@
       <a-tabs type="card" @change="callback" v-model="active" class="check-video">
         <div slot="tabBarExtraContent">
           当前选择数量{{ sumContent  + '/' + getData('createCount') }}
+          <a-button  type="primary" @click="tongbu()" :loading="tongbuLoading" style="margin-left:10px">
+          刷新素材</a-button
+        >
         </div>
+         
         <a-tab-pane :tab="item.label" v-for="item of tab" :key="item.value">
           <a-row :gutter="24">
             <a-col :span="12">
@@ -1204,7 +1216,7 @@ export default {
       appId: '',
       loading: false,
       campaignTemplateId: '',
-      campaignType: '2',
+      campaignType: null,
       maxBid: 0,
       allForm: {
         dayBudget: '0',
@@ -1237,6 +1249,7 @@ export default {
       cunTitleVisible: false,
       cunTitleList: [],
       createCount: 0,
+      tongbuLoading:false
     }
   },
   computed: {
@@ -1265,6 +1278,35 @@ export default {
     },
   },
   methods: {
+    tongbu() {
+      this.tongbuLoading = true
+      getAction('/kuaishou/batch/syncVideo', {
+        accountId: localStorage.getItem('campaignAccountId'),
+      }).then((res) => {
+        if (res.success) {
+          this.$message.success(res.message)
+          this.tongbuLoading = false
+          var params = {}
+          params.accountId = localStorage.getItem('campaignAccountId')
+          params.materialType = this.creativeMaterialType
+          params.pageSize = this.ipagination.pageSize
+          params.pageNo = 1
+          params.status = 0
+          params.channelType = this.channelType
+          params.orderBy = this.orderBy
+          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')
+            params.startDate = moment(this.time[0]).format('YYYY-MM-DD') + ' 00:00:00'
+            params.endDate = moment(this.time[1]).format('YYYY-MM-DD') + ' 23:59:59'
+          }
+          this.showVideoList('/kuaishou/kuaiShouVideoGet/getVideoList', params)
+        } else {
+          this.$message.error(res.message)
+          this.tongbuLoading = false
+        }
+      })
+    },
     removeTitleCun(item) {
       deleteAction('/kuaishou/kuaiShouTitleCollection/delete', {
         id: item.id,
@@ -1276,17 +1318,20 @@ export default {
     },
     okTitleCun(item) {
       this.allForm.description = item.title
+      this.form.setFieldsValue({
+        description: item.title,
+      })
       this.cunTitleVisible = false
       this.cunTitleList = []
     },
     cunTitle() {
-      if (this.allForm.description == '') {
+      if (this.getData('description') && this.getData('description') == '') {
         this.$message.error('请填写广告语后再进行收藏')
       } else {
         var params = {}
         params.accountId = localStorage.getItem('campaignAccountId')
         params.userId = this.userInfo().id
-        params.title = this.allForm.description
+        params.title = this.getData('description')
         postAction('/kuaishou/kuaiShouTitleCollection/add', params).then((res) => {
           if (res.success) {
             this.$message.success('收藏成功')
@@ -1314,6 +1359,12 @@ export default {
     },
     okTitle(item) {
       this.allForm.description = item
+      this.$nextTick(() => {
+        this.form.setFieldsValue({
+          description: item,
+        })
+      })
+
       this.titleVisible = false
       this.dataOne = []
       this.value = ''
@@ -1723,7 +1774,7 @@ export default {
         this.checkVideo = this.checkVideoWai[this.ipagination.current - 1]
       }
     },
-    changeType(item) {
+    changeType() {
       this.$nextTick(() => {
         if (this.getData('creativeMaterialType') == '1') {
           this.form.setFieldsValue({
@@ -1902,6 +1953,7 @@ export default {
     getData(className) {
       return this.form.getFieldValue(className)
     },
+
     handleConfirmValue(rule, value, callback) {
       if (this.campaignType == 3) {
         if (value == '') {
@@ -2061,7 +2113,6 @@ export default {
               campaignId: localStorage.getItem('campaignList'),
               beginTime: moment(this.timeRange[0]).format('YYYY-MM-DD'),
               endTime: this.allForm.time == '2' ? moment(this.timeRange[1]).format('YYYY-MM-DD') : '',
-              description: this.allForm.description,
               appStore: values.useAppMarket == true ? this.allForm.appStore : null,
               useAppMarket: values.useAppMarket ? 1 : 0,
               sceneId: this.allForm.allianceAccount == '1' ? this.allForm.sceneId : [5],