ソースを参照

修改bug首页

“yueshang” 1 年間 前
コミット
1504457550
3 ファイル変更25 行追加7 行削除
  1. 2 2
      src/layout/indexCommon.vue
  2. 1 1
      src/store/modules/websocket.js
  3. 22 4
      src/views/liveChat/index.vue

+ 2 - 2
src/layout/indexCommon.vue

@@ -38,7 +38,7 @@
                       : '@/assets/images/profile.png'
                   "
                   class="head-img"
-                /><span>{{ logingName }}</span>
+                /><span>{{ userStore.name }}</span>
               </div>
               <template #dropdown>
                 <el-dropdown-menu>
@@ -133,7 +133,7 @@ const userStore = useUserStore();
 const settingsStore = useSettingsStore();
 const searchText = ref(""); //搜索ipt的值
 const selectValue = ref(1); //文档空间类型
-
+const wangzhi=import.meta.env.VITE_APP_BASE_API
 const isAlive = ref(true);
 
 function reload() {

+ 1 - 1
src/store/modules/websocket.js

@@ -67,7 +67,7 @@ const useWebsoctStore = defineStore('websoct', {
     
     // 重新连接
    reconnect(url) {
-      if (lockReconnect) return ElMessage({ message: "WebSocket重连失败,请尝试刷新界面", type: "error" });
+      if (this.lockReconnect) return ElMessage({ message: "WebSocket重连失败,请尝试刷新界面", type: "error" });
       this.lockReconnect = true;
       setTimeout(function () { //没连接上会一直重连,设置延迟避免请求过多
         ElMessage({ message: "请尝试重连中", type: "error" });

+ 22 - 4
src/views/liveChat/index.vue

@@ -247,6 +247,22 @@ const fileChangeMsg = async (val) => {
   sendId.value = val.id;
   websoctStore.sendMessage(message);
 };
+const getNewMsgList=async ()=>{
+  const resFriend = await msgFriend();
+    personList.data = resFriend.rows;
+  //圆点======
+  searchData.value.map((i) => {
+    personList.data.map((v)=>{
+      if (v.fromId == websoctStore.messOne?.fromId) {
+      v.showCircel = true;
+    }
+       if(i.msgId==v.msgId){
+        i=v
+       }
+    })
+  });
+  console.log('searchData.value', searchData.value)
+}
 //点击发送文件图标
 const fileUserTreeData = reactive({ data: {} });
 const sendFileClick = async () => {
@@ -258,15 +274,15 @@ const sendFileClick = async () => {
 //获取用户聊天记录
 const handleNewMessage = async () => {
   if (websoctStore.newMessage) {
-    msgRecordEvent(sendCont.data.toId); //获取用户的聊天记录
-    getMsgList();
+    msgRecordEvent(sendCont.data.toId); //获取用户的聊天记录  
+    getNewMsgList();
     websoctStore.newMessage = false; // 重置新消息标记
   }
 };
 watchEffect(() => {
   if (websoctStore.messOne?.fromId) {
     msgRecordEvent(websoctStore.messOne.fromId);
-    getMsgList();
+    getNewMsgList();
   }
 });
 // 滚动翻页========
@@ -427,6 +443,7 @@ onMounted(() => {
             class="head-sculpture"
             v-if="item.toId == userIds.uid && item.fromAvatar"
           />
+          <img :src="item.avatar " alt="" v-else-if="item.avatar"/>
           <img
             :src="wangzhi + item.toAvatar"
             class="head-sculpture"
@@ -443,7 +460,8 @@ onMounted(() => {
             "
             class="head-sculpture"
             v-else
-            >{{ item.toId == userIds.uid? item.fromName?.slice(0, 1): item.toName?.slice(0, 1) }}</span>
+            >{{ item.nickName
+              ? item.nickName?.slice(0, 1):item.toId == userIds.uid? item.fromName?.slice(0, 1): item.toName?.slice(0, 1) }}</span>
         </div>
         <div class="spill">
           <span class="person-name">{{