소스 검색

删除记录后,当前页无数据则后退一页

Michael Wang 6 년 전
부모
커밋
59b8de5ed0
2개의 변경된 파일25개의 추가작업 그리고 9개의 파일을 삭제
  1. 12 4
      src/modules/basic/view/course.vue
  2. 13 5
      src/modules/basic/view/specially.vue

+ 12 - 4
src/modules/basic/view/course.vue

@@ -755,10 +755,18 @@ export default {
         this.pageSize +
         "?" +
         param;
-      this.$httpWithMsg.get(url).then(response => {
-        this.specialtyTableData = response.data.content;
-        this.specialtyTotal = response.data.totalElements;
-      });
+      this.$httpWithMsg
+        .get(url)
+        .then(response => {
+          this.specialtyTableData = response.data.content;
+          this.specialtyTotal = response.data.totalElements;
+        })
+        .then(() => {
+          if (this.specialtyTableData.length === 0 && this.specialtyTotal > 0) {
+            this.currentSpecialtyPage = this.currentSpecialtyPage - 1;
+            this.searchSpecialtyPage();
+          }
+        });
     },
     getTag(status) {
       if (status == true) {

+ 13 - 5
src/modules/basic/view/specially.vue

@@ -590,11 +590,19 @@ export default {
         this.pageSize +
         "?" +
         param;
-      this.$httpWithMsg.get(url).then(response => {
-        console.log(response);
-        this.courseTableData = response.data.content;
-        this.courseTotal = response.data.totalElements;
-      });
+      this.$httpWithMsg
+        .get(url)
+        .then(response => {
+          console.log(response);
+          this.courseTableData = response.data.content;
+          this.courseTotal = response.data.totalElements;
+        })
+        .then(() => {
+          if (this.courseTableData.length === 0 && this.courseTotal > 0) {
+            this.currentCoursePage = this.currentCoursePage - 1;
+            this.searchCoursePage();
+          }
+        });
     },
     getCourses(query) {
       this.courseLoading = true;