李妹妹 5 ngày trước cách đây
mục cha
commit
1804804786
2 tập tin đã thay đổi với 43 bổ sung30 xóa
  1. 3 0
      src/components/LemonUI/components/index.vue
  2. 40 30
      src/views/qw/qwChat/qq.vue

+ 3 - 0
src/components/LemonUI/components/index.vue

@@ -419,6 +419,7 @@ export default {
       );
     },
     _renderContact(props, onClick, slot) {
+      //console.log(this.currentContactId,props,'prop')
       const {
         click: customClick,
         renderContainer,
@@ -688,6 +689,7 @@ export default {
                   }
                   this.changeContact(curactNew.conversationId,DEFAULT_MENU_LASTMESSAGES);
                   this.$emit("change-contact",curactNew, this);
+                  //this.$emit("change-conversation",curactNew, this);
                 }}
               >
                 发送消息
@@ -814,6 +816,7 @@ export default {
      * @param contactId 联系人 id
      */
     async changeContact(contactId, menuName) {
+      //console.log(this.currentContact,'===')
       if (menuName) {
            this.changeMenu(menuName);
       } else {

+ 40 - 30
src/views/qw/qwChat/qq.vue

@@ -808,7 +808,7 @@ export default {
       });
     },
     handleChangeConversation(conversation, instance) {
-      //console.log(conversation,'conversation')
+    //console.log(conversation,instance,'conversation')
         this.showCourseManage=false
       if(conversation.isGroup){
         // this.contact.extId=conversation.extId
@@ -827,11 +827,17 @@ export default {
       this.queryParams.userId = this.qwUser.id
 
       if(conversation.unread>0){
-        conversation.unread=0;
-        instance.updateContact(conversation);
+        // conversation.unread=0;
+        // instance.updateContact(conversation);
 
-        // 更新缓存中的会话记录
-        this.updateSessionConversation(conversation);
+        // // 更新缓存中的会话记录
+        // this.updateSessionConversation(conversation);
+
+        // 先更新UI和缓存,再清零(或在接口回调中清零)
+          instance.updateContact({ ...conversation, unread: 0 });
+          this.updateSessionConversation({ ...conversation, unread: 0 });
+          // 内存中同步更新
+          conversation.unread = 0;
       }
     },
 
@@ -857,8 +863,9 @@ export default {
         }
         getConversationId(data).then(response => {
           IMUI.appendConversation(response.data);
-          IMUI.changeContact(contact.conversationId);
-          IMUI.currentNewContactId=contact.id;
+          IMUI.changeContact(response.data.conversationId);
+          //IMUI.currentContactId=response.data.conversationId;
+          //this.updateSessionConversation(response.data);
         });
       }
     },
@@ -1295,8 +1302,9 @@ export default {
       align-items: center;
       justify-content: center;
  transition: border-radius 0.2s ease, background 0.2s ease; /* 只过渡需要变化的属性 */
-border-radius: 0 6px 6px 0;
-
+//border-radius: 0 6px 6px 0;
+position: relative;
+z-index: 2;
       .el-avatar{
         width: 36px;
         height: 36px;
@@ -1328,8 +1336,8 @@ border-radius: 0 6px 6px 0;
       }
       &.active{
         background: #F1F4F8;
-        border-radius: 6px;
-        //border-radius: 6px 0px 0px 6px;
+        border-radius: 8px 0px 0px 8px;
+         box-shadow: 10px 10px 0 0 #F1F4F8, 10px -10px 0 0 #F1F4F8;
         position: relative; /* 确保z-index生效 */
           z-index: 1; /* 高于相邻元素的默认层级 */
         .name{
@@ -1338,27 +1346,29 @@ border-radius: 0 6px 6px 0;
         .text{
           color: #202124;
         }
-        // &:before{
-        //   content: '';
-        //   position: absolute;
-        //   z-index: 0;
-        //   right: 0;
-        //   width: 10px;
-        //   height: auto;
-        //   background: #F1F4F8;
-        // }
+     &::before {
+      content: '';
+      position: absolute;
+      right: -10px;
+      top: -10px;
+      width: 72px;
+      height:10px ;
+      background:#409EFF;
+      border-bottom-right-radius:8px ;
+    }
+    &::after {
+      content: '';
+      position: absolute;
+      right: -10px;
+      bottom: -10px;
+     width: 72px;
+     height:10px ;
+      background: #409EFF;
+      border-top-right-radius:8px ;
+    }
+
       }
     }
-    /* 下一个元素:仅保留右上圆角,清除默认的右下圆角 */
-    // .q-item.active + .q-item {
-    //   border-top-right-radius: 6px;
-    //   border-bottom-right-radius: 0; /* 避免与选中元素底部衔接处的多余圆角 */
-    // }
-    // /* 上一个元素:仅保留右下圆角,清除默认的右上圆角 */
-    // .q-item + .q-item.active {
-    //   border-bottom-right-radius: 6px;
-    //   border-top-right-radius: 0; /* 避免与选中元素顶部衔接处的多余圆角 */
-    // }
   }
     .group-item{
       padding-left: 12px;