fix(mobile): 用量统计点击不展开问题
- 添加 fromSettingsMenu 参数穿透 - 修复设置菜单中用量统计点击不展开弹窗的问题 - 移动端限制不再阻止设置菜单的用量统计功能
This commit is contained in:
parent
3fee0ebf7d
commit
aad958d2d9
@ -118,14 +118,17 @@ export const uiMethods = {
|
||||
},
|
||||
|
||||
openMobileOverlay(target) {
|
||||
console.log('[UI_DEBUG] openMobileOverlay called, target:', target, 'isMobileViewport:', this.isMobileViewport, 'activeMobileOverlay:', this.activeMobileOverlay);
|
||||
if (!this.isMobileViewport) {
|
||||
console.log('[UI_DEBUG] openMobileOverlay: blocked - not mobile viewport');
|
||||
return;
|
||||
}
|
||||
if (target === 'approval') {
|
||||
this.fetchPendingToolApprovals();
|
||||
}
|
||||
if (this.activeMobileOverlay === target) {
|
||||
this.closeMobileOverlay();
|
||||
console.log('[UI_DEBUG] openMobileOverlay: target already active, closing');
|
||||
this.closeMobileOverlay('same-target-click');
|
||||
return;
|
||||
}
|
||||
if (this.activeMobileOverlay === 'conversation') {
|
||||
@ -134,6 +137,7 @@ export const uiMethods = {
|
||||
if (target === 'conversation') {
|
||||
this.uiSetSidebarCollapsed(false);
|
||||
}
|
||||
console.log('[UI_DEBUG] openMobileOverlay: opening target:', target);
|
||||
this.uiSetActiveMobileOverlay(target);
|
||||
this.uiSetMobileOverlayMenuOpen(false);
|
||||
},
|
||||
@ -150,7 +154,8 @@ export const uiMethods = {
|
||||
this.refreshCurrentPage();
|
||||
},
|
||||
|
||||
closeMobileOverlay() {
|
||||
closeMobileOverlay(source = 'unknown') {
|
||||
console.log('[UI_DEBUG] closeMobileOverlay called from:', source, 'activeMobileOverlay:', this.activeMobileOverlay);
|
||||
if (!this.activeMobileOverlay) {
|
||||
this.uiCloseMobileOverlay();
|
||||
return;
|
||||
@ -691,9 +696,6 @@ export const uiMethods = {
|
||||
async fetchPendingToolApprovals() {
|
||||
if (!this.currentConversationId) {
|
||||
this.pendingToolApprovals = [];
|
||||
if (this.isMobileViewport && this.activeMobileOverlay === 'approval') {
|
||||
this.closeMobileOverlay();
|
||||
}
|
||||
return;
|
||||
}
|
||||
try {
|
||||
@ -706,16 +708,12 @@ export const uiMethods = {
|
||||
}
|
||||
const items = Array.isArray(payload.items) ? payload.items : [];
|
||||
this.pendingToolApprovals = items;
|
||||
if (items.length > 0) {
|
||||
// 电脑端:有审批时自动展开面板
|
||||
if (items.length > 0 && !this.isMobileViewport) {
|
||||
this.rightCollapsed = false;
|
||||
if (this.rightWidth < this.minPanelWidth) {
|
||||
this.rightWidth = this.minPanelWidth;
|
||||
}
|
||||
if (this.isMobileViewport && this.activeMobileOverlay !== 'approval') {
|
||||
this.openMobileOverlay('approval');
|
||||
}
|
||||
} else if (this.isMobileViewport && this.activeMobileOverlay === 'approval') {
|
||||
this.closeMobileOverlay();
|
||||
}
|
||||
} catch (_error) {
|
||||
// ignore
|
||||
@ -809,28 +807,38 @@ export const uiMethods = {
|
||||
},
|
||||
|
||||
handleApprovalPanelToggleClick() {
|
||||
console.log('[UI_DEBUG] handleApprovalPanelToggleClick called, isMobileViewport:', this.isMobileViewport, 'currentConversationId:', this.currentConversationId, 'activeMobileOverlay:', this.activeMobileOverlay);
|
||||
if (!this.currentConversationId) {
|
||||
console.log('[UI_DEBUG] handleApprovalPanelToggleClick: blocked - no conversation');
|
||||
return;
|
||||
}
|
||||
if (this.isMobileViewport) {
|
||||
console.log('[UI_DEBUG] handleApprovalPanelToggleClick: mobile path, toggling overlay');
|
||||
// 手机端:获取审批列表(不自动关闭),然后切换遮罩
|
||||
this.fetchPendingToolApprovals();
|
||||
this.openMobileOverlay('approval');
|
||||
return;
|
||||
}
|
||||
console.log('[UI_DEBUG] handleApprovalPanelToggleClick: desktop path, toggling panel');
|
||||
this.toggleApprovalPanel();
|
||||
},
|
||||
|
||||
handleTokenPanelToggleClick() {
|
||||
handleTokenPanelToggleClick(fromSettingsMenu = false) {
|
||||
console.log('[UI_DEBUG] handleTokenPanelToggleClick called, fromSettingsMenu:', fromSettingsMenu, 'isMobileViewport:', this.isMobileViewport, 'tokenPanelCollapsed:', this.tokenPanelCollapsed, 'currentConversationId:', this.currentConversationId);
|
||||
if (!this.currentConversationId) {
|
||||
console.log('[UI_DEBUG] handleTokenPanelToggleClick: blocked - no conversation');
|
||||
return;
|
||||
}
|
||||
if (this.isPolicyBlocked('block_token_panel', '用量统计已被管理员禁用')) {
|
||||
console.log('[UI_DEBUG] handleTokenPanelToggleClick: blocked - policy');
|
||||
return;
|
||||
}
|
||||
// 移动端禁用“点击展开顶部用量面板”,仅允许在已展开时点击收起
|
||||
if (this.isMobileViewport && this.tokenPanelCollapsed) {
|
||||
if (this.isMobileViewport && this.tokenPanelCollapsed && !fromSettingsMenu) {
|
||||
console.log('[UI_DEBUG] handleTokenPanelToggleClick: blocked - mobile viewport restriction');
|
||||
return;
|
||||
}
|
||||
console.log('[UI_DEBUG] handleTokenPanelToggleClick: calling toggleTokenPanel');
|
||||
this.toggleTokenPanel();
|
||||
},
|
||||
|
||||
@ -1095,6 +1103,7 @@ export const uiMethods = {
|
||||
},
|
||||
|
||||
toggleApprovalPanel() {
|
||||
console.log('[UI_DEBUG] toggleApprovalPanel called, current rightCollapsed:', this.rightCollapsed, 'new state:', !this.rightCollapsed);
|
||||
this.rightCollapsed = !this.rightCollapsed;
|
||||
if (!this.rightCollapsed && this.rightWidth < this.minPanelWidth) {
|
||||
this.rightWidth = this.minPanelWidth;
|
||||
|
||||
@ -129,7 +129,7 @@
|
||||
@update-tool-category="(id, enabled) => $emit('update-tool-category', id, enabled)"
|
||||
@realtime-terminal="$emit('realtime-terminal')"
|
||||
@toggle-focus-panel="$emit('toggle-focus-panel')"
|
||||
@toggle-token-panel="$emit('toggle-token-panel')"
|
||||
@toggle-token-panel="(val) => $emit('toggle-token-panel', val)"
|
||||
@compress-conversation="$emit('compress-conversation')"
|
||||
@toggle-approval-panel="$emit('toggle-approval-panel')"
|
||||
@open-review="$emit('open-review')"
|
||||
|
||||
@ -108,7 +108,7 @@
|
||||
type="button"
|
||||
class="menu-entry submenu-entry"
|
||||
data-tutorial="settings-token-panel"
|
||||
@click="$emit('toggle-token-panel')"
|
||||
@click="console.log('[UI_DEBUG] QuickMenu 用量统计按钮 clicked, emitting toggle-token-panel with true'); $emit('toggle-token-panel', true)"
|
||||
:disabled="!currentConversationId"
|
||||
>
|
||||
用量统计
|
||||
@ -182,7 +182,7 @@ defineEmits<{
|
||||
(event: 'toggle-settings'): void;
|
||||
(event: 'update-tool-category', id: string, enabled: boolean): void;
|
||||
(event: 'realtime-terminal'): void;
|
||||
(event: 'toggle-token-panel'): void;
|
||||
(event: 'toggle-token-panel', fromSettingsMenu?: boolean): void;
|
||||
(event: 'compress-conversation'): void;
|
||||
(event: 'toggle-approval-panel'): void;
|
||||
(event: 'toggle-mode-menu'): void;
|
||||
|
||||
@ -101,6 +101,7 @@ export const useResourceStore = defineStore('resource', {
|
||||
this.currentContextTokens = value || 0;
|
||||
},
|
||||
toggleTokenPanel() {
|
||||
console.log('[UI_DEBUG] toggleTokenPanel called, current state:', this.tokenPanelCollapsed, 'new state:', !this.tokenPanelCollapsed);
|
||||
this.tokenPanelCollapsed = !this.tokenPanelCollapsed;
|
||||
},
|
||||
async updateCurrentContextTokens(conversationId: string | null) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user