Browse Source

学习中心添加下拉刷新和点击直播课跳转

xuqiaoying 3 years ago
parent
commit
91bce0c141
2 changed files with 21 additions and 1 deletions
  1. 2 0
      pages.json
  2. 19 1
      pages/learn/index.vue

+ 2 - 0
pages.json

@@ -43,6 +43,8 @@
 				"navigationBarTitleText": "学习",
 				"navigationBarTitleText": "学习",
 				"navigationBarTextStyle": "white",
 				"navigationBarTextStyle": "white",
 				"navigationStyle": "custom", // 隐藏系统导航栏
 				"navigationStyle": "custom", // 隐藏系统导航栏
+				"enablePullDownRefresh": true,
+				"backgroundTextStyle": "dark", 
 				"app-plus": {
 				"app-plus": {
 					"titleNView": false, //禁用原生导航栏 
 					"titleNView": false, //禁用原生导航栏 
 					"bounce": "none"
 					"bounce": "none"

+ 19 - 1
pages/learn/index.vue

@@ -32,7 +32,7 @@
 											'futuring': lookTimeStatus(live.liveStartTime, live.watchStatus) == 4,
 											'futuring': lookTimeStatus(live.liveStartTime, live.watchStatus) == 4,
 											'curring': [2,3].includes(lookTimeStatus(live.liveStartTime, live.watchStatus))}"
 											'curring': [2,3].includes(lookTimeStatus(live.liveStartTime, live.watchStatus))}"
 									>
 									>
-									<text v-if="lookTimeStatus(live.liveStartTime, live.watchStatus) == 1">点击观看</text>
+									<text v-if="lookTimeStatus(live.liveStartTime, live.watchStatus) == 1" @click="toLiveLook(live)">点击观看</text>
 									<text v-if="lookTimeStatus(live.liveStartTime, live.watchStatus) == 2">即将开播</text>
 									<text v-if="lookTimeStatus(live.liveStartTime, live.watchStatus) == 2">即将开播</text>
 									<template v-if="lookTimeStatus(live.liveStartTime, live.watchStatus) == 3">
 									<template v-if="lookTimeStatus(live.liveStartTime, live.watchStatus) == 3">
 										剩余:
 										剩余:
@@ -435,6 +435,7 @@
 <script>
 <script>
 var curTime = new Date().getTime() // 当前时间的时间戳
 var curTime = new Date().getTime() // 当前时间的时间戳
 import {mapGetters,mapActions} from 'vuex'
 import {mapGetters,mapActions} from 'vuex'
+import { WEBVIEW_URL } from '@/common/request.js'
 export default {
 export default {
     data() {
     data() {
         return {
         return {
@@ -490,6 +491,10 @@ export default {
 	async onShow() {
 	async onShow() {
 		await this.commonSystemTime()
 		await this.commonSystemTime()
 		this.sysTime = +this.$method.timest()
 		this.sysTime = +this.$method.timest()
+	},
+	 onPullDownRefresh() {
+		console.log('我下拉刷新了')
+		this.getCourseLiveQues()
 	},
 	},
 	methods: {
 	methods: {
 		...mapActions(['getUserInfo']),
 		...mapActions(['getUserInfo']),
@@ -560,8 +565,10 @@ export default {
 					this.allLoading = false
 					this.allLoading = false
 					console.log('this.courseLists;', this.courseLists, this.questionLists,this.livingLists)
 					console.log('this.courseLists;', this.courseLists, this.questionLists,this.livingLists)
 				// }
 				// }
+				wx.stopPullDownRefresh()
 			}).catch(err => {
 			}).catch(err => {
 				this.allLoading = false
 				this.allLoading = false
+				wx.stopPullDownRefresh()
 				// this.$u.toast('请重新刷新请求')
 				// this.$u.toast('请重新刷新请求')
 			})
 			})
 		},
 		},
@@ -572,6 +579,17 @@ export default {
 				})
 				})
 			})
 			})
 		},
 		},
+		// 看直播
+		// let encode = encodeURIComponent(WEBVIEW_URL+'pages/live/index?token='+uni.getStorageSync('token')+'&userInfo='+JSON.stringify(this.userInfo)+'&channelId='+item.liveUrl+'&gradeId='+0+'&courseId='+this.courseId+'&goodsId='+this.goodsId+'&orderGoodsId='+this.orderGoodsId+'&sectionId='+sectionId+'&chapterId='+chapterId+'&moduleId='+moduleId)
+		toLiveLook(item) {
+			let moduleId = item.moduleId || 0
+			let chapterId = item.chapterId || 0
+			let sectionId = item.sectionId || item.menuId
+			let encode = encodeURIComponent(WEBVIEW_URL+'pages/live/index?token='+uni.getStorageSync('token')+'&userInfo='+JSON.stringify(this.userInfo)+'&channelId='+item.liveUrl+'&gradeId='+0+'&courseId='+item.courseId+'&goodsId='+item.goodsId+'&orderGoodsId='+item.orderGoodsId+'&sectionId='+sectionId+'&chapterId='+chapterId+'&moduleId='+moduleId)
+			uni.navigateTo({
+				url:`../../pages/webview/index?url=`+encode
+			})
+		},
 		async studyIn(v, i, item, index) {
 		async studyIn(v, i, item, index) {
 			console.log('item', item)
 			console.log('item', item)
 			this.activeItem = item
 			this.activeItem = item