feat(优化):1.人事课孙凯发布月培训选我刘义亮参加培训如图一所示,但我的培训中却线上”我主讲“?请核实!
deploy-hxtesting / build-and-deploy (push) Successful in 1m8s

2.培训中心增加2个统计”我主讲X门“、”我参加X门“如图二所示
3.如图三培训详情页面右上角增加一个【培训签到】按钮,点击自动跳转到如图四”培训签到“页面自动打开该课程签到详情,
4.如图四所示增加一个【培训详情】块,点击自动返回如图三该培训详情页面!
请在本地修改代码!
This commit is contained in:
runny committed 2026-11-25 08:47:05 +08:00
1 parent 11450bdb96
commit ea0524c445
3 files changed
+69 -2

No files matched your search

@@ -13,6 +13,10 @@
</t-tag>
<h2 class="detail-name">{{ course?.name || '课程详情' }}</h2>
<t-tag v-if="course" theme="default" variant="outline" size="small">{{ typeText }}</t-tag>
<!-- 培训签到:跳「培训签到」页并自动定位本课程场次(SignPanel 读取 courseId 查询参数) -->
<t-button v-if="course" variant="outline" theme="primary" size="small" class="detail-signin" @click="goSignin">
培训签到
</t-button>
</div>
<div class="detail-meta">
<span v-if="course">学时 {{ course.hours }}<template v-if="course.credits"> · 学分 {{ course.credits }}</template></span>
@@ -348,6 +352,12 @@ const goBack = () => {
else router.push('/platform/training/dashboard')
}
// 培训签到:携 courseId 跳「培训签到」页,SignPanel.applyRouteCourse 自动选中
// 该课程的进行中/最近场次(与「月培训计划-记录」跳转同一查询参数口径)。
const goSignin = () => {
router.push({ path: '/platform/training/sign', query: { courseId } })
}
const loadAll = async () => {
loading.value = true
try {
@@ -404,6 +414,12 @@ onMounted(loadAll)
flex-shrink: 0;
}
// 培训签到入口:页头行右对齐(2026-11 需求)
.detail-signin {
margin-left: auto;
flex-shrink: 0;
}
.detail-name {
margin: 0;
font-size: var(--app-text-xl, 20px);
@@ -30,6 +30,9 @@
<template v-if="filter === 'mine'">
<span class="catalog-stats__maintain" :class="{ 'is-alert': maintainCount > 0 }">待维护 {{ maintainCount }} 门</span>
<span class="catalog-stats__pending" :class="{ 'is-info': pendingStartCount > 0 }">待开始 {{ pendingStartCount }} 门</span>
<!-- 我主讲/我参加统计(2026-11 需求):与卡片角标同口径着色(主讲橙/参加蓝) -->
<span class="catalog-stats__teach" :class="{ 'is-teach': teachingCount > 0 }">我主讲 {{ teachingCount }} 门</span>
<span class="catalog-stats__attend" :class="{ 'is-attend': attendCount > 0 }">我参加 {{ attendCount }} 门</span>
</template>
</div>
@@ -354,6 +357,13 @@ const myCoursesSource = computed<TrainingCourse[]>(() => {
// 待维护 = 我主讲且「草稿」状态的课程(2026-11 需求:待审/已发布缺课件不再计入统计)
const maintainCount = computed(() => myTeachingCourses.value.filter((c) => c.status === 'draft').length)
// 我主讲/我参加统计(2026-11 需求):我主讲含未发布(与「我的培训」页签同源);
// 我参加 = 我在名单中的已发布课程数(纯参加口径,主讲不计,与「我参加」角标一致)
const teachingCount = computed(() => myTeachingCourses.value.length)
const attendCount = computed(() =>
publishedCourses.value.filter((c) => myEnrolledCourseIds.value.has(c.id) && !isMyTeaching(c)).length,
)
// 置顶排序/维护按钮仍关注未发布(草稿/待审)或已发布但未上传课件的课程
const needsMaintain = (c: TrainingCourse) => c.status !== 'published' || !c.material_ids?.length
@@ -491,7 +501,9 @@ const visibleCards = computed<CatalogCard[]>(() => {
}
return list
.map((c) => {
const head = [c.post_scope, typeText(c), `${c.hours} 学时`, c.exam_enabled ? '随堂考试' : ''].filter(Boolean).join(' · ')
// meta 首段为参加人员文案(post_scope),加「参加:」前缀——裸名字会被误读成讲师名
// (讲师身份以「我主讲」角标为准,角标判定口径见 isMyTeaching)。
const head = [c.post_scope ? `参加:${c.post_scope}` : '', typeText(c), `${c.hours} 学时`, c.exam_enabled ? '随堂考试' : ''].filter(Boolean).join(' · ')
const maintainable = isMyTeaching(c) && canMaintainCourses.value
const unpublished = c.status !== 'published'
// 「我的培训」角色标记:我主讲(优先) / 我参加,其余视图不标记
@@ -671,6 +683,26 @@ onMounted(loadAll)
font-weight: 600;
}
}
// 我主讲统计:与「我主讲」角标同色(warning 橙)
&__teach {
margin-left: 6px;
&.is-teach {
color: var(--td-warning-color);
font-weight: 600;
}
}
// 我参加统计:与「我参加」角标同色(primary 蓝)
&__attend {
margin-left: 6px;
&.is-attend {
color: var(--td-brand-color);
font-weight: 600;
}
}
}
.catalog-grid-wrap {
@@ -59,6 +59,15 @@
<div class="upload-card__hint">{{ uploading ? '上传中…' : '课程实录留证 · 每个 ≤ ' + VIDEO_MAX_MB + 'MB' }}</div>
</div>
</template>
<!-- 培训详情:回跳课程学习详情页(与课程详情页「培训签到」按钮互为出入口) -->
<div v-if="selectedCourseId" class="stat-card upload-card" role="button" tabindex="0" @click="goCourseDetail" @keydown.enter="goCourseDetail">
<div class="stat-card__label">培训详情</div>
<div class="upload-card__main">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><path d="M4 19V5a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v14"/><path d="M2 19h20"/><path d="M8 7h8M8 11h6"/></svg>
<span :title="courseName(selectedCourseId)">{{ courseName(selectedCourseId) }}</span>
</div>
<div class="upload-card__hint">查看课程课件 / 随堂考试详情</div>
</div>
</div>
<input ref="photoInput" type="file" accept="image/*" multiple class="visually-hidden-input" @change="onEvidenceFiles($event, 'sign_photo')" />
<input ref="videoInput" type="file" accept="video/*" multiple class="visually-hidden-input" @change="onEvidenceFiles($event, 'training_video')" />
@@ -151,7 +160,7 @@
<script setup lang="ts">
import { computed, onMounted, ref, watch } from 'vue'
import { useRoute } from 'vue-router'
import { useRoute, useRouter } from 'vue-router'
import { MessagePlugin } from 'tdesign-vue-next'
import QRCode from 'qrcode'
import {
@@ -182,6 +191,7 @@ import { fmtBeijingTime } from '@/utils/datetime'
const props = defineProps<{ roles: string[]; admin?: boolean }>()
const route = useRoute()
const router = useRouter()
// 签到复核/代签:人事/课长(roles 已按权限组展开,经理自动命中)
const canReview = computed(() => props.admin || props.roles.some((r) => r === 'hr' || r === 'supervisor'))
// 佐证上传/删除:人事/课长/讲师(与课件上传同口径)
@@ -197,6 +207,15 @@ const exportLoading = ref(false)
const sessions = ref<TrainingCourseSession[]>([])
const courses = ref<TrainingCourse[]>([])
const selectedSessionId = ref('')
// 当前选中场次的课程 id:「培训详情」卡片回跳课程学习详情页用(2026-11 需求)
const selectedCourseId = computed(
() => sessions.value.find((s) => s.id === selectedSessionId.value)?.course_id || '',
)
// 培训详情:携课程 id 跳「培训签到」页的同源落地页(课程学习详情)。
const goCourseDetail = () => {
if (!selectedCourseId.value) return
router.push({ path: `/platform/training/course/${selectedCourseId.value}` })
}
const signCode = ref<TrainingSignCode | null>(null)
const summary = ref<SignSummary | null>(null)
const records = ref<TrainingSignRecord[]>([])