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