Tang 3 жил өмнө
parent
commit
cedf45c3e8
2 өөрчлөгдсөн 302 нэмэгдсэн , 324 устгасан
  1. 2 1
      pages/index/index.vue
  2. 300 323
      pages2/bank/detail.vue

+ 2 - 1
pages/index/index.vue

@@ -235,7 +235,8 @@ export default {
 		},
 		jumpGoodsDetail(item){
 			this.$navTo.togo('/pages2/wd/course', {
-				id: item.goodsId
+				id: item.goodsId,
+				gid:item.gradeId
 			});
 		},
 		preveItem() {

+ 300 - 323
pages2/bank/detail.vue

@@ -1,12 +1,12 @@
 <template>
 	<view>
 		<view style="background-color: #FFFFFF;">
-			<view >
+			<view>
 				<image :src="$method.splitImgHost(goodsData.coverUrl, true)" style="width: 100%;"></image>
 				<view style="padding:20rpx">
 					<view style="display: flex;margin-top: 13rpx;">
-						<view class="yearTag" v-if="goodsData.year">{{goodsData.year}}</view>
-						<view class="titleTag">{{goodsData.goodsName}}</view>
+						<view class="yearTag" v-if="goodsData.year">{{ goodsData.year }}</view>
+						<view class="titleTag">{{ goodsData.goodsName }}</view>
 					</view>
 					<!-- <view style="display: flex;justify-content: space-between;margin-top: 13rpx;" v-if="false">
 						<view class="noteTag"><image src="/static/icon/wk_icon1.png" class="wk_icon"></image>
@@ -17,31 +17,27 @@
 			</view>
 			<u-line color="#D6D6DB" />
 			<view>
-				<view>
-					<u-tabs :list="list" item-width="50%" font-size="24" bar-width="110" :current="current" @change="change" active-color="#007AFF"></u-tabs>
-				</view>
+				<view><u-tabs :list="list" item-width="50%" font-size="24" bar-width="110" :current="current" @change="change" active-color="#007AFF"></u-tabs></view>
 			</view>
 			<u-line color="#D6D6DB" />
 		</view>
 		<view class="intro" v-if="current == 0">
-			<view class="content" style="padding:10rpx;">
-				<rich-text :nodes="goodsData.mobileDetailHtml"></rich-text>
-			</view>
+			<view class="content" style="padding:10rpx;"><rich-text :nodes="goodsData.mobileDetailHtml"></rich-text></view>
 		</view>
-		<view class="title-list"  v-if="current == 1">
+		<view class="title-list" v-if="current == 1">
 			<view class="content">
-				<view class="list" v-for="(item1,index1) in bankList" :key="index1">
-					<template v-if="item1.type==1">
+				<view class="list" v-for="(item1, index1) in bankList" :key="index1">
+					<template v-if="item1.type == 1">
 						<view class="moduleItem" @click="clickModule" :data-id="item1.majorId" :data-index="index1">
-							<view class="courseName">{{item1.name}}</view>
+							<view class="courseName">{{ item1.name }}</view>
 							<view>
 								<image src="/static/icon/up.png" class="icon_up" v-if="!item1.showList"></image>
 								<image src="/static/icon/down.png" class="icon_up" v-if="item1.showList"></image>
 							</view>
 						</view>
-						
+
 						<template v-if="item1.showList">
-							<view v-for="(item2,index2) in item1.list" :key="index2" >
+							<view v-for="(item2, index2) in item1.list" :key="index2">
 								<view class="section" @click="changeItem" :data-index1="index1" :data-index2="index2" :data-id="item2.chapterExamId" :data-type="item1.type">
 									<image src="/static/icon/down1.png" class="icon_up" v-if="item2.showList"></image>
 									<image src="/static/icon/up1.png" class="icon_up" v-if="!item2.showList"></image>
@@ -49,10 +45,10 @@
 									<u-icon  v-if="item2.showList" name="arrow-down"></u-icon> -->
 									<text style="margin-left:34rpx;">{{ item2.name }}</text>
 								</view>
-								<view  v-if="item2.showList">
-									<view class="article" :class="{active:showTest(article.examId)}"  v-for="(article,index3) in item2.list" :key="index3">
-										<view class="flex_auto">{{article.examName}}</view>
-										<navigator  hover-class="none" :url="'/pages2/bank/questionBankTest?id='+article.examId+'&num='+showTest(article.examId).num">
+								<view v-if="item2.showList">
+									<view class="article" :class="{ active: showTest(article.examId) }" v-for="(article, index3) in item2.list" :key="index3">
+										<view class="flex_auto">{{ article.examName }}</view>
+										<navigator hover-class="none" :url="'/pages2/bank/questionBankTest?id=' + article.examId + '&num=' + showTest(article.examId).num">
 											<view class="btn" v-if="showTest(article.examId)">试做</view>
 										</navigator>
 									</view>
@@ -60,11 +56,9 @@
 								<u-line></u-line>
 							</view>
 						</template>
-						
-						
 					</template>
-					
-					<template v-if="item1.type ==2">
+
+					<template v-if="item1.type == 2">
 						<view class="section" :data-index1="index1" :data-id="item1.majorId" @click="changeItem" :data-type="item1.type">
 							<image src="/static/icon/down1.png" class="icon_up" v-if="item1.showList"></image>
 							<image src="/static/icon/up1.png" class="icon_up" v-if="!item1.showList"></image>
@@ -72,32 +66,29 @@
 							<u-icon  v-if="item1.showList" name="arrow-down"></u-icon> -->
 							<text style="margin-left:34rpx;">{{ item1.name }}</text>
 						</view>
-						<view v-if="item1.showList" >
-							<view class="article" :class="{active:showTest(article.examId)}"  :key="index2" v-for="(article,index2) in item1.list">
-								<view class="flex_auto">{{item1.name}}</view>
-								<navigator  hover-class="none" :url="'/pages2/bank/questionBankTest?id='+article.majorId+'&num='+showTest(article.examId).num">
-									<view class="btn"  v-if="showTest(article.examId)">试做</view>
+						<view v-if="item1.showList">
+							<view class="article" :class="{ active: showTest(article.examId) }" :key="index2" v-for="(article, index2) in item1.list">
+								<view class="flex_auto">{{ item1.name }}</view>
+								<navigator hover-class="none" :url="'/pages2/bank/questionBankTest?id=' + article.majorId + '&num=' + showTest(article.examId).num">
+									<view class="btn" v-if="showTest(article.examId)">试做</view>
 								</navigator>
-								
 							</view>
 						</view>
 					</template>
-					
-					<template v-if="item1.type ==3">
-						<view class="article" :class="{active:showTest(item1.majorId)}" >
-							<view class="flex_auto">{{item1.name}}</view>
-							<navigator  hover-class="none" :url="'/pages2/bank/questionBankTest?id='+item1.majorId+'&num='+showTest(item1.majorId).num">
+
+					<template v-if="item1.type == 3">
+						<view class="article" :class="{ active: showTest(item1.majorId) }">
+							<view class="flex_auto">{{ item1.name }}</view>
+							<navigator hover-class="none" :url="'/pages2/bank/questionBankTest?id=' + item1.majorId + '&num=' + showTest(item1.majorId).num">
 								<view class="btn" v-if="showTest(item1.majorId)">试做</view>
 							</navigator>
-							
 						</view>
 					</template>
 				</view>
-				
 			</view>
 		</view>
 		<view class="bottomBox">
-			<view class="priceTag">¥ {{goodsData.standPrice}}</view>
+			<view class="priceTag">¥ {{ goodsData.standPrice }}</view>
 			<view style="display: flex;color: #FFFFFF;align-items: center;">
 				<view class="btn1" @click="addCart">加购物车</view>
 				<view class="btn2" @click="buy">立即购买</view>
@@ -119,349 +110,335 @@ export default {
 					name: '大纲'
 				}
 			],
-			current:0,
-			id:'',
-			goodsData:{},
-			bankList:[],
-			goodsExamConfig:[],
+			current: 0,
+			id: '',
+			goodsData: {},
+			bankList: [],
+			goodsExamConfig: []
 		};
 	},
 	filters: {
-	   formatDate: function (value) {
-		   
-		var date = new Date(value);//时间戳为10位需*1000,时间戳为13位的话不需乘1000
-		var Y = date.getFullYear();
-		return Y;
-	  }
-	},
-	onUnload() {
-		
+		formatDate: function(value) {
+			var date = new Date(value); //时间戳为10位需*1000,时间戳为13位的话不需乘1000
+			var Y = date.getFullYear();
+			return Y;
+		}
 	},
+	onUnload() {},
 	computed: { ...mapGetters(['userInfo']) },
 	onLoad(option) {
-		console.log(option)
-		this.id = option.id
+		this.id = option.id;
 		this.getDetail();
-		this.goodsBankList()
-	},
-	onShow() {
-		
+		this.goodsBankList();
 	},
+	onShow() {},
 	methods: {
-		getDetail(){
+		getDetail() {
 			this.$api.commonGoodsDetail(this.id).then(res => {
-				console.log(res)
+				if (res.data.data.mobileDetailHtml) {
+					res.data.data.mobileDetailHtml = res.data.data.mobileDetailHtml.replace(/<img/gi, '<img style="max-width:100%;"');
+				}
 				this.goodsData = res.data.data;
-				this.goodsExamConfig = JSON.parse(res.data.data.goodsExamConfig)
-			})
+				this.goodsExamConfig = JSON.parse(res.data.data.goodsExamConfig);
+			});
 		},
 		goodsBankList() {
-			this.$api.goodsBankList({
-				goodsId:this.id
-			}).then(res => {
-				console.log(res)
-				this.bankList = res.data.data;
-			})
+			this.$api
+				.goodsBankList({
+					goodsId: this.id
+				})
+				.then(res => {
+					console.log(res);
+					this.bankList = res.data.data;
+				});
 		},
-		goodsChapterList(bank,id) {
-			this.$api.goodsChapterList({
-				moduleExamId:id
-			}).then(res => {
-				this.$set(bank,'list',res.data.data)
-				 
-			})
+		goodsChapterList(bank, id) {
+			this.$api
+				.goodsChapterList({
+					moduleExamId: id
+				})
+				.then(res => {
+					this.$set(bank, 'list', res.data.data);
+				});
 		},
-		
+
 		showTest(id) {
 			return this.goodsExamConfig.find(item => item.examId == id);
 		},
 		clickModule(e) {
-			
 			let index = e.currentTarget.dataset.index;
 			let id = e.currentTarget.dataset.id;
-			
-			
-			if(this.bankList[index].list) {
-				this.$set(this.bankList[index],'showList',!this.bankList[index].showList)
+
+			if (this.bankList[index].list) {
+				this.$set(this.bankList[index], 'showList', !this.bankList[index].showList);
 				return;
 			}
-			
-			this.$api.goodsChapterList({
-				moduleExamId:id
-			}).then(res => {
-				this.$set(this.bankList[index],'showList',true)
-				this.$set(this.bankList[index],'list',res.data.data)
-				 
-			})
+
+			this.$api
+				.goodsChapterList({
+					moduleExamId: id
+				})
+				.then(res => {
+					this.$set(this.bankList[index], 'showList', true);
+					this.$set(this.bankList[index], 'list', res.data.data);
+				});
 		},
-		buy(){
-			if(this.$method.isGoLogin()){
-				return
+		buy() {
+			if (this.$method.isGoLogin()) {
+				return;
 			}
-			this.$navTo.togo('/pages2/order/confirm_list?id='+this.id);
+			this.$navTo.togo('/pages2/order/confirm_list?id=' + this.id);
 		},
-		addCart(){
-			if(this.$method.isGoLogin()){
-				return
+		addCart() {
+			if (this.$method.isGoLogin()) {
+				return;
 			}
-			
-			let self = this
-			this.$api.addCart({goodsId:this.id}).then(res => {
-				if(res.data.code==200){
-					uni.setStorageSync('updateCart',1) //提醒刷新购物车
+
+			let self = this;
+			this.$api.addCart({ goodsId: this.id }).then(res => {
+				if (res.data.code == 200) {
+					uni.setStorageSync('updateCart', 1); //提醒刷新购物车
 					uni.showToast({
-					    title: '添加成功'
+						title: '添加成功'
 					});
-				}else{
+				} else {
 					this.$u.toast(res.data.msg);
 				}
 			});
-			
 		},
-		open(item){
-			item.showChildren = !item.showChildren
+		open(item) {
+			item.showChildren = !item.showChildren;
 		},
-		change(index){
+		change(index) {
 			this.current = index;
 		},
 		changeItem(e) {
-			
-			
-			let index1 = e.currentTarget.dataset.index1
-			let index2 = e.currentTarget.dataset.index2
-			let id = e.currentTarget.dataset.id
-			let type = e.currentTarget.dataset.type
-			
-			if(type == 1) {
-				if(this.bankList[index1].list[index2].list) {
-					this.$set(this.bankList[index1].list[index2],'showList',!this.bankList[index1].list[index2].showList)
+			let index1 = e.currentTarget.dataset.index1;
+			let index2 = e.currentTarget.dataset.index2;
+			let id = e.currentTarget.dataset.id;
+			let type = e.currentTarget.dataset.type;
+
+			if (type == 1) {
+				if (this.bankList[index1].list[index2].list) {
+					this.$set(this.bankList[index1].list[index2], 'showList', !this.bankList[index1].list[index2].showList);
 					return;
 				}
-				
-				this.$api.goodsExamList({
-					chapterExamId:id
-				}).then(res => {
-					
-					this.$set(this.bankList[index1].list[index2],'showList',true)
-					this.$set(this.bankList[index1].list[index2],'list',res.data.data)
-					
-					 
-				})
-				
-			} else if(type == 2) {
-				if(this.bankList[index1].list) {
-					this.$set(this.bankList[index1],'showList',!this.bankList[index1].showList)
+
+				this.$api
+					.goodsExamList({
+						chapterExamId: id
+					})
+					.then(res => {
+						this.$set(this.bankList[index1].list[index2], 'showList', true);
+						this.$set(this.bankList[index1].list[index2], 'list', res.data.data);
+					});
+			} else if (type == 2) {
+				if (this.bankList[index1].list) {
+					this.$set(this.bankList[index1], 'showList', !this.bankList[index1].showList);
 					return;
 				}
-				
-				this.$api.goodsExamList({
-					chapterExamId:id
-				}).then(res => {
-					
-					this.$set(this.bankList[index1],'showList',true)
-					this.$set(this.bankList[index1],'list',res.data.data)
-					
-					 
-				})
+
+				this.$api
+					.goodsExamList({
+						chapterExamId: id
+					})
+					.then(res => {
+						this.$set(this.bankList[index1], 'showList', true);
+						this.$set(this.bankList[index1], 'list', res.data.data);
+					});
 			}
-			
-			
-			
 		}
 	}
 };
 </script>
-<style >
-	page{
-		background-color: #EAEEF1;
-	}
+<style>
+page {
+	background-color: #eaeef1;
+}
 </style>
 <style lang="scss" scope>
-	.courseName{
-		white-space:nowrap;
-		overflow:hidden;
-		text-overflow:ellipsis; 
-	}
-	.icon_up{
-		width: 32rpx;
-		height: 32rpx;
+.courseName {
+	white-space: nowrap;
+	overflow: hidden;
+	text-overflow: ellipsis;
+}
+.icon_up {
+	width: 32rpx;
+	height: 32rpx;
+}
+.intro {
+	background: #eaeef1;
+	padding: 16rpx 16rpx 124rpx;
+
+	.content {
+		background: #fff;
+		border-radius: 16rpx;
+		.top {
+			border-radius: 16rpx;
+			padding: 32rpx 28rpx 16rpx;
+			font-size: 30rpx;
+			color: #333333;
+		}
+
+		.img {
+			width: 100%;
+		}
 	}
-	.intro {
-		background: #EAEEF1;
-		padding:16rpx 16rpx 124rpx;
-		
-		.content {
-			background:#fff;
-			border-radius: 16rpx;;
-			.top {
-				border-radius: 16rpx;
-				padding:32rpx 28rpx 16rpx;
-				font-size: 30rpx;
+}
+
+.moduleItem {
+	height: 80rpx;
+	color: #333333;
+	font-size: 32rpx;
+	line-height: 80rpx;
+	font-weight: bold;
+	display: flex;
+	justify-content: space-between;
+}
+.title-list {
+	background: #eaeef1;
+	padding: 16rpx 16rpx 124rpx;
+	.content {
+		.list {
+			background: #fff;
+			margin-bottom: 30rpx;
+			overflow: hidden;
+			border-radius: 16rpx;
+			padding: 10rpx 16rpx;
+
+			.module {
+				font-size: 32rpx;
 				color: #333333;
+
+				.icon {
+					margin-right: 10rpx;
+				}
 			}
-			
-			.img {
-				width:100%;
-			}
-		}
-	}
-	
-	.moduleItem{
-		height: 80rpx;
-		color: #333333;
-		font-size: 32rpx;
-		line-height: 80rpx;
-		font-weight: bold;
-		display: flex;
-		justify-content: space-between;
-	
-	}
-	.title-list {
-		background: #EAEEF1;
-		padding:16rpx 16rpx 124rpx;
-		.content {
-			
-			.list {
-				background:#fff;
-				margin-bottom:30rpx;
+
+			.section {
+				font-size: 30rpx;
+				color: #333;
+				white-space: nowrap;
 				overflow: hidden;
-				border-radius: 16rpx;
-				padding:10rpx 16rpx;
-				
-				.module {
-					font-size: 32rpx;
-					color: #333333;
-					
-					.icon {
-						margin-right:10rpx;
-					}
+				text-overflow: ellipsis;
+				margin: 20rpx 0;
+				display: flex;
+				align-items: center;
+			}
+
+			.article {
+				height: 80rpx;
+				display: flex;
+				align-items: center;
+				margin-left: 64rpx;
+				font-size: 24rpx;
+				color: #666666;
+				border-bottom: 1rpx solid #eeeeee;
+				display: flex;
+
+				.flex_auto {
+					flex: 1;
 				}
-				
-				.section {
-					font-size: 30rpx;
-					color: #333;
-					white-space:nowrap;
-					overflow:hidden;
-					text-overflow:ellipsis; 
-					margin: 20rpx 0;
-					display: flex;
-					align-items: center;
+
+				&:nth-last-of-type(1) {
+					border: 0;
 				}
-				
-				.article {
-					height:80rpx;
-					display: flex;
-					align-items: center;
-					margin-left:64rpx;
-					font-size: 24rpx;
-					color: #666666;
-					border-bottom: 1rpx solid #EEEEEE;
-					display: flex;
-					
-					.flex_auto{
-						flex:1;
-					}
-					
-					&:nth-last-of-type(1) {
-						border:0;
-					}
-					
-					&.active {
-						color:#007AFF;
-						
-						
-						.btn {
-							width: 96rpx;
-							height: 48rpx;
-							line-height: 48rpx;
-							text-align: center;
-							color:#fff;
-							font-size: 30rpx;
-							border-radius:24rpx;
-							background: #007AFF;
-							margin-left:36rpx;
-							border-radius: 24rpx;
-						}
+
+				&.active {
+					color: #007aff;
+
+					.btn {
+						width: 96rpx;
+						height: 48rpx;
+						line-height: 48rpx;
+						text-align: center;
+						color: #fff;
+						font-size: 30rpx;
+						border-radius: 24rpx;
+						background: #007aff;
+						margin-left: 36rpx;
+						border-radius: 24rpx;
 					}
 				}
 			}
 		}
 	}
-	.btn2{
-		width: 200rpx;
-		height: 64rpx;
-		background: linear-gradient(0deg, #FFB102, #FD644F);
-		box-shadow: 0rpx 10rpx 16rpx 4rpx rgba(1, 99, 235, 0.04);
-		border-radius: 32rpx;
-		line-height: 64rpx;
-		text-align: center;
-	}
-	.btn1{
-		width: 200rpx;
-		height: 64rpx;
-		background: linear-gradient(0deg, #015EEA, #00C0FA);
-		border-radius: 32rpx;
-		line-height: 64rpx;
-		text-align: center;
-		margin-right: 20rpx;
-	}
-	.bottomBox{
-		position: fixed;
-		bottom: 0;
-		width: 100%;
-		left: 0;
-		height:98rpx ;
-		background-color: #FFFFFF;
-		display: flex;
-		justify-content: space-between;
-		align-items: center;
-		padding: 0 30rpx;
-	}
-	.blackFont{
-		color: #333333;
-		margin: 0 4rpx;
-	}
-	.wk_icon{
-		width: 24rpx;
-		height: 24rpx;
-		margin-right: 12rpx;
-	}
-	.noteTag{
-		ont-size: 24rpx;
-		font-family: PingFang SC;
-		font-weight: 500;
-		color: #999999;
-		align-items: center;
-	}
-	.priceTag{
-		font-size: 30rpx;
-		font-family: PingFang SC;
-		font-weight: bold;
-		color: #FF2D55;
-	}
-	.titleTag{
-		font-size: 32rpx;
-		font-weight: bold;
-		color: #333333;
-		margin-left: 8rpx;
-	}
-	.yearTag{
-		width: 80rpx;
-		height: 32rpx;
-		background: #EBF5FF;
-		border: 2rpx solid #007AFF;
-		border-radius: 16rpx;
-		font-size: 24rpx;
-		color: #007AFF;
-		text-align: center;
-		line-height: 32rpx;
-	}
-	.itemBox{
-		background: #FFFFFF;
-		box-shadow: 0rpx 10rpx 9rpx 1rpx rgba(165, 196, 239, 0.1);
-		border-radius: 24rpx;
-		width: 100%;
-		padding: 20rpx;
-		margin-bottom: 20rpx;
-	}
+}
+.btn2 {
+	width: 200rpx;
+	height: 64rpx;
+	background: linear-gradient(0deg, #ffb102, #fd644f);
+	box-shadow: 0rpx 10rpx 16rpx 4rpx rgba(1, 99, 235, 0.04);
+	border-radius: 32rpx;
+	line-height: 64rpx;
+	text-align: center;
+}
+.btn1 {
+	width: 200rpx;
+	height: 64rpx;
+	background: linear-gradient(0deg, #015eea, #00c0fa);
+	border-radius: 32rpx;
+	line-height: 64rpx;
+	text-align: center;
+	margin-right: 20rpx;
+}
+.bottomBox {
+	position: fixed;
+	bottom: 0;
+	width: 100%;
+	left: 0;
+	height: 98rpx;
+	background-color: #ffffff;
+	display: flex;
+	justify-content: space-between;
+	align-items: center;
+	padding: 0 30rpx;
+}
+.blackFont {
+	color: #333333;
+	margin: 0 4rpx;
+}
+.wk_icon {
+	width: 24rpx;
+	height: 24rpx;
+	margin-right: 12rpx;
+}
+.noteTag {
+	ont-size: 24rpx;
+	font-family: PingFang SC;
+	font-weight: 500;
+	color: #999999;
+	align-items: center;
+}
+.priceTag {
+	font-size: 30rpx;
+	font-family: PingFang SC;
+	font-weight: bold;
+	color: #ff2d55;
+}
+.titleTag {
+	font-size: 32rpx;
+	font-weight: bold;
+	color: #333333;
+	margin-left: 8rpx;
+}
+.yearTag {
+	width: 80rpx;
+	height: 32rpx;
+	background: #ebf5ff;
+	border: 2rpx solid #007aff;
+	border-radius: 16rpx;
+	font-size: 24rpx;
+	color: #007aff;
+	text-align: center;
+	line-height: 32rpx;
+}
+.itemBox {
+	background: #ffffff;
+	box-shadow: 0rpx 10rpx 9rpx 1rpx rgba(165, 196, 239, 0.1);
+	border-radius: 24rpx;
+	width: 100%;
+	padding: 20rpx;
+	margin-bottom: 20rpx;
+}
 </style>