fix(transmit): 🐛 fix forwarding function can not be used

This commit is contained in:
Dawn
2025-10-24 03:13:27 +08:00
parent 78cdf846d1
commit ae86ee3a1f
5 changed files with 23 additions and 6 deletions
@@ -262,6 +262,10 @@ const computeMsgHover = computed(() => (item: MessageType) => {
return false
}
if (chatStore.msgMultiChooseMode === 'forward') {
return false
}
return hoverId.value === item.message.id || item.isCheck
})
// 是否显示悬浮页脚
@@ -1,5 +1,7 @@
<template>
<div class="relative flex-center gap-22px h-full">
<div
v-if="chatStore.isMsgMultiChoose && chatStore.msgMultiChooseMode !== 'forward' && !showModal"
class="relative flex-center gap-22px h-full">
<!-- 功能模块 -->
<div class="flex flex-col flex-y-center gap-14px" v-for="opt in opts">
<n-button :disabled="opt.disabled" secondary circle @click="opt.click" class="size-46px">
@@ -205,6 +207,9 @@ const opts = computed(() => [
watch(showModal, (visible, previous) => {
if (!visible && previous) {
if (chatStore.msgMultiChooseMode === 'forward') {
chatStore.setMsgMultiChoose(false)
}
chatStore.resetSessionSelection()
if (!chatStore.isMsgMultiChoose) {
chatStore.clearMsgCheck()
@@ -32,7 +32,7 @@
<div class="flex justify-center items-center">
<n-checkbox
v-model:checked="message.isCheck"
v-if="chatStore.isMsgMultiChoose && !isMultiSelectDisabled"
v-if="chatStore.isMsgMultiChoose && chatStore.msgMultiChooseMode !== 'forward' && !isMultiSelectDisabled"
class="mr-3 select-none"
:focusable="false"
@click.stop />
+8 -3
View File
@@ -137,7 +137,7 @@ export const useChatMain = (isHistoryMode = false, options: UseChatMainOptions =
}
/** 通用右键菜单 */
const handleForward = (item: MessageType) => {
const handleForward = async (item: MessageType) => {
if (!item?.message?.id) return
const target = chatStore.chatMessageList.find((msg) => msg.message.id === item.message.id)
if (!target) {
@@ -145,7 +145,8 @@ export const useChatMain = (isHistoryMode = false, options: UseChatMainOptions =
}
chatStore.clearMsgCheck()
target.isCheck = true
chatStore.setMsgMultiChoose(false)
chatStore.setMsgMultiChoose(true, 'forward')
await nextTick()
useMitt.emit(MittEnum.MSG_MULTI_CHOOSE, {
action: 'open-forward',
mergeType: MergeMessageType.SINGLE
@@ -1116,7 +1117,11 @@ export const useChatMain = (isHistoryMode = false, options: UseChatMainOptions =
const handleMsgClick = (item: MessageType) => {
// 移动端不触发 active 效果
if (!isMobile()) {
activeBubble.value = item.message.id
if (chatStore.msgMultiChooseMode === 'forward') {
activeBubble.value = ''
} else {
activeBubble.value = item.message.id
}
}
// 启用键盘监听
const handleKeyPress = (e: KeyboardEvent) => {
+4 -1
View File
@@ -66,6 +66,7 @@ export const useChatStore = defineStore(
// 存储每条撤回消息的过期定时器
const expirationTimers: Record<string, boolean> = {}
const isMsgMultiChoose = ref<boolean>(false)
const msgMultiChooseMode = ref<'normal' | 'forward'>('normal')
// 当前聊天室的消息Map计算属性
const currentMessageMap = computed(() => {
@@ -815,8 +816,9 @@ export const useChatStore = defineStore(
return sessionList.value.filter((session) => session.type === RoomTypeEnum.GROUP)
}
const setMsgMultiChoose = (flag: boolean) => {
const setMsgMultiChoose = (flag: boolean, mode: 'normal' | 'forward' = 'normal') => {
isMsgMultiChoose.value = flag
msgMultiChooseMode.value = flag ? mode : 'normal'
}
// 重置所有会话选择状态
@@ -872,6 +874,7 @@ export const useChatStore = defineStore(
isMsgMultiChoose,
clearMsgCheck,
setMsgMultiChoose,
msgMultiChooseMode,
resetSessionSelection,
checkMsgExist,
clearRedundantMessages