Selaa lähdekoodia

优化@功能

wkw 1 kuukausi sitten
vanhempi
sitoutus
c23dc1a8b4

+ 1 - 0
src/stores/modules/webSocketStore.js

@@ -69,6 +69,7 @@ export const useWebSocketStore = defineStore("webSocketStore", {
     chatRefresh:0,//强制刷新会话列表
     needRefreshIm:0,//软刷新会话列表
     indexs:0,// 接收消息计数器
+    isassign:'',//是否@自己
   }),
 
   persist: {

+ 2 - 1
src/views/im/chat/components/AtUserList/index.vue

@@ -68,7 +68,8 @@ const open = () => {
 };
 onMounted(async () => {
   // 获取群成员信息
-  users.value = await wsStore.fetchGroupMembers();
+  let members = await wsStore.fetchGroupMembers()
+  users.value = members.filter(member => member.uuid !== walletStore.account)
 })
 defineExpose({ open });
 </script>

+ 9 - 7
src/views/im/chat/index.vue

@@ -146,7 +146,7 @@
       @select="onActionSelect"
     />
     <!-- @样式 -->
-    <div class="assign" v-if="wsStore.toUserInfo.type == 'group'">
+    <div class="assign" v-if="wsStore.toUserInfo.type == 'group' && wsStore.isassign" @click="changAssign">
       <div class="assign-text">有人@我</div>
     </div>
     <!-- 引用消息展示 -->
@@ -377,6 +377,9 @@ const imMessages = computed(() =>{
     return item;
   });
 })
+const changAssign = () => {
+  wsStore.isassign = '';
+}
 
 
 // 滚动到底部
@@ -421,7 +424,7 @@ const currentBottomHeight = computed(() => {
 
 // 切换表情/工具面板
 const toggleAppBox = async (type) => {
-  if(wsStore.chatDelAuth[ wsStore.toUserInfo.uuid]){
+  if(!wsStore.verifyChatAuth(wsStore.toUserInfo.uuid)){
     showToast(`${wsStore.toUserInfo.type == 'user' ? '对方已删除' : '您已不在群聊里面'}`);
     return;
   }
@@ -609,7 +612,7 @@ let audioChunks = [];
 
 // 切换文字/语音输入模式
 const toggleVoiceMode = () => {
-  if(wsStore.chatDelAuth[wsStore.toUserInfo.uuid]){
+  if(!wsStore.verifyChatAuth(wsStore.toUserInfo.uuid)){
     showToast(`${wsStore.toUserInfo.type == 'user' ? '对方已删除' : '您已不在群聊里面'}`);
     return;
   }
@@ -755,7 +758,7 @@ const renderQuoteContent = (msg) => {
 
 // 发送消息
 const sendMessage = () => {
-  if(wsStore.chatDelAuth[wsStore.toUserInfo.uuid]){
+  if(!wsStore.verifyChatAuth(wsStore.toUserInfo.uuid)){
     showToast(`${wsStore.toUserInfo.type == 'user' ? '对方已删除' : '您已不在群聊里面'}`);
     return;
   }
@@ -789,10 +792,9 @@ console.log(wsStore.toUserInfo);
   ccMsg.value = []; // 清空 @成员
   scrollToBottom();
 };
-
 // 发送图片消息
 const afterRead = async (file) => { 
-  if(wsStore.chatDelAuth[wsStore.toUserInfo.uuid]){
+  if(!wsStore.verifyChatAuth(wsStore.toUserInfo.uuid)){
     showToast(`${wsStore.toUserInfo.type == 'user' ? '对方已删除' : '您已不在群聊里面'}`);
     return;
   }
@@ -927,7 +929,7 @@ const goToPage = (item) => {
 }
 const goBack = () => router.push("im");
 const goDetail = () =>{
-  if(wsStore.chatDelAuth[ wsStore.toUserInfo.uuid]){
+  if(!wsStore.verifyChatAuth(wsStore.toUserInfo.uuid)){
     showToast(`${wsStore.toUserInfo.type == 'user' ? '对方已删除' : '您已不在群聊里面'}`);
     return;
   }

+ 4 - 0
src/views/im/hook/messagesHook.js

@@ -244,6 +244,10 @@ export const handleMessageHook = async (payload, wsStore) => {
 
   // 文本消息
   if (message.contentType === MsgType.MSG_TYPE.TEXT) {
+    let ccArr = msg?.cc.split(',');
+    if (wsStore.groupMembersList && wsStore.groupMembersList[message.from]) {
+      wsStore.isassign = wsStore.groupMembersList[message.from].filter(val => ccArr.includes(val.userId + '')).find(val => val.uuid == message.to)
+    }
     wsStore.pushMessage(formatMessageExt({
       ...message,
       toUsername: message.to,