Przeglądaj źródła

更新 VideoPost 发布页面

reghao 1 rok temu
rodzic
commit
b017e2557d
2 zmienionych plików z 49 dodań i 50 usunięć
  1. 31 4
      src/views/post/VideoPost.vue
  2. 18 46
      src/views/post/VideoPostPublish.vue

+ 31 - 4
src/views/post/VideoPost.vue

@@ -197,10 +197,9 @@
       width="70%"
       center
     >
-      <video-post-publish />
+      <video-post-publish @video-publish="onVideoPublish" />
       <span slot="footer" class="dialog-footer">
-        <el-button @click="publishVideoDiaglog = false">取 消</el-button>
-        <el-button type="primary" @click="publishVideoDiaglog = false">关 闭</el-button>
+        <el-button type="text" @click="publishVideoDiaglog = false">取 消</el-button>
       </span>
     </el-dialog>
     <!-- 修改视频可见范围对话框 -->
@@ -244,7 +243,7 @@
 <script>
 import VideoPreviewPlayer from 'components/VideoPreviewPlayer'
 import VideoPostPublish from '@/views/post/VideoPostPublish'
-import { updateVideoScope, videoInfo, deleteVideoPost, getVideoPosts } from '@/api/video'
+import { updateVideoScope, videoInfo, deleteVideoPost, getVideoPosts, addVideoPost } from '@/api/video'
 
 export default {
   name: 'VideoPost',
@@ -384,6 +383,34 @@ export default {
       this.$message.info(this.queryInfo)
     },
     handleClose() {
+    },
+    onVideoPublish(videoForm) {
+      this.publishVideoDiaglog = false
+      addVideoPost(videoForm).then(res => {
+        if (res.code === 0) {
+          this.$notify({
+            title: '提示',
+            message: '投稿成功,等待审核通过后其他人就可以看到你的视频了',
+            type: 'warning',
+            duration: 3000
+          })
+          this.$router.push('/post/list/video')
+        } else {
+          this.$notify({
+            title: '提示',
+            message: res.msg,
+            type: 'warning',
+            duration: 3000
+          })
+        }
+      }).catch(error => {
+        this.$notify({
+          title: '提示',
+          message: error.message,
+          type: 'warning',
+          duration: 3000
+        })
+      })
     }
   }
 }

+ 18 - 46
src/views/post/VideoPostPublish.vue

@@ -1,7 +1,7 @@
 <template>
   <el-row class="movie-list">
-    <el-col :md="12" style="padding-right: 5px; padding-left: 5px; padding-bottom: 5px">
-      <el-row style="padding-right: 5px; padding-left: 5px; padding-bottom: 5px">
+    <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">
             <span>上传视频文件</span>
@@ -26,8 +26,8 @@
             </uploader>
           </div>
         </el-card>
-      </el-row>
-      <el-row style="padding-right: 5px; padding-left: 5px; padding-bottom: 5px">
+      </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>
@@ -52,10 +52,10 @@
             </el-tooltip>
           </div>
         </el-card>
-      </el-row>
-    </el-col>
-    <el-col :md="12" style="padding-right: 5px; padding-left: 5px; padding-bottom: 5px">
-      <el-row style="padding-right: 5px; padding-left: 5px; padding-bottom: 5px">
+      </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">
             <span>稿件信息</span>
@@ -110,13 +110,13 @@
             </el-form>
           </div>
         </el-card>
-      </el-row>
-    </el-col>
+      </el-col>
+    </el-row>
   </el-row>
 </template>
 
 <script>
-import { videoRegion, addVideoPost } from '@/api/video'
+import { videoRegion } from '@/api/video'
 import { getVideoChannelInfo, getVideoCoverChannelInfo } from '@/api/file'
 import { hashFile } from '@/utils/functions'
 
@@ -208,8 +208,8 @@ export default {
       }
     }).catch(error => {
       this.$notify({
-        title: '提示',
-        message: '获取 OSS 服务器地址失败, 暂时无法上传视频文件',
+        title: '获取 OSS 服务器地址失败, 暂时无法上传视频文件',
+        message: error.message,
         type: 'warning',
         duration: 3000
       })
@@ -232,8 +232,8 @@ export default {
       }
     }).catch(error => {
       this.$notify({
-        title: '提示',
-        message: '获取 OSS 服务器地址失败, 暂时无法上传视频封面',
+        title: '获取 OSS 服务器地址失败, 暂时无法上传视频封面',
+        message: error.message,
         type: 'warning',
         duration: 3000
       })
@@ -521,42 +521,14 @@ export default {
       }
 
       if (this.form.scheduledPubDate !== null) {
-        console.log(this.form.scheduledPubDate)
-        if (this.form.scheduledPubDate !== null) {
-          this.$notify({
-            title: '提示',
-            message: '定时发布的时间必须在当前时间之后',
-            type: 'warning',
-            duration: 3000
-          })
-        }
-      }
-
-      addVideoPost(this.form).then(res => {
-        if (res.code === 0) {
-          this.$notify({
-            title: '提示',
-            message: '投稿成功,等待审核通过后其他人就可以看到你的视频了',
-            type: 'warning',
-            duration: 3000
-          })
-          this.$router.push('/post/list/video')
-        } else {
-          this.$notify({
-            title: '提示',
-            message: res.msg,
-            type: 'warning',
-            duration: 3000
-          })
-        }
-      }).catch(error => {
         this.$notify({
           title: '提示',
-          message: error.message,
+          message: '定时发布的时间必须在当前时间之后',
           type: 'warning',
           duration: 3000
         })
-      })
+      }
+      this.$emit('video-publish', this.form)
     }
   }
 }