he2802 3 lat temu
rodzic
commit
364f8bfb8e
2 zmienionych plików z 32 dodań i 6 usunięć
  1. 15 3
      pages2/wd/class.vue
  2. 17 3
      pages2/wd/course.vue

+ 15 - 3
pages2/wd/class.vue

@@ -51,19 +51,31 @@ export default {
 	data() {
 		return {
 			list: [1, 2, 3],
-			goodsList: []
+			goodsList: [],
+			param:{
+				pageNum: 1,
+				pageSize: 10
+			},
+			total: 0
 		};
 	},
 	onLoad(option) {
 		this.courseGoodsList();
 	},
 	onShow() {},
+	onReachBottom() {
+		if (this.goodsList.length < this.total) {
+			this.param.pageNum++;
+			this.courseGoodsList();
+		}
+	},
 	methods: {
 		courseGoodsList() {
 			let self = this;
-			this.$api.courseGoodsList().then(res => {
+			this.$api.courseGoodsList(this.param).then(res => {
 				if (res.data.code == 200) {
-					self.goodsList = res.data.rows;
+					self.goodsList.push.apply(self.goodsList, res.data.rows);
+					self.total = res.data.total;
 				}
 			});
 		},

+ 17 - 3
pages2/wd/course.vue

@@ -24,7 +24,13 @@ export default {
 	data() {
 		return {
 			goodsId: 0,
-			courseList: []
+			courseList: [],
+			param:{
+				pageNum: 1,
+				pageSize: 10,
+				total: 0
+			},
+			
 		};
 	},
 	onLoad(option) {
@@ -33,6 +39,12 @@ export default {
 		this.courseCourseList();
 	},
 	onShow() {},
+	onReachBottom() {
+		if (this.courseList.length < this.param.total) {
+			this.param.pageNum++;
+			this.courseCourseList();
+		}
+	},
 	methods: {
 		jump(item) {
 			this.$navTo.togo('/pages2/class/detail', {
@@ -49,9 +61,11 @@ export default {
 		},
 		courseCourseList() {
 			let self = this;
-			this.$api.courseCourseList({ goodsId: this.goodsId }).then(res => {
+			this.param.goodsId =this.goodsId
+			this.$api.courseCourseList(this.param).then(res => {
 				if (res.data.code == 200) {
-					self.courseList = res.data.rows;
+					self.courseList.push.apply(self.courseList, res.data.rows);
+					self.param.total = res.data.total;
 				}
 			});
 		},