Преглед изворни кода

修改 默认选择广告语

yumeng пре 5 година
родитељ
комит
1405bfc0ef
1 измењених фајлова са 1 додато и 664 уклоњено
  1. 1 664
      src/views/modules/kuaishouapp/creativeCreate.vue

+ 1 - 664
src/views/modules/kuaishouapp/creativeCreate.vue

@@ -989,6 +989,7 @@
                   // 设置默认选中的视频
                   if (this.videoList.length > 0) {
                     this.videoUrl = this.videoList[0].localUrl
+                    this.description = this.videoList[0].videoDesc
                   }
                 }
               })
@@ -1194,668 +1195,4 @@
       }
     }
   }
-      },
-      wrapperCol: {
-        xs: {
-          span: 10
-        },
-        sm: {
-          span: 17
-      },
-      form: this.$form.createForm(this),
-      url: {
-        userAllocationList: '/ctop/userAllocation/list',
-        getOptionsUrl: '/kuaishou/create/getOptions',
-        getChildrenUrl: '/kuaishou/create/getChildren',
-        videoListUrl: '/kuaishou/kuaiShouVideo/list',
-        imageListUrl: '/kuaishou/kuaiShouImage//image/list',
-        actionBarTextListUrl: '/kuaishou/kuaiShouActionBarText/list',
-        getDescriptionUrl: '/kuaishou/kuaiShouVideo/queryShouVideo',
-        creativeUrl: '/kuaishou/create/createCreative',
-        selectGroupCreate: '/kuaishou/kuaiShouGroupCreateLog/select/group'
-      }
-    }
-  },
-  methods: {
-    ...mapGetters(['nickname', 'avatar', 'userInfo']),
-    handleOk(e) {
-      console.log(e)
-      this.visible = false
-      this.imageUrl = []
-      if (this.checkeds.length > 0) {
-        for (let i = 0; i < this.checkeds.length; i++) {
-          let imageId = this.checkeds[i]
-          for (let j = 0; j < this.imageList.length; j++) {
-            let imageVo = this.imageList[j]
-            if (imageId == imageVo.id) {
-              this.imageUrl.push(imageVo.src)
-            }
-          }
-        }
-      }
-    },
-    showModal() {
-      this.visible = true
-    },
-    // 上传视频弹窗
-    handleOkVideo(e) {
-      this.visibleVideo = false
-      this.closeAllVideoFun()
-    },
-    showModalVideo() {
-      this.visibleVideo = true
-      this.stopOtherVideo()
-    },
-    handleCancelVideo() {
-      this.closeAllVideoFun()
-      this.videoUrl = ''
-    },
-    // 有单张图片的上传视频弹窗,多选
-    handleOkSinglePicVideo(e) {
-      this.visibleSinglePicVideo = false
-      this.closeAllVideoFun()
-    },
-    showSinglePicModalVideo() {
-      this.visibleSinglePicVideo = true
-      this.stopOtherVideo()
-    },
-    handleCancelSinglePicVideo() {
-      this.closeAllVideoFun()
-      this.videoUrl = ''
-    },
-    //   视频多选
-    VideoOnChange(checkedValues) {
-      this.haveSinglePicVideoUrl = checkedValues
-      console.log(this.haveSinglePicVideoUrl)
-    },
-
-    // 停止播放除当前外的视频
-    stopOtherVideo() {
-      jq(document).ready(function() {
-        // 播放当前视频停止其他视频
-        let videos = jq('video')
-
-        function pauseAll() {
-          let self = this
-          ;[].forEach.call(videos, i => {
-            // 将 videos 中其他的 video 全部暂停
-            i !== self && i.pause()
-          })
-        }
-        // 给play事件绑定暂停函数
-        ;[].forEach.call(videos, i => {
-          i.addEventListener('play', pauseAll.bind(i))
-        })
-      })
-    },
-    // 停止播放所有视频
-    closeAllVideoFun() {
-      let videos = jq('video')
-      let videosArr = Array.prototype.slice.call(videos)
-      videosArr.forEach(x => {
-        x.pause()
-      })
-    },
-    changChecked() {
-      if (this.imageList.length == this.checkeds.length) {
-        this.isAllChecked = true
-      } else {
-        this.isAllChecked = false
-      }
-    },
-    //   有单张图片的上传封面
-    showSinglePicCoverModal() {
-      this.visibleSinglePicCover = true
-    },
-    handleOkSinglePicCover() {
-      this.haveSinglePicimagesList = []
-      if (this.checkeds.length > 0) {
-        for (let i = 0; i < this.checkeds.length; i++) {
-          let imageId = this.checkeds[i]
-          for (let j = 0; j < this.imageList.length; j++) {
-            let imageVo = this.imageList[j]
-            if (imageId == imageVo.id) {
-              this.haveSinglePicimagesList.push(imageVo.src)
-            }
-          }
-        }
-      }
-      this.visibleSinglePicCover = false
-    },
-    handleCancelSinglePicCover() {
-      this.visibleSinglePicCover = false
-      this.haveSinglePicimagesList = []
-    },
-    checkeda: function(id) {
-      let indexOf = this.checkeds.indexOf(id)
-      if (indexOf >= 0) {
-        this.$delete(this.checkeds, id)
-      } else {
-        this.checkeds.push(id)
-      }
-      console.log(this.checkeds)
-    },
-    checkAll(e) {
-      // 点击全选事件函数
-      let checkObj = document.querySelectorAll('.checkItem') // 获取所有checkbox项
-      if (e.target.checked) {
-        // 判定全选checkbox的勾选状态
-        for (let i = 0; i < this.imageList.length; i++) {
-          if (!checkObj[i].checked) {
-            // 将未勾选的checkbox选项push到绑定数组中
-            this.checkeds.push(checkObj[i].value)
-            console.log(this.checkeds)
-          }
-        }
-      } else {
-        // 如果是去掉全选则清空checkbox选项绑定数组
-        this.checkeds = []
-      }
-    },
-    changeImageType() {
-      if (this.imageType == '2') {
-        this.showLocalImageUpload = true
-        this.showCover = false
-      } else {
-        this.showLocalImageUpload = false
-        this.showCover = true
-      }
-    },
-    handleChange(value) {
-      console.log(`selected ${value}`)
-    },
-    handleBlur() {
-      console.log('blur')
-    },
-    handleFocus() {
-      console.log('focus')
-    },
-    filterOption(input, option) {
-      return option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
-    },
-    // 视频类型
-    changeVideoList() {
-      if ((this.creativeMaterialType == '1' || this.creativeMaterialType == '2') && this.sceneId == '2') {
-        // 横版竖版并且无单张图片
-        this.showImageUpload = false
-        this.showUploadType = true
-        this.selectVideoUpload = true
-        this.localUpload = false
-        this.showUploadImageRadio = true
-        this.showCover = true
-        this.showLocalImageUpload = false
-        this.videoUrl = ''
-        this.hasSinglePicVideoUpload = false
-        this.hasSinglePicCoverUpload = false
-        this.showSinglePicType = false
-        this.showSinglePicTiepianType = false
-        if (this.videoUploadType == '1') {
-          // 选择作品
-          this.localUpload = false
-        } else if (this.videoUploadType == '2') {
-          // 本地上传
-          this.localUpload = true
-        }
-        let params = {}
-        params.pageSize = '1000'
-        params.loginId = this.userInfo().id
-        params.positionType = '1'
-
-        if (this.creativeMaterialType == '1') {
-          // 竖版视频
-          params.materialType = '1'
-        }
-        if (this.creativeMaterialType == '2') {
-          params.materialType = '2'
-        }
-
-        getAction(this.url.videoListUrl, params).then(res => {
-          if (res.success) {
-            this.videoList = res.result.records
-            // 设置默认选中的视频
-            if (this.videoList.length > 0) {
-              this.videoUrl = this.videoList[0].localUrl
-          }
-        })
-        getAction(this.url.imageListUrl, params).then(res => {
-          this.imageList = res
-        })
-      } else if (
-        (this.creativeMaterialType == '1' || this.creativeMaterialType == '2' || this.creativeMaterialType == '3') &&
-        this.sceneId == '3'
-      ) {
-        // 横版竖版有单张图片
-        if (this.creativeMaterialType == '1' || this.creativeMaterialType == '2') {
-          // 切换横版或竖版
-          this.showUploadType = true
-          this.localUpload = false
-          this.selectVideoUpload = false
-          this.showImageUpload = false
-          this.showUploadImageRadio = false
-          this.showUploadSinglePicType = false
-          this.tiepianImageLocalUpload = false
-          let params = {}
-          params.pageSize = '1000'
-          params.loginId = this.userInfo().id
-          params.positionType = '2'
-          if (this.creativeMaterialType == '2') {
-            params.materialType = '2'
-          } else if (this.creativeMaterialType == '1') {
-            params.materialType = '1'
-          }
-          if (this.videoUploadType == '1') {
-            // 选择作品
-            this.tiepianVideoLocalUpload = false
-            this.hasSinglePicVideoUpload = true
-          } else if (this.videoUploadType == '2') {
-            // 本地上传
-            this.tiepianVideoLocalUpload = true
-            this.hasSinglePicVideoUpload = false
-            this.tiepianImageLocalUpload = false
-          }
-          getAction(this.url.videoListUrl, params).then(res => {
-            if (res.success) {
-              this.videoList = res.result.records
-              // 设置默认选中的视频
-              if (this.videoList.length > 0) {
-                this.videoUrl = this.videoList[0].localUrl
-              }
-            }
-          })
-        } else if (this.creativeMaterialType == '3') {
-          // 切换单张图片
-          this.positionType = '1'
-          this.singlePicTiepianType = '1'
-          this.showImageUpload = true
-          this.showUploadType = false
-          this.selectVideoUpload = false
-          this.showSinglePicType = false
-          this.showSinglePicTiepianType = false
-          this.hasSinglePicVideoUpload = false
-          this.tiepianVideoLocalUpload = false
-          this.hasSinglePicCoverUpload = false
-          if (this.changeSinglePicType == '1') {
-            // 选择封面
-            this.tiepianImageLocalUpload = false
-          } else if (this.changeSinglePicType == '2') {
-            // 本地上传
-            this.tiepianImageLocalUpload = true
-            this.hasSinglePicCoverUpload = false
-          }
-        }
-      }
-      if (this.creativeMaterialType == '1' || this.creativeMaterialType == '2') {
-        this.hasSinglePicCoverUpload = false
-        this.showSinglePicTiepianType = false
-      }
-      if (this.creativeMaterialType == '3') {
-        // 单张图片时
-        this.hasSinglePicVideoUpload = false
-        this.showSinglePicType = true
-        this.showUploadSinglePicType = true
-        this.showImageUpload = false
-        this.showSinglePicTiepianType = true
-        if (this.changeSinglePicType == '1') {
-          this.hasSinglePicCoverUpload = true
-        } else if (this.changeSinglePicType == '2') {
-          this.hasSinglePicCoverUpload = false
-        }
-      }
-    },
-    // 视频上传方式
-    changeUploadVideo() {
-      if (this.sceneId == '2') {
-        // 无单张图片时
-        this.hasSinglePicVideoUpload = false
-        this.hasSinglePicCoverUpload = false
-        this.tiepianVideoLocalUpload = false
-        this.tiepianImageLocalUpload = false
-        if (this.videoUploadType == '2') {
-          this.localUpload = true
-          this.selectVideoUpload = false
-          this.selectVideoUpload = true
-          this.localUpload = false
-      } else if (this.sceneId == '3') {
-        if (this.materialType == '3') {
-          if (this.changeSinglePicType == '2') {
-            this.hasSinglePicCoverUpload = false
-            this.tiepianImageLocalUpload = true
-          } else if (this.changeSinglePicType == '1') {
-            this.hasSinglePicCoverUpload = true
-            this.tiepianImageLocalUpload = false
-          }
-          this.showUploadImageRadio = false
-          this.tiepianVideoLocalUpload = false
-          if (this.videoUploadType == '1') {
-            this.hasSinglePicVideoUpload = true
-            this.tiepianVideoLocalUpload = false
-          } else if (this.videoUploadType == '2') {
-            this.hasSinglePicVideoUpload = false
-            this.tiepianVideoLocalUpload = true
-          }
-        }
-      }
-    },
-    getDescription() {
-      let params = {}
-      params.localUrl = this.videoUrl
-      params.loginId = this.userInfo().id
-      postAction(this.url.getDescriptionUrl, params).then(res => {
-        if (res.success) {
-          this.description = res.result.videoDesc
-          this.creativeName = res.result.videoName + '_' + moment().format('YYYY-MM-DD_HH:mm')
-        }
-      })
-    },
-
-    // 有单张图片的贴片方式
-    changeSinglePicTiepianTypeFun() {
-      if (this.creativeMaterialType == '3' && this.singlePicTiepianType == '1') {
-        this.positionType = '1'
-      } else if (this.creativeMaterialType == '3' && this.singlePicTiepianType == '2') {
-        this.positionType = '2'
-      }
-      let params = {}
-      params.pageSize = '1000'
-      params.loginId = this.userInfo().id
-      if (this.singlePicTiepianType == '1') {
-        params.materialType = '2'
-        params.positionType = '1'
-      }
-      if (this.singlePicTiepianType == '2') {
-        params.materialType = '2'
-        params.positionType = '2'
-      }
-      getAction(this.url.imageListUrl, params).then(res => {
-        this.imageList = res
-        console.log(res)
-      })
-    },
-
-    // 有单张图片的图片上传方式
-    changeSinglePicTypeFun() {
-      if (this.changeSinglePicType == '1') {
-        // 选择封面
-        this.hasSinglePicCoverUpload = true
-        this.tiepianImageLocalUpload = false
-      }
-      if (this.changeSinglePicType == '2') {
-        // 本地上传
-        this.hasSinglePicCoverUpload = false
-        this.tiepianImageLocalUpload = true
-      }
-    },
-    onChangeActionBarText() {
-      this.creativeMaterialType = '1'
-      if (this.ids.length == 2) {
-        let id = this.ids[0]
-        let params = {}
-        params.campaignId = id
-        getAction(this.url.actionBarTextListUrl, params).then(res => {
-          if (res.success) {
-            this.actionBarTextList = res.result.records
-          }
-        })
-        let unitId = this.ids[1]
-        let unitParams = {}
-        unitParams.unitId = unitId
-        getAction(this.url.selectGroupCreate, unitParams).then(res => {
-          this.sceneId = res.sceneId
-          if (res.sceneId == '2') {
-            // 无单张图片的时候
-            this.singlePicture = false
-            this.showImageUpload = false
-            this.showImpressionUrl = false
-            this.showClickTrackUrl = true
-            this.showUploadImageRadio = true
-            this.showCover = true
-            this.showLocalImageUpload = false
-            this.selectVideoUpload = true
-            this.hasSinglePicVideoUpload = false
-            this.hasSinglePicCoverUpload = false
-            this.showSinglePicTiepianType = false
-            this.showUploadSinglePicType = false
-            this.positionType = '1'
-            this.tiepianVideoLocalUpload = false
-            this.tiepianImageLocalUpload = false
-            let params2 = {}
-            params2.pageSize = '1000'
-            params2.materialType = '1'
-            params2.positionType = '1'
-            params2.loginId = this.userInfo().id
-            getAction(this.url.videoListUrl, params2).then(res => {
-              if (res.success) {
-                this.videoList = res.result.records
-                // 设置默认选中的视频
-                if (this.videoList.length > 0) {
-                  this.videoUrl = this.videoList[0].localUrl
-                  this.description = this.videoList[0].videoDesc
-                }
-              }
-            })
-
-            // 图片列表
-            getAction(this.url.imageListUrl, params2).then(res => {
-              this.imageList = res
-              console.log(res)
-            })
-          } else if (res.sceneId == '3') {
-            // 有单张图片的时候
-            this.singlePicture = true
-            this.showImpressionUrl = true
-            this.showClickTrackUrl = false
-            this.showUploadImageRadio = false
-            this.showCover = false
-            this.selectVideoUpload = false
-            this.showLocalImageUpload = false
-            this.positionType = '2'
-            // 如果有单张图片,上传作品方式为多选
-            this.hasSinglePicVideoUpload = true
-            let params2 = {}
-            params2.pageSize = '1000'
-            params2.materialType = '1'
-            params2.positionType = '2'
-            params2.loginId = this.userInfo().id
-            getAction(this.url.videoListUrl, params2).then(res => {
-              if (res.success) {
-                this.videoList = res.result.records
-                // 设置默认选中的视频
-                if (this.videoList.length > 0) {
-                  this.videoUrl = this.videoList[0].localUrl
-                }
-              }
-            })
-
-            // 图片列表
-            getAction(this.url.imageListUrl, params2).then(res => {
-              this.imageList = res
-            })
-          }
-        })
-      }
-    },
-    filterOption(input, option) {
-      return option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
-    },
-    loadData(selectedOptions) {
-      const targetOption = selectedOptions[selectedOptions.length - 1]
-      targetOption.loading = true
-      targetOption.loading = false
-      this.campaignId = `${targetOption.value}`
-      let params = {}
-      params.campaignId = this.campaignId
-      params.loginId = this.userInfo().id
-      params.accountId = this.accountId
-      postAction(this.url.getChildrenUrl, params).then(res => {
-        targetOption.children = res
-      })
-      this.options = [...this.options]
-    },
-    actionGroups() {
-      let params = {}
-      params.loginId = this.userInfo().id
-      params.accountId = this.accountId
-      postAction(this.url.getOptionsUrl, params).then(res => {
-        this.options = res
-      })
-    },
-
-    handleSubmit(e) {
-      e.preventDefault()
-      this.form.validateFields((err, values) => {
-        if (!err) {
-          let params = {}
-          params.accountId = this.accountId
-          if (this.ids.length == 2) {
-            params.unitId = this.ids[1]
-          }
-          params.videoUploadType = this.videoUploadType
-          params.imageUrl = this.imageUrl
-          params.actionBarText = this.actionBarTextDesc
-          params.description = this.description
-          params.clickTrackUrl = this.clickTrackUrl
-          params.creativeName = this.creativeName
-          params.creativeMaterialType = this.creativeMaterialType
-          params.impressionUrl = this.impressionUrl
-          params.sceneId = this.sceneId
-          params.loginId = this.userInfo().id
-          params.positionType = this.positionType
-          if (this.sceneId == '2') {
-            params.imageType = this.imageType
-            params.localImageUrl = this.localImageUrl
-            if (this.videoUploadType == '1') {
-              params.videoUrl = this.videoUrl
-            } else if (this.videoUploadType == '2') {
-              params.videoUrl = this.localUrl
-            }
-          } else if (this.sceneId == '3') {
-            if (this.creativeMaterialType != '3') {
-              if (this.videoUploadType == '1') {
-                params.haveSinglePicVideoUrl = this.haveSinglePicVideoUrl
-              } else if (this.videoUploadType == '2') {
-                params.haveSinglePicVideoUrl = this.tiepianVideoLocalUploadList
-              }
-            } else if (this.creativeMaterialType == '3') {
-              if (this.changeSinglePicType == '1') {
-                params.haveSinglePicimagesList = this.haveSinglePicimagesList
-              } else if (this.changeSinglePicType == '2') {
-                params.haveSinglePicimagesList = this.tiepianImageLocalUploadList
-              }
-            }
-          }
-          postAction(this.url.creativeUrl, params).then(res => {
-            console.log(res)
-            if (res.success) {
-              alert('广告创意创建成功')
-            }else{
-              alert(res.message)
-            }
-          })
-        }
-      })
-    }
-  },
-  created: function() {
-    let params = {}
-    params.pageSize = '1000'
-    params.mediaId = '2'
-    params.userId = this.userInfo().id
-    getAction(this.url.userAllocationList, params).then(res => {
-      if (res.success) {
-        this.accountList = res.result.records
-      }
-    })
-  }
-}
-.select_all {
-  margin-bottom: 10px;
-}
-
-.ant-modal-body {
-  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 {
-        position: relative;
-
-        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;
-            }
-          }
-        }
-      }
-    }
-  }
-}
 </style>