lrf402788946 преди 4 години
родител
ревизия
a1e1af959b
променени са 2 файла, в които са добавени 48 реда и са изтрити 5 реда
  1. 0 2
      src/components/parts/chat.vue
  2. 48 3
      src/views/hall/direct.vue

+ 0 - 2
src/components/parts/chat.vue

@@ -100,7 +100,6 @@ export default {
       }
     },
     async sendEmotion(type) {
-      // TODO 修改content内容,发送
       let object = { sender_name: this.user.name ? this.user.name : this.user.adminuser };
       let content = '';
       content = `<img src='${_.get(this, `${type}`)}' style="width:30px;height:30px" />`;
@@ -116,7 +115,6 @@ export default {
       return word.startsWith('<img');
     },
     channel() {
-      console.log('in function:');
       this.$stomp({
         [`/exchange/public_chat`]: this.onMessage,
       });

+ 48 - 3
src/views/hall/direct.vue

@@ -48,7 +48,12 @@
                   <span>直播</span>
                 </el-col>
                 <el-col :span="24" class="video">
-                  <video :src="dockInfo.file_path" autoplay="autoplay" controls="controls" style="height: 395px; width: 100%;">
+                  <video
+                    :src="dockInfo.file_path"
+                    autoplay="autoplay"
+                    controls="controls"
+                    :style="{ height: `${this.user.role == 3 ? '350px' : '395px'}`, width: '100%' }"
+                  >
                     您的浏览器不支持 video 标签。
                   </video>
                   <div class="box">
@@ -79,6 +84,16 @@
                       </el-col>
                     </div>
                   </div>
+                  <div>
+                    <el-row type="flex" :gutter="10" style="padding-top:10px;height:30px;line-height:30px">
+                      <el-col :span="20">
+                        <el-input v-model="text" size="mini"></el-input>
+                      </el-col>
+                      <el-col :span="4">
+                        <el-button @click="send" size="mini" round style="background: #ff8500;color: #fff;">发送</el-button>
+                      </el-col>
+                    </el-row>
+                  </div>
                   <!-- <videoPlayer ref="videoPlayer" :options="videoOptions" class="vjs-custom-skin videoPlayer" :playsinline="true" /> -->
                 </el-col>
               </el-col>
@@ -569,6 +584,9 @@ export default {
     // 测试轮播
     lunboList: [],
     animate: false,
+
+    //现场直播对话框
+    text: '',
   }),
   created() {
     this.$set(this, `dock_id`, this.$route.query.id);
@@ -577,7 +595,7 @@ export default {
   },
   methods: {
     ...mapProduct({ mapProductQuery: 'newquery' }),
-    ...market({ marketFetch: 'fetch', operaFetch: 'operaFetch' }),
+    ...market({ marketFetch: 'fetch', operaFetch: 'operaFetch', sendMsg: 'operationCreate' }),
     ...dock({ dockQuery: 'query', dockFetch: 'fetch', goodsquery: 'goodsquery' }),
     ...expertsuser({ expertQuery: 'query' }),
     ...transaction({ tquery: 'query' }),
@@ -759,6 +777,7 @@ export default {
     // 测试轮播
     scroll() {
       let con1 = this.$refs.con1;
+      console.log(con1);
       con1.style.marginTop = '-30px';
       this.animate = !this.animate;
       var that = this; // 在异步函数中会出现this的偏移问题,此处一定要先保存好this的指向
@@ -775,9 +794,35 @@ export default {
     mLeave() {
       this.timer1 = setInterval(this.scroll, 1000);
     },
+    //
+    async send() {
+      if (this.text != '') {
+        let object = { login_role: 3, type: 2, login_name: this.user.adminuser, remark: this.text, dockid: this.dock_id };
+        let res = await this.sendMsg(object);
+        this.$checkRes(res, null, res.errmsg || '发言失败');
+      } else this.$message.error('请输入信息后发送');
+    },
+
+    channel() {
+      this.$stomp({
+        [`/exchange/bullet_chat/${this.dock_id}`]: this.onMessage,
+      });
+    },
+    onMessage(message) {
+      let body = _.get(message, 'body');
+      if (body) {
+        body = JSON.parse(body);
+        this.lunboList.push(body);
+        this.text = '';
+      }
+      // const { content, contenttype, sendid, sendname, icon, groupid, sendtime, type } = message.headers;
+      // let object = { content, contenttype, sendid, sendname, icon, groupid, sendtime, type };
+      // this.list.push(object);
+    },
   },
   mounted() {
     this.timer1 = setInterval(this.scroll, 2000);
+    this.channel();
   },
   computed: {
     ...mapState(['user']),
@@ -908,7 +953,7 @@ export default {
   margin: 0 10px 10px 10px;
   border: 2px solid #ccc;
   width: 97%;
-  background-color: #000;
+  // background-color: #000;
 }
 .livemain .livevideo .right {
   height: 460px;