guhongwei 3 years ago
parent
commit
c384497409
2 changed files with 10 additions and 3 deletions
  1. 9 2
      src/components/chat.vue
  2. 1 1
      src/views/index.vue

+ 9 - 2
src/components/chat.vue

@@ -10,7 +10,7 @@
                   <el-image :src="leftIcon"></el-image>
                   <el-image :src="leftIcon"></el-image>
                 </el-col>
                 </el-col>
                 <el-col :span="22" class="info">
                 <el-col :span="22" class="info">
-                  <el-col :span="24" class="name">{{ item.sender_name }}</el-col>
+                  <el-col :span="24" class="name">{{ item.sender_name }}[{{ getTime(item) }}]</el-col>
                   <el-col :span="24" class="content">
                   <el-col :span="24" class="content">
                     {{ item.content }}
                     {{ item.content }}
                   </el-col>
                   </el-col>
@@ -20,7 +20,7 @@
             <template v-else>
             <template v-else>
               <el-col :span="24" class="left right">
               <el-col :span="24" class="left right">
                 <el-col :span="22" class="info">
                 <el-col :span="22" class="info">
-                  <el-col :span="24" class="name">{{ item.sender_name }}</el-col>
+                  <el-col :span="24" class="name">[{{ getTime(item) }}]{{ item.sender_name }}</el-col>
                   <el-col :span="24" class="content">
                   <el-col :span="24" class="content">
                     {{ item.content }}
                     {{ item.content }}
                   </el-col>
                   </el-col>
@@ -50,6 +50,7 @@ import { mapState, createNamespacedHelpers } from 'vuex';
 const { mapActions: clientApply } = createNamespacedHelpers('clientApply');
 const { mapActions: clientApply } = createNamespacedHelpers('clientApply');
 const { mapActions: mapChat } = createNamespacedHelpers('chat');
 const { mapActions: mapChat } = createNamespacedHelpers('chat');
 const { mapActions: chatRecord } = createNamespacedHelpers('chatRecord');
 const { mapActions: chatRecord } = createNamespacedHelpers('chatRecord');
+const moment = require('moment');
 export default {
 export default {
   name: 'chat',
   name: 'chat',
   props: {
   props: {
@@ -137,6 +138,12 @@ export default {
         container.scrollTop = container.scrollHeight;
         container.scrollTop = container.scrollHeight;
       });
       });
     },
     },
+    // 整理时间
+    getTime(item) {
+      const ct = _.get(item.meta, 'createdAt');
+      if (!ct) return;
+      return moment(ct).format('YYYY-MM-DD HH:mm:ss');
+    },
   },
   },
   computed: {
   computed: {
     ...mapState(['user']),
     ...mapState(['user']),

+ 1 - 1
src/views/index.vue

@@ -36,7 +36,7 @@ export default {
       // 创建用户
       // 创建用户
       let data = {
       let data = {
         _tenant: 'platform',
         _tenant: 'platform',
-        client_id: '5fa34a8e3849fd0eecf7f1c6',
+        client_id: '5fa34a8e3849fd0eecf7f1c7',
         client_name: '顾红伟',
         client_name: '顾红伟',
       };
       };
       this.$set(this, `userInfo`, data);
       this.$set(this, `userInfo`, data);