Эх сурвалжийг харах

限制系统会话不能删除
修复自己添加的会话删除时id传错的问题

liling 2 жил өмнө
parent
commit
2acb008f85

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

@@ -26,6 +26,7 @@ const useWebsoctStore = defineStore('websoct', {
       }
       this.socket.addEventListener("open", () => {
         // console.log("WebSocket连接已打开")
+        clearInterval(heartTimer)
         heartTimer = setInterval(() => {
           this.sendHeartbeat();
         }, 30000); // 每隔30秒发送一次心跳消息

+ 5 - 7
src/views/liveChat/index.vue

@@ -540,13 +540,12 @@ onMounted(() => {
         <img :src="cebian" class="cebian" v-if="clickPersonIndex == index" />
         <button
           class="del-chat"
-          v-if="clickPersonIndex == index"
-          @click="delClick(item.toId == userIds.uid?item.fromId:item.toId)"
+          v-if="clickPersonIndex == index && item.fromId!=-1"
+          @click="delClick(item.userId!=null? item.userId : (item.toId == userIds.uid?item.fromId:item.toId))"
         >
           删除会话
         </button>
         <div>
-          <!-- <img :src="item.avatar?item.avatar : chat" class="head-sculpture" /> -->
           <img
             :src="wangzhi + item.fromAvatar"
             class="head-sculpture"
@@ -569,8 +568,7 @@ onMounted(() => {
             "
             class="head-sculpture"
             v-else
-            >{{ item.nickName
-              ? item.nickName?.slice(0, 1):item.toId == userIds.uid? item.fromName?.slice(0, 1): item.toName?.slice(0, 1) }}</span>
+            >{{ item.nickName!=null? 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">{{
@@ -687,7 +685,7 @@ onMounted(() => {
                       "
                       class="head-sculpture"
                       v-else
-                      >{{ record.fromName.slice(0, 1) }}</span
+                      >{{ record.fromName!=null ? record.fromName.slice(0, 1) :'系' }}</span
                     >
                   </div>
                 </div>
@@ -725,7 +723,7 @@ onMounted(() => {
                       "
                       class="head-sculpture"
                       v-else
-                      >{{ record.fromName.slice(0, 1) }}</span
+                      >{{ record.fromName!=null? record.fromName.slice(0, 1):'系' }}</span
                     >
                   </div>
                   <div