Browse Source

课程和题库分享

xuqiaoying 3 years ago
parent
commit
b8ddad2f76
4 changed files with 135 additions and 12 deletions
  1. 1 1
      pages/learn/index.scss
  2. 3 3
      pages/learn/index.vue
  3. 66 4
      pages2/bank/detail.vue
  4. 65 4
      pages3/course/detail.vue

+ 1 - 1
pages/learn/index.scss

@@ -164,7 +164,7 @@
 			width: 65rpx;
 			height: 35rpx;
 			line-height: 35rpx;
-			border-radius: 0rpx 22rpx 0rpx 22rpx;
+			border-radius: 12rpx 0rpx 12rpx 0rpx;
 			background-color: #FFB102;
 			color: #fff;
 			font-size: 20rpx;

+ 3 - 3
pages/learn/index.vue

@@ -81,7 +81,7 @@
 						<view class="c_downs">
 							<view class="lefts">
 								<image class="lefet_img" :src="$method.splitImgHost(item.coverUrl, true)" mode=""></image>
-								<view class="live_icon">直播</view>
+								<!-- <view class="live_icon">直播</view> -->
 							</view>
 							<view class="rights">
 								
@@ -242,8 +242,8 @@ export default {
 		}
 	},
 	onLoad() {
-		// 1668787200 ,2022.22.19的时间戳
-		this.leftDays = 1668787200 - parseInt(curTime/1000)
+		// 1668873600 ,2022.11.20的时间戳
+		this.leftDays = 1668873600 - parseInt(curTime/1000)
 		this.getCourseLiveQues()
 	},
 	async onShow() {

+ 66 - 4
pages2/bank/detail.vue

@@ -110,8 +110,17 @@
 		<view class="bottomBox" v-if="!hideBuyState">
 			<!-- <view class="priceTag">¥ {{ toFixed(goodsData.standPrice) }}</view> -->
 			<view class="icons">
-				<image src="/static/index/share.png" class="share"></image>
-				<image src="/static/index/shopcar.png" class="shopcar" @click="toShopcar()"></image>
+				
+				<view class="icon_item ones">
+					<image src="/static/index/share.png" class="share"></image>
+					<button type="default" open-type="share" class="bt_share"></button>
+					<view class="share_w">分享</view>
+				</view>
+				<view class="icon_item">
+					<image src="/static/index/shopcar.png" class="shopcar" @click="toShopcar()"></image>
+					<view class="share_w">购物车</view>
+				</view>
+				
 			</view>
 			<view style="display: flex;color: #FFFFFF;align-items: center;">
 				<view class="btn1" @click="addCart">加购物车</view>
@@ -155,8 +164,29 @@ export default {
 		this.id = option.id;
 		this.getDetail();
 		this.goodsBankList();
+		wx.showShareMenu({
+			withShareTicket: true,
+			menus: ["shareAppMessage", "shareTimeline"]
+		})
 	},
 	onShow() {},
+	// 分享到朋友圈
+	onShareTimeline() {
+		return {
+			title: this.goodsData.goodsName,
+			query: 'id=' + this.id,
+			imageUrl: this.$method.splitImgHost(this.goodsData.coverUrl, true)
+		}
+	},
+	onShareAppMessage() {
+		console.log('asdsaufga-------')
+		return {
+			title: this.goodsData.goodsName,
+			path: `/pages2/bank/detail?id=` + this.id,
+			imageUrl: this.$method.splitImgHost(this.goodsData.coverUrl, true)
+		}
+	},
+	
 	methods: {
 		toFixed(number) {
 			if(number) {
@@ -551,11 +581,43 @@ page {
 	align-items: center;
 	padding: 0 24rpx;
 	box-shadow: 0px -5px 20px 1px rgba(1,99,235,0.1000);
+	.icons {
+		display: flex;
+		.share_w {
+			font-size: 20rpx;
+			color: #666666;
+			margin-top: 6rpx;
+		}
+		.icon_item {
+			text-align: center;
+		}
+		.ones {
+			margin-left: 32rpx;
+			margin-right: 60rpx;
+			position: relative;
+			top: 0;
+			left: 0;
+			/deep/ button::after{
+				border: none; 
+			}
+			.bt_share {
+				width: 38rpx;
+				height: 38rpx;
+				position: absolute;
+				top: 3rpx;
+				left: 0;
+				z-index: 100;
+				opacity: 0;
+			}
+		}
+	}
 	.share {
 		width: 38rpx;
 		height: 38rpx;
-		margin-left: 32rpx;
-		margin-right: 60rpx;
+		position: relative;
+		top: 3rpx;
+		z-index: 99;
+		margin-bottom: 4rpx;
 	}
 	.shopcar {
 		width: 40rpx;

+ 65 - 4
pages3/course/detail.vue

@@ -99,8 +99,15 @@
 			<!-- <view class="priceTag">¥ {{toFixed(detail.standPrice)}}</view> -->
             <!-- <view class="priceTag">分享</view> -->
 			<view class="icons">
-				<image src="/static/index/share.png" class="share"></image>
-				<image src="/static/index/shopcar.png" class="shopcar" @click="toShopcar()"></image>
+				<view class="icon_item ones">
+					<image src="/static/index/share.png" class="share"></image>
+					<button type="default" open-type="share" class="bt_share"></button>
+					<view class="share_w">分享</view>
+				</view>
+				<view class="icon_item">
+					<image src="/static/index/shopcar.png" class="shopcar" @click="toShopcar()"></image>
+					<view class="share_w">购物车</view>
+				</view>
 			</view>
 			<view style="display: flex;color: #FFFFFF;align-items: center;">
 				<view class="btn1" @click="addCart">加购物车</view>
@@ -150,12 +157,34 @@ export default {
 		this.getDetail()
 		this.goodsCourseList()
 		this.appCommonGoodsCourseModuleFreeExamList();
+		wx.showShareMenu({
+			withShareTicket: true,
+			menus: ["shareAppMessage", "shareTimeline"]
+		})
 	},
 	onUnload(option) {
 		this.$store.commit('setPlaySectionId', {playSectionId  :0});
 		//移除所有的事件监听器
 		uni.$off();
 	},
+	// 分享到朋友圈
+	onShareTimeline() {
+		console.log('safsaghdsoug')
+		return {
+			title: this.detail.goodsName,
+			query: 'id=' + this.id,
+			imageUrl: this.$method.splitImgHost(this.detail.coverUrl)
+		}
+	},
+	// 分享给朋友
+	onShareAppMessage() {
+		return {
+			title: this.detail.goodsName,
+			path: `/pages3/course/detail?id=` + this.id,
+			imageUrl: this.$method.splitImgHost(this.detail.coverUrl)
+		}
+	},
+	
 	mounted() {
 		let self = this
 		uni.$on('getSection', item => {
@@ -597,11 +626,43 @@ export default {
 		align-items: center;
 		padding: 0 24rpx;
 		box-shadow: 0px -5px 20px 1px rgba(1,99,235,0.1000);
+		.icons {
+			display: flex;
+			.share_w {
+				font-size: 20rpx;
+				color: #666666;
+				margin-top: 6rpx;
+			}
+			.icon_item {
+				text-align: center;
+			}
+			.ones {
+				margin-left: 32rpx;
+				margin-right: 60rpx;
+				position: relative;
+				top: 0;
+				left: 0;
+				/deep/ button::after{
+					border: none; 
+				}
+				.bt_share {
+					width: 38rpx;
+					height: 38rpx;
+					position: absolute;
+					top: 3rpx;
+					left: 0;
+					z-index: 100;
+					opacity: 0;
+				}
+			}
+		}
 		.share {
 			width: 38rpx;
 			height: 38rpx;
-			margin-left: 32rpx;
-			margin-right: 60rpx;
+			position: relative;
+			top: 3rpx;
+			z-index: 99;
+			margin-bottom: 4rpx;
 		}
 		.shopcar {
 			width: 40rpx;