123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158 |
- <template>
- <view style="display: flex;justify-content: space-between;align-items: center;" @click="getVideo">
- <view style="display: flex;align-items: center;margin: 20rpx 0;">
- <view class="tag tagColor1" v-if="menuItem.sectionType==1">录播</view>
- <view class="tag tagColor2" v-if="menuItem.sectionType==2">直播</view>
- <view class="tag tagColor3" v-if="menuItem.sectionType==3">回放</view>
- <view class="t_content">
- <view v-if="menuItem.sectionType==1" :class="playSectionId==newId?'color1':''">{{menuItem.name}}</view>
- <view v-if="menuItem.sectionType==2" :class="playSectionId==newId?'color2':''">{{menuItem.name}}</view>
- <view v-if="menuItem.sectionType==3" :class="playSectionId==newId?'color3':''">{{menuItem.name}}</view>
- <view style="font-size: 20rpx;color: #FF3B30;" v-if="menuItem.liveStartTime">
- <view v-if="menuItem.liveStartTime>nowTime">
- <text>{{$method.timestampToTime(menuItem.liveStartTime)}}</text>-
- <text>{{$method.timestampToTime(menuItem.liveEndTime)}}</text>
- </view>
- <view v-if="menuItem.liveStartTime<=nowTime&&menuItem.liveEndTime>nowTime">
- <text>直播中</text>
- </view>
- <view v-if="menuItem.liveEndTime<nowTime">
- <text>回放</text>
- </view>
- </view>
- </view>
- </view>
- <view v-if="menuItem.tryListen&&!isBuy" class="tryBox">
- 试看
- </view>
- </view>
- </template>
- <script>
- import { mapGetters } from 'vuex';
- import eventHub from '@/common/eventHub.js'
- export default {
- name: 'courseSection',
- props: {
- menuItem: {
- type: Object,
- default: {}
- },
- isBuy: {
- type: Boolean,
- default: false
- },
- levelId: {
- type: String,
- default: ""
- },
- isRebuild: {
- type: Boolean,
- default: false
- }
- },
- data() {
- return {
- nowTime:0,
- newId:0
- };
- },
- onLoad() {},
- created() {
-
- },
- mounted() {
- this.nowTime = Number(new Date().getTime()/1000).toFixed(0)
- this.newId= this.menuItem.sectionId>0?this.menuItem.sectionId:this.menuItem.menuId
- },
- methods: {
- getVideo(){
- if(!this.isBuy){
- //非购买
- if(!this.menuItem.tryListen){
- //不允许试听
- return
- }
-
- }
- if(!this.menuItem.recordingUrl){
- uni.showToast({
- title: '暂无播放数据',
- icon: 'error'
- });
- }
- if(this.playSectionId==this.newId){
- //切换为同一节
- return
- }
- //设置播放的节ID
- this.$store.commit('setPlaySectionId', {playSectionId :this.newId});
- // return
- eventHub.$emit('getSection', this.menuItem)
- eventHub.$emit('levelId', this.levelId)
-
- }
- },
- computed: { ...mapGetters(['playSectionId']) }
-
- };
- </script>
- <style scoped>
- .tryBox{
- width: 96rpx;
- height: 48rpx;
- background: #007AFF;
- border-radius: 24rpx;
- color: #FFFFFF;
- font-size: 30rpx;
- line-height: 48rpx;
- text-align: center;
- }
- .icon_up{
- width: 24rpx;
- height: 24rpx;
- }
- .t_content3{
- color: #007AFF;
- }
- .t_content2{
- color: #007AFF;
- }
- .t_content1{
- color: #007AFF;
- }
- .t_content{
- margin-left: 10rpx;
- color: #666666;
- white-space:nowrap;
- overflow:hidden;
- text-overflow:ellipsis;
- }
- .tagColor3{
- border: 2rpx solid #FF9500;
- color: #FF9500;
- }
- .tagColor2{
- border: 2rpx solid #FF3B30;
- color: #FF3B30;
- }
- .tagColor1{
- border: 2rpx solid #007AFF;
- color: #007AFF;
- }
- .color3{
- color: #FF9500;
- }
- .color2{
- color: #FF3B30;
- }
- .color1{
- color: #007AFF;
- }
- .tag{
- border-radius: 8rpx;
- font-size: 20rpx;
- padding: 5rpx;
- }
- </style>
|