Bladeren bron

fix 已做的题

he2802 3 jaren geleden
bovenliggende
commit
cb51da900f
2 gewijzigde bestanden met toevoegingen van 148 en 22 verwijderingen
  1. 147 21
      pages/index/index.vue
  2. 1 1
      pages2/class/detail.vue

+ 147 - 21
pages/index/index.vue

@@ -67,7 +67,7 @@
 								<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" @click="jumpCourseDetail()">{{ workList[0].goodsName }}</view>
+								<view class="course_title" @click="jumpGoodsDetail(goodsItem)">{{ goodsItem.goodsName }}</view>
 							</u-col>
 							<u-col span="2" text-align="center">
 								<view><image src="/static/right.png" class="arr-icon" @click="nextItem"></image></view>
@@ -76,25 +76,44 @@
 					</view>
 				</view>
 			</view>
-			<u-tabs class="tabs" :current="tabCurrent" @change="tab" :list="list1" :activeStyle="{fontSize:'36rpx'}" :inactiveStyle="{color:'#EAEEF1',fontSize:'30rpx'}" sticky></u-tabs>
-			<view class="course-list">
-				<view class="item" v-for="item in 3">
+			<u-tabs class="tabs" :current="tabCurrent" @change="tab" :list="menu" :activeStyle="{fontSize:'36rpx'}" :inactiveStyle="{color:'#EAEEF1',fontSize:'30rpx'}" sticky></u-tabs>
+			<view class="course-list" v-show="tabCurrent==0">
+				<navigator class="item" v-for="(item,index) in list1" :url="'/pages2/course/detail?id='+item.goodsId">
 					<view class="img">
-						<image src="/static/wd_bg_login.jpg"></image>
-						<view class="time">2020</view>
+						<image :src="$method.splitImgHost(item.coverUrl, true)"></image>
+						<view class="time">{{item.year?item.year:''}}</view>
 					</view>
 					<view class="text">
-						<view class="title">施工现场专业人员岗位培训基础班(设备安装质量员)</view>
+						<view class="title">{{item.goodsName}}</view>
 						<view class="desc">
 							<view class="left">
-								60
+								{{item.classHours}}
 								<text>学时</text>
 							</view>
-							<view class="right">¥ 999.00</view>
+							<view class="right">¥ {{item.standPrice}}</view>
 						</view>
 					</view>
 					
-				</view>
+				</navigator>
+			</view>
+			<view class="course-list" v-show="tabCurrent==1">
+				<navigator class="item" v-for="(item,index) in list2" :url="'/pages2/bank/detail?id='+item.goodsId">
+					<view class="img">
+						<image :src="$method.splitImgHost(item.coverUrl, true)"></image>
+						<view class="time">{{item.year?item.year:''}}</view>
+					</view>
+					<view class="text">
+						<view class="title">{{item.goodsName}}</view>
+						<view class="desc">
+							<view class="left" v-if="false">
+								{{item.classHours}}
+								<text>学时</text>
+							</view>
+							<view class="right">¥ {{item.standPrice}}</view>
+						</view>
+					</view>
+					
+				</navigator>
 			</view>
 		</view>
 	</view>
@@ -119,24 +138,46 @@ export default {
 			autoplay: true,
 			interval: 2000,
 			duration: 500,
-			list1: [{
+			menu: [{
 					name: '推荐课程',
 				}, {
 					name: '推荐题库',
 				}],
 			goodsIndex: 0,
+			goodsItem: 0,
 			workList: [],
-			workTextList: []
+			workTextList: [],
+			planGoodsList: [],
+			paramList: [
+				{
+					pageNum: 1,
+					pageSize: 10,
+					total: 0,
+					showStatus: 0,
+					goodsType:1
+				},
+				{
+					pageNum: 1,
+					pageSize: 10,
+					total: 0,
+					showStatus: 0,
+					goodsType:2
+				}
+			],
+			list1: [],
+			list2: [],
 		};
 	},
 	onPullDownRefresh() {},
 	onLoad(option) {
 		this.init()
+		this.courseList();
+		this.bankList();
 	},
 	onShow() {
-		/* if(this.current === 2 && this.$method.isLogin()){
-			this.$refs.refMy.init();
-		} */
+		 if(this.$method.isLogin()){
+			this.init()
+		} 
 	},
 	onShareAppMessage(res) {
 		var self = this;
@@ -146,6 +187,51 @@ export default {
 		};
 	},
 	methods: {
+		//课程
+		courseList() {
+			var self = this;
+			var param = this.paramList[0];
+			this.$api.goodsList(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.goodsList(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;
+				}
+			});
+		},
+		jumpGoodsDetail(item){
+			this.$navTo.togo('/pages2/wd/course', {
+				id: item.goodsId
+			});
+		},
+		preveItem() {
+			if (this.goodsIndex > 0) {
+				this.goodsIndex = this.goodsIndex - 1;
+				this.planGoodsList =this.workList[this.goodsIndex].goodsVos
+				this.goodsItem = this.planGoodsList[0];
+				this.dealRL(this.workList[this.goodsIndex].calendarStudyVo)
+			}
+		},
+		nextItem() {
+			if (this.goodsIndex < this.workList.length - 1) {
+				this.goodsIndex = this.goodsIndex + 1;
+				this.planGoodsList =this.workList[this.goodsIndex].goodsVos
+				this.goodsItem = this.planGoodsList[0];
+				this.dealRL(this.workList[this.goodsIndex].calendarStudyVo)
+			}
+		},
 		jumpPlan() {
 			if (!this.$method.isLogin()) {
 				this.$navTo.togo('/pages/login/login');
@@ -158,10 +244,12 @@ export default {
 				//未登录
 				this.date_num = [];
 				this.workList = [];
+				this.planGoodsList = [];
 				this.initDay();
 			} else {
 				this.date_num = [];
 				this.workList = [];
+				this.planGoodsList = [];
 				this.userPlanSeven();
 			}
 		},
@@ -189,17 +277,50 @@ export default {
 				d.setDate(d.getDate() + 1);
 			}
 		},
+		dealRL(calendarStudyVo){
+			let self = this
+			self.date_num = []
+			let date = new Date();
+			let num = date.getDate();
+			let month = date.getMonth() + 1;
+			let list = [];
+			for (let i = 0; i < calendarStudyVo.length; i++) {
+				let item = calendarStudyVo[i];
+				if (item.month == month) {
+					list = item.dayStudyList;
+				}
+			}
+			for (let i = 0; i < list.length; i++) {
+				let item = list[i];
+				item.color = 0;
+				if (item.date == num) {
+					item.color = 3;
+				}
+				if (item.perform == 1) {
+					item.color = 1;
+				}
+				if (item.perform == 2) {
+					item.color = 2;
+				}
+				item.note = item.studyCourseKnob;
+				if (item.note > 0) {
+					item.dot = true;
+				}
+				self.date_num.push(item);
+			}
+		},
 		userPlanSeven() {
 			let self = this;
 			this.$api.userPlanSeven().then(result => {
 				if (result.data.data.length>0) {
 					
-					self.workList = result.data.data[0].goodsVos;
-					if (self.workList != null && self.workList.length > 0) {
-						self.courseItem = self.workList[self.goodsIndex];
+					self.workList = result.data.data
+					self.planGoodsList = self.workList[0].goodsVos;
+					if (self.planGoodsList != null && self.planGoodsList.length > 0) {
+						self.goodsItem = self.planGoodsList[0];
 					}
-					console.log(self.workList)
-					let date = new Date();
+					self.dealRL(result.data.data[0].calendarStudyVo)
+					/* let date = new Date();
 					let num = date.getDate();
 					let month = date.getMonth() + 1;
 					let list = [];
@@ -226,7 +347,7 @@ export default {
 							item.dot = true;
 						}
 						self.date_num.push(item);
-					}
+					} */
 				} else {
 					self.initDay();
 				}
@@ -319,6 +440,7 @@ export default {
 				flex:1;
 				font-size: 24rpx;
 				color: #333333;
+				position: relative;
 			}
 			
 			.btn {
@@ -477,6 +599,7 @@ export default {
 				.text {
 					flex:1;
 					padding-right:10rpx;
+					position: relative;
 					.title {
 						font-size: 30rpx;
 						color: #333333;
@@ -485,6 +608,9 @@ export default {
 					.desc {
 						margin-top:40rpx;
 						display: flex;
+						position: absolute;
+						bottom: 0;
+						width: 100%;
 						.left {
 							flex:1;
 							color:#333;

+ 1 - 1
pages2/class/detail.vue

@@ -136,7 +136,7 @@
 		<u-popup v-model="photoPopup" mode="bottom" border-radius="32" :mask-close-able="false">
 					<view class="photoBox">
 						<view class="photoTop">
-							<view class="sqzz" v-if="true">
+							<view class="sqzz" v-if="false">
 								<u-icon name="close" color="#333333" size="30" @click="closePhoto"></u-icon>
 							</view>
 							<view class="centersq">