Просмотр исходного кода

更新音频稿件相关页面和接口

reghao 2 лет назад
Родитель
Сommit
a8a94d8c72

+ 8 - 202
src/components/upload/EditAudio.vue

@@ -14,7 +14,7 @@
         <el-card class="box-card">
           <div slot="header" class="clearfix">
             <span>更新音频稿件信息</span>
-            <el-button style="float: right; padding: 3px 0" type="text" @click="onUpdateVideoInfo">更新</el-button>
+            <el-button style="float: right; padding: 3px 0" type="text" @click="onUpdateAudioPost">更新</el-button>
           </div>
           <div class="text item">
             <el-form ref="form" :model="form" label-width="80px">
@@ -28,32 +28,6 @@
           </div>
         </el-card>
       </el-col>
-      <el-col :md="12" style="padding-right: 5px; padding-left: 5px; padding-bottom: 5px">
-        <el-card class="box-card">
-          <div slot="header" class="clearfix">
-            <span>更新音频文件</span>
-            <el-button style="float: right; padding: 3px 0" type="text" @click="onUpdateVideoFile">更新</el-button>
-          </div>
-          <div class="text item">
-            <uploader
-              class="uploader-example"
-              :options="options"
-              :auto-start="true"
-              @file-added="onFileAdded"
-              @file-success="onFileSuccess"
-              @file-progress="onFileProgress"
-              @file-error="onFileError"
-            >
-              <uploader-unsupport />
-              <uploader-drop>
-                <p>拖动音频文件到此处或</p>
-                <uploader-btn :attrs="attrs">选择音频文件</uploader-btn>
-              </uploader-drop>
-              <uploader-list />
-            </uploader>
-          </div>
-        </el-card>
-      </el-col>
     </el-row>
   </el-row>
 </template>
@@ -65,159 +39,36 @@ export default {
   name: 'EditAudio',
   data() {
     return {
-      /***********************************************************************/
-      options: {
-        target: '//oss.reghao.cn/',
-        chunkSize: 1024 * 1024 * 1024, // 1GiB
-        fileParameterName: 'file',
-        testChunks: false,
-        query: (file, chunk) => {
-          return {
-            channelId: 2
-          }
-        },
-        headers: {
-          Authorization: '1234567890'
-        }
-      },
-      attrs: {
-        accept: 'audio/*'
-      },
-      imgHeaders: {
-        Authorization: '1234567890'
-      },
-      imgData: {
-        channelId: 3
-      },
-      /***********************************************************************/
-      coverUrl: null,
-      coverFile: null,
-      imageList: [],
-      imageUrl: '',
-      // 提交给后端的数据
-      tagsStr: null,
       form: {
-        videoFileId: null,
-        coverUrl: null,
         title: null,
         description: null,
-        categoryId: 0,
-        tags: [],
-        scope: null,
-        width: 0,
-        height: 0,
-        duration: 0
       },
-      videoInfo: null
     }
   },
   created() {
-    document.title = '编辑音频'
+    document.title = '编辑音频稿件'
 
     const audioId = this.$route.params.audioId
     getAudioPost(audioId).then(res => {
       if (res.code === 0) {
         const audioInfo = res.data
-        this.imageUrl = audioInfo.coverUrl
         this.form.title = audioInfo.title
         this.form.description = audioInfo.description
-        this.form.scope = audioInfo.scope
       } else {
       }
     })
   },
   methods: {
-    /***********************************************************************/
-    onFileAdded(file) {
-      if (file.file.size > 1024*1024*1024) {
-        file.cancel()
-        this.$notify(
-          {
-            title: '提示',
-            message: '音频文件应小于 1GiB',
-            type: 'warning',
-            duration: 3000
-          }
-        )
-        return
-      }
-      this.setTitle(file.file.name)
-      this.processVideo(file.file)
-    },
-    onFileProgress(rootFile, file, chunk) {
-    },
-    onFileSuccess(rootFile, file, response, chunk) {
-      const res = JSON.parse(response)
-      if (res.code === 0) {
-        const resData = res.data
-        this.form.audioFileId = resData.uploadId
-
-        this.$notify(
-          {
-            title: '提示',
-            message: '音频已上传',
-            type: 'warning',
-            duration: 3000
-          }
-        )
-      }
-    },
-    onFileError(rootFile, file, response, chunk) {
-      this.$notify(
-        {
-          title: '提示',
-          message: '文件上传错误',
-          type: 'warning',
-          duration: 3000
-        }
-      )
-    },
-    /***********************************************************************/
-    beforeAvatarUpload(file) {
-      const isJPG = file.type === 'image/jpeg'
-      const isLt2M = file.size / 1024 / 1024 < 2
-      if (!isJPG) {
-        this.$message.error('上传头像图片只能是 JPG 格式!')
-      }
-      if (!isLt2M) {
-        this.$message.error('上传头像图片大小不能超过 2MB!')
-      }
-      return isJPG && isLt2M
-    },
-    handleAvatarSuccess(res, file) {
-      this.imageList.push(file)
-      this.imageUrl = URL.createObjectURL(file.raw)
-      if (res.code === 0) {
-        const resData = res.data
-        const uploadId = resData.uploadId
-        const url = resData.url
-      } else {
-
-      }
-    },
-    setTitle(title) {
-      if (title.length > 50) {
-        this.form.title = title.substring(0, 50)
-        this.form.description = title
-      } else {
-        this.form.title = title
-      }
-    },
     onReturnAudio() {
       this.$router.push('/post/audio')
     },
-    onUpdateVideoFile() {
-      console.log('更新音频文件')
-    },
-    onUpdateVideoCover() {
-      console.log('更新音频封面')
+    onUpdateAudioPost() {
+      this.$notify({
+        message: '接口待实现',
+        type: 'info',
+        duration: 3000
+      })
     },
-    onUpdateVideoInfo() {
-      console.log('更新音频信息')
-    },
-    onUpdateVideoScope() {
-      console.log('更新音频作用域')
-    }
   }
 }
 </script>
@@ -230,10 +81,6 @@ export default {
     padding-left: 0.5%;
     padding-right: 0.5%;
   }
-
-  .coverImg {
-    height: 120px !important;
-  }
 }
 
 .movie-list {
@@ -241,45 +88,4 @@ export default {
   padding-left: 6%;
   padding-right: 6%;
 }
-
-.uploader-example {
-  width: 500px;
-  padding: 15px;
-  margin: 40px auto 0;
-  font-size: 12px;
-  box-shadow: 0 0 10px rgba(0, 0, 0, .4);
-}
-.uploader-example .uploader-btn {
-  margin-right: 4px;
-}
-.uploader-example .uploader-list {
-  max-height: 440px;
-  overflow: auto;
-  overflow-x: hidden;
-  overflow-y: auto;
-}
-
-.avatar-uploader .el-upload {
-  border: 1px dashed #d9d9d9;
-  border-radius: 6px;
-  cursor: pointer;
-  position: relative;
-  overflow: hidden;
-}
-.avatar-uploader .el-upload:hover {
-  border-color: #409EFF;
-}
-.avatar-uploader-icon {
-  font-size: 28px;
-  color: #8c939d;
-  width: 320px;
-  height: 240px;
-  line-height: 178px;
-  text-align: center;
-}
-.avatar {
-  width: 320px;
-  height: 240px;
-  display: block;
-}
 </style>

+ 1 - 1
src/components/upload/EditImage.vue

@@ -107,7 +107,7 @@ export default {
     }
   },
   created() {
-    document.title = '编辑相册'
+    document.title = '编辑相册稿件'
 
     const albumId = this.$route.params.albumId
     getAlbumImage(albumId).then(res => {

+ 1 - 1
src/components/upload/EditVideo.vue

@@ -141,7 +141,7 @@ export default {
     }
   },
   created() {
-    document.title = '编辑视频'
+    document.title = '编辑视频稿件'
 
     const videoId = this.$route.params.videoId
     getUserVideoPost(videoId).then(res => {

+ 0 - 2
src/components/upload/PublishAudio.vue

@@ -26,8 +26,6 @@
           </div>
         </el-card>
       </el-col>
-    </el-row>
-    <el-row style="padding-right: 5px; padding-left: 5px; padding-bottom: 5px">
       <el-col :md="12" style="padding-right: 5px; padding-left: 5px; padding-bottom: 5px">
         <el-card class="box-card">
           <div slot="header" class="clearfix">

+ 12 - 11
src/views/home/AudioPage.vue

@@ -90,14 +90,14 @@ export default {
 
         SocketInstance.connect()
         document.title = '音频 - ' + this.audioInfo.title
+
+        getUserInfo(this.audioInfo.publishBy).then(resp => {
+          if (resp.code === 0) {
+            this.user = resp.data
+          }
+        })
       } else {
       }
-
-      getUserInfo(10001).then(resp => {
-        if (resp.code === 0) {
-          this.user = resp.data
-        }
-      })
     })
   },
   methods: {
@@ -105,7 +105,7 @@ export default {
     handleBeforePlay(next) {
       // 这里可以做一些事情...
       //this.audioList[this.$refs.audioPlayer.currentPlayIndex].name
-      this.$refs.audioPlayer.$refs.audio.currentTime = 20
+      this.$refs.audioPlayer.$refs.audio.currentTime = this.audioInfo.currentTime
       // 开始播放
       next()
     },
@@ -125,21 +125,22 @@ export default {
       SocketInstance.send(jsonData)
     },
     onProgressMove(event) {
-      console.log(event)
     },
     onEnd(event) {
-      console.log('播放完成')
     },
     collectItem() {
       if (this.collected) {
-        console.log('取消收藏音频')
         this.collected = false
         this.collectedIcon = 'el-icon-star-off'
       } else {
-        console.log('收藏音频')
         this.collected = true
         this.collectedIcon = 'el-icon-star-on'
       }
+      this.$notify({
+        message: '接口未实现',
+        type: 'info',
+        duration: 3000
+      })
     }
   }
 }

+ 8 - 0
src/views/post/AudioPost.vue

@@ -21,6 +21,14 @@
             </router-link>
           </template>
         </el-table-column>
+        <el-table-column
+          prop="duration"
+          label="时长">
+        </el-table-column>
+        <el-table-column
+          prop="codec"
+          label="编码">
+        </el-table-column>
         <el-table-column
           prop="scope"
           label="可见范围">