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

更新稿件合集相关接口

reghao 1 год назад
Родитель
Сommit
a0d0c561c4

+ 19 - 50
src/api/collect.js

@@ -1,75 +1,44 @@
 import { get, post, delete0 } from '@/utils/request'
 
 const collectApi = {
-  updateAlbumScopeApi: '/api/content/post/album/update/scope',
-  updateAlbumCoverApi: '/api/content/post/album/update/cover',
-  updateAlbumNameApi: '/api/content/post/album/update/name',
-  collectItemApi: '/api/content/post/album/action',
+  albumUpdateApi: '/api/content/post/album/update',
+  albumActionApi: '/api/content/post/album/action',
   postAlbumApi: '/api/content/post/album',
+  albumApi: '/api/content/album',
   playlistApi: '/api/content/album/playlist'
 }
 
-// 收藏(取消收藏)内容
-export function collectItem(jsonData) {
-  return post(collectApi.collectItemApi, jsonData)
-}
-
-export function collectImageItem(jsonData) {
-  return post(collectApi.collectItemApi + '/image', jsonData)
+// 创建合集
+export function createAlbum(data) {
+  return post(collectApi.postAlbumApi + '/create', data)
 }
 
-// 获取用户合集
-export function getUserAlbums(page) {
-  return get(collectApi.postAlbumApi + '/user?pn=' + page)
+// 收藏(取消收藏)内容
+export function collectItem(jsonData) {
+  return post(collectApi.albumActionApi, jsonData)
 }
 
-export function getPostAlbums(query) {
-  return get(collectApi.postAlbumApi + '/user', query)
+// 获取用户稿件合集的 select-list
+export function getUserAlbumSelectList() {
+  return get(collectApi.postAlbumApi + '/kv')
 }
 
 // 获取合集内容
-export function getAlbumItems(page, albumId) {
-  return get(collectApi.postAlbumApi + '/item?pn=' + page + '&albumId=' + albumId)
-}
-
-export function getAlbumItems1(queryInfo) {
+export function getAlbumItems(queryInfo) {
   return get(collectApi.postAlbumApi + '/item', queryInfo)
 }
 
-// 获取用户收藏夹
-export function getUserPlaylist() {
-  return get(collectApi.postAlbumApi + '/user')
-}
-
-export function getAlbumTypes() {
-  return get(collectApi.postAlbumApi + '/kv')
-}
-
-export function deleteAlbumItem(data) {
-  return post(collectApi.collectItemApi, data)
-}
-
-export function createVideoAlbum(data) {
-  return post(collectApi.postAlbumApi + '/video/create', data)
-}
-
-export function updateAlbumScope(jsonData) {
-  return post(collectApi.updateAlbumScopeApi, jsonData)
-}
-
-export function updateAlbumName(jsonData) {
-  return post(collectApi.updateAlbumNameApi, jsonData)
-}
-
-export function updateAlbumCover(jsonData) {
-  return post(collectApi.updateAlbumCoverApi, jsonData)
+// 获取用户播放列表
+export function getUserPlaylist(queryInfo) {
+  return get(collectApi.albumApi + '/user', queryInfo)
 }
 
 // 获取播放列表
 export function getPlaylist(page) {
-  return get(collectApi.playlistApi + '?pn=' + page)
+  return get(collectApi.albumApi + '/playlist?pn=' + page)
 }
 
+// 获取播放列表内容
 export function getPlaylistItems(albumId) {
-  return get(collectApi.playlistApi + '/' + albumId)
+  return get(collectApi.albumApi + '/playlist/' + albumId)
 }

+ 1 - 1
src/components/layout/NavBar.vue

@@ -67,7 +67,7 @@
                 icon="el-icon-collection"
                 class="size"
                 @click.native="goToPlaylist"
-              >收藏夹</el-dropdown-item>
+              >播放列表</el-dropdown-item>
               <el-dropdown-item
                 icon="el-icon-s-data"
                 class="size"

+ 0 - 6
src/router/exam.js

@@ -1,12 +1,6 @@
 // ********************************************************************************************************************
 // 后台主页
 // ********************************************************************************************************************
-// const SiteConfig = () => import('views/admin/SiteConfig')
-// const Message = () => import('views/admin/Message')
-// const UserList = () => import('views/admin/UserList')
-// const PostList = () => import('views/admin/PostList')
-// const DataSource = () => import('views/admin/DataSource')
-
 const ExamIndex = () => import('views/exam/ExamIndex')
 const Exam = () => import('views/exam/Exam')
 const ExamDashboard = () => import('views/exam/ExamDashboard')

+ 1 - 1
src/router/mall.js

@@ -31,7 +31,7 @@ export default {
     },
     {
       path: '/mall/fav',
-      name: '收藏夹',
+      name: '播放列表',
       component: Fav,
       meta: { needAuth: false }
     },

+ 3 - 7
src/views/home/PostAlbumIndex.vue

@@ -66,7 +66,7 @@
 </template>
 
 <script>
-import { getPlaylist, getUserAlbums } from '@/api/collect'
+import { getPlaylist } from '@/api/collect'
 import { handleVisited } from '@/assets/js/utils'
 
 export default {
@@ -106,11 +106,7 @@ export default {
   },
   created() {
     document.title = '播放列表'
-    getPlaylist(this.currentPage).then(resp => {
-      if (resp.code === 0) {
-        this.dataList = resp.data
-      }
-    })
+    this.getData()
   },
   mounted() {
     // 当窗口宽度改变时获取屏幕宽度
@@ -130,7 +126,7 @@ export default {
     },
     getData() {
       this.dataList = []
-      getUserAlbums(this.currentPage).then(resp => {
+      getPlaylist(this.currentPage).then(resp => {
         if (resp.code === 0) {
           this.dataList = resp.data.list
           this.totalSize = resp.data.totalSize

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

@@ -3,7 +3,7 @@
     <el-row style="padding-right: 5px; padding-left: 5px; padding-bottom: 5px">
       <el-card class="box-card" style="padding-right: 5px; padding-left: 5px; padding-bottom: 5px">
         <div slot="header" class="clearfix">
-          <span>收藏夹 - <span style="color: blue">{{ albumName }}</span></span>
+          <span>播放列表 - <span style="color: blue">{{ albumName }}</span></span>
         </div>
       </el-card>
     </el-row>
@@ -127,7 +127,7 @@ export default {
     }
   },
   created() {
-    document.title = '收藏夹'
+    document.title = '播放列表'
     this.albumId = this.$route.params.albumId
     this.getAlbumItemsWrapper()
   },
@@ -151,7 +151,7 @@ export default {
           getUserInfo(respData.createBy).then(resp => {
             if (resp.code === 0) {
               this.user = resp.data
-              document.title = this.user.screenName + '的收藏夹'
+              document.title = this.user.screenName + '的播放列表'
             }
           })
         }

+ 8 - 4
src/views/home/VideoPage.vue

@@ -179,7 +179,7 @@
             >
               <el-table-column
                 prop="albumName"
-                label="收藏夹"
+                label="播放列表"
               />
               <el-table-column
                 prop="total"
@@ -240,7 +240,7 @@ import UserAvatarCard from '@/components/card/UserAvatarCard'
 import comment from '@/components/comment'
 
 import { similarVideo, videoInfo, videoErrorReport, downloadVideo, getShortUrl } from '@/api/video'
-import { collectItem, createVideoAlbum, getUserPlaylist } from '@/api/collect'
+import { collectItem, createAlbum, getUserPlaylist } from '@/api/collect'
 import { getUserInfo } from '@/api/user'
 import { publishComment, getComment } from '@/api/comment'
 import { getAuthedUser } from '@/utils/auth'
@@ -443,7 +443,11 @@ export default {
     // 用户点击收藏
     collection(videoId) {
       this.showPlaylistDialog = true
-      getUserPlaylist().then(resp => {
+      const queryInfo = {
+        pn: 1,
+        userId: this.currentUser.userId
+      }
+      getUserPlaylist(queryInfo).then(resp => {
         if (resp.code === 0) {
           this.playlist = resp.data.list
         }
@@ -538,7 +542,7 @@ export default {
     },
     onCreateAlbum() {
       this.showCreateAlbum = false
-      createVideoAlbum(this.albumForm).then(resp => {
+      createAlbum(this.albumForm).then(resp => {
         if (resp.code === 0) {
           this.playlist.push(resp.data)
         }

+ 2 - 2
src/views/mall/Fav.vue

@@ -1,6 +1,6 @@
 <template>
   <el-row>
-    <span>收藏夹</span>
+    <span>播放列表</span>
   </el-row>
 </template>
 
@@ -12,7 +12,7 @@ export default {
     }
   },
   created() {
-    document.title = '我的收藏夹'
+    document.title = '我的播放列表'
   },
   methods: {
   }

+ 1 - 1
src/views/mall/Mall.vue

@@ -34,7 +34,7 @@
               </template>
             </el-menu-item>
             <el-menu-item index="/mall/fav">
-              <template slot="title" class="el-icon-collection">收藏夹</template>
+              <template slot="title" class="el-icon-collection">播放列表</template>
             </el-menu-item>
           </el-menu>
         </el-col>

+ 1 - 1
src/views/mall/Visit.vue

@@ -12,7 +12,7 @@ export default {
     }
   },
   created() {
-    document.title = '我的收藏夹'
+    document.title = '我的播放列表'
   },
   methods: {
   }

+ 1 - 1
src/views/post/ImagePost.vue

@@ -156,7 +156,7 @@ export default {
     }
   },
   created() {
-    document.title = '相册稿件'
+    document.title = '我的图片稿件'
     this.getData()
   },
   methods: {

+ 1 - 1
src/views/post/Post.vue

@@ -58,7 +58,7 @@
           </el-submenu>
           <el-menu-item index="/post/album">
             <i class="el-icon-collection" />
-            <span slot="title">收藏夹</span>
+            <span slot="title">播放列表</span>
           </el-menu-item>
           <el-menu-item index="/post/history">
             <i class="el-icon-s-data" />

+ 24 - 40
src/views/post/PostAlbum.vue

@@ -10,16 +10,16 @@
             :src="albumInfo.coverUrl"
           />
           <el-row>
-            <span>当前收藏夹</span>
+            <span>当前播放列表</span>
             <el-select
               v-model="queryInfo.albumId"
               clearable
-              placeholder="稿件类型"
+              placeholder="播放列表"
               style="margin-left: 5px"
               @change="onSelectChange"
             >
               <el-option
-                v-for="item in allPostTypes"
+                v-for="item in allAlbums"
                 :key="item.label"
                 :label="item.label"
                 :value="item.value"
@@ -52,16 +52,7 @@
               style="padding-right: 5px; padding-left: 5px; padding-bottom: 5px"
             >
               <el-card :body-style="{ padding: '0px' }" class="card">
-                <div v-if="albumInfo.postType === 1" class="imgs">
-                  <el-image
-                    lazy
-                    fit="cover"
-                    class="coverImg"
-                    :src="item.thumbnailUrl"
-                    @click="showImages(index)"
-                  />
-                </div>
-                <div v-if="albumInfo.postType === 2" class="imgs" style="cursor: pointer" :title="item.title">
+                <div class="imgs" style="cursor: pointer" :title="item.title">
                   <router-link target="_blank" :to="`/video/${item.videoId}`">
                     <el-image
                       lazy
@@ -76,12 +67,12 @@
                     </span>
                   </router-link>
                 </div>
-                <div v-if="albumInfo.postType === 2" style="padding: 14px">
+                <div style="padding: 14px">
                   <router-link style="text-decoration-line: none" target="_blank" :to="`/video/${item.videoId}`">
                     <span style="left: 0;margin-bottom: 0px;color: black;">{{ item.title | ellipsis }}</span>
                   </router-link>
                 </div>
-                <div v-if="albumInfo.postType === 2" style="padding: 14px">
+                <div style="padding: 14px">
                   <span style="left: 0;margin-bottom: 0px;color: black;">
                     <router-link target="_blank" :to="`/user/${item.user.userId}`">
                       <i class="el-icon-user"> {{ item.user.screenName | ellipsisUsername }} </i></router-link> • {{ item.pubDateStr }}
@@ -145,7 +136,11 @@
 </template>
 
 <script>
-import { collectItem, getAlbumItems1, getAlbumTypes } from '@/api/collect'
+import {
+  collectItem,
+  getAlbumItems,
+  getUserAlbumSelectList
+} from '@/api/collect'
 
 export default {
   name: 'PostAlbum',
@@ -169,7 +164,7 @@ export default {
   },
   data() {
     return {
-      allPostTypes: [],
+      allAlbums: [],
       queryInfo: {
         albumId: null,
         pn: 1
@@ -185,7 +180,6 @@ export default {
       showEditScopeDialog: false,
       form: {
         albumId: null,
-        postType: '1',
         scope: '1'
       },
       createAlbumDiaglog: false,
@@ -197,15 +191,15 @@ export default {
     }
   },
   created() {
-    this.getUserAlbums()
+    this.getSelectList()
     this.queryInfo.albumId = this.$route.query.albumId
-    this.getData1()
-    document.title = '收藏夹'
+    this.getData()
+    document.title = '我的播放列表'
   },
   methods: {
     onSelectChange() {
       this.queryInfo.pn = 1
-      this.getData1()
+      this.getData()
       this.$router.push({
         path: '/post/album',
         query: this.queryInfo
@@ -214,12 +208,12 @@ export default {
     handleCurrentChange(pageNumber) {
       this.currentPage = pageNumber
       this.queryInfo.pn = pageNumber
-      this.getData1()
+      this.getData()
       // 回到顶部
       scrollTo(0, 0)
     },
-    getData1() {
-      getAlbumItems1(this.queryInfo).then(resp => {
+    getData() {
+      getAlbumItems(this.queryInfo).then(resp => {
         if (resp.code === 0) {
           const respData = resp.data
           this.dataList = respData.pageList.list
@@ -235,10 +229,10 @@ export default {
         })
       })
     },
-    getUserAlbums() {
-      getAlbumTypes().then(resp => {
+    getSelectList() {
+      getUserAlbumSelectList().then(resp => {
         if (resp.code === 0) {
-          this.allPostTypes = resp.data
+          this.allAlbums = resp.data
         }
       })
     },
@@ -262,12 +256,7 @@ export default {
     onSetCover(item) {
       const jsonData = {}
       jsonData.albumId = this.albumId
-      if (this.albumInfo.postType === 1) {
-        jsonData.postId = item.imageFileId
-      } else if (this.albumInfo.postType === 2) {
-        jsonData.postId = item.videoId
-      }
-
+      jsonData.postId = item.videoId
       jsonData.action = 3
       collectItem(jsonData).then(res => {
         if (res.code === 0) {
@@ -287,12 +276,7 @@ export default {
       }).then(() => {
         const jsonData = {}
         jsonData.albumId = this.albumId
-        if (this.albumInfo.postType === 1) {
-          jsonData.postId = item.imageFileId
-        } else if (this.albumInfo.postType === 2) {
-          jsonData.postId = item.videoId
-        }
-
+        jsonData.postId = item.videoId
         jsonData.action = 2
         collectItem(jsonData).then(res => {
           if (res.code === 0) {

+ 0 - 253
src/views/post/PostList.vue

@@ -1,253 +0,0 @@
-<template>
-  <el-row>
-    <el-col :md="2">
-      <el-menu
-        :default-active="this.$route.path"
-        router
-        class="el-menu-vertical-demo"
-      >
-        <el-menu-item v-for="(item,i) in navList" :key="i" :index="item.path">
-          <i :class="item.icon" />
-          <span slot="title">{{ item.name }}</span>
-        </el-menu-item>
-      </el-menu>
-    </el-col>
-    <el-col :md="22">
-      <el-row>
-        <el-tabs v-model="activeName" @tab-click="tabClick">
-          <el-tab-pane label="视频" name="video">
-            <video-post :data-list="dataList" />
-          </el-tab-pane>
-          <el-tab-pane label="音频" name="audio">
-            <audio-post :data-list="dataList" />
-          </el-tab-pane>
-          <el-tab-pane label="相册" name="image">
-            <image-post :data-list="dataList" />
-          </el-tab-pane>
-          <el-tab-pane label="文章" name="article">
-            <article-post :data-list="dataList" />
-          </el-tab-pane>
-        </el-tabs>
-      </el-row>
-      <el-row>
-        <el-col :span="22" class="pagination">
-          <el-pagination
-            background
-            :small="screenWidth <= 768"
-            layout="prev, pager, next"
-            :page-size="pageSize"
-            :current-page="currentPage"
-            :total="totalSize"
-            @current-change="handleCurrentChange"
-            @prev-click="handleCurrentChange"
-            @next-click="handleCurrentChange"
-          />
-        </el-col>
-      </el-row>
-    </el-col>
-  </el-row>
-</template>
-
-<script>
-import VideoPost from '@/views/post/VideoPost'
-import AudioPost from '@/views/post/AudioPost'
-import ImagePost from '@/views/post/ImagePost'
-import ArticlePost from '@/views/post/ArticlePost'
-
-import { getVideoPosts } from '@/api/video'
-import { getAudioPosts } from '@/api/audio'
-import { getUserAlbums } from '@/api/image'
-import { getArticlePosts } from '@/api/article'
-
-export default {
-  name: 'PostList',
-  components: { VideoPost, ImagePost, AudioPost, ArticlePost },
-  data() {
-    return {
-      // 屏幕宽度, 为了控制分页条的大小
-      screenWidth: document.body.clientWidth,
-      currentPage: 1,
-      pageSize: 12,
-      totalSize: 0,
-      dataList: [],
-      /** ***********************************************************************/
-      navList: [
-        { path: '/post/publish', name: '发布', icon: 'el-icon-upload' },
-        { path: '/post/list', name: '稿件', icon: 'el-icon-files' },
-        { path: '/post/analysis', name: '数据', icon: 'el-icon-data-analysis' }
-      ],
-      activeName: 'video',
-      userId: 10001,
-      showPreviewDialog: false,
-      videoProp: null,
-      showEditScopeDialog: false
-    }
-  },
-  watch: {
-    $route() {
-      this.$router.go()
-    }
-  },
-  created() {
-    document.title = '稿件列表'
-
-    const path = this.$route.path
-    if (path.endsWith('video')) {
-      this.activeName = 'video'
-      document.title = '视频稿件'
-    } else if (path.endsWith('image')) {
-      this.activeName = 'image'
-      document.title = '图片稿件'
-    } else if (path.endsWith('audio')) {
-      this.activeName = 'audio'
-      document.title = '音频稿件'
-    } else if (path.endsWith('article')) {
-      this.activeName = 'article'
-      document.title = '文章稿件'
-    }
-
-    this.getData()
-  },
-  methods: {
-    handleCurrentChange(pageNumber) {
-      this.currentPage = pageNumber
-      this.getData()
-      // 回到顶部
-      scrollTo(0, 0)
-    },
-    tabClick(tab) {
-      this.activeName = tab.name
-      this.goToTab(this.activeName)
-    },
-    goToTab(activeName) {
-      const path = '/post/' + activeName
-      if (this.$route.path === path) {
-        this.$router.go(0)
-        return
-      }
-      this.$router.push(path)
-    },
-    getData() {
-      this.dataList = []
-      if (this.activeName === 'video') {
-        getVideoPosts(this.currentPage).then(res => {
-          if (res.code === 0) {
-            const resData = res.data
-            this.dataList = resData.list
-            this.totalSize = resData.totalSize
-
-            if (this.totalSize !== 0) {
-              this.showEmpty = false
-            } else {
-              this.showEmpty = true
-            }
-          } else {
-            this.$notify({
-              title: '提示',
-              message: res.msg,
-              type: 'warning',
-              duration: 3000
-            })
-          }
-        }).catch(error => {
-          this.$notify({
-            title: '提示',
-            message: error.message,
-            type: 'error',
-            duration: 3000
-          })
-        })
-      } else if (this.activeName === 'image') {
-        getUserAlbums(this.userId).then(res => {
-          if (res.code === 0) {
-            const resData = res.data
-            if (resData.length !== 0) {
-              this.showEmpty = false
-              for (const item of resData) {
-                this.dataList.push(item)
-              }
-            } else {
-              this.showEmpty = true
-            }
-          }
-        })
-      } else if (this.activeName === 'audio') {
-        this.currentPage = 1
-        this.lastId = 0
-        getAudioPosts(this.currentPage).then(res => {
-          if (res.code === 0) {
-            const resData = res.data.list
-            if (resData.length !== 0) {
-              this.showEmpty = false
-              for (const item of resData) {
-                this.dataList.push(item)
-              }
-            } else {
-              this.showEmpty = true
-            }
-          }
-        })
-      } else if (this.activeName === 'article') {
-        this.currentPage = 1
-        this.lastId = 0
-        getArticlePosts(this.currentPage).then(res => {
-          if (res.code === 0) {
-            const resData = res.data.list
-            if (resData.length !== 0) {
-              this.showEmpty = false
-              for (const item of resData) {
-                this.dataList.push(item)
-              }
-            } else {
-              this.showEmpty = true
-            }
-          }
-        })
-      }
-    }
-  }
-}
-</script>
-
-<style>
-.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/views/post/VideoPost.vue

@@ -275,7 +275,7 @@ export default {
     }
   },
   created() {
-    document.title = '视频稿件'
+    document.title = '我的视频稿件'
     this.getData()
   },
   methods: {

+ 6 - 5
src/views/user/Home.vue

@@ -87,7 +87,7 @@
           </el-tab-pane>
           <el-tab-pane name="album">
             <span slot="label">
-              收藏夹<el-badge :value="userContentData.albumCount" :max="9999" class="item" type="warning" />
+              播放列表<el-badge :value="userContentData.albumCount" :max="9999" class="item" type="warning" />
             </span>
             <div v-if="activeName === 'album'">
               <el-col v-for="(item, index) in dataList" :key="index" :md="6" :sm="12" :xs="12">
@@ -129,7 +129,7 @@ import ImageAlbumCard from '@/components/card/ImageAlbumCard'
 import { getUserInfo, checkRelation, followUser, unfollowUser } from '@/api/user'
 import { getUserContentData, getUserVideos } from '@/api/video'
 import { getAlbumImage1 } from '@/api/image'
-import { getPostAlbums } from '@/api/collect'
+import { getPostAlbums, getUserPlaylist } from '@/api/collect'
 
 export default {
   name: 'Home',
@@ -150,7 +150,7 @@ export default {
       totalSize: 0,
       dataList: [],
       queryInfo: {
-        createBy: null,
+        userId: null,
         pn: 1
       },
       showEmpty: true,
@@ -164,6 +164,7 @@ export default {
   },
   created() {
     this.userId = this.$route.params.id
+    this.queryInfo.userId = this.userId
     getUserInfo(this.userId).then(resp => {
       if (resp.code === 0) {
         this.user = resp.data
@@ -176,7 +177,7 @@ export default {
           document.title = this.user.screenName + '的图片'
         } else if (path.endsWith('album')) {
           this.activeName = 'album'
-          document.title = this.user.screenName + '的收藏夹'
+          document.title = this.user.screenName + '的播放列表'
         } else {
           document.title = this.user.screenName + '的主页'
         }
@@ -278,7 +279,7 @@ export default {
       })
     },
     userAlbumWrapper(pageNumber, userId) {
-      getPostAlbums(this.queryInfo).then(resp => {
+      getUserPlaylist(this.queryInfo).then(resp => {
         if (resp.code === 0) {
           const respData = resp.data
           this.dataList = respData.list