Jelajahi Sumber

修改视频分区接口, 视频发布页和视频列表页使用不同的接口获取视频分区

reghao 2 tahun lalu
induk
melakukan
51a5a0b17a

+ 7 - 2
src/api/video.js

@@ -9,7 +9,8 @@ const videoApi = {
   videoResourceApi: '/api/content/post/video/resource',
   convertVideoApi: '/api/content/post/video/convert',
 
-  videoCategoryApi: '/api/content/video/categories',
+  videoCategoryApi: '/api/content/video/region',
+  videoCategoriesApi: '/api/content/video/categories',
   categoryVideoApi: '/api/content/video/category',
   categoryShortVideoApi: '/api/content/video/category/short',
   userVideoPostApi: '/api/content/video/user',
@@ -25,7 +26,7 @@ const videoApi = {
   videoRecommendApi: '/api/content/video/recommend',
   similarVideoApi: '/api/content/video/similar',
   hotVideoApi: '/api/content/video/hot',
-  userContentDataApi: '/api/content/userdata',
+  userContentDataApi: '/api/content/userdata'
 }
 
 // *********************************************************************************************************************
@@ -85,6 +86,10 @@ export function videoCategory() {
   return get(videoApi.videoCategoryApi)
 }
 
+export function videoCategories() {
+  return get(videoApi.videoCategoryApi)
+}
+
 // 获取分类视频
 export function categoryVideos(categoryId, page) {
   return get(videoApi.categoryVideoApi + '?categoryId=' + categoryId + '&page=' + page)

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

@@ -121,7 +121,7 @@ export default {
   methods: {
     // ****************************************************************************************************************
     handleBeforeUpload(file) {
-      const fileType = file.type
+      // const fileType = file.type
       var isJPG = false
       if (file.type === 'image/jpeg' || file.type === 'image/webp' ||
         file.type === 'image/gif' || file.type === 'image/png') {

+ 5 - 5
src/components/upload/PublishVideo.vue

@@ -406,8 +406,8 @@ export default {
         if (res.code === 0) {
           const resData = res.data
           for (let i = 0; i < resData.length; i++) {
-            const name = resData[i].name
-            const id = resData[i].id
+            const name = resData[i].label
+            const id = resData[i].value
             this.pCategoryList.push({ label: name, value: id })
             this.categoryMap.Set(id, resData[i].children)
           }
@@ -432,13 +432,13 @@ export default {
       // 重置子分区,清除前一次选择分区时留下的缓存
       this.categoryList = []
       for (const item of this.categoryMap.Get(id)) {
-        this.categoryList.push({ label: item.name, value: item.id })
+        this.categoryList.push({ label: item.label, value: item.value })
       }
     },
     // 根据输入的标签获取相似的标签
     getRecommendTags(tags) {
       for (const tag of tags) {
-        // console.log(tag)
+        console.log(tag)
       }
     },
     onSubmit() {
@@ -488,7 +488,7 @@ export default {
 
       if (this.form.scheduledPubDate !== null) {
         console.log(this.form.scheduledPubDate)
-        if (false) {
+        if (this.form.scheduledPubDate !== null) {
           this.$notify({
             title: '提示',
             message: '定时发布的时间必须在当前时间之后',

+ 2 - 2
src/views/home/ShortVideo.vue

@@ -53,7 +53,7 @@
 
 <script>
 import VideoCard from 'components/card/VideoCard'
-import { videoCategory, categoryShortVideos } from '@/api/video'
+import { categoryShortVideos, videoCategories } from '@/api/video'
 
 export default {
   name: 'ShortVideo',
@@ -78,7 +78,7 @@ export default {
   created() {
     document.title = '短视频主页'
 
-    videoCategory().then(resp => {
+    videoCategories().then(resp => {
       if (resp.code === 0) {
         this.treeNode = resp.data
       } else {

+ 3 - 3
src/views/home/Video.vue

@@ -26,7 +26,7 @@
         <el-col v-for="(video, index) in dataList" :key="index" :md="6" :sm="12" :xs="12">
           <video-card :video="video" />
         </el-col>
-<!--        <el-col v-if="totalSize === 0" class="not-result" :md="6" :sm="12" :xs="12">
+        <!--        <el-col v-if="totalSize === 0" class="not-result" :md="6" :sm="12" :xs="12">
           <img src="@/assets/img/icon/not-result.png">
           <div>没有视频数据</div>
         </el-col>-->
@@ -53,7 +53,7 @@
 
 <script>
 import VideoCard from 'components/card/VideoCard'
-import { videoCategory, categoryVideos } from '@/api/video'
+import { categoryVideos, videoCategories } from '@/api/video'
 
 export default {
   name: 'Video',
@@ -79,7 +79,7 @@ export default {
   created() {
     document.title = '视频主页'
 
-    videoCategory().then(resp => {
+    videoCategories().then(resp => {
       if (resp.code === 0) {
         this.treeNode = resp.data
       } else {