فهرست منبع

修改: 课程详情中视频号的预约和跳转

littleblue55 5 روز پیش
والد
کامیت
1fbe48e18e
4فایلهای تغییر یافته به همراه115 افزوده شده و 10 حذف شده
  1. 1 1
      components/lgSwiper.vue
  2. 105 5
      pages/goOnEdu/course/courseDetail/courseDetail.vue
  3. 1 1
      pages/goOnEdu/index.vue
  4. 8 3
      pages/index/index.vue

+ 1 - 1
components/lgSwiper.vue

@@ -35,7 +35,7 @@
 				this.currentIndex = e.detail.current
 			},
 			swiperClick(data){
-				console.log(111, data)
+				// console.log(111, data)
 				this.$emit('swiperClick', data);
 			}
 		},

+ 105 - 5
pages/goOnEdu/course/courseDetail/courseDetail.vue

@@ -3,7 +3,8 @@
 		<view v-if="!loginShow" class="container" :style="{ height : `${loginShow ? '100vh' : 'auto' }`, 
 		overflow: `${loginShow ? 'hidden' : 'auto' }` }">
 			<view class="container-poster" style="width: 100%;padding: 0 20rpx;">
-				<image show-menu-by-longpress :src="courseDetail.poster?courseDetail.poster:''" mode="widthFix"
+				<channel-live v-if="feedShow" :feed-id="feedId" :finder-user-name="finderId"></channel-live>
+				<image v-else show-menu-by-longpress :src="courseDetail.poster?courseDetail.poster:''" mode="widthFix"
 					style="width: 100%;"></image>
 			</view>
 			<view class="course-tab-list">
@@ -12,8 +13,13 @@
 					{{ data }}
 				</view>
 			</view>
-			<view class="content" v-if="currentTab === 0">
-				<view class="content-text">
+			<view class="content" v-if="currentTab === 0" style="overflow: hidden;">
+				<view class="content-text" 
+				:style="{
+					marginBottom: `${videoShow?'140rpx':'0'}`,
+					paddingBottom: `${videoShow?'150rpx':'0'}`
+				}"
+				style="height: 100%;overflow: scroll;padding-left: 20rpx;padding-right: 20rpx;">
 					<view class="text-title">{{courseDetail.courseName}}</view>
 					<view class="text-title">课程概述</view>
 					<view class="text-content">{{courseDetail.summary}}</view>
@@ -22,6 +28,10 @@
 					<view class="text-title">培训地点</view>
 					<view class="text-content">{{courseDetail.loc}}</view>
 					<view class="text-tip" v-if="!isMember">个人会员或单位会员免费,点击现在入会></view>
+					
+				</view>
+				<view class="section-bottom" @click="toVideo" v-show="videoShow">
+					<text>预约课程</text>
 				</view>
 			</view>
 			<view class="content" v-if="currentTab === 1" style="overflow: hidden;">
@@ -78,7 +88,7 @@
 	} from '@/store/authStore'
 	const authStore = useAuthStore();
 	// const isMember = ref(false)
-
+	const feedShow = ref(false)
 	import {
 		ref,
 		computed
@@ -96,6 +106,8 @@
 	const items = ref(['课程简介', '观看评论']);
 	const currentTab = ref(0);
 	const comment = ref("");
+	const feedId = ref(null);
+	const finderId = "sphIfs9sYiL5RB3"
 	// 评论发送按钮样式
 	const customStyle = ref({
 		backgroundColor: '#e6e6e6',
@@ -132,6 +144,10 @@
 			if (res?.data) {
 				courseDetail.value = res.data;
 				showBuy.value = showBuyAction()
+				if(courseDetail.value.loc === '微信视频号' && new Date(formatDateS(courseDetail.value.courseDate)) < new Date()){
+					// console.log(123456)
+					getVideo()
+				}
 				// console.log(courseDetail, "课程详情")
 			}
 		})
@@ -310,6 +326,7 @@
 		} else {
 			loginShow.value = true
 		}
+		// toVideo()
 		// loginShow.value = true
 	})
 	onShow(() => {
@@ -366,6 +383,72 @@
 			imageUrl: courseDetail.value.cover
 		};
 	})
+	
+	
+	// 跳转预告
+	function toVideo(){
+		wx.getChannelsLiveNoticeInfo({
+			'finderUserName': 'sphIfs9sYiL5RB3',
+			success: (res)=>{
+				let noticeId = null;
+				if(res.otherInfos.length > 0){
+					let date1 = new Date(formatDateS(courseDetail.value.courseDate))
+					res.otherInfos.forEach(item=>{
+						let date = new Date(item.startTime*1000);
+						// console.log(item,date1, date)
+						if(date1.getTime()===date.getTime()){
+							noticeId = item.noticeId;
+						}
+					})
+				}
+				// console.log(noticeId)
+				if(!noticeId){
+					noticeId = res.noticeId
+				}
+				// console.log(res)
+				wx.reserveChannelsLive({
+					"noticeId": noticeId,
+					success: (resp)=>{
+						console.log(resp)
+					},
+					fail: (err)=>{
+						console.log(err)
+					}
+				})
+			}
+		})
+	}
+	function getVideo(){
+		const startDate = new Date(formatDateS(courseDetail.value.courseDate));
+		// 计算 endTime(startDate 加一天)
+		const endDate = new Date(startDate);
+		endDate.setDate(startDate.getDate() + 1);
+		// 获取时间戳
+		const startTime = startDate.getTime();
+		const endTime = endDate.getTime();
+		wx.getChannelsLiveInfo({
+			'finderUserName': 'sphIfs9sYiL5RB3',
+			'startTime': startTime,
+			'endTime': endTime,
+			success: (res)=>{
+				feedId.value = res.feedId;
+				console.log("直播信息", res.feedId)
+				feedShow.value = true
+				// wx.openChannelsLive({
+				// 	finderUserName: 'sphIfs9sYiL5RB3',
+				// 	feedId: res.feedId,
+				// 	nonceId: res.nonceId,
+				// 	success: (resp)=>{
+				// 		console.log(resp)
+				// 	}
+				// })
+			}
+		})
+	}
+	
+	const videoShow = computed(()=>{
+		return courseDetail.value?.loc==='微信视频号' && !feedShow.value
+	})
 </script>
 <style lang="scss">
 	.u-drawer-bottom {
@@ -408,12 +491,14 @@
 		position: relative;
 
 		.content-text {
-			padding: 0 20rpx env(safe-area-inset-bottom, 0);
+			// env(safe-area-inset-bottom, 0)
+			// padding: 0 20rpx 0;
 			font-size: 38rpx;
 
 			.text-title {
 				font-weight: bold;
 				margin-bottom: 15rpx;
+				margin-top: 15rpx;
 			}
 
 			.text-content {
@@ -427,6 +512,21 @@
 				margin-bottom: env(safe-area-inset-bottom, 0);
 			}
 		}
+		.content-button-hold{
+			width: 100%;
+			height: 120rpx;
+		}
+		.content-button{
+			width: 100%;
+			// height: 100rpx;
+			// line-height: 100rpx;
+			text-align: center;
+			background-color: #fe0000;
+			color: #fff;
+			// position: absolute;
+			// bottom: 0;
+			padding:20rpx  0 calc(20rpx + env(safe-area-inset-bottom, 0));
+		}
 	}
 
 	.section-bottom {

+ 1 - 1
pages/goOnEdu/index.vue

@@ -2,7 +2,7 @@
 	<view>
 		<view class="main-btn" @click="toPage(courseUrl)">
 			<image :src="`${FILE_URL}/edu-icon/course.png`"></image>
-			<text>培训课程</text>
+			<text>行业培训</text>
 		</view>
 		<view class="main-btn" @click="toOtherApp">
 			<image :src="`${FILE_URL}/edu-icon/net.png`"></image>

+ 8 - 3
pages/index/index.vue

@@ -7,8 +7,13 @@
 		</u-navbar>
 		<!-- <u-link href="http://www.uviewui.com">蜀道难,难于上青天</u-link> -->
 		<view class="page-content">
-			<swiper class="swiper" circular indicator-dots style="border-radius: 20rpx;overflow: hidden;height: 200px">
-				<swiper-item v-for="(data, index) in swiperList" style="width: 100%;height: 100%;" :key="index">
+			<swiper class="swiper" 
+			autoplay
+			:interval="5000"
+			:duration="500"
+			circular indicator-dots style="border-radius: 20rpx;overflow: hidden;height: 200px">
+				<swiper-item v-for="(data, index) in swiperList" 
+				style="width: 100%;height: 100%;" :key="index">
 					<view class="swiper-item" style="width: 100%;height: 100%;" @click="itemClick(data)">
 						<image :src="data.imgUrl" mode="aspectFill" style="width: 100%;height: 100%;"></image>
 					</view>
@@ -270,7 +275,7 @@ import { msg, msgSuccess } from '../../utils/common'
 			isLogin: true,
 			title: '会费缴交',
 			icon: 'icon-shangchuanchenggong',
-			url: '/pages/huiFeiJiaoJiao/huiFeiJiaoJiao',
+			url: '/pages/huifeijiaojiaoRukou/huifeijiaojiaoRukou',
 			toOtherApp: false,
 			otherAppId: '其他小程序的appid'
 		}