Commit 52effe2c by chenwq

加入im

1 parent 82034d78
......@@ -23,6 +23,9 @@
"postcss-loader": "^6.2.0",
"sha1": "^1.1.1",
"storejs": "^1.1.0",
"tim-js-sdk": "^2.23.1",
"tim-upload-plugin": "^1.0.5",
"tim-wx-sdk": "^2.23.1",
"vant": "^2.12.21",
"vconsole": "^3.7.0",
"vue": "^2.6.11",
......
<template>
<!-- v-if="LiveProps[liveDetail.status].isLive" -->
<div class="videoContainer">
<div
class="small-box"
@click="isSmallBox = false"
v-show="isSmallBox"
>
<img
class="icon-small-live"
src="@/assets/images/icon-small-live.jpg"
/>
<div class="small-box" @click="isSmallBox = false" v-show="isSmallBox">
<img class="icon-small-live" src="@/assets/images/icon-small-live.jpg" />
<div class="flex small-content">
<!-- <div v-if="LiveStatus[liveDetail.status] == 'live'" class="live-line"> -->
<div
class="live-line"
v-if="LiveProps[liveDetail.status].isLive"
>
<div class="live-line" v-if="LiveProps[liveDetail.status].isLive">
<div class="side"></div>
<div class="center side"></div>
<div class="side"></div>
</div>
<img
v-if="!LiveProps[liveDetail.status].isLive"
:src="IMAGES.REPLAY_ICON"
class="live-replayIcon"
/>
<img v-if="!LiveProps[liveDetail.status].isLive" :src="IMAGES.REPLAY_ICON" class="live-replayIcon" />
<div class="text">{{ LiveProps[liveDetail.status].status }}</div>
</div>
</div>
<!-- @click="openFullscreen" -->
<!-- @touchmove.stop.prevent 禁止使用滚动 -->
<div
:style="videoStyle"
id="live-box"
:class="['live-box', { videoFullscreen: videoFullscreen }]"
v-show="!isSmallBox"
>
<div
class="sprite-icon icon-live-close"
v-show="!videoFullscreen && !isSmallBox"
@click="isSmallBox = true"
></div>
<div :style="videoStyle" id="live-box" :class="['live-box', { videoFullscreen: videoFullscreen }]" v-show="!isSmallBox">
<div class="sprite-icon icon-live-close" v-show="!videoFullscreen && !isSmallBox" @click="isSmallBox = true"></div>
<div :class="{ videoShort: isAction }">
<div class="mask">
<div class="status flex">
<div
v-if="LiveProps[liveDetail.status].isLive"
class="live-line"
>
<div v-if="LiveProps[liveDetail.status].isLive" class="live-line">
<div class="side"></div>
<div class="center side"></div>
<div class="side"></div>
</div>
<!-- 回放图标 -->
<img
v-if="!LiveProps[liveDetail.status].isLive"
:src="IMAGES.REPLAY_ICON"
class="live-replayIcon"
/>
<img v-if="!LiveProps[liveDetail.status].isLive" :src="IMAGES.REPLAY_ICON" class="live-replayIcon" />
<div class="text">{{ LiveProps[liveDetail.status].text }}</div>
</div>
<template v-if="isShowGif">
<img
class="coverGif"
:src="LiveProps[liveDetail.status].covergif"
alt=""
/>
<img class="coverGif" :src="LiveProps[liveDetail.status].covergif" alt="" />
</template>
</div>
<div
class="fullscreen-btn"
@click="openFullscreen(false)"
>
<div class="fullscreen-btn" @click="openFullscreen(false)">
<img :src="IMAGES.FULL_SCREEN" />
</div>
<div
class="poster-btn"
@click="showKf = true"
>
<div class="poster-btn" @click="showKf = true">
<img :src="detail.floatingMaskDiagram" />
</div>
<video
id="player-container-id"
preload="auto"
playsinline
webkit-playsinline
></video>
<group-modal
v-model="showKf"
:detail="detail"
/>
<video id="player-container-id" preload="auto" playsinline webkit-playsinline></video>
<group-modal v-model="showKf" :detail="detail" />
</div>
<action
:bgBlack="true"
class="BgAction"
v-show="videoFullscreen && isAction"
></action>
<action :bgBlack="true" class="BgAction" v-show="videoFullscreen && isAction"></action>
<!-- IM -->
<im v-show="videoFullscreen" class="Im"></im>
</div>
</div>
</template>
<script type="text/ecmascript-6">
import { wxConfig } from '@/api'
import Im from './Im.vue'
const IMAGES = Object.freeze({
// COVER_LIVE: 'https://wimg.588ku.com/gif620/20/04/23/79a7882dfb0c59497976fd8b3bfe60ef.gif',
COVER_LIVE: 'https://img02.glsx.com.cn/weapp/resource/scrm-mobile/crowdfunding/COVER_LIVE.gif',
......@@ -128,8 +80,9 @@ const LiveProps = Object.freeze({
})
const PLAYERDOMID = 'player-container-id'
export default {
components: { Im },
name: 'LiveBox',
data () {
data() {
return {
player: null,
videoFullscreen: false,
......@@ -142,7 +95,7 @@ export default {
}
},
computed: {
isAction () {
isAction() {
const { activityStatus, buyFlag } = this.detail
return activityStatus != 3 && buyFlag != 2 //TODO CONSTANT
}
......@@ -167,7 +120,7 @@ export default {
}
},
mounted () {
mounted() {
this.createPlayerCover()
this.createPlayer()
this.play()
......@@ -217,13 +170,13 @@ export default {
// })
},
methods: {
createPlayerCover () {
createPlayerCover() {
!this.IsIOS && (this.isShowGif = true)
},
createPlayer () {
createPlayer() {
this.player = TCPlayer(PLAYERDOMID, TCPlayerConfig)
},
play () {
play() {
wxConfig.ready(() => {
wx.getNetworkType({
success: (result) => {
......@@ -241,12 +194,12 @@ export default {
})
},
controlBarStyle () {
controlBarStyle() {
var [controlBar] = document.getElementsByClassName('vjs-control-bar')
controlBar.style.bottom = this.isAction ? '10vh' : '0'
},
fixHls () {
fixHls() {
if (Hls.isSupported()) {
this.video = document.getElementById(PLAYERDOMID)
this.hls = new Hls()
......@@ -256,7 +209,7 @@ export default {
}
},
// 打开关闭全屏
openFullscreen (status = true) {
openFullscreen(status = true) {
// console.log('openFullscreen')
this.isShowGif = false
const [live] = document.getElementsByClassName('live-box')
......@@ -273,7 +226,7 @@ export default {
this.$emit('handleLiveFull', { isFull: this.videoFullscreen })
},
// 处理tcplayer错误码14
dealTcPlayerErr14 () {
dealTcPlayerErr14() {
this.hls.on(Hls.Events.ERROR, function (event, data) {
if (data.fatal) {
switch (data.type) {
......@@ -294,16 +247,19 @@ export default {
}
})
},
changeGifStatus () {
changeGifStatus() {
this.isShowGif = !this.isShowGif
},
continueVideo () {
continueVideo() {
this.player.play()
}
}
}
</script>
<style scoped lang="scss">
.videoContainer {
position: relative;
}
.small-box {
position: fixed;
top: 18%;
......@@ -365,7 +321,7 @@ export default {
border-radius: 4px;
overflow: hidden;
user-select: auto;
transition: width,height 0.2s ease;
transition: width, height 0.2s ease;
.icon-live-close {
position: absolute;
top: 2px;
......@@ -472,4 +428,12 @@ export default {
background: linear-gradient(0deg, rgba(0, 0, 0, 0.6), rgba(225, 225, 225, 0)); /* 标准的语法(必须放在最后) */
}
}
.Im {
position: absolute;
bottom: 0;
background: #ffffff;
left: 0;
width: 100%;
z-index: 99;
}
</style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!