fix(training-UI): 员工培训UI交互点击【员工培训】、【培训管理】默认打开对应工作区
This commit is contained in:
1 parent
5e7e5a8717
commit
ffd3634302
1 file changed
+34
-5
@@ -3,7 +3,9 @@
|
||||
* features/chat/components/TrainingWorkspacePanel.vue
|
||||
* 用途:在培训 Agent 的聊天页顶部提供“员工培训 + 培训管理”一体化工作区。
|
||||
* 依赖:useTrainingWorkspace、lucide 图标、聊天页 currentAgent/currentUser。
|
||||
* 逻辑:只在培训 Agent 下渲染;员工与 HR 管理员首次进入默认展开工作区,但新建/切换会话后保持收起,避免聊天过程中被自动展开打断。
|
||||
* 逻辑:只在培训 Agent 下渲染;员工与 HR 管理员首次进入默认展开工作区,
|
||||
* 收起态下点击“员工培训 / 培训管理 / 展开工作区”会直接展开到对应工作区;
|
||||
* 新建/切换会话后统一回到聊天页,避免聊天过程中被自动展开打断。
|
||||
*/
|
||||
import { computed, reactive, ref, watch, type ShallowUnwrapRef } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
@@ -94,6 +96,33 @@ const setWorkspaceExpanded = (expanded: boolean, manual = false) => {
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 从聊天页顶部入口切换到指定培训工作区,并立即展开工作区内容。
|
||||
* AI 触发时机:当用户在 chat 主页面手动点击“员工培训 / 培训管理 / 展开工作区”时,
|
||||
* 不能只切换 tab 高亮,必须同步展开对应工作区,避免用户误以为点击无效。
|
||||
*/
|
||||
const openWorkspaceView = (view: typeof workspace.activeView) => {
|
||||
workspace.activeView = view;
|
||||
setWorkspaceExpanded(true, true);
|
||||
};
|
||||
|
||||
/**
|
||||
* 收起培训工作区并回到纯聊天页面。
|
||||
* AI 触发时机:点击“收起工作区”时,必须立即恢复聊天消息区与输入栏,而不是仅折叠局部内容。
|
||||
*/
|
||||
const collapseToChatPage = () => {
|
||||
setWorkspaceExpanded(false, true);
|
||||
};
|
||||
|
||||
/**
|
||||
* 展开当前已选中的培训工作区。
|
||||
* AI 触发时机:当用户已在收起态选定某个 tab 后点击“展开工作区”,
|
||||
* 应沿用当前 activeView 打开对应面板,而不是切回默认视图。
|
||||
*/
|
||||
const expandCurrentWorkspace = () => {
|
||||
setWorkspaceExpanded(true, true);
|
||||
};
|
||||
|
||||
const currentAnswerLabel = computed(() => {
|
||||
const question = workspace.currentQuestion;
|
||||
if (!question) return '';
|
||||
@@ -222,7 +251,7 @@ const handleStageCardClick = (stageKey: string) => {
|
||||
type="button"
|
||||
class="rounded-full px-3 py-1.5 text-xs font-medium transition"
|
||||
:class="workspace.activeView === 'learner' ? 'bg-brand-600 text-white' : 'bg-surface-soft text-secondary hover:bg-slate-100'"
|
||||
@click="workspace.activeView = 'learner'"
|
||||
@click="openWorkspaceView('learner')"
|
||||
>
|
||||
{{ $t('chat.training.tabs.learner') }}
|
||||
</button>
|
||||
@@ -231,7 +260,7 @@ const handleStageCardClick = (stageKey: string) => {
|
||||
type="button"
|
||||
class="rounded-full px-3 py-1.5 text-xs font-medium transition"
|
||||
:class="workspace.activeView === 'admin' ? 'bg-brand-600 text-white' : 'bg-surface-soft text-secondary hover:bg-slate-100'"
|
||||
@click="workspace.activeView = 'admin'"
|
||||
@click="openWorkspaceView('admin')"
|
||||
>
|
||||
{{ $t('chat.training.tabs.admin') }}
|
||||
</button>
|
||||
@@ -260,7 +289,7 @@ const handleStageCardClick = (stageKey: string) => {
|
||||
<button
|
||||
type="button"
|
||||
class="inline-flex h-9 items-center gap-2 rounded-xl border border-default bg-white px-3.5 text-xs font-medium leading-none text-secondary transition hover:bg-surface-soft"
|
||||
@click="setWorkspaceExpanded(true, true)"
|
||||
@click="expandCurrentWorkspace"
|
||||
>
|
||||
<ChevronDown class="h-4 w-4 shrink-0" />
|
||||
<span class="leading-none">{{ $t('chat.training.actions.expandWorkspace') }}</span>
|
||||
@@ -337,7 +366,7 @@ const handleStageCardClick = (stageKey: string) => {
|
||||
<button
|
||||
type="button"
|
||||
class="inline-flex h-9 items-center gap-2 rounded-xl border border-default bg-white px-3.5 text-xs font-medium leading-none text-secondary transition hover:bg-surface-soft"
|
||||
@click="setWorkspaceExpanded(false, true)"
|
||||
@click="collapseToChatPage"
|
||||
>
|
||||
<ChevronUp class="h-4 w-4 shrink-0" />
|
||||
<span class="leading-none">{{ $t('chat.training.actions.collapseWorkspace') }}</span>
|
||||
|
||||
Reference in new issue
Block a user