Explorar o código

update PostAlbum.vue

reghao hai 1 ano
pai
achega
b1af63e142
Modificáronse 1 ficheiros con 20 adicións e 15 borrados
  1. 20 15
      src/views/post/PostAlbum.vue

+ 20 - 15
src/views/post/PostAlbum.vue

@@ -2,7 +2,7 @@
   <el-container>
     <el-header height="220">
       <el-card class="box-card" style="padding-right: 5px; padding-left: 5px; padding-bottom: 5px">
-        <div slot="header" class="clearfix">
+        <div v-if="albumInfo !== null" slot="header" class="clearfix">
           <el-image
             lazy
             fit="cover"
@@ -98,17 +98,6 @@
                 </div>
               </el-card>
             </el-col>
-            <el-pagination
-              :small="screenWidth <= 768"
-              hide-on-single-page
-              layout="prev, pager, next"
-              :page-size="pageSize"
-              :current-page="currentPage"
-              :total="totalSize"
-              @current-change="handleCurrentChange"
-              @prev-click="handleCurrentChange"
-              @next-click="handleCurrentChange"
-            />
           </div>
         </el-col>
       </el-row>
@@ -182,13 +171,24 @@ export default {
   },
   created() {
     this.getSelectList()
-    this.queryInfo.albumId = this.$route.query.albumId
+    const albumId = this.$route.query.albumId
+    if (albumId !== undefined) {
+      this.queryInfo.albumId = albumId
+    }
+
+    const pn = this.$route.query.pn
+    if (albumId !== undefined) {
+      this.queryInfo.pn = pn
+      this.currentPage = pn
+    }
+
     this.getData()
     document.title = '我的播放列表'
   },
   methods: {
     onSelectChange() {
       this.queryInfo.pn = 1
+      this.currentPage = 1
       this.getData()
       this.$router.push({
         path: '/post/album',
@@ -198,9 +198,14 @@ export default {
     handleCurrentChange(pageNumber) {
       this.currentPage = pageNumber
       this.queryInfo.pn = pageNumber
-      this.getData()
+      // this.getData()
+      this.$router.push({
+        path: '/post/album',
+        query: this.queryInfo
+      })
       // 回到顶部
       scrollTo(0, 0)
+      this.getData()
     },
     getData() {
       getAlbumItems(this.queryInfo).then(resp => {
@@ -209,7 +214,7 @@ export default {
           this.dataList = respData.pageList.list
           this.totalSize = respData.pageList.totalSize
           this.albumInfo = respData.albumInfo
-          this.queryInfo.albumId = this.albumInfo.albumName
+          this.queryInfo.albumId = this.albumInfo.albumId + ''
         }
       }).catch(error => {
         this.$message({