Commit f8f75166 by chenwq

直播不要控制条

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