zs 1 year ago
parent
commit
35f65fe9fe
1 changed files with 10 additions and 13 deletions
  1. 10 13
      src/views/user/user/chat.vue

+ 10 - 13
src/views/user/user/chat.vue

@@ -13,7 +13,7 @@
                   <el-col class="time" v-if="item.time != ''">{{ item.time }}</el-col>
                   <el-col class="time" v-if="item.time != ''">{{ item.time }}</el-col>
                   <el-col :span="24" class="content">
                   <el-col :span="24" class="content">
                     <el-col :span="2" class="logo">
                     <el-col :span="2" class="logo">
-                      <el-image v-if="user" :src="bglogin" style="width: 60px; height: 60px; border-radius: 60px" mode="widthFix"></el-image>
+                      <el-avatar :size="60">{{ item.user.name || item.user.nickname }}</el-avatar>
                     </el-col>
                     </el-col>
                     <el-col :span="8" v-if="item.msg_type == '0'">
                     <el-col :span="8" v-if="item.msg_type == '0'">
                       <text class="text">{{ item.content }}</text>
                       <text class="text">{{ item.content }}</text>
@@ -34,8 +34,8 @@
                     </el-col>
                     </el-col>
                     <el-col :span="2" class="logo">
                     <el-col :span="2" class="logo">
                       <el-image
                       <el-image
-                        v-if="config && config.file.length != 0"
-                        :src="config.file[0].url"
+                        v-if="config && config.logo.length != 0"
+                        :src="config.logo[0].url"
                         style="width: 60px; height: 60px; border-radius: 60px"
                         style="width: 60px; height: 60px; border-radius: 60px"
                         mode="widthFix"
                         mode="widthFix"
                       ></el-image>
                       ></el-image>
@@ -67,7 +67,6 @@ import { onMounted, ref, getCurrentInstance } from 'vue';
 import { useRoute } from 'vue-router';
 import { useRoute } from 'vue-router';
 import store from '@/stores/counter';
 import store from '@/stores/counter';
 import { ElMessage } from 'element-plus';
 import { ElMessage } from 'element-plus';
-import bglogin from '@/assets/bglogin.jpg';
 // 接口
 // 接口
 import { ChatStore } from '@/stores/users/chat';
 import { ChatStore } from '@/stores/users/chat';
 import { ConfigStore } from '@/stores/system/config';
 import { ConfigStore } from '@/stores/system/config';
@@ -88,8 +87,8 @@ let total: Ref<number> = ref(0);
 let skip = 0;
 let skip = 0;
 let page = 0;
 let page = 0;
 let limit: number = proxy.$limit;
 let limit: number = proxy.$limit;
-const user: Ref<any> = ref({ logo: [] });
-const config: Ref<any> = ref({ file: [] });
+const user: Ref<any> = ref({});
+const config: Ref<any> = ref({ logo: [] });
 const file: Ref<any> = ref([]);
 const file: Ref<any> = ref([]);
 const input: Ref<any> = ref('');
 const input: Ref<any> = ref('');
 // 字典表
 // 字典表
@@ -130,7 +129,6 @@ const toSend = async () => {
   let res: IQueryResult;
   let res: IQueryResult;
   let form: any = {
   let form: any = {
     user: user.value._id,
     user: user.value._id,
-    admin: admin.value._id,
     speaker: admin.value._id,
     speaker: admin.value._id,
     content: input.value,
     content: input.value,
     msg_type: '0',
     msg_type: '0',
@@ -159,12 +157,10 @@ const onUpload = async (e: { value: Array<any> }) => {
 };
 };
 // 下拉查看聊天记录
 // 下拉查看聊天记录
 const load = () => {
 const load = () => {
-  if (total.value != 0) {
-    if (total.value > limit) {
-      page = page + 1;
-      limit = limit * page;
-      search({ skip, limit });
-    } else ElMessage({ type: `warning`, message: `已经到底了!` });
+  if (total.value != 0 && total.value > limit) {
+    page = page + 1;
+    limit = limit * page;
+    search({ skip, limit });
   }
   }
 };
 };
 // 返回上一页
 // 返回上一页
@@ -238,6 +234,7 @@ const toBack = () => {
             background: #16f80f;
             background: #16f80f;
           }
           }
         }
         }
+
       }
       }
     }
     }
   }
   }