Commit 52effe2c by chenwq

加入im

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