diff --git a/frontend/src/views/training/components/CourseCatalog.vue b/frontend/src/views/training/components/CourseCatalog.vue index 7292f48..cd4f997 100644 --- a/frontend/src/views/training/components/CourseCatalog.vue +++ b/frontend/src/views/training/components/CourseCatalog.vue @@ -755,9 +755,6 @@ onMounted(loadAll) // 000165 复测:预览区撑满抽屉 —— 抽屉 body 拉成 flex 纵向布局,课程内容块 // 撑满剩余高度(此前仅 min-height:100%,document-preview 的 height:100% 在 // auto 高度链上不生效,预览塌陷为固定小窗) -// 000165 复测:预览区撑满抽屉 —— 抽屉 body 拉成 flex 纵向布局,课程内容块 -// 撑满剩余高度(此前仅 min-height:100%,document-preview 的 height:100% 在 -// auto 高度链上不生效,预览塌陷为固定小窗) .course-catalog :deep(.t-drawer__body) { display: flex; flex-direction: column; @@ -771,19 +768,30 @@ onMounted(loadAll) flex: 1; min-height: 0; - // t-loading 包裹层承载预览的 flex 撑满 - :deep(.t-loading) { + // t-loading 组件包装层的真实 DOM 类是 t-loading__parent > t-loading__content + // (此前误写 .t-loading 未命中,高度链断裂预览塌陷),拉成纵向 flex 撑满 + :deep(.t-loading__parent) { flex: 1; min-height: 0; display: flex; flex-direction: column; - > .document-preview { + .t-loading__content { flex: 1; min-height: 0; + display: flex; + flex-direction: column; } } + // 兜底:预览组件给确定性高度(视口 - 抽屉头/元信息/按钮行/留白), + // 即使 flex 高度链断裂也满屏,底部仅保留「下载课件」按钮一行高度 + :deep(.document-preview) { + flex: 1; + min-height: 0; + height: calc(100vh - 210px); + } + &__meta { margin: 0; color: var(--td-text-color-secondary); diff --git a/internal/application/service/training_notify.go b/internal/application/service/training_notify.go index 8a05369..6f830c8 100644 --- a/internal/application/service/training_notify.go +++ b/internal/application/service/training_notify.go @@ -130,7 +130,7 @@ type notifyTextTemplates struct { // 内置默认文案(与历史硬编码逐字一致;{lecturer} 缺讲师时渲染为「待定」)。 const ( defaultStudentNoticeTitle = "培训开课通知" - defaultStudentNoticeContent = "您被点名参加「{course}」培训:{time},{place},讲师:{lecturer}。请准时参加。" + defaultStudentNoticeContent = "诚邀您参加「{course}」,培训时间:{time},培训地点:{place},培训讲师:{lecturer},请提前安排好工作,准时参加,谢谢!" defaultLecturerOpenTitle = "授课提醒" defaultLecturerOpenFooter = "请准时参加,详情见培训平台。" defaultLecturerMaintainTitle = "课程维护提醒" @@ -253,7 +253,15 @@ func (s *trainingService) sessionNoticeText(ctx context.Context, tenantID uint64 place = "线上会议(链接见课程页)" } lecturerName := "待定" - if lecturer, err := s.repo.GetMember(ctx, tenantID, session.LecturerID); err == nil && lecturer != nil && lecturer.UserName != "" { + // 讲师解析兜底(000165 复测):场次未指定讲师时回退课程管理主数据的讲师, + // 避免课程已设讲师但通知仍显示「待定」(场次先建、讲师后补的场景)。 + lecturerID := session.LecturerID + if strings.TrimSpace(lecturerID) == "" { + if course, err := s.repo.GetCourse(ctx, tenantID, session.CourseID); err == nil && course != nil { + lecturerID = course.LecturerID + } + } + if lecturer, err := s.repo.GetMember(ctx, tenantID, lecturerID); err == nil && lecturer != nil && lecturer.UserName != "" { lecturerName = lecturer.UserName } tpl := s.loadNotifyTextTemplates(ctx, tenantID) @@ -593,6 +601,8 @@ func demandCollectYear(refID string, now time.Time) int { const demandCollectPlanPath = "/platform/training/plan" // wecomDispatchContent 企微投递正文 = 站内 content + 场景尾部链接。 +// 000165 复测:学员开课通知(session_notice_student)与开课提醒统一为 markdown +// 样式 —— 站内标题加粗置顶(如【培训开课通知】),正文随配置模板。 // demand_collect 且行内带 link_url 时追加两行 markdown 链接: // // 下载教育训练需求表模板(签名匿名直链,20 天有效;无 token 时省略) @@ -600,6 +610,14 @@ const demandCollectPlanPath = "/platform/training/plan" // // 其余场景原样返回(提醒类场景的 markdown 由生成侧 remindContent 拼好)。 func wecomDispatchContent(row *claimedNotification) string { + if row.Scene == types.SceneSessionNoticeStudent { + var b strings.Builder + if title := strings.TrimSpace(row.Title); title != "" { + b.WriteString("**【" + title + "】**\n") + } + b.WriteString(strings.TrimSpace(row.Content)) + return b.String() + } if row.Scene != types.SceneDemandCollect || row.LinkURL == "" { return row.Content } diff --git a/internal/application/service/training_scheduler.go b/internal/application/service/training_scheduler.go index a04f9f8..622dd75 100644 --- a/internal/application/service/training_scheduler.go +++ b/internal/application/service/training_scheduler.go @@ -347,42 +347,54 @@ func (s *TrainingScheduler) generateForTenant( // 立即入队(training_notify.go),调度器不再发学员 remind_tN 重复打扰; // day_before 场次在 T-1 且课件就绪时在此入队(课件缺失跳过,上传课件后 // 补推钩子兜底)。讲师 remind_tN_lecturer 授课提醒保持不变。 + // 000165 复测:多档提醒窗口(T-3/T-1)同时过期时(临近创建/改期的场次), + // 一次扫描只发最近一档(按天升序取最小),避免同屏重复轰炸; + // 正常节奏(提前数天创建)不受影响 —— 未到窗口的档位不会入选。 + dueDay := 0 for _, d := range cfg.remindDays { if now.Before(start.Add(-time.Duration(d) * 24 * time.Hour)) { continue } + if dueDay == 0 || d < dueDay { + dueDay = d + } + } + if dueDay > 0 { if sess.LecturerID != "" { rows := []*types.TrainingNotification{s.newReminderRow(tenantID, sess.LecturerID, - types.TrainingRemindScene(d, true), + types.TrainingRemindScene(dueDay, true), remindTitle(cfg.texts.LecturerOpenTitle, course), remindContent(course, &sess, false, cfg.texts.LecturerOpenFooter), sess.ID, cfg.pushEnabled, now)} if err := s.insertNotifications(ctx, tenantID, sess.ID, rows); err != nil { return err } } - if sess.NotifyMode != types.TrainingNotifyModeDayBefore || d != 1 { - continue - } - hasMaterial, err := s.courseHasMaterial(ctx, tenantID, sess.CourseID) - if err != nil { - return err - } - if !hasMaterial { - continue - } - targets, err := s.sessionTargets(ctx, tenantID, sess) - if err != nil { - return err - } - rows := make([]*types.TrainingNotification, 0, len(targets)) - for _, uid := range targets { - rows = append(rows, s.newReminderRow(tenantID, uid, - types.SceneSessionNoticeStudent, - remindTitle(cfg.texts.StudentNoticeTitle, course), remindContent(course, &sess, false, cfg.texts.LecturerOpenFooter), - sess.ID, cfg.pushEnabled, now)) - } - if err := s.insertNotifications(ctx, tenantID, sess.ID, rows); err != nil { - return err + if sess.NotifyMode == types.TrainingNotifyModeDayBefore && dueDay == 1 { + hasMaterial, err := s.courseHasMaterial(ctx, tenantID, sess.CourseID) + if err != nil { + return err + } + if hasMaterial { + targets, err := s.sessionTargets(ctx, tenantID, sess) + if err != nil { + return err + } + rows := make([]*types.TrainingNotification, 0, len(targets)) + for _, uid := range targets { + // 讲师已有同场次的授课提醒(remind_t1_lecturer), + // 学员通知跳过讲师,避免同一人收到两条相同内容 + if sess.LecturerID != "" && uid == sess.LecturerID { + continue + } + rows = append(rows, s.newReminderRow(tenantID, uid, + types.SceneSessionNoticeStudent, + remindTitle(cfg.texts.StudentNoticeTitle, course), remindContent(course, &sess, false, cfg.texts.LecturerOpenFooter), + sess.ID, cfg.pushEnabled, now)) + } + if err := s.insertNotifications(ctx, tenantID, sess.ID, rows); err != nil { + return err + } + } } }