处理1116消息类型;新增查看部门页面
This commit is contained in:
parent
d781a94a89
commit
7595af1d33
2
components.d.ts
vendored
2
components.d.ts
vendored
@ -39,6 +39,8 @@ declare module 'vue' {
|
||||
SysGroupAdminMessage: typeof import('./src/components/talk/message/system/SysGroupAdminMessage.vue')['default']
|
||||
SysGroupCancelMutedMessage: typeof import('./src/components/talk/message/system/SysGroupCancelMutedMessage.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']
|
||||
SysGroupMemberCancelMutedMessage: typeof import('./src/components/talk/message/system/SysGroupMemberCancelMutedMessage.vue')['default']
|
||||
SysGroupMemberKickedMessage: typeof import('./src/components/talk/message/system/SysGroupMemberKickedMessage.vue')['default']
|
||||
|
@ -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">
|
||||
{{revokeInfo.withdraw_name}}撤回了你一条消息 |
|
||||
{{ formatTime(datetime) }}
|
||||
{{extra}}
|
||||
</span>
|
||||
<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}}一条消息 |
|
||||
|
@ -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>
|
@ -28,7 +28,7 @@ export const ChatMsgSysGroupNotice = 1111 // 编辑群公告
|
||||
export const ChatMsgSysGroupTransfer = 1113 // 变更群主
|
||||
export const ChatMsgSysGroupAdmin = 1114 // 设置管理员
|
||||
export const ChatMsgSysGroupMemberRemoved = 1115 // 移出群成员消息(部门群、公司群自动移出)
|
||||
export const ChatMsgSysGroupNameChange = 1116 // 修改群名称
|
||||
export const ChatMsgSysGroupInfoChange = 1116 // 管理员更新了群信息
|
||||
|
||||
export const ChatMsgTypeMapping = {
|
||||
[ChatMsgTypeText]: '[文本消息]',
|
||||
@ -60,7 +60,7 @@ export const ChatMsgTypeMapping = {
|
||||
[ChatMsgSysGroupTransfer]: '[转让群主]',
|
||||
[ChatMsgSysGroupAdmin]: '[设置管理员]',
|
||||
[ChatMsgSysGroupMemberRemoved]: '[移出群成员消息]',
|
||||
[ChatMsgSysGroupNameChange]: '[修改群名称]'
|
||||
[ChatMsgSysGroupInfoChange]: '[修改群名称]'
|
||||
}
|
||||
|
||||
// 消息类型 - 消息组件 映射关系
|
||||
@ -93,7 +93,7 @@ export const MessageComponents = {
|
||||
[ChatMsgSysGroupTransfer]: 'sys-group-transfer-message',
|
||||
[ChatMsgSysGroupAdmin]:'sys-group-admin-message',
|
||||
[ChatMsgSysGroupMemberRemoved]:'sys-group-member-removed-message',
|
||||
[ChatMsgSysGroupNameChange]:'sys-group-name-change-message'
|
||||
[ChatMsgSysGroupInfoChange]:'sys-group-info-change-message'
|
||||
}
|
||||
|
||||
// 可转发的消息类型
|
||||
|
@ -6,7 +6,7 @@ import * as message from '@/constant/message'
|
||||
import { formatTalkItem, palyMusic, formatTalkRecord } from '@/utils/talk'
|
||||
// import { isElectronMode } from '@/utils/common'
|
||||
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)) {
|
||||
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')
|
||||
addChatRecord(this.getIndexName(),newRecord)
|
||||
useDialogueStore().addDialogueRecord(newRecord)
|
||||
@ -233,6 +251,14 @@ class Talk extends Base {
|
||||
msg_text: this.getTalkText(),
|
||||
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()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -64,6 +64,7 @@ onMounted(() => {
|
||||
background-color: #fff;
|
||||
.group-deps-list-each {
|
||||
padding: 34rpx 32rpx;
|
||||
border-bottom: 1px solid $theme-border-color;
|
||||
span {
|
||||
font-size: 28rpx;
|
||||
font-weight: 500;
|
||||
|
@ -383,7 +383,7 @@ const updateGroupInfos = () => {
|
||||
state.chatGroupInfos = [
|
||||
{
|
||||
label: t('chat.settings.groupName'),
|
||||
hasPointer: true,
|
||||
hasPointer: groupParams?.groupInfo?.is_manager ? true : false,
|
||||
value: groupName.value,
|
||||
subValue: '',
|
||||
customInfo: '',
|
||||
|
@ -108,6 +108,8 @@ const photoActionsSelect = (index) => {
|
||||
} else {
|
||||
uni.chooseVideo({
|
||||
sourceType: ['album'],
|
||||
compressed: true,
|
||||
maxDuration: 60,
|
||||
success: async (res) => {
|
||||
console.log(res, 'res')
|
||||
let data = await onUploadImageVideo(
|
||||
|
@ -115,7 +115,12 @@
|
||||
</aside>
|
||||
|
||||
<!-- 头像信息 -->
|
||||
<aside class="avatar-column" @click="toUserDetailPage(item)">
|
||||
<aside
|
||||
class="avatar-column"
|
||||
@click="toUserDetailPage(item)"
|
||||
@touchstart="() => handleAvatarTouchStart(item)"
|
||||
@touchend="handleAvatarTouchEnd"
|
||||
>
|
||||
<im-avatar
|
||||
class="pointer"
|
||||
:src="item.avatar"
|
||||
@ -130,9 +135,11 @@
|
||||
<div class="talk-title">
|
||||
<span
|
||||
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 }}
|
||||
</span>
|
||||
<span>
|
||||
@ -1357,7 +1364,7 @@ const updateMentionUserIds = () => {
|
||||
const currentMentions = new Set()
|
||||
|
||||
// 收集当前所有@的用户ID,并转换为number类型
|
||||
ops.forEach(op => {
|
||||
ops.forEach((op) => {
|
||||
if (op.insert && op.insert.mention) {
|
||||
currentMentions.add(Number(op.insert.mention.id))
|
||||
}
|
||||
@ -1509,6 +1516,36 @@ const isLeader = computed(() => {
|
||||
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 () => {
|
||||
if (typeof plus !== 'undefined') {
|
||||
const webview = plus.webview.currentWebview()
|
||||
@ -1550,6 +1587,9 @@ onUnmounted(() => {
|
||||
dialogueStore.setDialogue({})
|
||||
}
|
||||
clearMultiSelect()
|
||||
if (avatarPressTimer) {
|
||||
clearTimeout(avatarPressTimer)
|
||||
}
|
||||
})
|
||||
</script>
|
||||
<style scoped lang="less">
|
||||
|
@ -190,13 +190,14 @@ onMounted(() => {
|
||||
|
||||
//输入搜索文本
|
||||
const inputSearchText = (e) => {
|
||||
// console.log(e)
|
||||
if (e.trim() != state.searchText.trim()) {
|
||||
state.pageNum = 1
|
||||
state.searchResult = null // 清空搜索结果
|
||||
emits('lastIdChange', 0, 0, 0)
|
||||
}
|
||||
state.searchText = e.trim()
|
||||
if (!e.trim()) {
|
||||
state.searchResult = null // 清空搜索结果
|
||||
emits('lastIdChange', 0, 0, 0)
|
||||
}
|
||||
zPaging.value?.reload()
|
||||
@ -261,6 +262,7 @@ const queryAllSearch = (pageNum, searchResultPageSize) => {
|
||||
item.group_type = 0
|
||||
})
|
||||
}
|
||||
|
||||
let tempGeneral_infos = Array.isArray(data.general_infos)
|
||||
? [...data.general_infos]
|
||||
: data.general_infos
|
||||
@ -269,6 +271,8 @@ const queryAllSearch = (pageNum, searchResultPageSize) => {
|
||||
data.group_member_infos || [],
|
||||
)
|
||||
data.general_infos = tempGeneral_infos
|
||||
|
||||
// 检查数据是否为空
|
||||
let isEmpty = true
|
||||
let dataKeys = Object.keys(data)
|
||||
let paginationKey = ''
|
||||
@ -278,27 +282,36 @@ const queryAllSearch = (pageNum, searchResultPageSize) => {
|
||||
isEmpty = false
|
||||
}
|
||||
})
|
||||
|
||||
if (isEmpty) {
|
||||
if (pageNum == 1) {
|
||||
if (pageNum === 1) {
|
||||
// 第一页请求且为空,清空结果
|
||||
state.searchResult = null
|
||||
zPaging.value?.complete([])
|
||||
} else {
|
||||
data = state.searchResult
|
||||
zPaging.value?.complete([data])
|
||||
// 加载更多且为空,保持原列表不变
|
||||
zPaging.value?.complete(state.searchResult ? [state.searchResult] : [])
|
||||
}
|
||||
} else {
|
||||
if (props.isPagination) {
|
||||
if (
|
||||
paginationKey &&
|
||||
Array.isArray(
|
||||
(state?.searchResult && state?.searchResult[paginationKey]) || [],
|
||||
) &&
|
||||
((state?.searchResult && state?.searchResult[paginationKey]) || [])
|
||||
.length > 0
|
||||
) {
|
||||
data[paginationKey] = state.searchResult[paginationKey].concat(
|
||||
data[paginationKey],
|
||||
)
|
||||
if (pageNum === 1) {
|
||||
// 第一页请求,直接设置新数据
|
||||
state.searchResult = data
|
||||
} else {
|
||||
// 加载更多,合并数据
|
||||
if (
|
||||
paginationKey &&
|
||||
Array.isArray(
|
||||
(state?.searchResult && state?.searchResult[paginationKey]) || [],
|
||||
)
|
||||
) {
|
||||
data[paginationKey] = state.searchResult[paginationKey].concat(
|
||||
data[paginationKey],
|
||||
)
|
||||
}
|
||||
state.searchResult = data
|
||||
}
|
||||
|
||||
emits(
|
||||
'lastIdChange',
|
||||
data.last_id,
|
||||
@ -315,17 +328,31 @@ const queryAllSearch = (pageNum, searchResultPageSize) => {
|
||||
}
|
||||
zPaging.value?.completeByTotal([data], total)
|
||||
} else {
|
||||
state.searchResult = data
|
||||
zPaging.value?.complete([data])
|
||||
}
|
||||
}
|
||||
state.searchResult = data
|
||||
} else {
|
||||
zPaging.value?.complete([])
|
||||
if (pageNum === 1) {
|
||||
// 第一页请求失败,清空结果
|
||||
state.searchResult = null
|
||||
zPaging.value?.complete([])
|
||||
} else {
|
||||
// 加载更多失败,保持原列表不变
|
||||
zPaging.value?.complete(state.searchResult ? [state.searchResult] : [])
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
resp.catch(() => {
|
||||
zPaging.value?.complete([])
|
||||
if (pageNum === 1) {
|
||||
// 第一页请求异常,清空结果
|
||||
state.searchResult = null
|
||||
zPaging.value?.complete([])
|
||||
} else {
|
||||
// 加载更多异常,保持原列表不变
|
||||
zPaging.value?.complete(state.searchResult ? [state.searchResult] : [])
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user