he2802 il y a 4 ans
Parent
commit
364d32cfc1
2 fichiers modifiés avec 62 ajouts et 11 suppressions
  1. 8 0
      common/httpList/plan.js
  2. 54 11
      components/home.vue

+ 8 - 0
common/httpList/plan.js

@@ -26,4 +26,12 @@ export default {
 			data: data
 		})
 	},
+	//本周用户学习计划
+	userPlanSeven(data) {
+		return myRequest({
+			url: '/plan/userPlanSeven',
+			method: 'get',
+			data: data
+		})
+	},
 }

+ 54 - 11
components/home.vue

@@ -33,14 +33,14 @@
 					<view style="width: 100%;display: flex;justify-content:center;margin-top: 40rpx;">
 						<view v-for="(item, index) in date_num" :key="index" class="date_num">{{ item }}</view>
 					</view>
-					<view style="width: 100%;margin-top: 20rpx;" v-if="false">
+					<view style="width: 100%;margin-top: 20rpx;"  >
 						<u-row gutter="16">
 							<u-col span="2" text-align="center">
-								<view><image src="/static/left.png" class="arr-icon"></image></view>
+								<view><image src="/static/left.png" class="arr-icon" @click="preveItem"></image></view>
 							</u-col>
-							<u-col span="8" text-align="center"><view class="course_title">二级建造师市政公用工程</view></u-col>
+							<u-col span="8" text-align="center"><view class="course_title" @click="jumpCourseDetail()">{{ courseItem.courseName }}</view></u-col>
 							<u-col span="2" text-align="center">
-								<view><image src="/static/right.png" class="arr-icon"></image></view>
+								<view><image src="/static/right.png" class="arr-icon" @click="nextItem"></image></view>
 							</u-col>
 						</u-row>
 					</view>
@@ -120,6 +120,11 @@ export default {
 	name: 'home',
 	data() {
 		return {
+			courseItem:{},
+			courseIndex:0,
+			vertical:"vertical",
+			workList: [],
+			workTextList: [],
 			show: false,
 			tab_list: [
 				{
@@ -167,17 +172,55 @@ export default {
 		this.windowHeight = uni.getSystemInfoSync().windowHeight;
 		this.initList();
 		this.advertisingList();
-		// d是当前星期一的日期对象
-		var d=this.getMonDate();
-		var arr=[];
-		for(var i=0; i<7; i++)
-		{
-			this.date_num.push(d.getDate())
-			d.setDate(d.getDate()+1);
+		if(!this.$method.isLogin()){
+			//未登录
+			// d是当前星期一的日期对象
+			var d=this.getMonDate();
+			var arr=[];
+			for(var i=0; i<7; i++)
+			{
+				this.date_num.push(d.getDate())
+				d.setDate(d.getDate()+1);
+			}
+		}else{
+			this.userPlanSeven()
 		}
+		
 		console.log(arr)
 	},
 	methods: {
+		preveItem(){
+			if(self.courseIndex>0){
+				self.courseIndex  = self.courseIndex-1
+				self.courseItem = self.workList[self.courseIndex]
+			}
+		},
+		nextItem(){
+			if(self.courseIndex<self.workList.length-1){
+				self.courseIndex  = self.courseIndex+1
+				self.courseItem = self.workList[self.courseIndex]
+			}
+		},
+		jumpCourseDetail(){
+			this.$navTo.togo('/pages2/course/detail', {
+				id: this.courseItem.courseId
+			});
+		},
+		noticeBar(index){
+			let item = this.workList[index]
+			this.$navTo.togo('/pages2/course/detail', {
+				id: item.courseId
+			});
+		},
+		userPlanSeven() {
+			let self = this;
+			this.$api.userPlanSeven().then(result => {
+				 self.workList = result.data.data.coursePlanVo;
+				 if(self.workList.length>0){
+					 self.courseItem = self.workList[self.courseIndex]
+				 }
+			});
+		},
 		getMonDate()
 		{
 			var d=new Date(),