update
This commit is contained in:
@@ -138,6 +138,7 @@ import { useConnectionsStore, type ConnectionInfo } from '../stores/connections.
|
|||||||
import { useTagsStore, type TagInfo } from '../stores/tags.store';
|
import { useTagsStore, type TagInfo } from '../stores/tags.store';
|
||||||
import apiClient from '../utils/apiClient';
|
import apiClient from '../utils/apiClient';
|
||||||
import { useUiNotificationsStore } from '../stores/uiNotifications.store';
|
import { useUiNotificationsStore } from '../stores/uiNotifications.store';
|
||||||
|
import { useWorkspaceEventEmitter } from '../composables/workspaceEvents'; // +++ 导入事件发射器 +++
|
||||||
|
|
||||||
interface ItemToSend {
|
interface ItemToSend {
|
||||||
name: string;
|
name: string;
|
||||||
@@ -171,6 +172,7 @@ const { t } = useI18n();
|
|||||||
const connectionsStore = useConnectionsStore();
|
const connectionsStore = useConnectionsStore();
|
||||||
const tagsStore = useTagsStore();
|
const tagsStore = useTagsStore();
|
||||||
const uiNotificationsStore = useUiNotificationsStore();
|
const uiNotificationsStore = useUiNotificationsStore();
|
||||||
|
const emitWorkspaceEvent = useWorkspaceEventEmitter(); // +++ 获取事件发射器实例 +++
|
||||||
|
|
||||||
const searchTerm = ref('');
|
const searchTerm = ref('');
|
||||||
const targetPath = ref('');
|
const targetPath = ref('');
|
||||||
@@ -343,6 +345,7 @@ const handleSend = async () => {
|
|||||||
} else {
|
} else {
|
||||||
uiNotificationsStore.showSuccess(t('sendFilesModal.transferInitiatedGeneric'));
|
uiNotificationsStore.showSuccess(t('sendFilesModal.transferInitiatedGeneric'));
|
||||||
}
|
}
|
||||||
|
emitWorkspaceEvent('ui:openTransferProgressModal'); // +++ 触发打开传输进度模态框的事件 +++
|
||||||
emit('update:visible', false);
|
emit('update:visible', false);
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
console.error('Failed to initiate transfer:', error);
|
console.error('Failed to initiate transfer:', error);
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import TransferProgressModal from './TransferProgressModal.vue'; // 导入传输
|
|||||||
import { useSessionStore } from '../stores/session.store';
|
import { useSessionStore } from '../stores/session.store';
|
||||||
import { useConnectionsStore, type ConnectionInfo } from '../stores/connections.store';
|
import { useConnectionsStore, type ConnectionInfo } from '../stores/connections.store';
|
||||||
import { useLayoutStore, type PaneName } from '../stores/layout.store';
|
import { useLayoutStore, type PaneName } from '../stores/layout.store';
|
||||||
import { useWorkspaceEventEmitter, useWorkspaceEventSubscriber } from '../composables/workspaceEvents';
|
import { useWorkspaceEventEmitter, useWorkspaceEventSubscriber, useWorkspaceEventOff } from '../composables/workspaceEvents'; // +++ 导入 useWorkspaceEventOff +++
|
||||||
|
|
||||||
import type { SessionTabInfoWithStatus } from '../stores/session/types'; // 路径修正
|
import type { SessionTabInfoWithStatus } from '../stores/session/types'; // 路径修正
|
||||||
|
|
||||||
@@ -18,6 +18,7 @@ import type { SessionTabInfoWithStatus } from '../stores/session/types'; // 路
|
|||||||
const { t } = useI18n(); // 初始化 i18n
|
const { t } = useI18n(); // 初始化 i18n
|
||||||
const emitWorkspaceEvent = useWorkspaceEventEmitter(); // +++ 获取事件发射器 +++
|
const emitWorkspaceEvent = useWorkspaceEventEmitter(); // +++ 获取事件发射器 +++
|
||||||
const onWorkspaceEvent = useWorkspaceEventSubscriber(); // +++ 获取事件订阅器 +++
|
const onWorkspaceEvent = useWorkspaceEventSubscriber(); // +++ 获取事件订阅器 +++
|
||||||
|
const offWorkspaceEvent = useWorkspaceEventOff(); // +++ 获取事件取消订阅器 +++
|
||||||
const layoutStore = useLayoutStore(); // 初始化布局 store
|
const layoutStore = useLayoutStore(); // 初始化布局 store
|
||||||
const connectionsStore = useConnectionsStore();
|
const connectionsStore = useConnectionsStore();
|
||||||
const { isHeaderVisible } = storeToRefs(layoutStore); // 从 layout store 获取主导航栏可见状态
|
const { isHeaderVisible } = storeToRefs(layoutStore); // 从 layout store 获取主导航栏可见状态
|
||||||
@@ -281,6 +282,18 @@ onMounted(() => {
|
|||||||
console.log('[TabBar] Received connection:connect event:', payload);
|
console.log('[TabBar] Received connection:connect event:', payload);
|
||||||
handlePopupConnect(payload.connectionId);
|
handlePopupConnect(payload.connectionId);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// +++ 监听打开传输进度模态框事件 +++
|
||||||
|
const handleOpenTransferProgressModal = () => {
|
||||||
|
console.log('[TabBar] Received ui:openTransferProgressModal event, opening modal.');
|
||||||
|
showTransferProgressModal.value = true;
|
||||||
|
};
|
||||||
|
onWorkspaceEvent('ui:openTransferProgressModal', handleOpenTransferProgressModal);
|
||||||
|
|
||||||
|
// 在组件卸载前取消订阅
|
||||||
|
onBeforeUnmount(() => {
|
||||||
|
offWorkspaceEvent('ui:openTransferProgressModal', handleOpenTransferProgressModal); // +++ 正确取消订阅 +++
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// +++ 组件卸载前移除全局监听器 +++
|
// +++ 组件卸载前移除全局监听器 +++
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ export type WorkspaceEventPayloads = {
|
|||||||
|
|
||||||
// UI Interaction Events
|
// UI Interaction Events
|
||||||
'ui:openLayoutConfigurator': void;
|
'ui:openLayoutConfigurator': void;
|
||||||
|
'ui:openTransferProgressModal': void; // 请求打开文件传输进度模态框
|
||||||
// 'ui:toggleVirtualKeyboard': void; // 如果决定迁移 CommandInputBar 的这个事件
|
// 'ui:toggleVirtualKeyboard': void; // 如果决定迁移 CommandInputBar 的这个事件
|
||||||
'fileManager:openModalRequest': { sessionId: string }; // 请求打开文件管理器模态框
|
'fileManager:openModalRequest': { sessionId: string }; // 请求打开文件管理器模态框
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user