Tang 4 年 前
コミット
5601c7e81d
4 ファイル変更248 行追加152 行削除
  1. 30 0
      common/httpList/bank.js
  2. 49 17
      pages2/bank/detail.vue
  3. 157 104
      pages2/bank/question.vue
  4. 12 31
      pages2/course/detail.vue

+ 30 - 0
common/httpList/bank.js

@@ -57,4 +57,34 @@ export default {
 			method: 'get',
 		})
 	},
+	//查询题库试卷列表
+	banklistexam(data) {
+		return myRequest({
+			url:'/bank/exam/list',
+			method: 'get',
+			data: data,
+		})
+	},
+	//获取题库试卷详细信息
+	bankInfoexam(data) {
+		return myRequest({
+			url: '/bank/exam/' + data,
+			method: 'get',
+		})
+	},
+	//查询题目详情列表
+	questiondetailList(data) {
+		return myRequest({
+			url:'/bank/question/list',
+			method: 'get',
+			data: data,
+		})
+	},
+	//获取题目详情详细信息
+	questiondetail(data) {
+		return myRequest({
+			url: '/bank/question/' + data,
+			method: 'get',
+		})
+	},
 }

+ 49 - 17
pages2/bank/detail.vue

@@ -61,9 +61,9 @@
 					<u-col span="11"><view class="video_t1">2020年二级建造师教育选修</view></u-col>
 				</u-row>
 			</view>
-			<view><u-tabs :list="pageData.typeId === 1 ? list : list1" font-size="24" bar-width="100" :current="current" @change="change" active-color="#32467B"></u-tabs></view>
+			<view><u-tabs list="list" font-size="24" bar-width="100" :current="current" @change="change" active-color="#32467B"></u-tabs></view>
 			<u-line color="#D6D6DB" />
-			<view v-if="current == 0 && pageData.typeId === 1">
+			<view v-if="current == 0">
 				<!-- 题库目录-->
 				<view style="margin-top: 15rpx;">
 					<u-row>
@@ -86,7 +86,7 @@
 							</view>
 						</scroll-view>
 					</view> -->
-					<view class="catalogBox" :class="activeStatus ? 'changeCatalogBox' : ''">
+					<view v-if="pageData.typeId === 1" class="catalogBox" :class="activeStatus ? 'changeCatalogBox' : ''">
 						<view
 							class="catalogA"
 							v-for="(item, index) in chapterList"
@@ -97,6 +97,17 @@
 							{{ item.name }}
 						</view>
 					</view>
+					<view v-else class="catalogBox" :class="activeStatus ? 'changeCatalogBox' : ''">
+						<view
+							class="catalogA"
+							v-for="(item, index) in chapterList"
+							:key="index"
+							:class="activeStatusCata === item.examId ? 'activesq' : ''"
+							@click="getsecSJ(item, index)"
+						>
+							{{ item.name }}
+						</view>
+					</view>
 				</view>
 				<u-line color="#D6D6DB" />
 			</view>
@@ -222,17 +233,6 @@ export default {
 					name: '相关推荐'
 				}
 			],
-			list1: [
-				{
-					name: '题库介绍'
-				},
-				{
-					name: '出题名师'
-				},
-				{
-					name: '相关推荐'
-				}
-			],
 			current: 0,
 			activeStatus: false, //课程目录下拉样式变化是否开启
 			activeStatusCata: 0, //当前选中章节
@@ -254,6 +254,8 @@ export default {
 			this.pageData = options;
 			if (res.data.data.typeId === 1) {
 				this.getBankDList(options);
+			} else {
+				this.getBankDListSJ(options);
 			}
 			this.teacherS(options.teacherIds);
 			this.recommendList(options);
@@ -284,6 +286,25 @@ export default {
 				this.chapterList = chaList;
 			});
 		},
+		getBankDListSJ(options) {
+			var data = {
+				bankId: options.bankId
+			};
+			this.$api.banklistexam(data).then(res => {
+				var chaList = res.data.rows;
+				if (chaList.length === 0) {
+					uni.showToast({
+						title: '暂无相关试卷列表',
+						icon: 'none',
+						duration: 2000
+					});
+					return;
+				}
+				this.getsecSJ(chaList[0]);
+				this.chapterList = chaList;
+				console.log(this.chapterList);
+			});
+		},
 		activeList(item, index) {
 			var self = this;
 			var dataset = {
@@ -299,6 +320,11 @@ export default {
 			this.activeStatusCata = item.bankChapterId;
 			this.showBox = false;
 		},
+		getsecSJ(item) {
+			this.infoData = item;
+			this.activeStatusCata = item.examId;
+			this.showBox = false;
+		},
 		teacherS(v) {
 			var data = {
 				teacherIds: v
@@ -325,9 +351,15 @@ export default {
 			this.current = index;
 		},
 		jumpExam() {
-			this.$navTo.togo('/pages2/bank/question', {
-				type: 1
-			});
+			if (this.pageData.typeId === 1) {
+				this.$navTo.togo('/pages2/bank/question', {
+					bankSectionId: this.infoData.bankSectionId
+				});
+			} else {
+				this.$navTo.togo('/pages2/bank/question', {
+					examId: this.infoData.examId
+				});
+			}
 		},
 		drawProgressbg() {
 			// 使用 wx.createContext 获取绘图上下文 context

+ 157 - 104
pages2/bank/question.vue

@@ -1,6 +1,17 @@
 <template>
-	<view  >
-		<view  class="footer_tab">
+	<view>
+		<view class="contentList">
+			<view class="headerTitle">
+				<view class="leftIcon" v-for="(item, index) in titleS" :key="index" v-if="item.value === list[nowPageData].type">
+					<span >{{ item.label }}</span>
+				</view>
+				<view class="right">
+					1
+					<span class="lengNum">/10</span>
+				</view>
+			</view>
+		</view>
+		<view class="footer_tab">
 			<u-line color="#D6D6DB" />
 			<u-row gutter="16">
 				<u-col span="4">
@@ -30,10 +41,10 @@
 			</u-row>
 		</view>
 		<u-popup v-model="show" mode="bottom" :safe-area-inset-bottom="true">
-			<view class="popup_box" >
-				<scroll-view scroll-y="true" class="popup_list" >
-					<view v-for="(item,index) in list" :key="index" class="btn_num" :class="index%2==0?'btn_bac2':'btn_bac1'">
-						<text class="">{{index}}</text>
+			<view class="popup_box">
+				<scroll-view scroll-y="true" class="popup_list">
+					<view v-for="(item, index) in list" :key="index" class="btn_num" :class="index % 2 == 0 ? 'btn_bac2' : 'btn_bac1'">
+						<text class="">{{ index + 1 }}</text>
 					</view>
 				</scroll-view>
 			</view>
@@ -42,110 +53,152 @@
 </template>
 
 <script>
-	export default {
-		data() {
-			return {
-				type:1,
-				show:false,
-				list:[1,2,3,4,5,6,7,2,3,4,5,6,7,2,3,4,5,6,7,2,3,4,5,
-				6,1,2,3,4,5,6,7,2,3,4,5,6,7,2,3,4,5,6,7,2,3,4,5,6,7]
+export default {
+	data() {
+		return {
+			type: 1,
+			show: false,
+			list: [],
+			nowPageData: 0,
+			titleS: [
+				{
+					label: '单选题',
+					value: 1
+				},
+				{
+					label: '多选题',
+					value: 2
+				}
+			]
+		};
+	},
+	onLoad(option) {
+		this.titleListFn(option);
+	},
+	onShow() {},
+	methods: {
+		titleListFn(option) {
+			if (option.bankSectionId) {
+				var data = {
+					bankSectionId: option.bankSectionId
+				};
 			}
+			if (option.examId) {
+				var data = {
+					examId: option.examId
+				};
+			}
+			this.$api.questiondetailList(data).then(res => {
+				this.list = res.data.rows;
+			});
 		},
-		onLoad(option) {
-			this.type = option.type
-			console.log(this.type)
-		},
-		onShow(){
-		},
-		methods: {
-			menu(){
-				this.show = true
-			},
-		
-		},
-		
+		menu() {
+			this.show = true;
+		}
 	}
+};
 </script>
 <style>
-	::-webkit-scrollbar{
-		width: 0;
-		height: 0;
-		color: transparent;
-	}
-	.u-drawer-content-visible{
-		border-radius: 32rpx 32rpx 0rpx 0rpx;
-		overflow: hidden;
-	}
+::-webkit-scrollbar {
+	width: 0;
+	height: 0;
+	color: transparent;
+}
+.u-drawer-content-visible {
+	border-radius: 32rpx 32rpx 0rpx 0rpx;
+	overflow: hidden;
+}
 </style>
 <style scope>
-	.btn_bac2{
-		background: #32467B;
-		color: #FFf;
-	}
-	.btn_bac1{
-		background: #F7F8FF;
-		color: #666666;
-	}
-	.btn_num::before{
-		content: "";
-		padding-top: 100%;
-		display: block;}
-	.btn_num text{
-		
-		font-size: 24rpx;
-		width: 100%;
-		display: inline-block;
-		text-align: center;
-		top: 50%;
-		position: absolute;
-		height: 30rpx;
-		line-height: 30rpx;
-		margin-top: -15rpx;
-		}
-	.btn_num{
-		
-		border-radius: 32rpx;
-		width: 16%;
-		margin: 2%;
-		display: inline-block;
-		position: relative;
-	}
-	.popup_list{
-		border-radius: 32rpx 32rpx 0rpx 0rpx;
-		height: 899rpx;
-		background: #F2F3F6;
-		padding-bottom: 30rpx;
-	}
-	.popup_box{
-		height: 899rpx;
-		box-shadow: 0rpx 0rpx 16rpx 4rpx rgba(145, 156, 178, 0.1);
-		border-radius: 32rpx 32rpx 0rpx 0rpx;
-		background: #F2F3F6;
-		padding: 30rpx;
-	}
-	.sc_t{
-		font-size: 22rpx;
-		color: #000000;
-	}
-	.box{
-		height: 95rpx;
-		display: flex;
-		flex-direction: column;
-		justify-content: center;
-		position: relative;
-	}
-	.sc{
-		width: 29rpx ;
-		height: 29rpx;
-	}
-	.footer_tab{
-		position:fixed;
-		bottom:0;
-		height: 96rpx;
-		width: 100%;
-		background-color: #FFFFFF;
-	}
+.contentList {
+	padding: 0rpx 32rpx;
+}
+.contentList > .headerTitle {
+	display: flex;
+	align-items: center;
+	justify-content: space-between;
+	color: #32467b;
+}
+.headerTitle > .leftIcon {
+	padding: 0rpx 10rpx;
+	height: 36rpx;
+	line-height: 36rpx;
+	border: 1rpx solid #32467b;
+	font-size: 28rpx;
+	border-radius: 10rpx;
+	background-color: rgba(50, 70, 123, 0.1);
+}
+.headerTitle > .right > .lengNum {
+	font-size: 28rpx;
+	color: #999999;
+}
+.btn_bac2 {
+	background: #32467b;
+	color: #fff;
+}
+.btn_bac1 {
+	background: #f7f8ff;
+	color: #666666;
+}
+.btn_num::before {
+	content: '';
+	padding-top: 100%;
+	display: block;
+}
+.btn_num text {
+	font-size: 24rpx;
+	width: 100%;
+	display: inline-block;
+	text-align: center;
+	top: 50%;
+	position: absolute;
+	height: 30rpx;
+	line-height: 30rpx;
+	margin-top: -15rpx;
+}
+.btn_num {
+	border-radius: 32rpx;
+	width: 16%;
+	margin: 2%;
+	display: inline-block;
+	position: relative;
+}
+.popup_list {
+	border-radius: 32rpx 32rpx 0rpx 0rpx;
+	height: 899rpx;
+	background: #f2f3f6;
+	padding-bottom: 30rpx;
+}
+.popup_box {
+	height: 899rpx;
+	box-shadow: 0rpx 0rpx 16rpx 4rpx rgba(145, 156, 178, 0.1);
+	border-radius: 32rpx 32rpx 0rpx 0rpx;
+	background: #f2f3f6;
+	padding: 30rpx;
+}
+.sc_t {
+	font-size: 22rpx;
+	color: #000000;
+}
+.box {
+	height: 95rpx;
+	display: flex;
+	flex-direction: column;
+	justify-content: center;
+	position: relative;
+}
+.sc {
+	width: 29rpx;
+	height: 29rpx;
+}
+.footer_tab {
+	position: fixed;
+	bottom: 0;
+	height: 96rpx;
+	width: 100%;
+	background-color: #ffffff;
+}
 page {
-		background: #FFFFFF;
-	}
+	background: #ffffff;
+}
 </style>

+ 12 - 31
pages2/course/detail.vue

@@ -235,7 +235,7 @@ export default {
 		Verify.init();
 		this.$api.courseInfo(option.id).then(res => {
 			this.queryData = res.data.data;
-			this.getCourseInfo();
+			this.getTeacher(res.data.data.teacherIds);
 			this.getChapter(res.data.data.courseId);
 			this.getcommendList(res.data.data.courseId);
 		});
@@ -247,9 +247,9 @@ export default {
 		}
 		let that = this;
 		this.windowHeight = uni.getSystemInfoSync().windowHeight;
-		setTimeout(function(){
-			that.getHeight()
-		},1800)
+		setTimeout(function() {
+			that.getHeight();
+		}, 1800);
 	},
 	onPageScroll: function(e) {
 		//防止触发两次跳动
@@ -270,8 +270,8 @@ export default {
 		}
 	},
 	methods: {
-		getHeight(){
-			let that = this
+		getHeight() {
+			let that = this;
 			const query = uni.createSelectorQuery().in(this);
 			query
 				.select('#modules1')
@@ -284,7 +284,7 @@ export default {
 				.select('#modules2')
 				.boundingClientRect(data => {
 					that.h2 = data.height;
-					console.log(data.height,66)
+					console.log(data.height, 66);
 					that.countHeight(that);
 				})
 				.exec();
@@ -299,7 +299,7 @@ export default {
 				.select('#modules4')
 				.boundingClientRect(data => {
 					that.h4 = data.height;
-					console.log(data.height,4444)
+					console.log(data.height, 4444);
 					that.countHeight(that);
 				})
 				.exec();
@@ -352,7 +352,7 @@ export default {
 			}
 		},
 		getcommendList(v) {
-			let self = this
+			let self = this;
 			var data = {
 				courseId: v
 			};
@@ -377,21 +377,10 @@ export default {
 			this.activeStatusCata = item.chapterId;
 			this.showBox = false;
 		},
-
-		getCourseInfo() {
-			var self = this;
-			this.$api.courseInfo(this.queryData.courseId).then(res => {
-				if (res.data.code === 200) {
-					self.pageData = res.data.data;
-					self.getTeacher(res.data.data.teacherIds);
-
-				}
-			});
-		},
 		getChapter(v) {
 			var self = this;
 			var data = {
-				courseId: v 
+				courseId: v
 			};
 			this.$api.coursechapterlist(data).then(res => {
 				var chaList = res.data.rows;
@@ -409,19 +398,11 @@ export default {
 				self.$api.coursesectionlist(dataset).then(result => {
 					self.getsec(result.data.rows[0]);
 				});
-				if(chaList.length>0){
-					var dataset = {
-						chapterId: res.data.rows[0].chapterId
-					};
-					self.$api.coursesectionlist(dataset).then(result => {
-						self.getsec(result.data.rows[0]);
-					});
-				}
 				this.chapterList = chaList;
 			});
 		},
 		getTeacher(v) {
-			let self = this
+			let self = this;
 			var data = {
 				teacherIds: v
 			};
@@ -521,7 +502,7 @@ export default {
 		},
 		getNavTo(item) {
 			this.$navTo.togo('/pages2/course/detail', {
-				id:item.courseId
+				id: item.courseId
 			});
 		},
 		change(index) {