处理1116消息类型;新增查看部门页面

This commit is contained in:
wangyifeng 2025-03-22 14:22:09 +08:00
parent d781a94a89
commit 7595af1d33
10 changed files with 148 additions and 28 deletions

2
components.d.ts vendored
View File

@ -39,6 +39,8 @@ declare module 'vue' {
SysGroupAdminMessage: typeof import('./src/components/talk/message/system/SysGroupAdminMessage.vue')['default'] SysGroupAdminMessage: typeof import('./src/components/talk/message/system/SysGroupAdminMessage.vue')['default']
SysGroupCancelMutedMessage: typeof import('./src/components/talk/message/system/SysGroupCancelMutedMessage.vue')['default'] SysGroupCancelMutedMessage: typeof import('./src/components/talk/message/system/SysGroupCancelMutedMessage.vue')['default']
SysGroupCreateMessage: typeof import('./src/components/talk/message/system/SysGroupCreateMessage.vue')['default'] SysGroupCreateMessage: typeof import('./src/components/talk/message/system/SysGroupCreateMessage.vue')['default']
SysGroupInfoChange: typeof import('./src/components/talk/message/system/SysGroupInfoChange.vue')['default']
SysGroupInfoChangeMessage: typeof import('./src/components/talk/message/system/SysGroupInfoChangeMessage.vue')['default']
SysGroupJoinMessage: typeof import('./src/components/talk/message/system/SysGroupJoinMessage.vue')['default'] SysGroupJoinMessage: typeof import('./src/components/talk/message/system/SysGroupJoinMessage.vue')['default']
SysGroupMemberCancelMutedMessage: typeof import('./src/components/talk/message/system/SysGroupMemberCancelMutedMessage.vue')['default'] SysGroupMemberCancelMutedMessage: typeof import('./src/components/talk/message/system/SysGroupMemberCancelMutedMessage.vue')['default']
SysGroupMemberKickedMessage: typeof import('./src/components/talk/message/system/SysGroupMemberKickedMessage.vue')['default'] SysGroupMemberKickedMessage: typeof import('./src/components/talk/message/system/SysGroupMemberKickedMessage.vue')['default']

View File

@ -66,7 +66,6 @@ defineProps({
<span v-if="talk_type === 2 && login_uid !== revokeInfo.withdraw_id && login_uid === revokeInfo.retracted_id && revokeInfo.withdraw_id !== revokeInfo.retracted_id"> <span v-if="talk_type === 2 && login_uid !== revokeInfo.withdraw_id && login_uid === revokeInfo.retracted_id && revokeInfo.withdraw_id !== revokeInfo.retracted_id">
{{revokeInfo.withdraw_name}}撤回了你一条消息 | {{revokeInfo.withdraw_name}}撤回了你一条消息 |
{{ formatTime(datetime) }} {{ formatTime(datetime) }}
{{extra}}
</span> </span>
<span v-if="talk_type === 2 && login_uid !== revokeInfo.withdraw_id && login_uid !== revokeInfo.retracted_id && revokeInfo.withdraw_id !== revokeInfo.retracted_id"> <span v-if="talk_type === 2 && login_uid !== revokeInfo.withdraw_id && login_uid !== revokeInfo.retracted_id && revokeInfo.withdraw_id !== revokeInfo.retracted_id">
{{revokeInfo.withdraw_name}}撤回了{{revokeInfo.retracted_name}}一条消息 | {{revokeInfo.withdraw_name}}撤回了{{revokeInfo.retracted_name}}一条消息 |

View File

@ -0,0 +1,23 @@
<script setup>
import './sys-message.less'
import { useInject } from '@/hooks'
const { showUserInfoModal } = useInject()
defineProps({
extra: Object,
data: Object
})
</script>
<template>
<div class="im-message-sys-text">
<div class="sys-text">
<a @click="showUserInfoModal(data.user_id)">
{{ data.nickname }}
</a>
<span>修改群名为</span>
<span>"{{ extra.group_name }}"</span>
</div>
</div>
</template>

View File

@ -28,7 +28,7 @@ export const ChatMsgSysGroupNotice = 1111 // 编辑群公告
export const ChatMsgSysGroupTransfer = 1113 // 变更群主 export const ChatMsgSysGroupTransfer = 1113 // 变更群主
export const ChatMsgSysGroupAdmin = 1114 // 设置管理员 export const ChatMsgSysGroupAdmin = 1114 // 设置管理员
export const ChatMsgSysGroupMemberRemoved = 1115 // 移出群成员消息(部门群、公司群自动移出) export const ChatMsgSysGroupMemberRemoved = 1115 // 移出群成员消息(部门群、公司群自动移出)
export const ChatMsgSysGroupNameChange = 1116 // 修改群名称 export const ChatMsgSysGroupInfoChange = 1116 // 管理员更新了群信息
export const ChatMsgTypeMapping = { export const ChatMsgTypeMapping = {
[ChatMsgTypeText]: '[文本消息]', [ChatMsgTypeText]: '[文本消息]',
@ -60,7 +60,7 @@ export const ChatMsgTypeMapping = {
[ChatMsgSysGroupTransfer]: '[转让群主]', [ChatMsgSysGroupTransfer]: '[转让群主]',
[ChatMsgSysGroupAdmin]: '[设置管理员]', [ChatMsgSysGroupAdmin]: '[设置管理员]',
[ChatMsgSysGroupMemberRemoved]: '[移出群成员消息]', [ChatMsgSysGroupMemberRemoved]: '[移出群成员消息]',
[ChatMsgSysGroupNameChange]: '[修改群名称]' [ChatMsgSysGroupInfoChange]: '[修改群名称]'
} }
// 消息类型 - 消息组件 映射关系 // 消息类型 - 消息组件 映射关系
@ -93,7 +93,7 @@ export const MessageComponents = {
[ChatMsgSysGroupTransfer]: 'sys-group-transfer-message', [ChatMsgSysGroupTransfer]: 'sys-group-transfer-message',
[ChatMsgSysGroupAdmin]:'sys-group-admin-message', [ChatMsgSysGroupAdmin]:'sys-group-admin-message',
[ChatMsgSysGroupMemberRemoved]:'sys-group-member-removed-message', [ChatMsgSysGroupMemberRemoved]:'sys-group-member-removed-message',
[ChatMsgSysGroupNameChange]:'sys-group-name-change-message' [ChatMsgSysGroupInfoChange]:'sys-group-info-change-message'
} }
// 可转发的消息类型 // 可转发的消息类型

View File

@ -6,7 +6,7 @@ import * as message from '@/constant/message'
import { formatTalkItem, palyMusic, formatTalkRecord } from '@/utils/talk' import { formatTalkItem, palyMusic, formatTalkRecord } from '@/utils/talk'
// import { isElectronMode } from '@/utils/common' // import { isElectronMode } from '@/utils/common'
import { ServeClearTalkUnreadNum, ServeCreateTalkList } from '@/api/chat/index.js' import { ServeClearTalkUnreadNum, ServeCreateTalkList } from '@/api/chat/index.js'
import { useTalkStore, useDialogueStore,useDialogueListStore } from '@/store' import { useTalkStore, useDialogueStore,useDialogueListStore,useGroupStore } from '@/store'
/** /**
* 好友状态事件 * 好友状态事件
@ -181,6 +181,24 @@ class Talk extends Base {
if ([1102, 1103, 1104, 1115].includes(record.msg_type)) { if ([1102, 1103, 1104, 1115].includes(record.msg_type)) {
useDialogueStore().updateGroupMembers() useDialogueStore().updateGroupMembers()
} }
if ([1116].includes(record.msg_type)) {
// 更新会话信息
useDialogueStore().setDialogue({
name: record.extra.group_name,
talk_type: record.talk_type,
receiver_id: record.receiver_id,
})
// 更新群聊信息
useGroupStore().updateGroupInfo({
group_name: record.extra.group_name,
avatar: record.extra.group_avatar,
})
// 更新会话列表中的会话信息
const dialogue = useDialogueListStore().getDialogueList(`${record.talk_type}_${record.receiver_id}`)
if (dialogue) {
dialogue.talk.username = record.extra.group_name
}
}
addDialogueRecord([newRecord],'add') addDialogueRecord([newRecord],'add')
addChatRecord(this.getIndexName(),newRecord) addChatRecord(this.getIndexName(),newRecord)
useDialogueStore().addDialogueRecord(newRecord) useDialogueStore().addDialogueRecord(newRecord)
@ -233,6 +251,14 @@ class Talk extends Base {
msg_text: this.getTalkText(), msg_text: this.getTalkText(),
updated_at: parseTime(new Date()) updated_at: parseTime(new Date())
}) })
if(this.resource.msg_type == 1116){
// 更新会话列表中的会话信息
const dialogue = useDialogueListStore().getDialogueList(`${this.resource.talk_type}_${this.resource.receiver_id}`)
if (dialogue) {
dialogue.talk.username = this.resource.extra.group_name
}
useTalkStore().loadTalkList()
}
} }
} }

View File

@ -64,6 +64,7 @@ onMounted(() => {
background-color: #fff; background-color: #fff;
.group-deps-list-each { .group-deps-list-each {
padding: 34rpx 32rpx; padding: 34rpx 32rpx;
border-bottom: 1px solid $theme-border-color;
span { span {
font-size: 28rpx; font-size: 28rpx;
font-weight: 500; font-weight: 500;

View File

@ -383,7 +383,7 @@ const updateGroupInfos = () => {
state.chatGroupInfos = [ state.chatGroupInfos = [
{ {
label: t('chat.settings.groupName'), label: t('chat.settings.groupName'),
hasPointer: true, hasPointer: groupParams?.groupInfo?.is_manager ? true : false,
value: groupName.value, value: groupName.value,
subValue: '', subValue: '',
customInfo: '', customInfo: '',

View File

@ -108,6 +108,8 @@ const photoActionsSelect = (index) => {
} else { } else {
uni.chooseVideo({ uni.chooseVideo({
sourceType: ['album'], sourceType: ['album'],
compressed: true,
maxDuration: 60,
success: async (res) => { success: async (res) => {
console.log(res, 'res') console.log(res, 'res')
let data = await onUploadImageVideo( let data = await onUploadImageVideo(

View File

@ -115,7 +115,12 @@
</aside> </aside>
<!-- 头像信息 --> <!-- 头像信息 -->
<aside class="avatar-column" @click="toUserDetailPage(item)"> <aside
class="avatar-column"
@click="toUserDetailPage(item)"
@touchstart="() => handleAvatarTouchStart(item)"
@touchend="handleAvatarTouchEnd"
>
<im-avatar <im-avatar
class="pointer" class="pointer"
:src="item.avatar" :src="item.avatar"
@ -130,9 +135,11 @@
<div class="talk-title"> <div class="talk-title">
<span <span
class="nickname pointer" class="nickname pointer"
v-show="talkParams.type == 2 && item.user_id !== talkParams.uid" v-show="
talkParams.type == 2 && item.user_id !== talkParams.uid
"
> >
<span class="at">@</span> <!-- <span class="at">@</span> -->
{{ item.nickname }} {{ item.nickname }}
</span> </span>
<span> <span>
@ -1357,7 +1364,7 @@ const updateMentionUserIds = () => {
const currentMentions = new Set() const currentMentions = new Set()
// @IDnumber // @IDnumber
ops.forEach(op => { ops.forEach((op) => {
if (op.insert && op.insert.mention) { if (op.insert && op.insert.mention) {
currentMentions.add(Number(op.insert.mention.id)) currentMentions.add(Number(op.insert.mention.id))
} }
@ -1509,6 +1516,36 @@ const isLeader = computed(() => {
return false return false
}) })
//@
const doMentionUser = (mentionSelect) => {
console.log(mentionSelect)
// mention
const mentionObj = {
id: mentionSelect.user_id, // 使 user_id erp_user_id
nickname: mentionSelect.nickname
}
getMentionSelectLists([mentionObj])
}
let avatarPressTimer = null
let currentPressItem = null
const handleAvatarTouchStart = (item) => {
currentPressItem = item
avatarPressTimer = setTimeout(() => {
doMentionUser(item)
}, 500)
}
const handleAvatarTouchEnd = () => {
if (avatarPressTimer) {
clearTimeout(avatarPressTimer)
avatarPressTimer = null
}
currentPressItem = null
}
onMounted(async () => { onMounted(async () => {
if (typeof plus !== 'undefined') { if (typeof plus !== 'undefined') {
const webview = plus.webview.currentWebview() const webview = plus.webview.currentWebview()
@ -1550,6 +1587,9 @@ onUnmounted(() => {
dialogueStore.setDialogue({}) dialogueStore.setDialogue({})
} }
clearMultiSelect() clearMultiSelect()
if (avatarPressTimer) {
clearTimeout(avatarPressTimer)
}
}) })
</script> </script>
<style scoped lang="less"> <style scoped lang="less">

View File

@ -190,13 +190,14 @@ onMounted(() => {
// //
const inputSearchText = (e) => { const inputSearchText = (e) => {
// console.log(e)
if (e.trim() != state.searchText.trim()) { if (e.trim() != state.searchText.trim()) {
state.pageNum = 1 state.pageNum = 1
state.searchResult = null //
emits('lastIdChange', 0, 0, 0) emits('lastIdChange', 0, 0, 0)
} }
state.searchText = e.trim() state.searchText = e.trim()
if (!e.trim()) { if (!e.trim()) {
state.searchResult = null //
emits('lastIdChange', 0, 0, 0) emits('lastIdChange', 0, 0, 0)
} }
zPaging.value?.reload() zPaging.value?.reload()
@ -261,6 +262,7 @@ const queryAllSearch = (pageNum, searchResultPageSize) => {
item.group_type = 0 item.group_type = 0
}) })
} }
let tempGeneral_infos = Array.isArray(data.general_infos) let tempGeneral_infos = Array.isArray(data.general_infos)
? [...data.general_infos] ? [...data.general_infos]
: data.general_infos : data.general_infos
@ -269,6 +271,8 @@ const queryAllSearch = (pageNum, searchResultPageSize) => {
data.group_member_infos || [], data.group_member_infos || [],
) )
data.general_infos = tempGeneral_infos data.general_infos = tempGeneral_infos
//
let isEmpty = true let isEmpty = true
let dataKeys = Object.keys(data) let dataKeys = Object.keys(data)
let paginationKey = '' let paginationKey = ''
@ -278,27 +282,36 @@ const queryAllSearch = (pageNum, searchResultPageSize) => {
isEmpty = false isEmpty = false
} }
}) })
if (isEmpty) { if (isEmpty) {
if (pageNum == 1) { if (pageNum === 1) {
//
state.searchResult = null
zPaging.value?.complete([]) zPaging.value?.complete([])
} else { } else {
data = state.searchResult //
zPaging.value?.complete([data]) zPaging.value?.complete(state.searchResult ? [state.searchResult] : [])
} }
} else { } else {
if (props.isPagination) { if (props.isPagination) {
if ( if (pageNum === 1) {
paginationKey && //
Array.isArray( state.searchResult = data
(state?.searchResult && state?.searchResult[paginationKey]) || [], } else {
) && //
((state?.searchResult && state?.searchResult[paginationKey]) || []) if (
.length > 0 paginationKey &&
) { Array.isArray(
data[paginationKey] = state.searchResult[paginationKey].concat( (state?.searchResult && state?.searchResult[paginationKey]) || [],
data[paginationKey], )
) ) {
data[paginationKey] = state.searchResult[paginationKey].concat(
data[paginationKey],
)
}
state.searchResult = data
} }
emits( emits(
'lastIdChange', 'lastIdChange',
data.last_id, data.last_id,
@ -315,17 +328,31 @@ const queryAllSearch = (pageNum, searchResultPageSize) => {
} }
zPaging.value?.completeByTotal([data], total) zPaging.value?.completeByTotal([data], total)
} else { } else {
state.searchResult = data
zPaging.value?.complete([data]) zPaging.value?.complete([data])
} }
} }
state.searchResult = data
} else { } else {
zPaging.value?.complete([]) if (pageNum === 1) {
//
state.searchResult = null
zPaging.value?.complete([])
} else {
//
zPaging.value?.complete(state.searchResult ? [state.searchResult] : [])
}
} }
}) })
resp.catch(() => { resp.catch(() => {
zPaging.value?.complete([]) if (pageNum === 1) {
//
state.searchResult = null
zPaging.value?.complete([])
} else {
//
zPaging.value?.complete(state.searchResult ? [state.searchResult] : [])
}
}) })
} }