zhuxinbo 5 år sedan
förälder
incheckning
b6852c3ead

+ 23 - 6
src/views/modules/kuaishouapp/account/stepForm/Step3.vue

@@ -84,8 +84,7 @@
                   </a-col>
                 </a-row>
                 <div :style="{ marginBottom: '16px' }">
-                  <a-button @click="addCreative(bestIndex)"
-                    :disabled="contentAll>=15||(pans[0].list[pans[0].list.length-1].imageUrlList.length==0&&pans[0].list[pans[0].list.length-1].imageList.length==0)">
+                  <a-button @click="addCreative(bestIndex)" :disabled="contentAll>=15||listCheck">
                     添加创意</a-button>
                 </div>
               </a-layout-content>
@@ -339,7 +338,7 @@
         var data = this.pans[index].list.map(item => {
           return item.imageList.length + item.imageUrlList.length
         })
-        if (this.contentAll> 15) {
+        if (this.contentAll > 15) {
           this.$message.error('封面最多15张')
           return
         }
@@ -457,11 +456,29 @@
       },
       contentAll() {
         var count, arr = []
-        for (let i = 0; i < this.pans[0].list.length; i++) {
+        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].imageUrlList, ...this.pans[0].list[i].imageList)
+            arr.push(...this.pans[0].list[i].imageUrlList, ...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
         }
-        return arr.length + this.content
       }
     },
     watch: {},

+ 1 - 0
src/views/modules/material/scriptMaterial.vue

@@ -1028,6 +1028,7 @@ export default {
       this.scene = ''
       this.clipRemark = ''
       this.picContent = ''
+      this.visible = false
     },
     showInput() {
       this.inputVisible = true

+ 100 - 90
src/views/modules/material/videoMaterial.vue

@@ -607,6 +607,7 @@ a {
           :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"
@@ -722,6 +723,7 @@ a {
             :accessKeySecret="accessKeySecret"
             :before-upload="fileWater"
             :dir="dirImg"
+            @delete='deleteImage'
             @loaded="overUploadImage"
           ></upload-to-ali>
           <span
@@ -1404,6 +1406,12 @@ export default {
       if (n != '') {
         this.getList(n)
       }
+    },
+    visibleDetail:function(n,o){
+        if(!n){
+          this.refuseFile = []
+          this.refuseReason = ''
+        }
     }
   },
   methods: {
@@ -1678,6 +1686,8 @@ export default {
           // })
           this.$message.success('水印素材生成中')
           this.visibleDetail = false
+          this.refuseFile = []
+          this.refuseReason = ''
           closeAllVideoFun()
           this.loadData()
         }
@@ -1744,6 +1754,7 @@ export default {
     },
     okEditShow(item, editStatus) {
       if (editStatus == '2') {
+
         var params = {}
         params.id = item.id
         params.auditorId = this.userInfo().id
@@ -1886,26 +1897,31 @@ export default {
       })
     },
     handleOkImage() {
-      var params = {}
-      params.projectId = this.addImageData.projectId
-      params.videoId = this.addImageData.code
-      params.imageArr = this.imageArrList
-      this.loadingImage = true
-      postAction('/insertImage', params).then(res => {
-        console.log(res)
-        if (res.code == 0) {
-          this.urlListImage = {
-            url: [],
-            md5: [],
-            name: [],
-            size: []
-          }
-          this.imageArrList = []
-          this.addImageVisible = false
-          this.loadingImage = false
-          this.loadData()
+        if(this.urlListImage.url.length>0){
+            var params = {}
+            params.projectId = this.addImageData.projectId
+            params.videoId = this.addImageData.code
+            params.imageArr = this.imageArrList
+            this.loadingImage = true
+            postAction('/insertImage', params).then(res => {
+                console.log(res)
+                if (res.code == 0) {
+                this.urlListImage = {
+                    url: [],
+                    md5: [],
+                    name: [],
+                    size: []
+                }
+                this.imageArrList = []
+                this.addImageVisible = false
+                this.loadingImage = false
+                this.loadData()
+                }else{
+                this.loadingImage = false
+                }
+            })
         }
-      })
+     
     },
     handleOk() {
       this.loading = true
@@ -2059,7 +2075,8 @@ export default {
         this.queryParam = { 
             type: 'VIDEO', 
             userId: this.userInfo().id, 
-            status: key 
+            status: key ,
+            projectId:this.queryParam.projectId
         } 
         if (this.form.getFieldValue('projectId')) { 
             this.form.setFieldsValue({ 
@@ -2080,6 +2097,11 @@ export default {
       this.repeat = false
       this.$message.success('上传成功')
     },
+    deleteImage(url){
+        console.log(url,this.urlListImage.url)
+
+
+    },
     overUploadImage(urlAll) {
       //   var index = this.urlList.url.findIndex(item => item === urlAll[0])
       //   var data = { url: urlAll[0], code: this.urlList.md5[index], name: this.urlList.name[index] }
@@ -2088,97 +2110,85 @@ export default {
       that.material = []
       that.imageArrList = []
       var img
-      
-      for (var i = 0; i < this.urlListImage.url.length; i++) {
-          that.imageArrList.push({
-            // width: img.width,
-            // height: img.height,
-            // size: this.urlListImage.size[i],
-            code: this.urlListImage.md5[i],
-            url: this.urlListImage.url[i],
-            materialName: this.urlListImage.name[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)
-          }
-        //   that.imageArrList.push({
-        //     width: img.width,
-        //     height: img.height,
-        //     size: this.urlListImage.size[i],
-        //     code: this.urlListImage.md5[i],
-        //     url: this.urlListImage.url[i],
-        //     materialName: this.urlListImage.name[i]
-        //   })
-        } else {
-
-          img.onload = () => {
-            // that.imageArrList.push({
-            //   width: img.width,
-            //   height: img.height,
-            //   size: that.urlListImage.size[i-1],
-            //   code: that.urlListImage.md5[i-1],
-            //   url: that.urlListImage.url[i-1],
-            //   materialName: that.urlListImage.name[i-1]
-            // })
+      if(urlAll.length>0){
+        for (var i = 0; i < this.urlListImage.url.length; i++) {
+            that.imageArrList.push({
+                // width: img.width,
+                // height: img.height,
+                // size: this.urlListImage.size[i],
+                code: this.urlListImage.md5[i],
+                url: this.urlListImage.url[i],
+                materialName: this.urlListImage.name[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)
+                that.material.push(true)
                 } else {
-                  that.material.push(false)
+                that.material.push(false)
                 }
             } else if (img.width == 1080) {
                 if (img.height == 1920) {
-                  that.material.push(true)
+                that.material.push(true)
                 } else {
-                  that.material.push(false)
+                that.material.push(false)
                 }
             } else if (img.width == 1280) {
                 if (img.height == 720) {
-                  that.material.push(true)
+                that.material.push(true)
                 } else {
-                  that.material.push(false)
+                that.material.push(false)
                 }
             } else if (img.width == 1920) {
                 if (img.height == 1080) {
-                  that.material.push(true)
+                that.material.push(true)
                 } else {
-                  that.material.push(false)
+                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)
+                }
+                
+            }
+            }
         }
+      }else{
+
       }
+
     },
     file(file) {
       var bmf = new BMF()

+ 242 - 59
src/views/modules/onlineTraining/onlineTrainingList.vue

@@ -16,7 +16,10 @@
   <a-row :gutter="10">
 
     <a-col :sm="6" style="margin-bottom: 20px;z-index: 10">
-      <a-card class="search-box" style="min-height:500px">
+      <a-card class="search-box" style="min-height:500px" title="在线视频培训列表">
+        <a slot="extra" @click="addList">
+          新增培训视频
+        </a>
         <a-directory-tree defaultExpandAll @select="onSelect" @expand="onExpand" :loadData="onLoadData"
           :treeData="treeData">
         </a-directory-tree>
@@ -44,12 +47,87 @@
         <div id="videoPlay" style="height:800px" v-show="!startList"></div>
       </a-card>
     </a-col>
+    <a-modal :width="800" 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" :disabled="fileUrl==''">
+          确定
+        </a-button>
+      </template>
+      <a-form :form="form">
+        <a-form-item :label-col="labelCol" :wrapper-col="wrapperCol" label="培训上传方式">
+          <a-radio-group buttonStyle="solid" v-model="typeUpload" @change="clear">
+            <a-radio-button value="1">原有目录上传</a-radio-button>
+            <a-radio-button value="2" :disabled="roleName!='admin'">新建目录上传</a-radio-button>
+          </a-radio-group>
+        </a-form-item>
+        <a-form-item :label-col="labelCol" :wrapper-col="wrapperCol" label="一级目录选择">
+          <a-select
+            v-decorator="['media', { rules: [{ required: true, message: '请选择一级目录' }], initialValue: '汇创视频培训'  }]"
+            showSearch allowClear placeholder="选择模板" optionFilterProp="children" :filterOption="filterOption" disabled>
+            <a-select-option value="汇创视频培训">
+              汇创视频培训
+            </a-select-option>
+          </a-select>
+        </a-form-item>
+        <div v-if="typeUpload == '1'">
+          <a-form-item :label-col="labelCol" :wrapper-col="wrapperCol" label="二级目录选择">
+            <a-select v-decorator="['title', { rules: [{ required: true, message: '请选择二级目录' }]  }]" style="width: 100%"
+              placeholder="请选择二级目录" @change="getTopic">
+              <a-select-option v-for="(item,index) in titleList" :key="index" :value="item.value">
+                {{item.label}}
+              </a-select-option>
+            </a-select>
+          </a-form-item>
+          <a-form-item :label-col="labelCol" :wrapper-col="wrapperCol" label="三级目录选择">
+            <a-select v-decorator="['topic', { rules: [{ required: true, message: '请选择三级目录' }]  }]" style="width: 100%"
+              placeholder="请选择三级目录" :disabled="!getData('title')" @change="setOssDir">
+              <a-select-option v-for="(item,index) in topicList" :key="index" :value="item.value">
+                {{item.label}}
+              </a-select-option>
+            </a-select>
+          </a-form-item>
+        </div>
+        <div v-else>
+          <a-form-item :label-col="labelCol" :wrapper-col="wrapperCol" label="二级目录">
+            <!-- <a-input placeholder="请填写二级目录"
+              v-decorator="['titleAll', { rules: [{ required: true, message: '二级目录必填' }]  }]" /> -->
+            <a-select mode="tags" v-model="oneList" placeholder="请填写二级目录" @change="handleChange">
+              <a-select-option v-for="(item,index) in titleList" :key="index" :value="item.value">
+                {{item.label}}
+              </a-select-option>
+            </a-select>
+          </a-form-item>
+          <a-form-item :label-col="labelCol" :wrapper-col="wrapperCol" label="三级目录">
+            <a-input placeholder="请填写三级目录"
+              v-decorator="['topicAll', { rules: [{ required: true, message: '三级目录必填' }]  }]" />
+          </a-form-item>
+        </div>
+        <a-form-item :label-col="labelCol" :wrapper-col="wrapperCol" label="培训视频名称">
+          <a-input placeholder="请填写培训视频名称"
+            v-decorator="['name', { rules: [{ required: true,message:'培训视频名称不能为空'}] }]" />
+        </a-form-item>
+        <a-form-item :label-col="labelCol" :wrapper-col="wrapperCol" label="培训视频简介">
+          <a-input placeholder="请填写培训视频简介" v-decorator="['intro']" />
+        </a-form-item>
+        <a-form-item :label-col="labelCol" :wrapper-col="wrapperCol" label="文件上传"
+          v-show="(getData('title') && getData('topic'))||(oneList.length>0 && getData('topicAll'))">
+          <upload-to-ali v-model="fileUrl" :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>
+        </a-form-item>
+
+      </a-form>
+
+    </a-modal>
   </a-row>
 </template>
 
 <script>
   import {
-    getAction
+    getAction,
+    postAction
   } from '@/api/manage'
   import {
     JeecgListMixin
@@ -57,6 +135,7 @@
   import moment from 'moment'
   import $ from 'jquery'
   import qs from 'qs'
+  import UploadToAli from '@femessage/upload-to-ali'
   // document.write(textDes('https://ctop-media.oss-cn-beijing.aliyuncs.com/video/2020-03-20/20网服-1584693978588.mp4'))
   // document.write('<br>' + desDecrypt('s4HMPbmUfZ0=', 'ckplayerDesKey'))
   function textDes(str) {
@@ -92,49 +171,38 @@
     mixins: [JeecgListMixin],
     data() {
       return {
-        visibleDetail: false,
-        srcList: '',
-        timeList: [{
-            label: '分类1',
-            value: 1,
-            show: true
-          },
-          {
-            label: '分类2',
-            value: 2,
-            show: true
-          },
-          {
-            label: '分类3',
-            value: 3,
-            show: true
+        typeUpload: '1',
+        titleList: [],
+        topicList: [],
+        oneList: [],
+        fileUrl: '',
+        customDomain: '',
+        region: 'oss-cn-beijing',
+        bucket: 'ctop-media',
+        acceptVideo: 'video/mpeg,video/mp4',
+        accessKeyId: 'LTAIbNbqWzSOklQV',
+        accessKeySecret: '1rkPz7JNoXk8sJevPaeYHWqfkQXBGh',
+        labelCol: {
+          xs: {
+            span: 24
           },
-          {
-            label: '分类4',
-            value: 4,
-            show: true
-          },
-          {
-            label: '分类5',
-            value: 5,
-            show: true
-          },
-          {
-            label: '分类6',
-            value: 6,
-            show: true
-          },
-          {
-            label: '分类7',
-            value: 7,
-            show: true
+          sm: {
+            span: 5
+          }
+        },
+        wrapperCol: {
+          xs: {
+            span: 24
           },
-          {
-            label: '分类8',
-            value: 8,
-            show: true
+          sm: {
+            span: 12
           }
-        ],
+        },
+        visibleDetail: false,
+        srcList: '',
+        loadingImage: false,
+        addImageVisible: false,
+        form: this.$form.createForm(this),
         treeData: [{
             title: '巨量引擎',
             key: '巨量引擎'
@@ -170,29 +238,133 @@
           video: "" //视频地址
         },
         active: 1,
-        data: [{
-            title: '素材库-脚本库视频'
-          },
-          {
-            title: '素材库-脚本库文档'
-          },
-          {
-            title: '素材库-视频库操作视频'
-          },
-          {
-            title: '素材库-视频库操作文档'
-          }
-        ],
         url: {
           list: '/ctop/materialInfo/list'
         },
         startList: true,
         simpleMode: false,
-        course: null
+        course: null,
+        dirVideo: "online/",
+        roleName: localStorage.getItem('roleCode')
       }
     },
-    components: {},
+    components: {
+      UploadToAli,
+    },
     methods: {
+      clear() {
+        this.form.setFieldsValue({
+          topic: '',
+          title: ''
+        })
+      },
+      filterOption(input, option) {
+        return option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
+      },
+      getTopic(e) {
+        //    e.target.value 
+        console.log(e)
+        this.topicList = []
+        this.form.setFieldsValue({
+          topic: ''
+        })
+        getAction('/ctop/edu/system/topic', {
+          title: e
+        }).then(res => {
+          if (res.success) {
+            this.topicList = res.result.map(item => {
+              return {
+                value: item,
+                label: item
+              }
+            })
+          }
+        })
+      },
+      setOssDir(e) {
+        this.dirVideo = 'online/' + this.getData('title') + '/' + this.getData('topic')
+      },
+      addList() {
+        this.addImageVisible = true
+        this.loadingImage = false
+        this.typeUpload = '1'
+        getAction("/ctop/edu/system/lesson").then(res => {
+          console.log(res)
+          if (res.success) {
+            this.titleList = res.result.map(item => {
+              return {
+                value: item,
+                label: item
+              }
+            })
+          }
+        })
+
+      },
+      handleChange(value) {
+        console.log(value)
+        this.oneList = value.pop()
+      },
+      handleOkImage(e) {
+        this.loadingImage = true
+        this.form.validateFieldsAndScroll((err, values) => {
+          if (err) {
+            // 这里做逻辑处理
+          } else {
+            var params = {}
+            if (this.typeUpload == '1') {
+              params = {
+                ...values,
+                ossFileUrl: 'https:' + this.fileUrl,
+                fileType: 1
+              }
+            } else {
+              params = {
+                ...values,
+                ossFileUrl: 'https:' + this.fileUrl,
+                fileType: 1,
+                title: this.oneList,
+                topic: values.topicAll
+              }
+            }
+            postAction('/ctop/edu/lesson/upload', params).then(res => {
+              if (res.success) {
+                this.loadingImage = false
+                this.closeImage()
+                getAction("/ctop/edu/system/lesson").then(res => {
+
+                })
+              }
+            })
+          }
+        })
+      },
+      closeImage() {
+        this.addImageVisible = false
+        this.form.resetFields()
+        this.fileUrl = ""
+        this.oneList = []
+      },
+      file(file) {
+        if (this.typeUpload == '1') {
+          this.dirVideo = 'online/' + this.getData('title') + '/' + this.getData('topic')
+        } else {
+          this.dirVideo = 'online/' + this.getData('titleAll') + '/' + this.getData('topicAll')
+        }
+        var that = this
+        return new Promise(function (resolve, reject) {
+
+          if (that.dirVideo.split('/').length == 3) {
+            resolve()
+          } else {
+            reject()
+          }
+
+        })
+      },
+      overUpload() {
+
+      },
       onLoadData(treeNode) {
         console.log(treeNode)
         return new Promise(resolve => {
@@ -337,7 +509,12 @@
 
 
                 } else {
-                  this.videoObject.video = textDes(res.result.fileUrl)
+                  if (res.result.fileUrl) {
+                    this.videoObject.video = textDes(res.result.fileUrl)
+                  } else {
+                    this.videoObject.video = textDes(res.result.ossFileUrl)
+                  }
+
                 }
                 console.log(this.videoObject.video)
 
@@ -394,6 +571,9 @@
         this.ipagination.current = page
         this.loadData()
       },
+      getData(className) {
+        return this.form.getFieldValue(className)
+      },
       getAdd(checked) {
         this.active = checked
         if (checked == 5) {
@@ -456,11 +636,14 @@
     },
     mounted() {
       this.$nextTick(() => {
-        this.videoObject.video = " CK:2OoC8kA6lhNFqCi2uVquDPpnuq9VcRji9nGXe5nqadA6Jey7YFFEP8pE99j58UBbLyb7YN7cpkw="
+        this.videoObject.video =
+          " CK:2OoC8kA6lhNFqCi2uVquDPpnuq9VcRji9nGXe5nqadA6Jey7YFFEP8pE99j58UBbLyb7YN7cpkw="
 
         let player = new ckplayer(this.videoObject)
 
+
       })
+
     },
     created() {
       // console.log(player)

+ 2 - 2
vue.config.js

@@ -66,11 +66,11 @@ module.exports = {
       '/jeecg-boot': {
         // target: 'http://39.97.120.42:8080', //请求本地 需要jeecg-boot后台项目  生产环境
         // target: 'http://39.106.184.70:8080', //请求本地 需要jeecg-boot后台项目
-        target: 'http://192.168.1.13:8080', //请求本地 需要jeecg-boot后台项目  蒙蒙
+        // target: 'http://192.168.1.13:8080', //请求本地 需要jeecg-boot后台项目  蒙蒙
         // target: 'http://192.168.1.90:8080', //请求本地 需要jeecg-boot后台项目  英豪
         // target: 'http://192.168.1.103:8080', //请求本地 需要jeecg-boot后台项目
         // target: 'http://192.168.2.115:8080', //请求本地 需要jeecg-boot后台项目  祚云
-        // target: 'http://192.168.1.127:8080', //请求本地 需要jeecg-boot后台项目  孙震
+        target: 'http://192.168.1.127:8080', //请求本地 需要jeecg-boot后台项目  孙震
         ws: false,
         changeOrigin: true
       },