Browse Source

批量2.0添加程序化

朱鑫波 3 years ago
parent
commit
8e2156822d
2 changed files with 127 additions and 48 deletions
  1. 125 46
      src/views/modules/kuaishouapp/batchCreation/creat/creatUnit.vue
  2. 2 2
      vue.config.js

+ 125 - 46
src/views/modules/kuaishouapp/batchCreation/creat/creatUnit.vue

@@ -40,6 +40,17 @@
                 {{createCount}}
             </div>
         </a-form-item>
+      <a-form-item
+        label="创意制作方式"
+        :labelCol="{ lg: { span: 7 }, sm: { span: 7 } }"
+        :wrapperCol="{ lg: { span: 10 }, sm: { span: 17 } }"
+      >
+        <a-radio-group buttonStyle="solid" v-decorator="['unitType', { initialValue: '4' }]" @change="changeUnitType">
+          <a-radio-button value="4">自定义</a-radio-button>
+          <a-radio-button value="7">程序化</a-radio-button>
+        </a-radio-group>
+      </a-form-item>
+
         
       <a-form-item
         label="目标应用"
@@ -593,6 +604,7 @@
         label="创建类型"
         :labelCol="{ lg: { span: 7 }, sm: { span: 7 } }"
         :wrapperCol="{ lg: { span: 10 }, sm: { span: 17 } }"
+        v-if="getData('unitType')=='4'"
       >
          <a-radio-group
           buttonStyle="solid"
@@ -604,18 +616,18 @@
         </a-radio-group>
       </a-form-item>
       <a-form-item
-        v-if="getData('createType')=='0'"
-        label="封面数"
+        v-if="getData('unitType')=='7' || getData('createType')!='1'"
+        :label="getData('unitType')=='7'?'视频数':'封面数'"
         :labelCol="{ lg: { span: 7 }, sm: { span: 7 } }"
         :wrapperCol="{ lg: { span: 10 }, sm: { span: 17 } }"
       >
          <a-input-number
-          :max="15"
-          :min="1"
+          :max="getData('unitType')=='7'?10:15"
+          :min="getData('unitType')=='7'?3:1"
           v-decorator="[
             'imageCount',
             {
-              rules: [{ required: true, message: '封面数必填' }],
+              rules: [{ required: true, message: '数量必填必填' }],
               initialValue: 5,
             },
           ]"
@@ -629,7 +641,11 @@
         :labelCol="{ lg: { span: 7 }, sm: { span: 7 } }"
         :wrapperCol="{ lg: { span: 10 }, sm: { span: 17 } }"
       >
-        <a @click="getVideoList()">选择视频</a> {{ videoList.length + '/' + (getData('createType')=='0'?getData('createCount'):getData('createCount')*15) }}
+        <a @click="getVideoList()">选择视频</a> 
+        {{ videoList.length + '/' + (getData('unitType')=='4'
+        ?(getData('createType')=='0'?
+        getData('createCount'):getData('createCount')*15)
+        :getData('createCount')*getData('imageCount')) }}
         <br />
         <div v-if="videoList.length > 0 && showVideo" style="display:flex;flex-wrap:wrap">
           <span v-for="(item, index) of videoList" :key="index" style="position: relative" class="width-video">
@@ -890,7 +906,7 @@
           <a-col :span="8">
             <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol">
               当前选择数量
-              {{ sumContent + '/' + (getData('createType')=='0'?getData('createCount'):getData('createCount')*15) }}
+              {{ sumContent + '/' + (getData('unitType')=='4'?(getData('createType')=='0'?getData('createCount'):getData('createCount')*15):getData('createCount')*getData('imageCount') )}}
               <a-button  type="primary" @click="tongbu()" :loading="tongbuLoading" style="margin-left:10px"  v-if="mediaDimension == 'a'">
               刷新素材</a-button>
             </a-form-item>
@@ -1847,26 +1863,39 @@ export default {
         sum += this.checkVideoWai[i].length
       }
       this.sumContent = sum
-      if (this.getData('createType') == '0') {
-        if (sum > this.getData('createCount')) {
-          this.$message.error('最多选择' + this.getData('createCount') + '个素材')
-          this.checkVideo = []
-          this.sumContent = this.sumContent - 10
-
-          // if (this.active == 0) {
-            this.checkVideoAll[this.ipagination.current - 1] = this.checkVideo
-         
+      if(this.getData('unitType') == '4'){
+        if (this.getData('createType') == '0') {
+          if (sum > this.getData('createCount')) {
+            this.$message.error('最多选择' + this.getData('createCount') + '个素材')
+            this.checkVideo = []
+            this.sumContent = this.sumContent - 10
+
+            // if (this.active == 0) {
+              this.checkVideoAll[this.ipagination.current - 1] = this.checkVideo
+          
+          }
+        } else {
+          if (sum > this.getData('createCount') * 15) {
+            this.$message.error('最多选择' + this.getData('createCount') * 15 + '个素材')
+            this.checkVideo = []
+            this.sumContent = this.sumContent - 15
+
+            // if (this.active == 0) {
+              this.checkVideoAll[this.ipagination.current - 1] = this.checkVideo
+            // } else if (this.active == 1) {
+            //   this.checkVideoWai[this.ipagination.current - 1] = this.checkVideo
+            // }
+          }
         }
-      } else {
-        if (sum > this.getData('createCount') * 15) {
-          this.$message.error('最多选择' + this.getData('createCount') * 15 + '个素材')
+      }else{
+        if (sum > this.getData('createCount')*this.getData('imageCount')) {
+          this.$message.error('最多选择'+this.getData('createCount')*this.getData('imageCount')+'个素材')
           this.checkVideo = []
-          this.sumContent = this.sumContent - 15
-
+          this.sumContent-=10
           // if (this.active == 0) {
             this.checkVideoAll[this.ipagination.current - 1] = this.checkVideo
           // } else if (this.active == 1) {
-          //   this.checkVideoWai[this.ipagination.current - 1] = this.checkVideo
+            // this.checkVideoWai[this.ipagination.current - 1] = this.checkVideo
           // }
         }
       }
@@ -1892,21 +1921,33 @@ export default {
         sum += this.checkVideoWai[i].length
       }
       this.sumContent = sum
-
-      if (this.getData('createType') == '0') {
-        if (sum > this.getData('createCount')) {
-          this.$message.error('最多选择' + this.getData('createCount') + '个素材')
-          this.checkVideo.pop()
-          this.sumContent--
-          // if (this.active == 0) {
-            this.checkVideoAll[this.ipagination.current - 1] = this.checkVideo
-          // } else if (this.active == 1) {
-          //   this.checkVideoWai[this.ipagination.current - 1] = this.checkVideo
-          // }
+      if(this.getData('unitType') == '4'){
+        if (this.getData('createType') == '0') {
+          if (sum > this.getData('createCount')) {
+            this.$message.error('最多选择' + this.getData('createCount') + '个素材')
+            this.checkVideo.pop()
+            this.sumContent--
+            // if (this.active == 0) {
+              this.checkVideoAll[this.ipagination.current - 1] = this.checkVideo
+            // } else if (this.active == 1) {
+            //   this.checkVideoWai[this.ipagination.current - 1] = this.checkVideo
+            // }
+          }
+        } else {
+          if (sum > this.getData('createCount') * 15) {
+            this.$message.error('最多选择' + this.getData('createCount') * 15 + '个素材')
+            this.checkVideo.pop()
+            this.sumContent--
+            // if (this.active == 0) {
+              this.checkVideoAll[this.ipagination.current - 1] = this.checkVideo
+            // } else if (this.active == 1) {
+              // this.checkVideoWai[this.ipagination.current - 1] = this.checkVideo
+            // }
+          }
         }
-      } else {
-        if (sum > this.getData('createCount') * 15) {
-          this.$message.error('最多选择' + this.getData('createCount') * 15 + '个素材')
+      }else{
+        if (sum > this.getData('createCount')*this.getData('imageCount')) {
+          this.$message.error('最多选择'+this.getData('createCount')*this.getData('imageCount')+'个素材')
           this.checkVideo.pop()
           this.sumContent--
           // if (this.active == 0) {
@@ -1916,6 +1957,8 @@ export default {
           // }
         }
       }
+      
+
     },
     getVideoList() {
       this.orderBy = 'time'
@@ -1939,7 +1982,8 @@ export default {
       // })
     },
     getDataSource(page, pageSize) {
-
+      console.log(this.checkVideo, this.checkVideoAll)
+      this.checkVideo = this.checkVideoAll[page-1]
       this.ipagination.current = page
       this.searchVideo()
     },
@@ -1983,13 +2027,17 @@ export default {
     changeType() {
       this.$nextTick(() => {
         if (this.getData('creativeMaterialType') == '1') {
-          this.form.setFieldsValue({
-            name: '自定义创意_竖版视频',
-          })
+          if(this.getData('unitType') == '4') {
+            this.form.setFieldsValue({creativeName:'自定义创意_竖版视频'})
+          }else{
+            this.form.setFieldsValue({creativeName:'程序化创意_竖版视频'})
+          }
         } else {
-          this.form.setFieldsValue({
-            name: '自定义创意_横版视频',
-          })
+          if(this.getData('unitType') == '4') {
+            this.form.setFieldsValue({creativeName:'自定义创意_横版视频'})
+          }else{
+            this.form.setFieldsValue({creativeName:'程序化创意_横版视频'})
+          }
         }
       })
     },
@@ -2315,12 +2363,15 @@ export default {
       e.preventDefault()
       if (
         this.checkVideo.length <
-        (this.getData('createType') == '0' ? this.getData('createCount') : this.getData('createCount') * 15)
+        (this.getData('unitType')=='4'?this.getData('createType') == '0' ? this.getData('createCount') : this.getData('createCount') * 15:
+        this.getData('createCount')*this.getData('imageCount'))
       ) {
         // this.$message.error('选择的素材不能小于创建条数')
+        this.getData('unitType')=='4'?
         this.getData('createType') == '0'
           ? this.$message.error('选择的素材不能小于创建条数')
-          : this.$message.error('选择的素材不能小于创建条数*15')
+          : this.$message.error('选择的素材不能小于创建条数*15'):
+          this.$message.error('选择的素材不能小于创建条数*'+this.getData('imageCount'))
       } else {
         this.form.validateFieldsAndScroll((err, values) => {
           if (!err) {
@@ -2344,7 +2395,7 @@ export default {
               creativeCategory: values.creativeCategory
                 ? values.creativeCategory[values.creativeCategory.length - 1]
                 : null,
-              unitType: '4',
+              unitType: values.unitType,
             }
             var params = {
               userId: this.userInfo().id,
@@ -2379,6 +2430,34 @@ export default {
     onChange(value) {
       // console.log(value)
     },
+    changeUnitType(e){
+      this.sumContent = 0
+      this.videoList = []
+      this.checkVideo = []
+      this.checkVideoAll = []
+      this.ipagination.pageSize = 10
+      this.$nextTick(()=>{
+        if (this.getData('creativeMaterialType') == '1') {
+          if(this.getData('unitType') == '4') {
+            this.form.setFieldsValue({creativeName:'自定义创意_竖版视频'})
+          }else{
+            this.form.setFieldsValue({creativeName:'程序化创意_竖版视频'})
+          }
+        } else {
+          if(this.getData('unitType') == '4') {
+            this.form.setFieldsValue({creativeName:'自定义创意_横版视频'})
+          }else{
+            this.form.setFieldsValue({creativeName:'程序化创意_横版视频'})
+          }
+        }
+        // if(e.target.value == '4') {
+        //   this.form.setFieldsValue({creativeName:'自定义创意_竖版视频'})
+        // }else{
+        //   this.form.setFieldsValue({creativeName:'程序化创意_竖版视频'})
+        // }
+      })
+      
+    },
     handleChange(value) {
       //   this.$refs.population.getAppList(value)
       this.getSiteList(value)

+ 2 - 2
vue.config.js

@@ -105,10 +105,10 @@ module.exports = {
         // target: 'http://192.168.1.43:8088', //请求本地 需要jeecg-boot后台项目  毕洁泉
         // target: 'http://192.168.1.43:8806', //请求本地 需要jeecg-boot后台项目  毕洁泉
         // target: 'http://192.168.0.252:8098', //请求本地 需要jeecg-boot后台项目  毕洁泉
-        // target: 'http://192.168.1.59:7701', //请求本地 需要jeecg-boot后台项目  赵西安
+        target: 'http://192.168.1.59:7701', //请求本地 需要jeecg-boot后台项目  赵西安
         // target: 'http://192.168.1.193:8080', //请求本地 需要jeecg-boot后台项目  李煜一
         // target: 'http://192.168.1.193:31012', //请求本地 需要jeecg-boot后台项目  李煜一
-        target: 'http://api.tjyourong.com.cn', //请求本地 需要jeecg-boot后台项目
+        // target: 'http://api.tjyourong.com.cn', //请求本地 需要jeecg-boot后台项目
         // target: 'https://trac.tjyourong.com.cn', //请求本地 需要jeecg-boot后台项目
         // target: 'http://39.106.184.70:8088/', //请求本地 需要jeecg-boot后台项目
         //  target: 'http://adsp.tjyourong.com.cn/', //请求本地 需要jeecg-boot后台项目