消息页 参数冲突
Some checks are pending
Check / lint (push) Waiting to run
Check / typecheck (push) Waiting to run
Check / build (build, 18.x, ubuntu-latest) (push) Waiting to run
Check / build (build, 18.x, windows-latest) (push) Waiting to run
Check / build (build:app, 18.x, ubuntu-latest) (push) Waiting to run
Check / build (build:app, 18.x, windows-latest) (push) Waiting to run
Check / build (build:mp-weixin, 18.x, ubuntu-latest) (push) Waiting to run
Check / build (build:mp-weixin, 18.x, windows-latest) (push) Waiting to run

This commit is contained in:
wwt 2025-03-14 09:48:05 +08:00
commit e6075849fe
6 changed files with 113 additions and 5 deletions

1
components.d.ts vendored
View File

@ -34,6 +34,7 @@ declare module 'vue' {
RevokeMessage: typeof import('./src/components/talk/message/RevokeMessage.vue')['default']
RouterLink: typeof import('vue-router')['RouterLink']
RouterView: typeof import('vue-router')['RouterView']
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']
SysGroupJoinMessage: typeof import('./src/components/talk/message/system/SysGroupJoinMessage.vue')['default']

View File

@ -179,3 +179,11 @@ export const uploadImg = (data,onProgressFn) => {
onUploadProgress:(progressEvent)=>onProgressFn(progressEvent,data.get('file'))
})
}
// 根据msg_id获取消息
export const detailGetRecordsContext = (data) => {
return request({
url: '/api/v1/talk/record/detail',
method: 'GET',
data,
})
}

View File

@ -21,13 +21,19 @@ defineProps({
datetime: {
type: String,
default: ''
},
msg_id: {
type: String,
default: ''
}
})
</script>
<template>
<div class="im-message-revoke">
<div class="content">
<span v-if="login_uid == user_id"> 你撤回了一条消息 | {{ formatTime(datetime) }} </span>
<span v-if="login_uid == user_id"> 你撤回了一条消息 | {{ formatTime(datetime) }}
<slot></slot> <!-- 添加插槽用于放置重新编辑按钮 -->
</span>
<span v-else-if="talk_type == 1"> 对方撤回了一条消息 | {{ formatTime(datetime) }} </span>
<span v-else>
"{{ nickname }}" 撤回了一条消息 |

View File

@ -0,0 +1,25 @@
<script setup>
import './sys-message.less'
import { useInject } from '@/hooks'
defineProps({
extra: Object,
data: Object
})
const { showUserInfoModal } = useInject()
</script>
<template>
<div class="im-message-sys-text">
<div class="sys-text">
<template v-for="(user, index) in extra.members" :key="index">
<a @click="showUserInfoModal(user.user_id)">{{ user.nickname }}</a>
<em v-show="index < extra.members.length - 1"></em>
</template>
<span>已成为管理员</span>
</div>
</div>
</template>

View File

@ -26,6 +26,7 @@ export const ChatMsgSysGroupMemberMuted = 1109 // 群成员禁言
export const ChatMsgSysGroupMemberCancelMuted = 1110 // 群成员解除禁言
export const ChatMsgSysGroupNotice = 1111 // 编辑群公告
export const ChatMsgSysGroupTransfer = 1113 // 变更群主
export const ChatMsgSysGroupAdmin = 1114 // 设置管理员
export const ChatMsgTypeMapping = {
[ChatMsgTypeText]: '[文本消息]',
@ -53,7 +54,9 @@ export const ChatMsgTypeMapping = {
[ChatMsgSysGroupCancelMuted]: '[群解除禁言消息]',
[ChatMsgSysGroupMemberMuted]: '[群成员禁言消息]',
[ChatMsgSysGroupMemberCancelMuted]: '[群成员解除禁言消息]',
[ChatMsgSysGroupNotice]: '[群公告]'
[ChatMsgSysGroupNotice]: '[群公告]',
[ChatMsgSysGroupTransfer]: '[转让群主]',
[ChatMsgSysGroupAdmin]: '[设置管理员]'
}
// 消息类型 - 消息组件 映射关系
@ -83,7 +86,8 @@ export const MessageComponents = {
[ChatMsgSysGroupCancelMuted]: 'sys-group-cancel-muted-message',
[ChatMsgSysGroupMemberMuted]: 'sys-group-member-muted-message',
[ChatMsgSysGroupMemberCancelMuted]: 'sys-group-member-cancel-muted-message',
[ChatMsgSysGroupTransfer]: 'sys-group-transfer-message'
[ChatMsgSysGroupTransfer]: 'sys-group-transfer-message',
[ChatMsgSysGroupAdmin]:'sys-group-admin-message'
}
// 可转发的消息类型

View File

@ -68,7 +68,12 @@
:nickname="item.nickname"
:talk_type="item.talk_type"
:datetime="item.created_at"
/>
:msg_id="item.msg_id"
>
<template v-if="canEditRevokedMessage(item) && item.user_id === userStore.uid">
<span class="edit-revoked-message" @click="restoreRevokedMessage(item)">重新编辑</span>
</template>
</revoke-message>
</div>
<div
@ -474,7 +479,7 @@ import useZPaging from '@/uni_modules/z-paging/components/z-paging/js/hooks/useZ
import emojiPanel from './components/emojiPanel.vue'
import filePanel from './components/filePanel.vue'
import lodash from 'lodash'
import { ServePublishMessage } from '@/api/chat'
import { ServePublishMessage,detailGetRecordsContext } from '@/api/chat'
import copy07 from '@/static/image/chatList/copy07@2x.png'
import multipleChoices from '@/static/image/chatList/multipleChoices@2x.png'
import cite from '@/static/image/chatList/cite@2x.png'
@ -761,6 +766,13 @@ const onEditorChange = () => {
}
onEditorEvent(emitCall('input_event', text))
// emit('editor-event', emitCall('input_event', text))
// 5
const now = new Date().getTime()
Object.keys(state.value.revokedMessages).forEach(msgId => {
if ((now - state.value.revokedMessages[msgId].revokeTime) > 5 * 60 * 1000) {
delete state.value.revokedMessages[msgId]
}
})
}
const onClipboardMatcher = (node, Delta) => {
@ -918,6 +930,47 @@ const withdrawerConfirm = () => {
state.value.showWin = false
}
//
const canEditRevokedMessage = (item) => {
console.log( item)
if(item.is_revoke === 1 && item.msg_type === 1) {
const now = new Date().getTime();
const revokeTime = new Date(item.created_at).getTime();
console.log(now)
// 5
return (now - revokeTime) <= 5 * 60 * 1000
}
return false
}
//
const restoreRevokedMessage = async (item) => {
//
const res = await detailGetRecordsContext({
msgId: item.msg_id
})
console.log(res)
if(res.code == 200) {
const content = res.data.item?.extra?.content;
const quill = getQuill()
quill.setText(content)
//
quill.setSelection(content.length, 0)
quill.focus()
}
/* const revokedMsg = state.value.revokedMessages[msgId]
//
if (revokedMsg.msgType === 1) { //
const quill = getQuill()
quill.setText(revokedMsg.content)
quill.focus()
} */
//
}
const actionDelete = (item) => {
console.log('删除')
item.isCheck = true
@ -1285,6 +1338,17 @@ onUnmounted(() => {
}
}
.edit-revoked-message {
margin-left: 10rpx;
color: #46299D;
cursor: pointer;
font-size: 24rpx;
&:hover {
text-decoration: underline;
}
}
.searchRoot {
background-color: #fff;
padding: 22rpx 18rpx;