lrf402788946 %!s(int64=5) %!d(string=hai) anos
pai
achega
448e720c4b
Modificáronse 1 ficheiros con 6 adicións e 3 borrados
  1. 6 3
      src/views/hall/hallDetail.vue

+ 6 - 3
src/views/hall/hallDetail.vue

@@ -49,7 +49,7 @@
               <el-col :span="24" class="top">
                 图文直播
               </el-col>
-              <el-col :span="24" class="info" style="height: 402px;overflow: auto;">
+              <el-col :span="24" class="info" style="height: 402px;overflow: auto;" id="chatSell">
                 <template v-for="(i, index) in mainTalk">
                   <span :key="`sellTime${i.id}`">[{{ i.send_time }}] {{ i.sender_name }}</span>
                   <span v-html="i.content" :key="`sellContent${i.id}${index}`"></span>
@@ -60,7 +60,7 @@
               <el-col :span="24" class="top">
                 聊天记录
               </el-col>
-              <el-col :span="24" class="info" style="height: 402px;overflow: auto;">
+              <el-col :span="24" class="info" style="height: 402px;overflow: auto;" id="chatBuy">
                 <template v-for="(i, index) in otherTalk">
                   <span :key="`buyTime${i.id}${index}`">[{{ i.send_time }}] {{ i.sender_name }}</span>
                   <span v-html="i.content" :key="`buyContent${i.id}${index}`"></span>
@@ -150,7 +150,6 @@ export default {
         let object = { number: this.id, sender_name: this.user.name, content: this.content };
         if (this.user.uid) object.sender_id = this.user.uid;
         let res = await this.create(object);
-        console.log(this.$refs.editor);
         this.$refs.editor.setContent();
         this.$set(this, `content`, '');
         this.$forceUpdate();
@@ -171,6 +170,10 @@ export default {
         let is_seller = this.sellerList.find(f => f.user_id == body.sender_id);
         if (is_seller) this.mainTalk.push({ id: body._id, sender_name: body.sender_name, send_time: body.send_time, content: body.content });
         else this.otherTalk.push({ id: body._id, sender_name: body.sender_name, send_time: body.send_time, content: body.content });
+        this.$nextTick(() => {
+          document.getElementById('chatBuy').scrollTop = document.getElementById('chatBuy').scrollHeight + 150;
+          document.getElementById('chatSell').scrollTop = document.getElementById('chatSell').scrollHeight + 150;
+        });
       }
     },
   },