chenrong 9 mesiacov pred
rodič
commit
e33e87e6fd

+ 10 - 9
src/views/profile/profileH5.vue

@@ -90,18 +90,21 @@ export default {
     }
   },
   mounted() {
-    this.getCharacterList()
+    this.initCharacterList()
   },
   methods: {
     tabChange() {
-      this.query.pageNum = 1
-      this.characterList = []
-      this.getCharacterList()
+      this.initCharacterList()
     },
     load() {
       this.query.pageNum += 1
       this.getCharacterList()
     },
+    initCharacterList() {
+      this.characterList = []
+      this.query.pageNum = 1
+      this.getCharacterList()
+    },
     getCharacterList(query) {
       this.loading = true
       let params = this.query
@@ -118,7 +121,7 @@ export default {
           this.noMore = true
         }
         this.characterList = [...this.characterList, ...res.rows]
-        if (this.characterList.length >= res.total) {
+        if ((this.query.pageNum * this.query.pageSize) >= res.total) {
           this.noMore = true
         }
         this.total = res.total
@@ -203,8 +206,7 @@ export default {
               message: '删除成功!'
             });
             this.showPopup = false
-            this.characterList = []
-            this.getCharacterList()
+            this.initCharacterList()
           })
         })
       } else if (this.selectObj.scene == 1) {
@@ -220,8 +222,7 @@ export default {
               message: '删除成功!'
             });
             this.showPopup = false
-            this.characterList = []
-            this.getCharacterList()
+            this.initCharacterList()
           })
         })
 

+ 11 - 8
src/views/profile/profilePC.vue

@@ -179,7 +179,7 @@ export default {
   },
   mounted() {
     this.getUserInfo()
-    this.getCharacterList()
+    this.initCharacterList()
   },
   methods: {
     getUserInfo() {
@@ -252,7 +252,7 @@ export default {
             message: '修改成功!'
           });
           this.dialogVisible = false
-          this.getCharacterList()
+          this.initCharacterList()
         })
       } else if (this.selectObj.scene == 1) {
         // 点击是场景
@@ -266,7 +266,7 @@ export default {
             message: '修改成功!'
           });
           this.dialogVisible = false
-          this.getCharacterList()
+          this.initCharacterList()
         })
       }
     },
@@ -285,7 +285,7 @@ export default {
               message: '删除成功!'
             });
             this.dialogVisible = false
-            this.getCharacterList()
+            this.initCharacterList()
           })
         })
       } else if (this.selectObj.scene == 1) {
@@ -301,16 +301,19 @@ export default {
               message: '删除成功!'
             });
             this.dialogVisible = false
-            this.getCharacterList()
+            this.initCharacterList()
           })
         })
 
       }
     },
     tabChange(index) {
-      this.query.pageNum = 1
-      this.characterList = []
       this.query.type = index
+      this.initCharacterList()
+    },
+    initCharacterList() {
+      this.characterList = []
+      this.query.pageNum = 1
       this.getCharacterList()
     },
     load() {
@@ -336,7 +339,7 @@ export default {
           this.noMore = true
         }
         this.characterList = [...this.characterList, ...res.rows]
-        if (this.characterList.length >= res.total) {
+        if ((this.query.pageNum * this.query.pageSize) >= res.total) {
           this.noMore = true
         }
         this.total = res.total