Переглянути джерело

fix: 修复潜在的超过200个返回元素溢出的bug

ChenYangfan 6 роки тому
батько
коміт
0f5431efd9

+ 7 - 1
src/components/DiscussionArea.vue

@@ -62,6 +62,7 @@ export default {
   },
   watch: {
     currentPage () {
+      this.comments = null
       this.updateComments()
     }
   },
@@ -82,7 +83,12 @@ export default {
   },
   methods: {
     updateComments () {
-      getComments({ slideId: this.slide.id, pageNumber: this.currentPage, sort: 'createAt,desc' }).then(res => {
+      this.getComments(30).then(() => {
+        this.getComments(10000)
+      })
+    },
+    getComments (size) {
+      return getComments({ slideId: this.slide.id, pageNumber: this.currentPage, sort: 'createAt,desc' }).then(res => {
         this.wsComments = []
         this.comments = res.data
       }).catch(err => {

+ 1 - 1
src/components/SlideStateBar.vue

@@ -49,7 +49,7 @@ export default {
   font-size: 14px;
   font-weight: bold;
   position: relative;
-  margin: 0 0 16px 0;
+  margin: 0 0 24px 0;
 
   & > div {
     cursor: pointer;

+ 0 - 0
src/utils/preload.js


+ 6 - 1
src/views/student/components/StudentCourseSlides.vue

@@ -47,7 +47,12 @@ export default {
   },
   methods: {
     init () {
-      studentGetSlidesByCourse({ courseId: this.course.id, size: 100, sort: 'name' }).then(res => {
+      this.getSlides(20).then(() => {
+        this.getSlides(10000)
+      })
+    },
+    getSlides (size) {
+      return studentGetSlidesByCourse({ courseId: this.course.id, size, sort: 'name' }).then(res => {
         this.slides = res.data
       }).catch(err => {
         this.$setErrorMessage('获取课程课件列表过程中:' + err.response.data.msg)

+ 7 - 2
src/views/student/tabs/StudentCoursesManager.vue

@@ -70,14 +70,19 @@ export default {
   },
   methods: {
     search: debounce(function () {
-      getCourses({ key: this.searchKey }).then(res => {
+      getCourses({ key: this.searchKey, size: 100 }).then(res => {
         this.searchResult = res.data
       }).catch(err => {
         this.$setErrorMessage(err.response.data.msg)
       })
     }, 500),
     updateInfo () {
-      studentGetCourses({ size: 100, sort: 'name' }).then(res => {
+      this.getCourses(20).then(() => {
+        this.getCourses(10000)
+      })
+    },
+    getCourses () {
+      return studentGetCourses({ size: 100, sort: 'name' }).then(res => {
         this.courses = res.data
       }).catch(err => {
         this.$setErrorMessage(err.response.data.msg)

+ 6 - 1
src/views/student/tabs/StudentExplore.vue

@@ -45,7 +45,12 @@ export default {
   },
   methods: {
     updateInfo () {
-      studentGetCourses({ size: 100, sort: 'name' }).then(res => {
+      this.getCourses(20).then(() => {
+        this.getCourses(10000)
+      })
+    },
+    getCourses () {
+      return studentGetCourses({ size: 100, sort: 'name' }).then(res => {
         this.courses = res.data
       }).catch(err => {
         this.$setErrorMessage(err.response.data.msg)

+ 6 - 1
src/views/teacher/components/TeacherCourseSlides.vue

@@ -48,7 +48,12 @@ export default {
   },
   methods: {
     init () {
-      teacherGetSlidesByCourse({ courseId: this.course.id, size: 100, sort: 'name' }).then(res => {
+      this.getSlides(10).then(() => {
+        this.getSlides(10000)
+      })
+    },
+    getSlides (size) {
+      return teacherGetSlidesByCourse({ courseId: this.course.id, sort: 'name', size }).then(res => {
         this.slides = res.data
       }).catch(err => {
         this.slides = []

+ 1 - 1
src/views/teacher/components/TeacherSlideDetail.vue

@@ -4,7 +4,7 @@
     <slide-detail :slide="slide"></slide-detail>
     <c-button class="full-width mb-16" @click="handleReadSlide">浏览课件</c-button>
     <a :href="slideUrl">
-      <c-button class="full-width mb-16 secondary">
+      <c-button class="full-width mb-32 secondary">
         下载课件
       </c-button>
     </a>

+ 1 - 1
src/views/teacher/tabs/CreateSlide.vue

@@ -75,7 +75,7 @@ export default {
       return true
     },
     handleSubmit () {
-      if (!this.formChecked) {
+      if (!this.formChecked()) {
         this.$setInfoMessage(this.message)
         return
       }

+ 6 - 1
src/views/teacher/tabs/TeacherCoursesManager.vue

@@ -45,7 +45,12 @@ export default {
   },
   methods: {
     updateInfo () {
-      teacherGetCourses({ size: 100, sort: 'name' }).then(res => {
+      this.getCourses(20).then(() => {
+        this.getCourses(10000)
+      })
+    },
+    getCourses (size) {
+      return teacherGetCourses({ sort: 'name', size }).then(res => {
         this.courses = res.data
       }).catch(err => {
         this.$setErrorMessage('获取课程时:' + err.response.data.msg)

+ 10 - 5
src/views/teacher/tabs/TeacherExplore.vue

@@ -74,16 +74,21 @@ export default {
   },
   methods: {
     updateInfo () {
-      teacherGetCourses({ size: 100, sort: 'createAt' }).then(res => {
-        this.courses = res.data
-      }).catch(err => {
-        this.$setErrorMessage('获取课件时:' + err.response.data.msg)
-      })
       teacherGetSlides({ size: 1, sort: 'updateAt,desc' }).then(res => {
         this.slides = res.data
       }).catch(err => {
         this.$setErrorMessage(err.response.data.msg)
       })
+      this.getCourses(20).then(() => {
+        this.getCourses(10000)
+      })
+    },
+    getCourses (size) {
+      return teacherGetCourses({ size, sort: 'createAt' }).then(res => {
+        this.courses = res.data
+      }).catch(err => {
+        this.$setErrorMessage('获取课件时:' + err.response.data.msg)
+      })
     },
     handleToCreateCourse () {
       this.$router.push({ name: 'create-new-course' })

+ 29 - 0
yarn.lock

@@ -10905,6 +10905,35 @@ webpack@^4.0.0:
     watchpack "^1.6.0"
     webpack-sources "^1.4.1"
 
+webpack@latest:
+  version "4.41.6"
+  resolved "https://registry.yarnpkg.com/webpack/-/webpack-4.41.6.tgz#12f2f804bf6542ef166755050d4afbc8f66ba7e1"
+  integrity sha512-yxXfV0Zv9WMGRD+QexkZzmGIh54bsvEs+9aRWxnN8erLWEOehAKUTeNBoUbA6HPEZPlRo7KDi2ZcNveoZgK9MA==
+  dependencies:
+    "@webassemblyjs/ast" "1.8.5"
+    "@webassemblyjs/helper-module-context" "1.8.5"
+    "@webassemblyjs/wasm-edit" "1.8.5"
+    "@webassemblyjs/wasm-parser" "1.8.5"
+    acorn "^6.2.1"
+    ajv "^6.10.2"
+    ajv-keywords "^3.4.1"
+    chrome-trace-event "^1.0.2"
+    enhanced-resolve "^4.1.0"
+    eslint-scope "^4.0.3"
+    json-parse-better-errors "^1.0.2"
+    loader-runner "^2.4.0"
+    loader-utils "^1.2.3"
+    memory-fs "^0.4.1"
+    micromatch "^3.1.10"
+    mkdirp "^0.5.1"
+    neo-async "^2.6.1"
+    node-libs-browser "^2.2.1"
+    schema-utils "^1.0.0"
+    tapable "^1.1.3"
+    terser-webpack-plugin "^1.4.3"
+    watchpack "^1.6.0"
+    webpack-sources "^1.4.1"
+
 websocket-driver@>=0.5.1:
   version "0.7.3"
   resolved "https://registry.npm.taobao.org/websocket-driver/download/websocket-driver-0.7.3.tgz#a2d4e0d4f4f116f1e6297eba58b05d430100e9f9"