| 
					
				 | 
			
			
				@@ -63,7 +63,7 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               <div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 <el-checkbox-group v-model="selectedFilters"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                   <el-checkbox label="1">去掉重粉</el-checkbox> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                  <el-checkbox label="2">去掉小黑屋</el-checkbox> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                  <el-checkbox label="2">去掉黑粉</el-checkbox> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 </el-checkbox-group> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 <div style="margin-top: 10px; text-align: right;"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                   <el-button size="mini" type="primary" @click="applyFilter">确定</el-button> 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -378,7 +378,7 @@ export default { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               this.updateSessionConversation(conversation); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               // 如果找不到会话,可能需要刷新会话列表 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-              this.refreshCurrentSession(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              this.refreshSession(messageAppKey); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           } else if (messageAppKey) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             // 如果不是当前账号的消息,增加对应账号的未读消息数 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -389,6 +389,10 @@ export default { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 item => item.conversationId === message.toContactId 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              if (index === -1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                this.refreshSession(messageAppKey, false) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               if (index !== -1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 let conversation = this.qwUserSessions[messageAppKey][index] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 conversation.lastSendTime = message.sendTime; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -912,41 +916,52 @@ export default { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     // 搜索 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     handleSearch() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       const keyword = this.searchKeyword.trim().toLowerCase(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      if (!keyword) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      if (!keyword && !this.selectedFilters) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // 为空时显示全部 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         this.$refs.IMUI.initConversations(this.conversationData); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      const notRepeat = this.selectedFilters.some(item => item === '1') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      const notBlack = this.selectedFilters.some(item => item === '2') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       // 过滤会话列表 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       const filtered = this.conversationData.filter(item => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // 搜索最后一条消息内容和联系人名 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return ( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           (item.lastContent && item.lastContent.toLowerCase().includes(keyword)) || 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           (item.displayName && item.displayName.toLowerCase().includes(keyword)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        ) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          && (notRepeat ? !item.isRepeat : true) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          && (notBlack ? !item.isBlack : true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       this.$refs.IMUI.initConversations(filtered); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     applyFilter() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       this.filterPopoverVisible = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      // 这里可以根据 selectedFilters 做过滤 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       this.handleSearch(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    // 手动刷新当前企微账号的会话列表 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    refreshCurrentSession() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    // 刷新企微账号会话列表 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    refreshSession(appKey, isCurrent = true) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       // 删除当前企微账号的会话缓存 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      if (this.appKey) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        delete this.qwUserSessions[this.appKey]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        delete this.qwUserSessions[`${this.appKey}_selected`]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      delete this.qwUserSessions[appKey]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      delete this.qwUserSessions[`${appKey}_selected`]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        // 重新获取会话列表 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        this.getConversation(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      // 重新获取会话列表 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      getConversations(this.qwUser.id).then(response => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        this.conversationData = response.data; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        this.$message({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          message: '会话列表已刷新', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          type: 'success' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // 缓存会话记录 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        this.qwUserSessions[appKey] = response.data; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (isCurrent) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          this.$refs.IMUI.initConversations(response.data); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          const fstConversation = this.conversationData[0]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          if(fstConversation) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            this.$refs.IMUI.changeContact(fstConversation.conversationId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     handleClose() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       this.$emit('close') 
			 |