index.vue
2.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<template>
<div class="group-live-mask" v-if="groupLiveVisible">
<div class="live-container">
<div class="video-wrap">
<template v-if="channel === 3 && userID !== anchorID">
<live-player />
</template>
<template v-else>
<live-pusher />
</template>
</div>
<div class="chat-wrap">
<live-chat v-if="groupLiveVisible" />
</div>
</div>
</div>
</template>
<script>
import { mapState } from 'vuex'
import livePusher from './components/live-pusher'
import livePlayer from './components/live-player'
import liveChat from './components/live-chat'
export default {
name: 'groupLive',
data() {
return {
groupLiveVisible: false,
channel: 1 // 进入直播间渠道:1 群组内直播 2 群组外直播 3 点击消息卡片
}
},
computed: {
...mapState({
userID: state => state.user.userID,
groupID: state => state.groupLive.groupLiveInfo.groupID,
roomID: state => state.groupLive.groupLiveInfo.roomID,
anchorID: state => state.groupLive.groupLiveInfo.anchorID,
}),
},
mounted() {
this.$bus.$on('open-group-live', (options) => {
this.channel = options.channel
this.groupLiveVisible = true
})
this.$bus.$on('close-group-live', () => {
this.groupLiveVisible = false
this.$store.commit('clearAvChatRoomMessageList')
})
},
beforeDestroy() {
this.$bus.$off('open-group-live')
this.$bus.$off('close-group-live')
},
components: {
livePusher,
livePlayer,
liveChat,
},
methods: {}
}
</script>
<style lang="stylus" scoped>
.group-live-mask{
position absolute
top 8vh
width 80vw
height 80vh
max-width: 1280px
background: #fff
z-index 999
}
.live-container {
width 100%
height 100%
display flex
.video-wrap {
position relative
flex 1
min-width 500px
height 100%
background url('../../assets/image/video-bg.png') center no-repeat
}
.chat-wrap {
width 375px
height 100%
background #f5f5f5
}
}
</style>