Przeglądaj źródła

提交代码,oss上传应用

zhuxinbo 5 lat temu
rodzic
commit
b7bb9305de

+ 107 - 107
src/api/actor.js

@@ -1,108 +1,108 @@
-
-import {axios} from '@/utils/request'
-
-export function actorList(parameter) {
-    return axios({
-      url: "/ctop/actor/list",
-      method: 'get',
-      params: parameter
-    })
-}
-export function actorPhotoList(parameter) {
-    return axios({
-      url: "/ctop/actor/photo/list",
-      method: 'get',
-      params: parameter
-    })
-}
-
-export function actorPhotoDelete(parameter) {
-    return axios({
-      url: "/ctop/actor/photo/delete",
-      method: 'delete',
-      params: parameter
-    })
-}
-
-export function actorPhotoAdd(parameter) {
-    return axios({
-      url: "/ctop/actor/photo/add",
-      method: 'post',
-      params: parameter
-    })
-}
-
-export function actorVideoDelete(parameter) {
-    return axios({
-      url: "/ctop/actor/video/delete",
-      method: 'delete',
-      params: parameter
-    })
-}
-
-export function actorVideoAdd(parameter) {
-    return axios({
-      url: "/ctop/actor/video/add",
-      method: 'post',
-      params: parameter
-    })
-}
-
-export function actorDetail(parameter) {
-    return axios({
-        url: "/ctop/actor/detail",
-        method: 'get',
-        params: parameter
-    })
-}
-
-
-export function actorCommentList(parameter) {
-    return axios({
-        url: "/ctop/actor/comment/list",
-        method: 'get',
-        params: parameter
-    })
-}
-
-export function actorCommentAdd(parameter) {
-    return axios({
-        url: "/ctop/actor/comment/add",
-        method: 'post',
-        params: parameter
-    })
-}
-
-export function actorCommentDetele(parameter) {
-    return axios({
-        url: "/ctop/actor/comment/delete",
-        method: 'delete',
-        params: parameter
-    })
-}
-
-
-export function actorVideoList(parameter) {
-    return axios({
-        url: "/ctop/actor/video/list",
-        method: 'get',
-        params: parameter
-    })
-}
-
-
-export function fileCheck(parameter) {
-    return axios({
-        url: "/file/check",
-        method: 'get',
-        params: parameter
-    })
-}
-
-export function fileInsert(parameter) {
-    return axios({
-        url: "/file/insert",
-        method: 'post',
-        params: parameter
-    })
+
+import {axios} from '@/utils/request'
+
+export function actorList(parameter) {
+    return axios({
+      url: "/ctop/actor/list",
+      method: 'get',
+      params: parameter
+    })
+}
+export function actorPhotoList(parameter) {
+    return axios({
+      url: "/ctop/actor/photo/list",
+      method: 'get',
+      params: parameter
+    })
+}
+
+export function actorPhotoDelete(parameter) {
+    return axios({
+      url: "/ctop/actor/photo/delete",
+      method: 'delete',
+      params: parameter
+    })
+}
+
+export function actorPhotoAdd(parameter) {
+    return axios({
+      url: "/ctop/actor/photo/add",
+      method: 'post',
+      params: parameter
+    })
+}
+
+export function actorVideoDelete(parameter) {
+    return axios({
+      url: "/ctop/actor/video/delete",
+      method: 'delete',
+      params: parameter
+    })
+}
+
+export function actorVideoAdd(parameter) {
+    return axios({
+      url: "/ctop/actor/video/add",
+      method: 'post',
+      params: parameter
+    })
+}
+
+export function actorDetail(parameter) {
+    return axios({
+        url: "/ctop/actor/detail",
+        method: 'get',
+        params: parameter
+    })
+}
+
+
+export function actorCommentList(parameter) {
+    return axios({
+        url: "/ctop/actor/comment/list",
+        method: 'get',
+        params: parameter
+    })
+}
+
+export function actorCommentAdd(parameter) {
+    return axios({
+        url: "/ctop/actor/comment/add",
+        method: 'post',
+        params: parameter
+    })
+}
+
+export function actorCommentDetele(parameter) {
+    return axios({
+        url: "/ctop/actor/comment/delete",
+        method: 'delete',
+        params: parameter
+    })
+}
+
+
+export function actorVideoList(parameter) {
+    return axios({
+        url: "/ctop/actor/video/list",
+        method: 'get',
+        params: parameter
+    })
+}
+
+
+export function fileCheck(parameter) {
+    return axios({
+        url: "/file/check",
+        method: 'get',
+        params: parameter
+    })
+}
+
+export function fileInsert(parameter) {
+    return axios({
+        url: "/file/insert",
+        method: 'post',
+        params: parameter
+    })
 }

+ 1 - 1
src/views/modules/Statistics/dataDisplayStatistics.vue

@@ -223,8 +223,8 @@
             <a-select
               style="width: 120px"
               v-model="statHour"
-              placeholder="请选择账户"
               @change="getElseData"
+              allowClear
             >
               <a-select-option v-for="item of 24" :key="item-1" :value="item-1">{{item-1}}</a-select-option>
             </a-select>

Plik diff jest za duży
+ 1420 - 1341
src/views/modules/kuaishouapp/creativeCreate.vue


+ 184 - 123
src/views/modules/kuaishouapp/uploadVideo.vue

@@ -1,9 +1,6 @@
 <template>
   <a-card :bordered="false">
-
-
     <a-form @submit="handleSubmit" :form="form">
-
       <!--<a-form-item
         label="视频标识"
         :labelCol="{lg: {span: 7}, sm: {span: 7}}"
@@ -11,11 +8,11 @@
         <a-input v-model="videoName" placeholder="(必填) 区分视频的标识"></a-input>
       </a-form-item>-->
 
-
       <a-form-item
         label="选择快手账户"
         :labelCol="{lg: {span: 7}, sm: {span: 7}}"
-        :wrapperCol="{lg: {span: 10}, sm: {span: 17} }">
+        :wrapperCol="{lg: {span: 10}, sm: {span: 17} }"
+      >
         <a-select
           v-model="accountId"
           showSearch
@@ -24,93 +21,107 @@
           placeholder="选择需创建的快手账户"
           optionFilterProp="children"
           style="width: 500px"
-          :filterOption="filterOption"
+          :filterOption="true"
         >
-          <a-select-option v-for="userAccount in accountList" :key="userAccount.accountId"
-                           :value="userAccount.accountId">{{userAccount.authName}}
-          </a-select-option>
+          <a-select-option
+            v-for="userAccount in accountList"
+            :key="userAccount.accountId"
+            :value="userAccount.accountId"
+          >{{userAccount.authName}}</a-select-option>
         </a-select>
       </a-form-item>
 
-
       <a-form-item
         label="素材投放位置"
         :labelCol="{lg: {span: 7}, sm: {span: 7}}"
-        :wrapperCol="{lg: {span: 8}, sm: {span: 8} }">
+        :wrapperCol="{lg: {span: 8}, sm: {span: 8} }"
+      >
         <a-radio-group buttonStyle="solid" v-model="positionType">
           <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="{lg: {span: 7}, sm: {span: 7}}"
-        :wrapperCol="{lg: {span: 8}, sm: {span: 8} }">
+        :wrapperCol="{lg: {span: 8}, sm: {span: 8} }"
+      >
         <a-radio-group buttonStyle="solid" v-model="materialType">
           <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="{lg: {span: 7}, sm: {span: 7}}"
-        :wrapperCol="{lg: {span: 12}, sm: {span: 12} }">
-        <upload-to-ali v-model="localUrl"
-                       :customDomain="customDomain"
-                       multiple
-                       preview
-                       :region="region"
-                       :bucket="bucket"
-                       :accept="acceptVideo"
-                       :max="5"
-                       :size="1024000"
-                       :accessKeyId="accessKeyId"
-                       :accessKeySecret="accessKeySecret"></upload-to-ali>
+        :wrapperCol="{lg: {span: 12}, sm: {span: 12} }"
+      >
+        <upload-to-ali
+          v-model="localUrl"
+          :customDomain="customDomain"
+          multiple
+          preview
+          :region="region"
+          :bucket="bucket"
+          :accept="acceptVideo"
+          :max="5"
+          :size="1024000"
+          :accessKeyId="accessKeyId"
+          :accessKeySecret="accessKeySecret"
+          :before-upload="file"
+          :dir="dirVideo"
+          @loaded="overUpload"
+        ></upload-to-ali>
       </a-form-item>
 
-
-      <a-form-item class="pic_upload_content"
-                   label="封面图素材上传"
-                   :labelCol="{lg: {span: 7}, sm: {span: 7}}"
-                   :wrapperCol="{lg: {span: 12}, sm: {span: 12} }">
-        <upload-to-ali v-model="localImageUrl"
-                       :customDomain="customDomain"
-                       multiple
-                       preview
-                       :region="region"
-                       :bucket="bucket"
-                       :accept="acceptImage"
-                       :max="25"
-                       :size="1024000"
-                       :accessKeyId="accessKeyId"
-                       :accessKeySecret="accessKeySecret"></upload-to-ali>
+      <a-form-item
+        class="pic_upload_content"
+        label="封面图素材上传"
+        :labelCol="{lg: {span: 7}, sm: {span: 7}}"
+        :wrapperCol="{lg: {span: 12}, sm: {span: 12} }"
+      >
+        <upload-to-ali
+          v-model="localImageUrl"
+          :customDomain="customDomain"
+          multiple
+          preview
+          :region="region"
+          :bucket="bucket"
+          :accept="acceptImage"
+          :max="25"
+          :size="1024000"
+          :accessKeyId="accessKeyId"
+          :accessKeySecret="accessKeySecret"
+          :before-upload="file"
+          :dir="dirImg"
+          @loaded="overUpload"
+        ></upload-to-ali>
       </a-form-item>
 
-
       <a-form-item
         label="描述"
         :labelCol="{lg: {span: 7}, sm: {span: 7}}"
-        :wrapperCol="{lg: {span: 8}, sm: {span: 8} }">
-        <a-textarea
-          v-model="videoDesc" placeholder="(必填) 说点什么..." :rows="4"/>
+        :wrapperCol="{lg: {span: 8}, sm: {span: 8} }"
+      >
+        <a-textarea v-model="videoDesc" placeholder="(必填) 说点什么..." :rows="4" />
       </a-form-item>
 
       <!-- v-decorator="[
        'confirm_videoDesc',
        {rules: [{ required: true, message: 'error:' },
        {validator: handleConfirmValue}]}
-       ]"-->
+      ]"-->
       <a-form-item
         label="格式"
         :labelCol="{lg: {span: 7}, sm: {span: 7}}"
-        :wrapperCol="{lg: {span: 8}, sm: {span: 2} }">
+        :wrapperCol="{lg: {span: 8}, sm: {span: 2} }"
+      >
         <span>视频上传需满足以下条件</span>
         <ul siz>
-          <li>视频格式为MPEG-4/H.264/HEVC编码的MP4,
+          <li>
+            视频格式为MPEG-4/H.264/HEVC编码的MP4,
             其中,分辨率不小于720p、码率不小于3000kbps以及帧率不小于20fps
           </li>
           <li>音频编码为AAC并且码率不小于64kbps</li>
@@ -118,103 +129,153 @@
         </ul>
       </a-form-item>
 
-
-      <a-form-item :wrapperCol="{ span: 24 }"
-                   style="text-align: center">
+      <a-form-item :wrapperCol="{ span: 24 }" style="text-align: center">
         <a-button htmlType="submit" type="primary">提交</a-button>
         <a-button style="margin-left: 8px">保存</a-button>
       </a-form-item>
-
-
     </a-form>
   </a-card>
 </template>
 
 <script>
-  import UploadToAli from '@femessage/upload-to-ali';
-  import {postAction, getAction} from '@/api/manage';
-  import {mapActions, mapGetters} from 'vuex'
+import UploadToAli from '@femessage/upload-to-ali'
+import { postAction, getAction } from '@/api/manage'
+import { fileCheck, fileInsert } from '@/api/actor'
+import BMF from 'browser-md5-file'
+import { mapActions, mapGetters } from 'vuex'
 
-  export default {
-    name: 'BaseForm',
-    components: {
-      UploadToAli
-    },
-    data() {
-      return {
-        accountId: '',
-        accountList: {},
-        localUrl: '',
-        localImageUrl: '',
-        positionType: '1',
-        materialType: '1',
-        videoDesc: '',
-        customDomain: '',
-        acceptVideo: 'video/mpeg,video/mp4',
-        acceptImage: 'image/jpeg,jpg,image/png',
-        accessKeyId: 'LTAIbNbqWzSOklQV',
-        accessKeySecret: '1rkPz7JNoXk8sJevPaeYHWqfkQXBGh',
-        region: 'oss-cn-beijing',
-        bucket: 'ctop-media',
-        form: this.$form.createForm(this),
-        url: {
-          addUrl: '/kuaishou/kuaiShouVideo/insert',
-          userAllocationList: '/ctop/userAllocation/list',
-        }
+export default {
+  name: 'BaseForm',
+  components: {
+    UploadToAli
+  },
+  data() {
+    return {
+      accountId: '',
+      accountList: {},
+      localUrl: [],
+      localImageUrl: [],
+      positionType: '1',
+      materialType: '1',
+      videoDesc: '',
+      customDomain: '',
+      acceptVideo: 'video/mpeg,video/mp4',
+      acceptImage: 'image/jpeg,jpg,image/png',
+      accessKeyId: 'LTAIbNbqWzSOklQV',
+      accessKeySecret: '1rkPz7JNoXk8sJevPaeYHWqfkQXBGh',
+      region: 'oss-cn-beijing',
+      bucket: 'ctop-media',
+      form: this.$form.createForm(this),
+      url: {
+        addUrl: '/kuaishou/kuaiShouVideo/insert',
+        userAllocationList: '/ctop/userAllocation/list'
       }
-    },
+    }
+  },
 
-    methods: {
-      ...mapGetters(["nickname", "avatar", "userInfo"]),
-      /*handleConfirmValue(rule, value, callback) {
+  methods: {
+    ...mapGetters(['nickname', 'avatar', 'userInfo']),
+    /*handleConfirmValue(rule, value, callback) {
         value = this.videoDesc;
         if (value == '') {
           callback('请输入视频描述')
         }
         callback()
       },*/
-      handleSubmit(e) {
-        console.log(this.localUrl);
-        console.log(this.videoDesc);
-        e.preventDefault()
-        this.form.validateFields((err, values) => {
-          if (!err) {
-            console.log('Received values of form: ', values);
-            let params = {};
-            params.accountId = this.accountId;
-            params.localUrl = this.localUrl;
-            params.positionType = this.positionType;
-            params.materialType = this.materialType;
-            params.videoDesc = this.videoDesc;
-            params.localImageUrl = this.localImageUrl;
-            params.loginId = this.userInfo().id;
-            console.log(params)
-            postAction(this.url.addUrl, params).then((res) => {
-              console.log(res)
-              if (res.success) {
-                alert("视频批量上传成功");
+    handleSubmit(e) {
+      console.log(this.localUrl)
+      console.log(this.videoDesc)
+      e.preventDefault()
+      this.form.validateFields((err, values) => {
+        if (!err) {
+          console.log('Received values of form: ', values)
+          let params = {}
+          params.accountId = this.accountId
+          params.localUrl = this.localUrl
+          params.positionType = this.positionType
+          params.materialType = this.materialType
+          params.videoDesc = this.videoDesc
+          params.localImageUrl = this.localImageUrl
+          params.loginId = this.userInfo().id
+          console.log(params)
+          postAction(this.url.addUrl, params).then(res => {
+            console.log(res)
+            if (res.success) {
+              alert('视频批量上传成功')
+            }
+          })
+        }
+      })
+    },
+    file(file) {
+      console.log(file)
+      var bmf = new BMF()
+      var that = this
+      return new Promise(function(resolve, reject) {
+        bmf.md5(file[0], (err, md5) => {
+          console.log(md5, 123123123)
+          that.md5 = md5
+          fileCheck({ code: md5 }).then(res => {
+            console.log(res)
+            if (res.code == 0) {
+              if (file[0].type == 'image/jpeg' || file[0].type == 'jpg' || file[0].type == 'image/png') {
+                that.localImageUrl.push(res.url)
+              } else {
+                that.localUrl.push(res.url)
               }
-            });
-          }
+              reject()
+            } else {
+              resolve()
+            }
+          })
         })
-      },
+      })
     },
-    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
-        }
-      });
+    overUpload(url) {
+      // console.log(url,this.md5)
+      fileInsert({ code: this.md5, url: url[0] }).then(res => {
+        console.log(res)
+      })
+    }
+  },
+  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
+      }
+    })
+  },
+  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 + '/'
     }
   }
+}
 </script>
 
 <style lang="scss">
-  .pic_upload_content .draggable-list {
-    display: block;
-  }
+.pic_upload_content .draggable-list {
+  display: block;
+}
 </style>

+ 400 - 0
src/views/modules/material/materialList.vue

@@ -0,0 +1,400 @@
+<style>
+.ping .ant-modal-content .ant-modal-footer {
+  display: none !important;
+}
+.ant-modal-body {
+  padding-top: 0px;
+}
+li {
+  list-style-type: none;
+}
+</style>
+<style lang="scss" scoped>
+.actor-photo-list {
+  display: flex;
+  padding-left: 0;
+  li {
+    width: 25%;
+    margin: 10px;
+    position: relative;
+    height: 250px;
+    border: 1px solid #f2f2f2;
+    img,
+    video {
+      width: 100%;
+      margin-top: auto;
+      margin-bottom: auto;
+      top: 0;
+      bottom: 0;
+      position: absolute;
+      max-height: 250px;
+    }
+  }
+}
+</style>
+<template>
+  <a-card :bordered="false">
+    <!-- 查询区域 -->
+    <div class="table-page-search-wrapper">
+      <a-form layout="inline">
+        <a-row :gutter="24">
+          <a-col :md="6" :sm="8">
+            <a-form-item label="素材名称">
+              <a-input placeholder="请输入素材名称" v-model="queryParam.buildingName"></a-input>
+            </a-form-item>
+          </a-col>
+
+          <a-col :md="6" :sm="8">
+            <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
+              <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
+              <a-button
+                type="primary"
+                @click="searchReset"
+                icon="reload"
+                style="margin-left: 8px"
+              >重置</a-button>
+            </span>
+          </a-col>
+        </a-row>
+      </a-form>
+    </div>
+
+    <!-- 操作按钮区域 -->
+    <!-- <div class="table-operator">
+      <a-button @click="handleAdd" v-show="show" type="primary" icon="plus">新增</a-button>
+    </div>-->
+
+    <!-- table区域-begin -->
+    <div>
+      <a-table
+        ref="table"
+        size="middle"
+        bordered
+        rowKey="id"
+        :columns="columns"
+        :dataSource="dataSource"
+        :pagination="ipagination"
+        :loading="loading"
+      >
+        <!-- 字符串超长截取省略号显示-->
+        <span slot="esContent" slot-scope="text">
+          <j-ellipsis :value="text" :length="10" />
+        </span>
+        <span slot="url" slot-scope="url">
+          <img :src="url" alt  style="height:150px"/>
+        </span>
+        <span slot="action">
+          <!-- <a href="javascript:;" @click="handleDetail(record)">详情</a>
+          <a-divider type="vertical" />
+          <a-dropdown>
+            <a class="ant-dropdown-link">
+              更多
+              <a-icon type="down" />
+            </a>
+            <a-menu slot="overlay">
+              <a-menu-item v-show="show">
+                <a @click="handleEdit(record)">编辑</a>
+              </a-menu-item>
+            </a-menu>
+          </a-dropdown>
+          <a-divider type="vertical" />
+          <a href="javascript:;" @click="showDetail(record)">场地信息</a>-->
+        </span>
+      </a-table>
+    </div>
+    <!-- table区域-end -->
+
+    <!-- 表单区域 -->
+    <a-modal title="详情" v-model="detail" class="ping" :width="800">
+      <a-tabs defaultActiveKey="1" @change="callback" v-model="indexDetail">
+        <a-tab-pane tab="场地图集" key="1" forceRender>
+          <div>
+            <a type="primary" style="margin-left:10px" @click="addPhoto=true">新增场地图片</a>
+            <ul class="actor-photo-list">
+              <li v-for="(item,index) of photoList" :key="index">
+                <a-icon
+                  type="close-circle"
+                  style="position:absolute;top:-5px;right:-5px;color:red;z-index:10;cursor: pointer;"
+                  @click="deteleImg(item.id)"
+                />
+                <img :src="item.photoUrl" alt />
+              </li>
+            </ul>
+          </div>
+          <div style="text-align:right">
+            <a-pagination
+              showQuickJumper
+              :total="total"
+              @change="pageChange"
+              :pageSize.sync="pageSize"
+            />
+          </div>
+        </a-tab-pane>
+        <a-tab-pane tab="场地视频" key="2">
+          <div>
+            <a type="primary" style="margin-left:10px" @click="addVideo=true">新增场地视频</a>
+            <ul class="actor-photo-list">
+              <li v-for="(item,index) of videoList" :key="index">
+                <a-icon
+                  type="close-circle"
+                  style="position:absolute;top:-5px;right:-5px;color:red;z-index:10;cursor: pointer;"
+                  @click="deteleVideo(item.id)"
+                />
+                <video
+                  class="video"
+                  :src="item.videoUrl"
+                  controls="controls"
+                  style="min-height:160px"
+                >您的浏览器不支持 video 标签。</video>
+              </li>
+            </ul>
+          </div>
+          <div style="text-align:right">
+            <a-pagination
+              showQuickJumper
+              :total="videoTotal"
+              @change="pageChange"
+              :pageSize.sync="pageSize"
+            />
+          </div>
+        </a-tab-pane>
+      </a-tabs>
+    </a-modal>
+
+    <!-- 新增图集 -->
+    <a-modal
+      v-model="addPhoto"
+      title="新增图集"
+      @ok="handleOk('photo')"
+      @cancel="handleCancel('photo')"
+    >
+      <upload-to-ali
+        style="margin:10px"
+        v-model="imageUrl"
+        :customDomain="customDomain"
+        preview
+        :region="region"
+        :bucket="bucket"
+        :accept="acceptImage"
+        :max="1"
+        :size="1024000"
+        :accessKeyId="accessKeyId"
+        :accessKeySecret="accessKeySecret"
+      ></upload-to-ali>
+    </a-modal>
+    <!-- 新增作品 -->
+    <a-modal
+      v-model="addVideo"
+      title="新增作品"
+      @ok="handleOk('video')"
+      @cancel="handleCancel('video')"
+    >
+      <upload-to-ali
+        style="margin:10px"
+        v-model="videoUrl"
+        :customDomain="customDomain"
+        preview
+        :region="region"
+        :bucket="bucket"
+        :accept="acceptVideo"
+        :max="1"
+        :size="1024000"
+        :accessKeyId="accessKeyId"
+        :accessKeySecret="accessKeySecret"
+      ></upload-to-ali>
+    </a-modal>
+  </a-card>
+</template>
+
+<script>
+import { JeecgListMixin } from '@/mixins/JeecgListMixin'
+import JEllipsis from '@/components/jeecg/JEllipsis'
+import UploadToAli from '@femessage/upload-to-ali'
+import { yardPhotoList, yardVideoList, yardPhotoDelete, yardVideoDelete, yardPhotoAdd, yardVideoAdd } from '@/api/yard'
+export default {
+  name: 'YardList',
+  mixins: [JeecgListMixin],
+  components: {
+    JEllipsis,
+    UploadToAli
+  },
+  data() {
+    return {
+      queryParam: {},
+      description: '场地管理',
+      // 新增修改按钮是否显示
+      show: true,
+      // 表头
+      columns: [
+        // {
+        //   title: '素材名称',
+        //   align: 'center',
+        //   dataIndex: ''
+        // },
+        {
+          title: '素材展示',
+          align: 'center',
+          dataIndex: 'url',
+          scopedSlots: { customRender: 'url' }
+        },
+        // {
+        //   title: '素材上传人',
+        //   align: 'center',
+        //   dataIndex: ''
+        // },
+        // {
+        //   title: '素材审核',
+        //   align: 'center',
+        //   dataIndex: ''
+        // },
+        {
+          title: '创建时间',
+          align: 'center',
+          dataIndex: 'createTime'
+        },
+        // {
+        //   title: '投放',
+        //   align: 'center',
+        //   dataIndex: ''
+        // },
+        // {
+        //   title: '操作',
+        //   dataIndex: 'action',
+        //   align: 'center',
+        //   scopedSlots: { customRender: 'action' }
+        // }
+      ],
+      url: {
+        list: '/ctop/materialInfo/list'
+      },
+      detail: false,
+      indexDetail: '1',
+      currentPage: 0,
+      pageSize: 4,
+      videoTotal: 0,
+      photoTotal: 0,
+      total: 0,
+      videoList: [],
+      photoList: [],
+      imageUrl: '',
+      videoUrl: '',
+      customDomain: '',
+      region: 'oss-cn-beijing',
+      bucket: 'ctop-media',
+      acceptVideo: 'video/mpeg,video/mp4',
+      acceptImage: 'image/jpeg,image/jpg,image/png',
+      accessKeyId: 'LTAIbNbqWzSOklQV',
+      accessKeySecret: '1rkPz7JNoXk8sJevPaeYHWqfkQXBGh',
+      addPhoto: false,
+      addVideo: false,
+      confirmLoading: true
+    }
+  },
+
+  methods: {
+    showDetail(item) {
+      console.log(item)
+      this.detail = true
+      this.id = item.id
+      this.getPhoto()
+    },
+    callback(key) {
+      console.log(key)
+      if (key == '1') {
+        this.currentPage = 1
+        this.getPhoto()
+      } else if (key == '2') {
+        this.currentPage = 1
+        this.getVideo()
+      }
+    },
+    pageChange: function(page) {
+      console.log(page)
+      this.currentPage = page
+      if (this.indexDetail == '1') {
+        this.getPhoto()
+      } else if (this.indexDetail == '2') {
+        this.getVideo()
+      }
+    },
+    getPhoto() {
+      yardPhotoList({ pageNo: this.currentPage, pageSize: 4, yardId: this.id }).then(res => {
+        if (res.code == 0) {
+          console.log(res)
+          this.photoList = res.result.records
+          this.total = res.result.total
+        }
+      })
+    },
+    getVideo() {
+      yardVideoList({ pageNo: this.currentPage, pageSize: 4, yardId: this.id }).then(res => {
+        if (res.code == 0) {
+          console.log(res)
+          this.videoList = res.result.records
+          this.videoTotal = res.result.total
+        }
+      })
+    },
+    handleOk(type) {
+      const that = this
+      if (type == 'photo') {
+        yardPhotoAdd({ yardId: that.id, photoUrl: that.imageUrl })
+          .then(res => {
+            if (res.success) {
+              this.getPhoto()
+              this.handleCancel('photo')
+            } else {
+              that.$message.warning(res.message)
+            }
+          })
+          .finally(() => {
+            that.confirmLoading = false
+            that.handleCancel('photo')
+          })
+      } else {
+        yardVideoAdd({ yardId: that.id, videoUrl: that.videoUrl })
+          .then(res => {
+            if (res.success) {
+              this.getVideo()
+              this.handleCancel('video')
+            } else {
+              that.$message.warning(res.message)
+            }
+          })
+          .finally(() => {
+            that.confirmLoading = false
+            that.handleCancel('video')
+          })
+      }
+    },
+    handleCancel(type) {
+      if (type == 'photo') {
+        this.imageUrl = ''
+        this.addPhoto = false
+      } else {
+        this.videoUrl = ''
+        this.addVideo = false
+      }
+    },
+    deteleImg(id) {
+      yardPhotoDelete({ id: id }).then(res => {
+        if (res.code == 200) {
+          console.log(res)
+          this.getPhoto()
+        }
+      })
+    },
+    deteleVideo(id) {
+      yardVideoDelete({ id: id }).then(res => {
+        if (res.code == 200) {
+          console.log(res)
+          this.getVideo()
+        }
+      })
+    }
+  }
+}
+</script>
+<style  scoped>
+@import '~@assets/less/common.less';
+</style>

+ 3 - 1
src/views/modules/test/Test.vue

@@ -12,6 +12,7 @@
       :accessKeyId="OSS_ACCESSKEYID()"
       :accessKeySecret="OSS_ACCESSKEYSECRET()"
       :before-upload="file"
+      :dir="dir"
       @loaded="overUpload"
     ></upload-to-ali>
   </div>
@@ -28,6 +29,7 @@ export default {
       accessKeySecret: '1rkPz7JNoXk8sJevPaeYHWqfkQXBGh',
       bucket: 'ctop-media',
       region: 'oss-cn-beijing',
+      dir:"img/2019-10-30/",
       md5: ''
     }
   },
@@ -73,7 +75,7 @@ export default {
       })
     },
     overUpload(url) {
-      // console.log(url,this.md5)
+      console.log(url,this.md5)
       fileInsert({ code: this.md5, url: url[0] }).then(res => {
         console.log(res)
       })