Commit f8f75166 by chenwq

直播不要控制条

1 parent 778acb15
......@@ -195,7 +195,11 @@ export default {
controlBarStyle() {
var [controlBar] = document.getElementsByClassName('vjs-control-bar')
controlBar.style.bottom = this.isAction && !this.LiveProps[this.liveDetail.status].isLive ? '10vh' : '0'
if (!this.LiveProps[this.liveDetail.status].isLive) {
controlBar.style.bottom = this.isAction ? '10vh' : '0'
} else {
controlBar.style.display = 'none'
}
},
fixHls() {
......@@ -427,9 +431,8 @@ export default {
}
.Im {
position: absolute;
bottom: 40px;
bottom: 10px;
left: 0;
width: 100%;
z-index: 20;
}
</style>
......@@ -5,7 +5,7 @@
<div class="chatInfo" id="chatInfo">
<div class="chatUser-box" v-for="(item, index) in messageList" :key="index">
<div class="chatUser-info">
<span class="chatUser-info-text" :class="current == item.id">
<span class="chatUser-info-text">
<div v-if="item.isNotice">
<p>
<img class="icon-notice" src="@/assets/images/icon-notice.png" />
......@@ -20,7 +20,7 @@
</div>
</div>
<div class="chatBox-infoDesk" action="javascript:return true">
<van-field class="chatBox-input" v-model="messageContent" center placeholder="聊一聊..." use-button-slot type="search" @focus="handleFocus" @blur="sendTextMessage" @click="fixInputBeCovered($event)" @keydown="search($event)">
<van-field class="chatBox-input" v-model="messageContent" center placeholder="聊一聊..." use-button-slot type="search" @blur="sendTextMessage" @click="fixInputBeCovered($event)">
<!-- <van-button slot="button" size="small" type="info" @click="sendTextMessage">发送</van-button> -->
</van-field>
<action :bgBlack="true" class="action" v-show="isAction" :isImAction="true"></action>
......@@ -39,16 +39,13 @@ export default {
name: 'Im',
data() {
return {
userInfo: util.getUserInfo(),
imOptions: {},
messageContent: '',
messageList: [
{
isNotice: true,
content: '直播间内严禁出现违法违规、低俗、涉黄、吸烟酗酒等内容,直播期间请勿相信私下交易,诱导购买等信息,以防人身或财产损失。请大家注意财产安全,谨防网络诈骗,文明观看直播。'
}
],
current: 2
]
}
},
props: {
......@@ -56,7 +53,8 @@ export default {
type: Object,
default: () => {
return {
imGroupId: ''
imGroupId: '',
imSdkAppId: ''
}
}
},
......@@ -83,30 +81,30 @@ export default {
target.scrollIntoView(true)
}, 100)
},
getUserSig() {
const userInfo = util.getUserInfo()
// userId = this.userInfo.openid || this.userInfo.uuid
const userId = userInfo.nickName || userInfo.userName
shopmallApi.getLiveSig({ userId: userId }).then(res => {
this.userSig = res.userSig
this.initTim()
})
},
initTim() {
this.imOptions = {
userID: this.userInfo.userId,
userSig: this.userInfo.userSig,
const userInfo = util.getUserInfo()
const imOptions = {
userID: userInfo.nickName || userInfo.userName,
userSig: this.userSig,
groupID: this.liveDetail.imGroupId,
SDKAppID: this.liveDetail.imSdkAppId,
onMessageReceived: this.onMessageReceived,
onNetStateChange: this.onNetStateChange
}
timObj = new IM(this.imOptions)
console.log(timObj, '000000000')
console.log(this.imOptions)
timObj.join(this.imOptions).then(res => {
timObj = new IM(imOptions)
timObj.join(imOptions).then(res => {
console.log('login-------')
})
},
getUserSig() {
// this.userInfo.userId = this.userInfo.openid || this.userInfo.uuid
this.userInfo.userId = this.userInfo.nickName || this.userInfo.userName
// this.userName = this.userInfo.nickName || this.userInfo.userName
shopmallApi.getLiveSig({ userId: this.userInfo.userId }).then(res => {
this.userInfo.userSig = res.userSig
this.initTim()
})
},
// 收到消息触发
onMessageReceived(data) {
console.log('收到消息:', data)
......@@ -134,28 +132,23 @@ export default {
this.messageList = [...this.messageList, data]
this.scrollToBottom()
},
search(e) {
// this.$toast(e)
},
changeChatHeight(height = '230px') {
var chatBoxDom = this.$el.querySelector('.chatBox-middle')
chatBoxDom.style.height = height
this.scrollToBottom()
},
handleFocus() {
this.changeChatHeight('116px')
},
// changeChatHeight(height = '230px') {
// var chatBoxDom = this.$el.querySelector('.chatBox-middle')
// chatBoxDom.style.height = height
// this.scrollToBottom()
// },
// handleFocus() {
// this.changeChatHeight('116px')
// },
//发送聊天
sendTextMessage() {
let _this = this
this.changeChatHeight()
// this.changeChatHeight()
if (this.messageContent === '' || this.messageContent.trim().length === 0) {
this.messageContent = ''
this.$toast('不能发送空消息哦')
return
}
console.log(_this.messageContent, '准备发咯--')
timObj.send(_this.messageContent)
// console.log(this.messageContent, '准备发咯--')
timObj.send(this.messageContent)
this.messageContent = ''
},
scrollToBottom() {
......@@ -177,21 +170,15 @@ body {
width: 100%;
height: auto;
margin: auto 0;
/* background-color: #fff; */
overflow: hidden;
border-radius: 0.625rem;
}
#chat .chatBox-middle {
width: 100%;
// position: fixed;
// top: 18rem;
height: 230px;
overflow: hidden;
}
#chat .chatBox-infoDesk {
// width: 50%;
// position: fixed;
// bottom: 0;
display: flex;
margin: 0 10px 10px;
.chatBox-input {
......@@ -222,11 +209,6 @@ body {
display: flex;
flex-direction: row;
}
// #chat .chatUser-box-img {
// display: flex;
// }
#chat .chatUser-info {
margin: 0 1.25rem;
width: 70%;
......@@ -239,8 +221,6 @@ body {
color: rgb(234, 201, 36);
margin-right: 0.4rem;
font-weight: 600;
/* display: flex; */
/* flex-direction: row; */
}
#chat .chatUser-info-text {
......@@ -263,9 +243,6 @@ body {
#chat .chatUser-info-text span {
font-size: 12px;
}
// #chat .chatUser-box1 {
// flex-direction: row-reverse;
// }
</style>
<style>
#chat .chatBox-infoDesk .chatBox-input .van-field__control {
......@@ -278,7 +255,4 @@ body {
#chat .chatBox-infoDesk .van-cell::after {
border: none;
}
/* #chat .chatBox-infoDesk .van-button {
border-radius: 2rem !important;
} */
</style>
......@@ -11,7 +11,7 @@
import TIM from 'tim-js-sdk'
import TIMUploadPlugin from 'tim-upload-plugin'
const TimOptions = {
SDKAppID: 1400743527
// SDKAppID: 1400743527
}
export default class IM {
constructor(options = {}) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!