Quellcode durchsuchen

update EditVideo page

reghao vor 2 Jahren
Ursprung
Commit
9e6b621c57
1 geänderte Dateien mit 11 neuen und 103 gelöschten Zeilen
  1. 11 103
      src/components/upload/EditVideo.vue

+ 11 - 103
src/components/upload/EditVideo.vue

@@ -10,26 +10,6 @@
       </el-col>
     </el-row>
     <el-row style="padding-right: 5px; padding-left: 5px; padding-bottom: 5px">
-      <el-col :md="8" 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="onUpdateVideoScope">更新</el-button>
-          </div>
-          <div class="text item">
-            <el-form ref="form" :model="form" label-width="80px">
-              <el-form-item label="可见范围">
-                <el-select v-model="form.scope" placeholder="选择可见范围">
-                  <el-option label="所有人可见" value="1" />
-                  <el-option label="验证码可见" value="2" />
-                  <el-option label="VIP 可见" value="3" />
-                  <el-option label="仅自己可见" value="4" />
-                </el-select>
-              </el-form-item>
-            </el-form>
-          </div>
-        </el-card>
-      </el-col>
       <el-col :md="8" style="padding-right: 5px; padding-left: 5px; padding-bottom: 5px">
         <el-card class="box-card">
           <div slot="header" class="clearfix">
@@ -73,7 +53,7 @@
                 :before-upload="beforeAvatarUpload"
                 :on-success="handleAvatarSuccess"
               >
-                <img :src="imageUrl" class="avatar">
+                <img :src="coverUrl" class="avatar">
               </el-upload>
             </el-tooltip>
           </div>
@@ -113,7 +93,7 @@
 
 <script>
 import { getServerInfo } from '@/api/file'
-import { videoCategory, videoInfo, updateVideoInfo, updateVideoScope, updateVideoCover, updateVideoFile } from '@/api/video'
+import { getUserVideoPost, updateVideoInfo, updateVideoCover, updateVideoFile } from '@/api/video'
 
 export default {
   name: 'EditVideo',
@@ -145,19 +125,7 @@ export default {
       },
       /***********************************************************************/
       coverUrl: null,
-      categoryMap: {
-        Set: function(key, value) { this[key] = value },
-        Get: function(key) { return this[key] },
-        Contains: function(key) { return this.Get(key) !== null },
-        Remove: function(key) { delete this[key] }
-      },
-      category: [],
-      childCategory: [],
-      coverFile: null,
-      imageList: [],
-      imageUrl: '',
       // 提交给后端的数据
-      tagsStr: null,
       form: {
         videoFileId: null,
         coverUrl: null,
@@ -178,18 +146,18 @@ export default {
     document.title = '编辑视频'
 
     const videoId = this.$route.params.videoId
-    videoInfo(videoId).then(res => {
+    getUserVideoPost(videoId).then(res => {
       if (res.code === 0) {
-        const videoInfo = res.data
-        this.imageUrl = videoInfo.coverUrl
-        this.form.title = videoInfo.title
-        this.form.description = videoInfo.description
-        this.form.scope = videoInfo.scope
+        const userVideoPost = res.data
+        this.coverUrl = userVideoPost.coverUrl
+        this.form.title = userVideoPost.title
+        this.form.description = userVideoPost.description
+        this.form.scope = userVideoPost.scope
       } else {
 
       }
     })
-    //this.getVideoCategory()
+
     getServerInfo(1).then(res => {
       if (res.code === 0) {
         this.imgHeaders.Authorization = 'Bearer ' + res.data
@@ -254,65 +222,12 @@ export default {
       return isJPG && isLt2M
     },
     handleAvatarSuccess(res, file) {
-      this.imageList.push(file)
-      this.imageUrl = URL.createObjectURL(file.raw)
+      const localImageUrl = URL.createObjectURL(file.raw)
       if (res.code === 0) {
         const resData = res.data
         const uploadId = resData.uploadId
-        const url = resData.url
+        this.coverUrl = resData.url
       } else {
-
-      }
-    },
-    getVideoCategory() {
-      videoCategory()
-        .then(res => {
-          if (res.code === 0) {
-            for (let i = 0; i < res.data.length; i++) {
-              const name = res.data[i].name
-              //this.category.push(name)
-              this.categoryMap.Set(name, res.data[i])
-            }
-          } else {
-            this.$notify(
-              {
-                title: '提示',
-                message: res.msg,
-                type: 'warning',
-                duration: 3000
-              }
-            )
-          }
-        }).catch(error => {
-          this.$notify(
-            {
-              title: '提示',
-              message: error.message,
-              type: 'error',
-              duration: 3000
-            }
-          )
-        })
-    },
-    getCategory(name) {
-      // 重置子分区,清除前一次选择分区时留下的缓存
-      this.childCategory = []
-      this.currentCategory = this.categoryMap.Get(name)
-      this.form.categoryId = this.currentCategory.id
-
-      const c = this.currentCategory.children
-      if (c) {
-        for (let i = 0; i < c.length; i++) {
-          this.childCategory.push(c[i].name)
-        }
-      }
-    },
-    getChildCategory(name) {
-      const c = this.currentCategory.children
-      for (let i = 0; i < c.length; i++) {
-        if (c[i].name === name) {
-          this.form.categoryId = c[i].id
-        }
       }
     },
     onReturnVideo() {
@@ -339,13 +254,6 @@ export default {
         }
       })
     },
-    onUpdateVideoScope() {
-      updateVideoScope().then(res => {
-        if (res.code === 0) {
-          console.log('更新视频作用域')
-        }
-      })
-    }
   }
 }
 </script>