Pārlūkot izejas kodu

从后端获取上传视频文件和视频封面所需的 serverInfo

reghao 1 gadu atpakaļ
vecāks
revīzija
39662fab42
1 mainītis faili ar 7 papildinājumiem un 39 dzēšanām
  1. 7 39
      src/components/upload/PublishVideo.vue

+ 7 - 39
src/components/upload/PublishVideo.vue

@@ -135,7 +135,7 @@ export default {
         Authorization: ''
       },
       imgData: {
-        channelId: process.env.VUE_APP_UPLOAD_COVER_CHANNEL
+        channelId: null
       },
       coverUrl: null,
       // ****************************************************************************************************************
@@ -152,9 +152,9 @@ export default {
       ],
       form: {
         videoFileId: null,
-        channelId: process.env.VUE_APP_UPLOAD_VIDEO_CHANNEL,
+        channelId: 0,
         coverFileId: null,
-        coverChannelId: process.env.VUE_APP_UPLOAD_COVER_CHANNEL,
+        coverChannelId: 0,
         title: null,
         description: null,
         categoryPid: null,
@@ -169,6 +169,7 @@ export default {
     getVideoChannelInfo().then(res => {
       if (res.code === 0) {
         const resData = res.data
+        this.form.channelId = resData.channelId
         this.options = {
           target: resData.ossUrl,
           chunkSize: resData.maxSize,
@@ -176,7 +177,7 @@ export default {
           testChunks: false,
           query: (file, chunk) => {
             return {
-              channelId: this.form.channelId
+              channelId: resData.channelId
             }
           },
           headers: {
@@ -201,44 +202,11 @@ export default {
       })
     })
 
-    /* getServerInfo(this.form.channelId).then(res => {
-      if (res.code === 0) {
-        const resData = res.data
-        this.options = {
-          target: resData.ossUrl,
-          chunkSize: resData.maxSize,
-          fileParameterName: 'file',
-          testChunks: false,
-          query: (file, chunk) => {
-            return {
-              channelId: this.form.channelId
-            }
-          },
-          headers: {
-            Authorization: 'Bearer ' + resData.token
-          },
-          withCredentials: false
-        }
-      } else {
-        this.$notify({
-          title: '提示',
-          message: '获取 OSS 服务器地址失败, 暂时无法上传视频文件',
-          type: 'error',
-          duration: 3000
-        })
-      }
-    }).catch(error => {
-      this.$notify({
-        title: '提示',
-        message: '获取 OSS 服务器地址失败, 暂时无法上传视频文件',
-        type: 'warning',
-        duration: 3000
-      })
-    })*/
-
     getVideoCoverChannelInfo().then(res => {
       if (res.code === 0) {
         const resData = res.data
+        this.form.coverChannelId = resData.channelId
+        this.imgData.channelId = resData.channelId
         this.imgOssUrl = resData.ossUrl
         this.imgHeaders.Authorization = 'Bearer ' + resData.token
       } else {