he2802 4 gadi atpakaļ
vecāks
revīzija
7fb81f178f
4 mainītis faili ar 98 papildinājumiem un 9 dzēšanām
  1. 24 0
      common/httpList/collect.js
  2. 3 3
      components/my.vue
  3. 4 1
      pages/index/index.vue
  4. 67 5
      pages2/wd/collect.vue

+ 24 - 0
common/httpList/collect.js

@@ -24,4 +24,28 @@ export default {
 			method: 'get',
 		})
 	},
+	//查询收藏课程列表
+	courseCollectList(data) {
+		return myRequest({
+			url: '/collect/course/list',
+			method: 'get',
+			data: data,
+		})
+	},
+	//查询收藏题库列表
+	bankCollectList(data) {
+		return myRequest({
+			url: '/collect/bank/list',
+			method: 'get',
+			data: data,
+		})
+	},
+	//查询收藏重点列表
+	courseNoteList(data) {
+		return myRequest({
+			url: '/collect/note/list',
+			method: 'get',
+			data: data,
+		})
+	},
 }

+ 3 - 3
components/my.vue

@@ -133,10 +133,10 @@
 				collectTotal:0
 			};
 		},
-		mounted(){
-			this.getInfoAttached()
-		},
 		methods: {
+			init(){
+				this.getInfoAttached()
+			},
 			jumpPopup(){
 				this.show = true
 			},

+ 4 - 1
pages/index/index.vue

@@ -1,7 +1,7 @@
 <template>
 	<view>
 		<home v-show="current==0"></home>
-		<my v-show="current==1"></my>
+		<my v-show="current==1" ref="refMy"></my>
 		
 		<u-tabbar v-model="current" :list="list" active-color="#2F4379" :before-switch="beforeSwitch" ></u-tabbar>
 	</view>
@@ -51,6 +51,9 @@
 					this.$navTo.togo('/pages/login/login');
 					return false
 				}else{
+					if(index==1){
+						this.$refs.refMy.init()
+					}
 					return true
 				}
 				

+ 67 - 5
pages2/wd/collect.vue

@@ -5,7 +5,7 @@
 		</view>
 		<view >
 		    <view v-show="current === 0">
-		        <view class="content" v-for="(item,index) in list" :key="index">
+		        <view class="content" v-for="(item,index) in list1" :key="index">
 					<view class="c_t1">
 						2021年5月1日
 					</view>
@@ -51,19 +51,81 @@
 					'刷题', 
 					'重点考点'
 				],
-				list:[1,1,1,1,1,1,1,1,1,1,1],
+				list1: [],
+				list2: [],
+				list3: [],
+				paramList: [
+					{
+						pageNum: 1,
+						pageSize: 10,
+						total: 0,
+						showStatus: 0
+					},
+					{
+						pageNum: 1,
+						pageSize: 10,
+						total: 0,
+						showStatus: 0
+					},
+					{
+						pageNum: 1,
+						pageSize: 10,
+						total: 0,
+						showStatus: 0
+					}
+				],
 			}
 		},
 		onLoad(option) {
-			
+			this.initList()
 		},
 		onShow(){
 		},
 		methods: {
+			initList() {
+				this.courseList();
+				this.bankList();
+				this.noteList();
+			},
 			onClickItem(e){
 				this.current = e.currentIndex
-			}
-		
+			},
+			//课程
+			courseList() {
+				var self = this;
+				var param = this.paramList[0];
+				this.$api.courseCollectList(param).then(res => {
+					self.paramList[0].total = res.data.total;
+					self.list1.push.apply(self.list1, res.data.rows);
+					if (self.list1.length === res.data.total) {
+						self.paramList[0].showStatus = true;
+					}
+				});
+			},
+			//题库
+			bankList() {
+				var self = this;
+				var param = this.paramList[1];
+				this.$api.bankCollectList(param).then(res => {
+					self.paramList[1].total = res.data.total;
+					self.list2.push.apply(self.list2, res.data.rows);
+					if (self.list2.length === res.data.total) {
+						self.paramList[1].showStatus = true;
+					}
+				});
+			},
+			//考试重点
+			noteList() {
+				var self = this;
+				var param = this.paramList[2];
+				this.$api.courseNoteList(param).then(res => {
+					self.paramList[2].total = res.data.total;
+					self.list3.push.apply(self.list3, res.data.rows);
+					if (self.list3.length === res.data.total) {
+						self.paramList[2].showStatus = true;
+					}
+				});
+			},
 		},
 		
 	}