直播发送命令

This commit is contained in:
luyuan 2020-11-06 23:41:23 +08:00
parent 6b8ca9b797
commit 945a99d4ab
Signed by: theluyuan
GPG Key ID: A7972FD973317FF3
3 changed files with 48 additions and 56 deletions

View File

@ -174,15 +174,12 @@ export default defineComponent({
const lan: any = useI18n();
function navto(){
let url = '';
switch (props.type) {
switch (props.status) {
case 1:
url = '/regime/livedetail';
url = '/regime/liveing';
break;
case 2:
default:
url = '/regime/livedetail';
break;
case 3:
url = '/regeime/liveing';
}
console.log(props.zid);
if(props.zid != undefined){

View File

@ -5,56 +5,20 @@
</div>
<div class="info">
<div class="item">
<div class="item" v-for="(item,index) in list" :key="index">
<div style="display:flex">
<div class="stuinfo">
<div>andy</div>
<div>{{item.name}}</div>
</div>
</div>
<div class="icons">
<img src="@/static/images/camera.png" @click="sendmasg" alt="" class="icon">
<img src="@/static/images/vol.png" alt="" class="icon">
<img src="@/static/images/camera.png" @click="cameta(item.memberid)" alt="" class="icon">
<img src="@/static/images/vol.png" alt="" class="icon" @click="vol(item.memberid)">
</div>
</div>
<div class="item">
<div style="display:flex">
<div class="stuinfo">
<div>andy</div>
</div>
</div>
<div class="icons">
<img src="@/static/images/camera.png" alt="" class="icon">
<img src="@/static/images/vol.png" alt="" class="icon">
</div>
</div>
<div class="item">
<div style="display:flex">
<div class="stuinfo">
<div>andy</div>
</div>
</div>
<div class="icons">
<img src="@/static/images/camera.png" alt="" class="icon">
<img src="@/static/images/vol.png" alt="" class="icon">
</div>
</div>
<div class="item">
<div style="display:flex">
<div class="stuinfo">
<div>andy</div>
</div>
</div>
<div class="icons">
<img src="@/static/images/camera.png" alt="" class="icon">
<img src="@/static/images/vol.png" alt="" class="icon">
</div>
</div>
</div>
</div>
</template>
@ -148,12 +112,21 @@
import { defineComponent } from "vue";
export default defineComponent({
props:{
list:{
type: Array
}
},
setup(prop,context){
function sendmasg(){
context.emit("sentext")
function cameta(id: number){
context.emit("cameta", id)
}
function vol(id: number){
context.emit("vol", id)
}
return {
sendmasg
cameta,
vol
}
}
});

View File

@ -9,7 +9,7 @@
</div>
</div>
<div class="info">
<LiveingWatcher @sentext="sendtext"></LiveingWatcher>
<LiveingWatcher :list="roominfo.studentlist" @cameta="sendtext" @vol="senvol"></LiveingWatcher>
<div class="LivePlaying">
<LivePlaying></LivePlaying>
<div class="comment">
@ -325,7 +325,7 @@ export default defineComponent({
client = TRTC.createClient({
mode: 'rtc',
sdkAppId: '1400400340',
sdkAppId: '1400435767',
userId: store.state.userinfo.memberid,
userSig: userSig
});
@ -470,20 +470,42 @@ export default defineComponent({
});
}
function sendtext(){
const message = tim.createTextMessage({
function sendtext(id: number){
const m = tim.createTextMessage({
to: roominfo.value.roomid,
conversationType: TIM.TYPES.CONV_GROUP,
payload: {
text: 'Hello world!'
text: `beelinkMuteUserId:${id},isClose:0`
}
});
const promise = tim.sendMessage(message);
const promise = tim.sendMessage(m);
promise.then(function(imResponse: any) {
//
console.log(imResponse);
message.success("发送命令成功")
}).catch(function(imError: any) {
//
message.error("发送命令失败")
console.warn('sendMessage error:', imError);
});
}
function sendvol(id: number){
const m = tim.createTextMessage({
to: roominfo.value.roomid,
conversationType: TIM.TYPES.CONV_GROUP,
payload: {
text: `beelinkTurnOffTheCameraUserId:${id},isClose:1
0`
}
});
const promise = tim.sendMessage(m);
promise.then(function(imResponse: any) {
//
console.log(imResponse);
message.success("发送命令成功")
}).catch(function(imError: any) {
//
message.error("发送命令失败")
console.warn('sendMessage error:', imError);
});
}