guhongwei 4 år sedan
förälder
incheckning
7259392942
2 ändrade filer med 9 tillägg och 7 borttagningar
  1. 6 4
      src/components/parts/chat.vue
  2. 3 3
      src/views/live/parts/roomsDetail.vue

+ 6 - 4
src/components/parts/chat.vue

@@ -2,7 +2,7 @@
   <div id="chat">
     <el-row class="chat">
       <div class="chatList">
-        <ul>
+        <ul id="chatSell">
           <li v-for="(i, index) in list" :key="index">
             <p>
               <span>[{{ i.send_time | getTime }}]</span><span style="font-weight: bold;">{{ i.sender_name }}:</span>
@@ -15,7 +15,7 @@
             <el-input v-model="text" size="mini"></el-input>
           </el-col>
           <el-col :span="5">
-            <el-button @click="send" size="mini" round style="background: #ff8500;color: #fff;">发送</el-button>
+            <el-button @click="send" size="mini" round style="background: #2c69fe;color: #fff;">发送</el-button>
           </el-col>
         </el-row>
       </div>
@@ -72,13 +72,15 @@ export default {
       });
     },
     onMessage(message) {
-      console.log('lasjdas');
       // console.log('receive a message: ', message.body);
       let body = _.get(message, 'body');
       if (body) {
         body = JSON.parse(body);
         this.list.push(body);
         this.text = '';
+        this.$nextTick(() => {
+          document.getElementById('chatSell').scrollTop = document.getElementById('chatSell').scrollHeight + 275;
+        });
       }
       // const { content, contenttype, sendid, sendname, icon, groupid, sendtime, type } = message.headers;
       // let object = { content, contenttype, sendid, sendname, icon, groupid, sendtime, type };
@@ -123,7 +125,7 @@ export default {
   width: 100%;
   height: 340px;
   border-radius: 5px;
-  box-shadow: 0 0 5px #c20808;
+  box-shadow: 0 0 5px #2c69fe;
   padding: 0 10px 0px 10px;
   margin: 4px 0px 0 3px;
 }

+ 3 - 3
src/views/live/parts/roomsDetail.vue

@@ -63,18 +63,18 @@ export default {
           userSig: res.data,
         });
         await this.client_.join({ roomId: this.roomname, role: 'audience' });
-        this.client_.set
+        this.client_.set;
         this.client_.on('stream-subscribed', event => {
           const remoteStream = event.stream;
           // 远端流订阅成功,播放远端音视频流
-          remoteStream.setVideoProfile({ width: '50%', height: 200, float: 'left', frameRate: 15, bitrate: 900 /* kpbs */});
+          remoteStream.setVideoProfile({ width: '50%', height: 200, float: 'left', frameRate: 15, bitrate: 900 /* kpbs */ });
           remoteStream.play('look-video');
         });
         // 监听远端流增加事件
         this.client_.on('stream-added', event => {
           const remoteStream = event.stream;
           // 订阅远端音频和视频流
-          remoteStream.setScreenProfile({ width: '50%', height: 200, float: 'left', frameRate: 5, bitrate: 1600 /* kbps */});
+          remoteStream.setScreenProfile({ width: '50%', height: 200, float: 'left', frameRate: 5, bitrate: 1600 /* kbps */ });
           this.client_.subscribe(remoteStream, { audio: false, video: true }).catch(e => {
             console.error('failed to subscribe remoteStream');
           });