直播发送命令

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(); const lan: any = useI18n();
function navto(){ function navto(){
let url = ''; let url = '';
switch (props.type) { switch (props.status) {
case 1: case 1:
url = '/regime/livedetail'; url = '/regime/liveing';
break; break;
case 2: default:
url = '/regime/livedetail'; url = '/regime/livedetail';
break;
case 3:
url = '/regeime/liveing';
} }
console.log(props.zid); console.log(props.zid);
if(props.zid != undefined){ if(props.zid != undefined){

View File

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

View File

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