Tang 3 jaren geleden
bovenliggende
commit
8e30bd1ada

+ 339 - 306
pages2/bank/question_record.vue

@@ -1,368 +1,401 @@
 <template>
 	<view>
 		<view class="tabs">
-			<view class="tab" :class="{active:index==1}" data-index="1" @click="tab">全部题库记录</view>
-			<view class="tab" :class="{active:index==2}" data-index="2" @click="tab">全部试卷类型</view>
+			<view class="tab" :class="{ active: index == 1 }" data-index="1" @click="tab">全部题库记录</view>
+			<view class="tab" :class="{ active: index == 2 }" data-index="2" @click="tab">全部试卷类型</view>
 		</view>
-		
+
 		<view class="record">
 			<view class="item" v-for="record in recordList">
-				<view class="note">{{record.paperName}}</view>
-				<view class="title">{{record.examName}}</view>
+				<view class="note">{{ record.paperName }}</view>
+				<view class="title">{{ record.examName }}</view>
 				<view class="desc">
 					<view>
 						<image src="/static/icon/wk_icon2.png"></image>
-						<text>{{$method.timestampToTime(record.updateTime,false)}}</text>
+						<text>{{ $method.timestampToTime(record.updateTime, false) }}</text>
 					</view>
 					<view>
 						<image src="/static/icon/wk_icon2.png"></image>
-						<text>总共 {{record.totalQuestionNum}} 题 做对  {{record.rightQuestionNum}} 题</text>
+						<text>总共 {{ record.totalQuestionNum }} 题 做对 {{ record.rightQuestionNum }} 题</text>
 					</view>
 				</view>
 				<view class="btns">
-					<view class="btn" v-if="record.status == 1" @click="doRepeat(record.examId,record.goodsId,record.moduleExamId,record.chapterExamId)">
-						重做
-					</view>
-					<navigator :url="'/pages2/bank/questionBankExplain?explain=1&id='+record.examId+'&goodsid='+record.goodsId+'&moduleId='+record.moduleExamId+'&chapterId='+record.chapterExamId+''">
-						<view class="btn" v-if="record.status == 1">
-							解析
-						</view>
-					</navigator>
-					<navigator :url="'/pages2/bank/question_report?id='+record.recordId">
-						<view class="btn" v-if="record.status == 1">
-							报告
-						</view>
+					<view class="btn" v-if="record.status == 1" @click="doRepeat(record.examId, record.goodsId, record.moduleExamId, record.chapterExamId)">重做</view>
+					<navigator
+						:url="
+							'/pages2/bank/questionBankExplain?explain=1&id=' +
+								record.examId +
+								'&goodsid=' +
+								record.goodsId +
+								'&moduleId=' +
+								record.moduleExamId +
+								'&chapterId=' +
+								record.chapterExamId +
+								''
+						"
+					>
+						<view class="btn" v-if="record.status == 1">解析</view>
 					</navigator>
-					<navigator :url="'/pages2/bank/questionBankExplain?continue=1&recordId='+record.recordId+'&id='+record.examId+'&goodsid='+record.goodsId+'&moduleId='+record.moduleExamId+'&chapterId='+record.chapterExamId+''">
-						<view class="btn" v-if="record.status == 0">
-							继续
-						</view>
+					<navigator :url="'/pages2/bank/question_report?id=' + record.recordId"><view class="btn" v-if="record.status == 1">报告</view></navigator>
+					<navigator
+						:url="
+							'/pages2/bank/questionBankExplain?continue=1&recordId=' +
+								record.recordId +
+								'&id=' +
+								record.examId +
+								'&goodsid=' +
+								record.goodsId +
+								'&moduleId=' +
+								record.moduleExamId +
+								'&chapterId=' +
+								record.chapterExamId +
+								''
+						"
+					>
+						<view class="btn" v-if="record.status == 0">继续</view>
 					</navigator>
 				</view>
 			</view>
 		</view>
-		
-		
-		<view class="modal" v-if="index==1">
+
+		<view class="modal" v-if="index == 1">
 			<view class="content">
-				<view class="top">全部题库记录</view>
+				<view class="top" :class="activeIndex === 0 ? 'activesty' : ''" @click="testClick(3)">全部题库记录</view>
 				<view class="list">
-					<view class="item" v-for="listItem in list" @click="testClick(listItem)">{{listItem.goodsName}}</view>
+					<view class="item" :class="activeIndex == listItem.goodsId ? 'activesty' : ''" v-for="listItem in list" @click="testClick(listItem)">
+						{{ listItem.goodsName }}
+					</view>
 				</view>
 			</view>
-			<view class="modal_wrap" @click="index=0"></view>
+			<view class="modal_wrap" @click="index = 0"></view>
 		</view>
-		
-		<view class="modal" v-if="index==2">
+
+		<view class="modal" v-if="index == 2">
 			<view class="content">
-				<view class="top">全部试卷类型</view>
+				<view class="top" :class="typeIndex === 0 ? 'activesty' : ''" @click="paperClick(3)">全部试卷类型</view>
 				<view class="list">
-					<view class="item" v-for="listItem in list1" @click="paperClick(listItem)">{{listItem.paperName}}</view>
+					<view class="item" :class="typeIndex == listItem.paperId ? 'activesty' : ''" v-for="listItem in list1" @click="paperClick(listItem)">{{ listItem.paperName }}</view>
 				</view>
 			</view>
-			<view class="modal_wrap" @click="index=0"></view>
+			<view class="modal_wrap" @click="index = 0"></view>
 		</view>
 	</view>
 </template>
 
 <script>
-	export default {
-		data() {
-			return {
-				index:0,
-				list:[],
-				list1:[],
-				recordList:[],
-				goodsData:{},
-				param:{
-					pageNum:1,
-					pageSize:10
-				},
-				total:0
+export default {
+	data() {
+		return {
+			index: 0,
+			list: [],
+			list1: [],
+			recordList: [],
+			goodsData: {},
+			param: {
+				pageNum: 1,
+				pageSize: 10
+			},
+			total: 0,
+			activeIndex: 0,
+			typeIndex:0,
+		};
+	},
+	onLoad(option) {
+		this.listGoodsUserQuestion();
+		this.examaperList();
+		this.getExamRecordList();
+	},
+	onPullDownRefresh() {
+		let that = this;
+		this.param = {
+			pageNum: 1,
+			pageSize: 10
+		};
+		this.getExamRecordList();
+		setTimeout(function() {
+			uni.stopPullDownRefresh();
+		}, 500);
+	},
+	onReachBottom() {
+		if (this.recordList.length < this.total) {
+			this.param.pageNum++;
+			this.getExamRecordList();
+		}
+	},
+	onShow() {},
+	methods: {
+		getExamRecordList() {
+			if (this.param.pageNum == 1) {
+				this.recordList = [];
 			}
+			this.$api.examRecordList(this.param).then(res => {
+				this.recordList.push.apply(this.recordList, res.data.rows);
+				this.total = res.data.total;
+			});
 		},
-		onLoad(option) {
-			this.listGoodsUserQuestion();
-			this.examaperList();
-			this.getExamRecordList()
-			
+		/**
+		 * 去做题
+		 */
+		async doRepeat(id, goodsId, moduleId = 0, chapterId = 0) {
+			await this.getDetail();
+			let count = await this.examRecordCount(id);
+			let answerNum = await this.getExamDetail(id);
+			//超过答题次数
+			if (answerNum > 0 && count >= answerNum) {
+				this.$u.toast('该试卷只能答题' + answerNum + '次!');
+				return;
+			}
+
+			uni.navigateTo({
+				url: '/pages2/bank/questionBankExplain?id=' + id + '&goodsid=' + goodsId + '&moduleId=' + moduleId + '&chapterId=' + chapterId + ''
+			});
 		},
-		onPullDownRefresh(){
-			let that = this
-			this.param = {
-					pageNum:1,
-					pageSize:10
-				}
-				this.getExamRecordList()
-			setTimeout(function(){
-				uni.stopPullDownRefresh()
-			},500)
+		/**
+		 * @param {Object} exam_id
+		 * 获取试卷可以做的次数
+		 */
+		getExamDetail(exam_id) {
+			return new Promise(resolve => {
+				this.$api.getExamDetail(exam_id).then(res => {
+					resolve(res.data.data.answerNum);
+				});
+			});
+		},
+		/**
+		 * 查询试卷历史做题次数
+		 */
+		examRecordCount(examId) {
+			return new Promise(resolve => {
+				this.$api
+					.examRecordCount({
+						examId: examId,
+						goodsId: this.id
+					})
+					.then(res => {
+						resolve(res.data.data);
+					});
+			});
+		},
+
+		getDetail() {
+			return new Promise(resolve => {
+				this.$api.goodsDetail(this.id).then(res => {
+					this.goodsData = res.data.data;
+
+					resolve();
+				});
+			});
 		},
-		onReachBottom() {
-			if (this.recordList.length < this.total) {
-				this.param.pageNum++
-				this.getExamRecordList()
+		testClick(item) {
+			if (item === 3) {
+				this.index = 0;
+				this.activeIndex = 0;
+				this.param.goodsId = '';
+				this.param.pageNum = 1;
+				this.getExamRecordList();
+			} else {
+				this.index = 0;
+				this.activeIndex = item.goodsId;
+				this.param.goodsId = item.goodsId;
+				this.param.pageNum = 1;
+				this.getExamRecordList();
 			}
 		},
-		onShow(){
-			
+		paperClick(item) {
+			if (item === 3) {
+				this.index = 0;
+				this.typeIndex = 0;
+				this.param.paperId = '';
+				this.param.pageNum = 1;
+				this.getExamRecordList();
+			} else {
+				this.index = 0;
+				this.typeIndex = item.paperId;
+				this.param.paperId = item.paperId;
+				this.param.pageNum = 1;
+				this.getExamRecordList();
+			}
 		},
-		methods: {
-			getExamRecordList(){
-				if(this.param.pageNum==1){
-					this.recordList = []
-				}
-				this.$api.examRecordList(this.param).then(res => {
-					this.recordList.push.apply(this.recordList,res.data.rows)
-					this.total = res.data.total
-				})
-			},
-			/**
-			 * 去做题
-			 */
-			async doRepeat (id,goodsId,moduleId = 0, chapterId = 0) {
-				await this.getDetail()
-				let count = await this.examRecordCount(id);
-				let answerNum = await this.getExamDetail(id);
-				//超过答题次数
-				if(answerNum>0&&count >= answerNum) {
-					this.$u.toast('该试卷只能答题'+answerNum+'次!');
-					return
-				}
-				
-				uni.navigateTo({
-					url:'/pages2/bank/questionBankExplain?id='+id+'&goodsid='+goodsId+'&moduleId='+moduleId+'&chapterId='+chapterId+''
-				})
-			},
-			/**
-			 * @param {Object} exam_id
-			 * 获取试卷可以做的次数
-			 */
-			getExamDetail(exam_id){
-				return new Promise(resolve => {
-				this.$api.getExamDetail(exam_id).then(res => {
-					resolve(res.data.data.answerNum)
-				})
-				})
-			},
-			/**
-			 * 查询试卷历史做题次数
-			 */
-			examRecordCount(examId) {
-				return new Promise(resolve => {
-					
-					this.$api.examRecordCount({
-						examId:examId,
-						goodsId:this.id
-					}).then(res => {
-						
-						resolve(res.data.data)
-					})
-				})
-			},
-			
-			getDetail(){
-				return new Promise(resolve => {
-					
-					this.$api.goodsDetail(this.id).then(res => {
-						this.goodsData = res.data.data;
-						 
-						 resolve()
-					})
-				})
-			},
-			testClick(item) {
-				this.index = 0
-				this.param.goodsId = item.goodsId
-				this.param.pageNum = 1
-				this.getExamRecordList()
-			},
-			paperClick(item) {
-				this.index = 0
-				this.param.paperId = item.paperId
-				this.param.pageNum = 1
-				this.getExamRecordList()
-			},
-			tab(e) {
-				this.index = e.currentTarget.dataset.index;
-			},
-			
-			examaperList() {
-				this.$api.examaperList({
-					
-				}).then(res => {
-					this.list1 = res.data.rows;
-				})
-			},
-			
-			listGoodsUserQuestion() {
-				this.$api.listGoodsUserQuestion({
-					
-				}).then(res => {
-					this.list = res.data.rows;
-				})
-			},
+		tab(e) {
+			this.index = e.currentTarget.dataset.index;
+			console.log(this.index);
 		},
-		
+
+		examaperList() {
+			this.$api.examaperList({}).then(res => {
+				this.list1 = res.data.rows;
+			});
+		},
+
+		listGoodsUserQuestion() {
+			this.$api.listGoodsUserQuestion({}).then(res => {
+				this.list = res.data.rows;
+			});
+		}
 	}
+};
 </script>
-<style >
-	page {
-			background: #EAEEF1;
-		}
+<style>
+page {
+	background: #eaeef1;
+}
 </style>
 <style lang="scss" scope>
-	
-	.tabs {
-		position:fixed;
-		left:0;
-		width:100%;
-		top:0;
-		display: flex;
-		z-index: 10;
-		.tab {
-			flex:1;
-			height: 80rpx;
+.tabs {
+	position: fixed;
+	left: 0;
+	width: 100%;
+	top: 0;
+	display: flex;
+	z-index: 10;
+	.tab {
+		flex: 1;
+		height: 80rpx;
+		text-align: center;
+		line-height: 80rpx;
+		background: #ffffff;
+		font-size: 32rpx;
+		color: #999999;
+
+		&.active {
+			color: #333333;
+		}
+	}
+}
+
+.record {
+	margin-top: 80rpx;
+	padding: 16rpx 8rpx;
+	-moz-column-count: 2; /* Firefox */
+	-webkit-column-count: 2; /* Safari 和 Chrome */
+	column-count: 2;
+	-moz-column-gap: 16rpx;
+	-webkit-column-gap: 16rpx;
+	column-gap: 16rpx;
+	.item {
+		margin-bottom: 16rpx;
+		-moz-page-break-inside: avoid;
+		-webkit-column-break-inside: avoid;
+		break-inside: avoid;
+		background: #ffffff;
+		border-radius: 16rpx;
+		padding: 65rpx 20rpx 22rpx;
+		position: relative;
+		overflow: hidden;
+
+		.note {
+			color: #fff;
+			position: absolute;
+			left: 0;
+			top: 0;
+			// width: 112rpx;
+			padding: 0rpx 10rpx;
+			height: 40rpx;
 			text-align: center;
-			line-height: 80rpx;
-			background: #FFFFFF;
+			line-height: 40rpx;
+			background: linear-gradient(0deg, #4facfe, #007aff);
+			border-radius: 16rpx 0px 16rpx 0rpx;
+		}
+
+		.title {
 			font-size: 32rpx;
-			color: #999999;
-			
-			&.active {
-				color:#333333;
-			}
+			color: #333333;
+			font-weight: bold;
 		}
-	}
-	
-	.record {
-		margin-top:80rpx;
-		padding:16rpx 8rpx;
-		-moz-column-count:2; /* Firefox */
-		-webkit-column-count:2; /* Safari 和 Chrome */
-		column-count:2;
-		-moz-column-gap: 16rpx;
-		-webkit-column-gap: 16rpx;
-		column-gap: 16rpx;
-		.item {
-			margin-bottom:16rpx;
-			-moz-page-break-inside: avoid;
-			-webkit-column-break-inside: avoid;
-			break-inside: avoid;
-			background: #FFFFFF;
-			border-radius: 16rpx;
-			padding:65rpx 20rpx 22rpx;
-			position: relative;
-			overflow: hidden;
-			
-			.note {
-				color:#fff;
-				position:absolute;
-				left:0;
-				top:0;
-				width: 112rpx;
-				height: 40rpx;
-				text-align: center;
-				line-height: 40rpx;
-				background: linear-gradient(0deg, #4FACFE, #007AFF);
-				border-radius: 16rpx 0px 16rpx 0rpx;
-			}
-			
-			.title {
-				font-size: 32rpx;
-				color: #333333;
-				font-weight: bold;
-			}
-			
-			.desc {
-				margin-top:26rpx;
-				view {
-					margin:16rpx 0;
-					
-					image {
-						width: 23rpx;
-						height: 24rpx;
-					}
-					
-					text {
-						margin-left:15rpx;
-						font-size: 24rpx;
-						color: #999999;
-						line-height: 36rpx;
-					}
+
+		.desc {
+			margin-top: 26rpx;
+			view {
+				margin: 16rpx 0;
+
+				image {
+					width: 23rpx;
+					height: 24rpx;
 				}
-			}
-			
-			.btns {
-				margin-top:26rpx;
-				display: flex;
-				justify-content: space-around;
-				.btn {
-					width: 100rpx;
-					height: 48rpx;
-					line-height: 48rpx;
-					text-align: center;
-					color:#007AFF;
-					background: #FFFFFF;
-					border: 1rpx solid #007AFF;
-					border-radius: 16rpx;
+
+				text {
+					margin-left: 15rpx;
+					font-size: 24rpx;
+					color: #999999;
+					line-height: 36rpx;
 				}
 			}
 		}
+
+		.btns {
+			margin-top: 26rpx;
+			display: flex;
+			justify-content: space-around;
+			.btn {
+				width: 100rpx;
+				height: 48rpx;
+				line-height: 48rpx;
+				text-align: center;
+				color: #007aff;
+				background: #ffffff;
+				border: 1rpx solid #007aff;
+				border-radius: 16rpx;
+			}
+		}
 	}
-	
-	.modal {
-		position:fixed;
-		left:0;
-		width:100%;
-		top:80rpx;
-		bottom:0;
-		
-		.content {
-			position: relative;
-			z-index: 10;
-			background:#fff;
-			padding:8rpx 12rpx 20rpx;
+}
+
+.modal {
+	position: fixed;
+	left: 0;
+	width: 100%;
+	top: 80rpx;
+	bottom: 0;
+
+	.content {
+		position: relative;
+		z-index: 10;
+		background: #fff;
+		padding: 8rpx 12rpx 20rpx;
+		display: flex;
+		flex-wrap: wrap;
+
+		.top {
+			margin: 0 auto;
+			width: 726rpx;
+			height: 80rpx;
+			background: #f5f5f5;
+			color: #666666;
+			border-radius: 16rpx;
+			text-align: center;
+			line-height: 80rpx;
+			font-size: 32rpx;
+		}
+
+		.list {
+			margin-top: 16rpx;
 			display: flex;
 			flex-wrap: wrap;
-			
-			.top {
-				margin:0 auto;
-				width: 726rpx;
-				height: 80rpx;
-				background: #007AFF;
+			justify-content: space-between;
+
+			.item {
+				padding: 25rpx 20rpx;
+				width: 49%;
+				background: #f5f5f5;
 				border-radius: 16rpx;
-				color:#fff;
-				text-align: center;
-				line-height: 80rpx;
 				font-size: 32rpx;
+				color: #666666;
+				margin: 8rpx 0;
 			}
-			
-			.list {
-				margin-top:16rpx;
-				display: flex;
-				flex-wrap: wrap;
-				justify-content: space-between;
-				
-				.item {
-					padding:25rpx 20rpx;
-					width: 359rpx;
-					background: #F5F5F5;
-					border-radius: 16rpx;
-					font-size: 32rpx;
-					color: #666666;
-					margin:8rpx 0;
-				}
-			}
-		}
-		
-		.modal_wrap {
-			position: absolute;
-			left:0;
-			width:100%;
-			top:0;
-			height:100%;
-			background:rgba(0,0,0,0.3)
 		}
 	}
+
+	.modal_wrap {
+		position: absolute;
+		left: 0;
+		width: 100%;
+		top: 0;
+		height: 100%;
+		background: rgba(0, 0, 0, 0.3);
+	}
+}
+.activesty {
+	background: #007aff !important;
+	color: #fff !important;
+}
 </style>

BIN
static/641(.gif


BIN
static/coupon/overdue.png


BIN
static/coupon/used.png


BIN
static/level/flower_1.png


BIN
static/level/flower_2.png


BIN
static/level/flower_3.png


BIN
static/level/flower_4.png


BIN
static/level/flower_5.png


BIN
static/level/flower_6.png


BIN
static/level/hdbaoming.png


BIN
static/level/menu1.png


BIN
static/level/menu2.png


BIN
static/level/menu3.png


BIN
static/level/menu4.png


BIN
static/level/qiandao.png


BIN
static/level/spxuexi.png


BIN
static/level/wsziliao.png


BIN
static/level/zffenxiang.png