|
@@ -15,23 +15,26 @@
|
|
|
<view class="had_courses">
|
|
|
<!-- 直播 -->
|
|
|
<view class="lives">
|
|
|
- <view class="live_item">
|
|
|
+ <view v-for="(live, l_index) in livingLists" :key="l_index" class="live_item">
|
|
|
<view class="live_con">
|
|
|
<view class="live_status">
|
|
|
- <image src="/static/learn/living.png" class="liv_icon"></image>
|
|
|
- <!-- <image src="/static/learn/wlive.png" class="my_bg"></image> -->
|
|
|
- <text class="status_s">正在直播中...</text>
|
|
|
- <view class="look_bt">点击观看</view>
|
|
|
+ <image v-if="bgShow(live.liveStartTime, live.watchStatus)" src="/static/learn/living.png" class="liv_icon"></image>
|
|
|
+ <image v-else src="/static/learn/wlive.png" class="liv_icon"></image>
|
|
|
+ <text class="status_s">{{ live.liveStartTime | liveStatus(live.watchStatus)}}</text>
|
|
|
+ <view class="look_bt" :class="{}">{{ lookTimeStatus(live.liveStartTime, live.watchStatus) }}</view>
|
|
|
</view>
|
|
|
<view class="liv_time">
|
|
|
- 7月19日 15:00
|
|
|
+ <text class="timeR">{{ live.liveStartTime | formate('mm月dd日')}}</text>
|
|
|
+ <text>{{ live.liveStartTime | formate('hh:mm')}}</text>
|
|
|
</view>
|
|
|
- <view class="liv_title">一级建造师《水利实务》拔高训练直播</view>
|
|
|
+ <view class="liv_title">{{ live.name }}</view>
|
|
|
</view>
|
|
|
- <!-- <image src="/static/learn/wlive_bg.png" class="my_bg"></image> -->
|
|
|
- <image src="/static/learn/living_bg.png" class="my_bg"></image>
|
|
|
+ <image v-if="bgShow(live.liveStartTime, live.watchStatus)" src="/static/learn/living_bg.png" class="my_bg"></image>
|
|
|
+ <image v-else src="/static/learn/wlive_bg.png" class="my_bg"></image>
|
|
|
+
|
|
|
</view>
|
|
|
</view>
|
|
|
+
|
|
|
<!-- 我的课程 -->
|
|
|
<view class="my_courses">
|
|
|
<text class="titles">我的课程</text>
|
|
@@ -162,7 +165,6 @@ export default {
|
|
|
gradeList: [],
|
|
|
gradeValue: -1,
|
|
|
sysTime: 0,
|
|
|
- // totalC: 0,
|
|
|
courseLists: [],
|
|
|
questionLists: [], // 题库
|
|
|
paramQ: {
|
|
@@ -170,11 +172,22 @@ export default {
|
|
|
pageSize: 50
|
|
|
},
|
|
|
queitemIndex:'',
|
|
|
+ livingLists: [],
|
|
|
}
|
|
|
},
|
|
|
- onLoad(option) {
|
|
|
- this.getcourseList()
|
|
|
- this.getlistQuestion()
|
|
|
+ filters: {
|
|
|
+ liveStatus(liveTime, watchStatus) {
|
|
|
+ let curTime = new Date().getTime() // 当前时间的时间戳
|
|
|
+ let value = liveTime * 1000
|
|
|
+ if (curTime < value) { // 判断当前时间和直播开始时间
|
|
|
+ return ' 未开播'
|
|
|
+ } else {
|
|
|
+ return watchStatus == 'live' ? '正在直播中...' : '即将开播'
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ onLoad() {
|
|
|
+ this.getCourseLiveQues()
|
|
|
},
|
|
|
async onShow() {
|
|
|
await this.commonSystemTime()
|
|
@@ -182,11 +195,59 @@ export default {
|
|
|
console.log('this.sysTime', this.sysTime)
|
|
|
},
|
|
|
methods: {
|
|
|
+ bgShow(liveTime, watchStatus) {
|
|
|
+ let curTime = new Date().getTime() // 当前时间的时间戳
|
|
|
+ let value = liveTime * 1000
|
|
|
+ if (curTime > value) { // 判断当前时间和直播开始时间
|
|
|
+ return watchStatus == 'live' ? true : false
|
|
|
+ }
|
|
|
+ },
|
|
|
+ lookTimeStatus(liveTime, watchStatus) {
|
|
|
+ let curTime = new Date().getTime() // 当前时间的时间戳
|
|
|
+ let value = liveTime * 1000
|
|
|
+ if (curTime > value) { // 判断当前时间和直播开始时间
|
|
|
+ if (watchStatus == 'live') { //
|
|
|
+ return '点击观看'
|
|
|
+ } else {
|
|
|
+ return '即将开播'
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ return '剩余:'
|
|
|
+ }
|
|
|
+ },
|
|
|
toChoose() {
|
|
|
uni.switchTab({
|
|
|
url:'/pages/course/index'
|
|
|
})
|
|
|
},
|
|
|
+ // 查询直播课
|
|
|
+ getCourseLiveQues() {
|
|
|
+ let arrs = [
|
|
|
+ this.$api.courseGoodsList(this.paramC), // 查询用户拥有的商品/课程列表/course/goodsList
|
|
|
+ this.$api.listGoodsUserQuestion(this.paramQ), // 题库列表
|
|
|
+ this.$api.getgoodsLiveList({
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 3 // 默认3条
|
|
|
+ })
|
|
|
+ ]
|
|
|
+ Promise.all(arrs).then((res) => {
|
|
|
+ // if (res.data.code == 200) {
|
|
|
+ console.log('ewds========', res)
|
|
|
+ const [{ data: res1}, { data: res2}, {data: res3}] = res
|
|
|
+ if (res1.code == 200) {
|
|
|
+ this.courseLists = res1.rows || []
|
|
|
+ }
|
|
|
+ if (res2.code == 200) {
|
|
|
+ this.questionLists = res2.rows || []
|
|
|
+ }
|
|
|
+ if (res3.code == 200) {
|
|
|
+ this.livingLists = res3.rows || []
|
|
|
+ }
|
|
|
+ // }
|
|
|
+ }).catch(err => {
|
|
|
+ // this.$u.toast('请重新刷新请求')
|
|
|
+ })
|
|
|
+ },
|
|
|
// 查询用户拥有的商品/课程列表/course/goodsList
|
|
|
getcourseList() {
|
|
|
this.$api.courseGoodsList(this.paramC).then(res => {
|