chore: 初始化仓库,导入项目基线代码

Academy v0.8.3 完整代码基线:Go 后端(internal/cmd/cli/mcp-server/docreader)、
Vue 前端(frontend)、数据库迁移(migrations)、部署编排(docker/helm/deploy)与文档。
今日开发的培训推送管理改动随后单独提交。
This commit is contained in:
runny committed 2026-11-16 18:12:23 +08:00
commit 7ec21f35b0
5767 files changed
+1436788

No files matched your search

@@ -0,0 +1,128 @@
/**
* 企业培训工作台预览 harness(仅本地视觉验证用,不参与生产路由):
* 复刻 Training.vue 页头与页签切换,覆盖工作台三视图/培训计划/培训课程/
* 题库与考试/配置中心等子页,验证本次改动(模板下载、配置中心改名等)。
* 启动:npx vite --config vite.training-preview.config.ts
*/
import { createApp, computed, ref, h, defineComponent } from 'vue'
import { createPinia } from 'pinia'
import TDesign from 'tdesign-vue-next'
import 'tdesign-vue-next/dist/tdesign.css'
import '@/assets/theme/theme.css'
import '@/assets/theme/tdesign-overrides.less'
import { useAuthStore } from '@/stores/auth'
import WorkbenchPanel from '@/views/training/components/WorkbenchPanel.vue'
import PlanPanel from '@/views/training/components/PlanPanel.vue'
import CoursePanel from '@/views/training/components/CoursePanel.vue'
import StudyPanel from '@/views/training/components/StudyPanel.vue'
import RulePanel from '@/views/training/components/RulePanel.vue'
import ResourceIcon from '@/components/icons/ResourceIcon.vue'
const HARNESS_APP = defineComponent({
setup() {
const authStore = useAuthStore()
authStore.user = {
id: 'u1',
username: '林知夏',
email: 'lin@example.com',
tenant_id: '1',
created_at: '',
updated_at: '',
} as any
// trainee = 普通员工(仅课程/个人成长);hr = 培训运营(含数据驾驶舱)
const preset = ref<'trainee' | 'hr'>('hr')
type WorkbenchView = 'course' | 'growth' | 'dashboard'
const workbenchTab = ref<WorkbenchView>('course')
// 子页:工作台 / 培训计划 / 培训课程 / 学习考试 / 配置中心
const page = ref<'workbench' | 'plan' | 'course' | 'study' | 'rules'>('workbench')
const PAGES = [
{ key: 'workbench', title: '工作台' },
{ key: 'plan', title: '培训计划' },
{ key: 'course', title: '培训课程' },
{ key: 'study', title: '学习考试' },
{ key: 'rules', title: '配置中心' },
] as const
const roles = computed(() => (preset.value === 'hr' ? ['hr'] : ['trainee']))
const canSeeDashboard = computed(() => preset.value === 'hr')
const isWorkbench = computed(() => page.value === 'workbench')
const workbenchTabs = computed(() => {
const list: { key: WorkbenchView; label: string }[] = [
{ key: 'course', label: '课程' },
{ key: 'growth', label: '个人成长' },
]
if (canSeeDashboard.value) list.push({ key: 'dashboard', label: '数据驾驶舱' })
return list
})
const meta = computed(() => {
if (isWorkbench.value) {
if (workbenchTab.value === 'course') return { title: '培训课程', desc: '课程/课件上传后自动转入课件库并智能归档' }
if (workbenchTab.value === 'growth') return { title: '工作台', desc: '个人成长进阶 · 能力模型与成就任务总览' }
return { title: '工作台', desc: '培训运营总览、待办与达成率一览' }
}
const found = PAGES.find((p) => p.key === page.value)
return { title: found?.title || '', desc: '' }
})
const panelFor = (key: typeof page.value) => {
const common = { roles: roles.value, admin: false }
switch (key) {
case 'plan': return h(PlanPanel, common)
case 'course': return h(CoursePanel, common)
case 'study': return h(StudyPanel, common)
case 'rules': return h(RulePanel, common)
default: return h(WorkbenchPanel, { ...common, tab: workbenchTab.value })
}
}
return () => h('div', { class: 'preview-page' }, [
h('div', { class: 'preview-preset' }, [
'角色视角:',
h('button', {
class: ['pv-btn', preset.value === 'trainee' ? 'on' : ''],
onClick: () => (preset.value = 'trainee'),
}, '普通员工'),
h('button', {
class: ['pv-btn', preset.value === 'hr' ? 'on' : ''],
onClick: () => (preset.value = 'hr'),
}, '人事·培训运营'),
h('span', { class: 'pv-divider' }),
'子页:',
...PAGES.map((p) => h('button', {
key: p.key,
class: ['pv-btn', page.value === p.key ? 'on' : ''],
onClick: () => (page.value = p.key),
}, p.title)),
]),
h('header', { class: 'preview-header' }, [
h('div', { class: 'preview-title-row' }, [
h('div', { class: 'preview-title-group' }, [
h('h2', {}, [h(ResourceIcon, { type: 'training', size: 24 }), ` ${meta.value.title}`]),
h('span', { class: 'pv-role-tag' }, preset.value === 'hr' ? '人事 · 培训运营' : '学员'),
]),
isWorkbench.value
? h('nav', { class: 'workbench-switch' },
workbenchTabs.value.map((t) => h('button', {
key: t.key,
type: 'button',
class: ['workbench-switch__tab', workbenchTab.value === t.key ? 'is-active' : ''],
onClick: () => (workbenchTab.value = t.key),
}, t.label)))
: null,
]),
h('p', { class: 'preview-subtitle' }, meta.value.desc),
]),
h('div', { class: 'preview-body' }, [panelFor(page.value)]),
])
},
})
const app = createApp(HARNESS_APP)
app.use(TDesign)
app.use(createPinia())
app.mount('#app')