liuyu 4 yıl önce
ebeveyn
işleme
ee0119150c
1 değiştirilmiş dosya ile 22 ekleme ve 1 silme
  1. 22 1
      src/views/live/roomMeet.vue

+ 22 - 1
src/views/live/roomMeet.vue

@@ -32,7 +32,7 @@
             </el-col>
           </el-col>
           <el-col :span="24" class="videoBtn">
-            <el-button :type="typevalue" round @click="liveon()" size="mini"><i class="el-icon-camera-solid"></i></el-button>
+            <el-button v-show="switchbtn" :type="typevalue" round @click="liveon()" size="mini"><i class="el-icon-camera-solid"></i></el-button>
           </el-col>
         </el-col>
         <el-col :span="24" class="down">
@@ -98,6 +98,8 @@ export default {
       iscamera: false,
       typevalue: 'warning',
       index: 1,
+      switchrole: 'audience',
+      switchbtn: false,
     };
   },
   created() {
@@ -108,6 +110,7 @@ export default {
   },
   mounted() {
     this.channel();
+    this.swichchannel();
   },
   methods: {
     ...gensign(['gensignFetch']),
@@ -152,6 +155,24 @@ export default {
       // let object = { content, contenttype, sendid, sendname, icon, groupid, sendtime, type };
       // this.list.push(object);
     },
+    swichchannel() {
+      console.log('in function:');
+      this.$stomp({
+        [`/exchange/switch_role_` + this.user.uid]: this.onSwichMessage,
+      });
+    },
+    onSwichMessage(message) {
+      // console.log('receive a message: ', message.body);
+      let body = _.get(message, 'body');
+      if (body) {
+        body = JSON.parse(body);
+        if (body.switchrole === 'anchor') {
+          this.switchbtn = true;
+        } else {
+          this.switchbtn = false;
+        }
+      }
+    },
     async lookuserSearch() {
       let data = {};
       data.roomid = this.id;