fix bug#3892 重新编辑已撤回的消息

This commit is contained in:
wwt 2025-03-14 09:46:03 +08:00
parent 659c2c3e12
commit 2d28872a12
2 changed files with 37 additions and 24 deletions

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

@ -69,8 +69,8 @@
:datetime="item.created_at"
:msg_id="item.msg_id"
>
<template v-if="canEditRevokedMessage(item.msg_id) && item.user_id === userStore.uid">
<span class="edit-revoked-message" @click="restoreRevokedMessage(item.msg_id)">重新编辑</span>
<template v-if="canEditRevokedMessage(item) && item.user_id === userStore.uid">
<span class="edit-revoked-message" @click="restoreRevokedMessage(item)">重新编辑</span>
</template>
</revoke-message>
</div>
@ -478,7 +478,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'
@ -917,43 +917,48 @@ const actionWithdraw = (item) => {
}
const withdrawerConfirm = () => {
//
if (state.value.onfocusItem && state.value.onfocusItem.msg_type === 1) {
state.value.revokedMessages[state.value.onfocusItem.msg_id] = {
content: state.value.onfocusItem.extra.content,
revokeTime: new Date().getTime(),
msgType: state.value.onfocusItem.msg_type,
extra: state.value.onfocusItem.extra
}
}
dialogueStore.ApiRevokeRecord(state.value.onfocusItem.msg_id)
state.value.onfocusItem = null
state.value.showWin = false
}
//
const canEditRevokedMessage = (msgId) => {
if (!state.value.revokedMessages[msgId]) return false
const now = new Date().getTime()
const revokeTime = state.value.revokedMessages[msgId].revokeTime
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 = (msgId) => {
if (!state.value.revokedMessages[msgId]) return
const revokedMsg = state.value.revokedMessages[msgId]
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()
}
} */
//
}