فهرست منبع

feat(W3/W6): 补齐规划师认证前端与任务列表成员角标

任务号:sync_gap_tasks(2026-10-23-project-master-plan 差距补齐)

W3 规划师认证(后端已实现,本次补齐前端接入):
- cfc-frontend/utils/api.js:新增 7 个规划师认证接口封装
  (my/courses/training-activities/check-in/exam start|submit|result),
  submitPlannerExam 对 answers 做 JSON.stringify(后端按 JSON 字符串解析)
- cfc-frontend/pages.json:pages/guide 分包注册 training/index 与 training/exam
- cfc-frontend/pages/teacher/teacher-profile.vue:新增「培训认证中心」入口
- cfc-web/src/api/plannerCertification.js + views/admin/planner-cert/:
  落地认证看板/课程与类别管理/考核题库管理三页
- cfc-web/src/router/index.js:注册 3 条 planner-cert 路由(perm: planner:*)
- cfc-web/src/utils/permissions.js:operator 角色补 planner:* 权限
- cfc-web/src/views/Layout.vue:系统配置下新增「规划师认证」菜单组
- cfc-backend PlannerOfflineCourseService.listTrainingActivities:
  修复 categoryCode 误填 Integer categoryId 的缺陷,改为回填类别编码字符串
  (前端按 categoryCode 过滤线下活动,误填会导致活动 Tab 永远匹配不上)

W6 首页家庭任务数(补齐任务列表页缺口):
- cfc-frontend/pages/tasks/tasks.vue:新增 memberPendingCounts 与
  countTasksByMember(pending + in_progress),复用同一次 familyWide 响应,
  不额外发起请求,并透传 :pending-counts 给 MemberSelector
- cfc-frontend/components/MemberSelector.vue:minimal 变体补待完成角标
  (此前仅 strip 变体有角标,任务列表用 minimal 形态看不到数量)

W7 机构管理员管理:经核对 origin/cfclub 已完整实现(16 项清单全在),
本次无需改动,无新增数据库迁移。
Sisyphus 2 هفته پیش
والد
کامیت
ac7c452823

+ 4 - 2
cfc-backend/src/main/java/com/etotem/cfc/service/PlannerOfflineCourseService.java

@@ -84,9 +84,11 @@ public class PlannerOfflineCourseService {
             row.put("endTime", activity.getEndTime());
             row.put("location", activity.getLocation());
             row.put("coverImage", activity.getCoverImage());
-            row.put("categoryId", map.getCategoryId());
-            row.put("categoryCode", map.getCategoryId());
             PlannerCertCategory cat = categoryMapper.selectById(map.getCategoryId());
+            row.put("categoryId", map.getCategoryId());
+            // categoryCode 必须是类别编码字符串(如 "planner"),前端按 code 过滤活动;
+            // 不能误放 Integer 的 categoryId,否则线下活动 Tab 永远无法匹配。
+            row.put("categoryCode", cat != null ? cat.getCode() : "");
             row.put("categoryName", cat != null ? cat.getName() : "");
             row.put("durationHours", map.getDurationHours());
             row.put("isRequired", map.getIsRequired());

+ 37 - 1
cfc-frontend/components/MemberSelector.vue

@@ -220,6 +220,9 @@
             @click="onSelect(selfMember)"
           >
             <text class="minimal-chip-text">{{ selfLabel }}</text>
+            <view v-if="selfPendingCount > 0" class="minimal-chip-badge">
+              <text class="minimal-chip-badge-num">{{ selfPendingCount }}</text>
+            </view>
           </view>
 
           <!-- 各成员(排除本人行,避免同一人出现两次) -->
@@ -231,6 +234,9 @@
             @click="onSelect(m)"
           >
             <text class="minimal-chip-text">{{ m.nickname || m.roleLabel || '成员' }}</text>
+            <view v-if="m._pendingCount > 0" class="minimal-chip-badge">
+              <text class="minimal-chip-badge-num">{{ m._pendingCount }}</text>
+            </view>
           </view>
         </view>
       </scroll-view>
@@ -315,11 +321,20 @@ export default {
       var out = []
       var list = this.normalizedMembers || []
       for (var i = 0; i < list.length; i++) {
-        var copy = Object.assign({}, list[i], { _selected: self.isSameMember(list[i], self.selectedMemberId) })
+        var copy = Object.assign({}, list[i], {
+          _selected: self.isSameMember(list[i], self.selectedMemberId),
+          _pendingCount: (self.pendingCounts || {})[list[i].id] || 0
+        })
         out.push(copy)
       }
       return out
     },
+    // minimal 变体:「个人」项待完成角标数
+    selfPendingCount: function() {
+      var m = this.selfMember
+      if (!m) return 0
+      return (this.pendingCounts || {})[m.id] || 0
+    },
     // minimal 变体:各成员 chip 列表。
     // showSelf=true 时排除本人行(本人已由「个人」项承载,避免同一人出现两次);
     // showSelf=false 时保留全部成员(含本人,按昵称展示,保持原页面语义)。
@@ -954,6 +969,10 @@ $tab-dims: (
 }
 .minimal-chip {
   flex-shrink: 0;
+  display: inline-flex;
+  flex-direction: row;
+  align-items: center;
+  gap: 8rpx;
   padding: 10rpx 24rpx;
   border-radius: 24rpx;
   background: $facade-fill-2;
@@ -968,4 +987,21 @@ $tab-dims: (
   font-weight: 500;
   color: inherit;
 }
+.minimal-chip-badge {
+  min-width: 32rpx;
+  height: 32rpx;
+  padding: 0 8rpx;
+  background: #FF6B6B;
+  border-radius: 16rpx;
+  display: inline-flex;
+  flex-direction: row;
+  align-items: center;
+  justify-content: center;
+}
+.minimal-chip-badge-num {
+  font-size: calc(20rpx * var(--font-scale, 1));
+  font-weight: 600;
+  color: #FFFFFF;
+  line-height: 32rpx;
+}
 </style>

+ 12 - 0
cfc-frontend/pages.json

@@ -225,6 +225,18 @@
           "style": {
             "navigationBarTitleText": "活动详情"
           }
+        },
+        {
+          "path": "training/index",
+          "style": {
+            "navigationBarTitleText": "培训认证中心"
+          }
+        },
+        {
+          "path": "training/exam",
+          "style": {
+            "navigationBarTitleText": "认证考核"
+          }
         }
       ]
     },

+ 562 - 0
cfc-frontend/pages/guide/training/exam.vue

@@ -0,0 +1,562 @@
+<template>
+  <view class="container">
+    <!-- 试卷头 -->
+    <view class="header-card" v-if="!result">
+      <view class="header-title">{{ categoryName }}认证考核</view>
+      <view class="header-meta">
+        <text class="meta-item">共 {{ questionCount }} 题</text>
+        <text class="meta-item">限时 {{ durationMinutes }} 分钟</text>
+        <text class="meta-item">满分 {{ totalScore }} 分</text>
+      </view>
+      <view class="timer-row" :class="timerUrgent ? 'urgent' : ''">
+        <text class="timer-text">剩余时间 {{ countdownText }}</text>
+      </view>
+    </view>
+
+    <!-- 题目 -->
+    <view class="question-list" v-if="!result">
+      <view class="question-card" v-for="(q, idx) in questions" :key="q.id">
+        <view class="q-head">
+          <text class="q-index">{{ idx + 1 }}</text>
+          <text class="q-text">{{ q.question }}</text>
+          <text class="q-score">{{ q.score }}分</text>
+        </view>
+        <view class="option-list">
+          <view
+            class="option-item"
+            v-for="opt in q.options"
+            :key="opt.key"
+            :class="answers[q.id] === opt.key ? 'option-active' : ''"
+            @click="selectAnswer(q.id, opt.key)"
+          >
+            <text class="option-key">{{ opt.key }}</text>
+            <text class="option-text">{{ opt.text }}</text>
+          </view>
+        </view>
+      </view>
+    </view>
+
+    <!-- 结果 -->
+    <view class="result-card" v-if="result">
+      <view class="result-icon" v-if="result.passed">&#x1F389;</view>
+      <view class="result-icon fail" v-else>&#x1F614;</view>
+      <view class="result-title" v-if="result.passed">考核通过</view>
+      <view class="result-title fail" v-else>考核未通过</view>
+      <view class="result-score">{{ result.score }} 分 / 及格 {{ result.passScore }} 分</view>
+
+      <view class="result-desc success" v-if="result.passed">
+        <text>恭喜通过{{ categoryName }}认证。基础类别通过后,您的成长规划师状态已同步激活,可正常接单提供对应服务。</text>
+      </view>
+      <view class="result-desc fail" v-else>
+        <text>未达到及格线,可返回认证中心重新参加考核(课时已达标,重考不额外计费)。</text>
+      </view>
+
+      <view class="result-btn" @click="goBack">
+        <text>返回认证中心</text>
+      </view>
+    </view>
+
+    <!-- 加载 / 错误 -->
+    <view class="state-block" v-if="!result && errorMsg">
+      <text class="state-icon">&#x26A0;</text>
+      <text class="state-title">无法开始考核</text>
+      <text class="state-desc">{{ errorMsg }}</text>
+      <view class="result-btn" @click="goBack">
+        <text>返回认证中心</text>
+      </view>
+    </view>
+
+    <view class="state-block" v-if="!result && !errorMsg && loading">
+      <text class="state-title">正在生成试卷...</text>
+    </view>
+
+    <!-- 底部提交 -->
+    <view class="footer-bar" v-if="!result && !errorMsg && !loading && questions.length > 0">
+      <view class="answered-tip">
+        <text>已作答 {{ answeredCount }} / {{ questions.length }} 题</text>
+      </view>
+      <view class="submit-btn" @click="handleSubmit">
+        <text>提交试卷</text>
+      </view>
+    </view>
+  </view>
+</template>
+
+<script>
+import { startPlannerExam, submitPlannerExam } from '../../../utils/api.js'
+import fontScaleMixin from '@/mixins/font-scale.js'
+
+export default {
+  mixins: [fontScaleMixin],
+  data() {
+    return {
+      categoryId: null,
+      categoryName: '成长规划师',
+      attemptId: null,
+      paperId: null,
+      durationMinutes: 30,
+      questionCount: 0,
+      questions: [],
+      answers: {},
+      remaining: 0,
+      timer: null,
+      submitting: false,
+      result: null,
+      errorMsg: '',
+      loading: true
+    }
+  },
+  computed: {
+    countdownText() {
+      var m = Math.floor(this.remaining / 60)
+      var s = this.remaining % 60
+      return (m < 10 ? '0' + m : m) + ':' + (s < 10 ? '0' + s : s)
+    },
+    timerUrgent() {
+      return this.remaining > 0 && this.remaining <= 60
+    },
+    answeredCount() {
+      var keys = Object.keys(this.answers)
+      var n = 0
+      for (var i = 0; i < keys.length; i++) {
+        if (this.answers[keys[i]]) n++
+      }
+      return n
+    },
+    totalScore() {
+      var total = 0
+      for (var i = 0; i < this.questions.length; i++) {
+        total += (this.questions[i].score || 0)
+      }
+      return total
+    }
+  },
+  onLoad(options) {
+    this.categoryId = options && options.categoryId ? parseInt(options.categoryId, 10) : null
+    this.categoryName = options && options.categoryName ? decodeURIComponent(options.categoryName) : '成长规划师'
+    this.startExam()
+  },
+  onUnload() {
+    this.clearTimer()
+  },
+  methods: {
+    startExam() {
+      var self = this
+      if (!this.categoryId) {
+        this.errorMsg = '缺少认证类别参数'
+        this.loading = false
+        return
+      }
+      this.loading = true
+      this.errorMsg = ''
+      startPlannerExam(this.categoryId).then(function (res) {
+        self.loading = false
+        if (!res || res.code !== 200 || !res.data) {
+          self.errorMsg = (res && res.message) || '试卷加载失败'
+          return
+        }
+        var data = res.data
+        self.attemptId = data.attemptId
+        self.paperId = data.paperId
+        self.durationMinutes = data.durationMinutes || 30
+        self.questionCount = data.questionCount || (data.questions ? data.questions.length : 0)
+        self.questions = self.normalizeQuestions(data.questions || [])
+        self.remaining = self.durationMinutes * 60
+        self.startTimer()
+      }).catch(function (e) {
+        self.loading = false
+        self.errorMsg = (e && e.message) || '网络异常,请稍后重试'
+      })
+    },
+    /** 解析后端 options JSON 字段,兼容 ["文本", ...] 与 [{key,text}, ...] 两种格式 */
+    normalizeQuestions(list) {
+      var result = []
+      for (var i = 0; i < list.length; i++) {
+        var q = list[i]
+        var opts = []
+        var raw = q.options
+        var arr = []
+        if (typeof raw === 'string') {
+          try {
+            arr = JSON.parse(raw)
+          } catch (e) {
+            arr = []
+          }
+        } else if (raw && typeof raw.length === 'number') {
+          arr = raw
+        }
+        var letters = ['A', 'B', 'C', 'D', 'E', 'F']
+        for (var j = 0; j < arr.length; j++) {
+          var item = arr[j]
+          if (item && typeof item === 'object') {
+            opts.push({
+              key: item.key || item.label || item.code || letters[j] || ('O' + j),
+              text: item.text || item.content || item.label || ''
+            })
+          } else {
+            opts.push({
+              key: letters[j] || ('O' + j),
+              text: String(item)
+            })
+          }
+        }
+        result.push({
+          id: q.id,
+          question: q.question || '',
+          score: q.score || 1,
+          options: opts
+        })
+      }
+      return result
+    },
+    selectAnswer(questionId, key) {
+      if (this.result || this.submitting) return
+      this.$set(this.answers, questionId, key)
+    },
+    startTimer() {
+      var self = this
+      this.clearTimer()
+      this.timer = setInterval(function () {
+        self.remaining--
+        if (self.remaining <= 0) {
+          self.remaining = 0
+          self.clearTimer()
+          self.handleSubmit(true)
+        }
+      }, 1000)
+    },
+    clearTimer() {
+      if (this.timer) {
+        clearInterval(this.timer)
+        this.timer = null
+      }
+    },
+    handleSubmit(auto) {
+      if (this.submitting || this.result) return
+      var self = this
+      if (!auto && this.answeredCount < this.questions.length) {
+        uni.showModal({
+          title: '确认提交',
+          content: '还有 ' + (this.questions.length - this.answeredCount) + ' 题未作答,未作答题目按 0 分计。是否提交?',
+          confirmText: '提交',
+          cancelText: '继续作答',
+          success: function (res) {
+            if (res.confirm) self.doSubmit()
+          }
+        })
+        return
+      }
+      this.doSubmit()
+    },
+    doSubmit() {
+      var self = this
+      if (this.submitting || this.result) return
+      this.submitting = true
+      this.clearTimer()
+      submitPlannerExam(this.attemptId, this.answers).then(function (res) {
+        self.submitting = false
+        if (!res || res.code !== 200 || !res.data) {
+          self.errorMsg = (res && res.message) || '提交失败,请重试'
+          self.startTimer()
+          return
+        }
+        self.result = res.data
+      }).catch(function () {
+        self.submitting = false
+        self.errorMsg = '提交失败,请重试'
+        self.startTimer()
+      })
+    },
+    goBack() {
+      uni.navigateBack({
+        fail: function () {
+          uni.redirectTo({ url: '/pages/guide/training/index' })
+        }
+      })
+    }
+  }
+}
+</script>
+
+<style scoped lang="scss">
+.container {
+  min-height: 100vh;
+  background: $app-bg;
+  padding: 20rpx;
+  padding-bottom: 160rpx;
+}
+
+/* ===== 试卷头 ===== */
+.header-card {
+  background: linear-gradient(135deg, $status-info 0%, $status-info-deep 100%);
+  border-radius: 20rpx;
+  padding: 28rpx;
+  margin-bottom: 20rpx;
+}
+
+.header-title {
+  font-size: 34rpx;
+  font-weight: bold;
+  color: $app-surface;
+  margin-bottom: 10rpx;
+}
+
+.header-meta {
+  display: flex;
+  flex-direction: row;
+  gap: 24rpx;
+  margin-bottom: 18rpx;
+}
+
+.meta-item {
+  font-size: 23rpx;
+  color: rgba(255, 255, 255, 0.88);
+}
+
+.timer-row {
+  background: rgba(255, 255, 255, 0.2);
+  border-radius: 12rpx;
+  padding: 10rpx 20rpx;
+  align-self: flex-start;
+}
+
+.timer-row.urgent {
+  background: $status-danger;
+}
+
+.timer-text {
+  font-size: 26rpx;
+  color: $app-surface;
+  font-weight: 500;
+}
+
+/* ===== 题目 ===== */
+.question-card {
+  background: $app-surface;
+  border-radius: 18rpx;
+  padding: 24rpx;
+  margin-bottom: 20rpx;
+  box-shadow: 0 4rpx 14rpx rgba(0, 0, 0, 0.04);
+}
+
+.q-head {
+  display: flex;
+  flex-direction: row;
+  align-items: flex-start;
+  margin-bottom: 18rpx;
+}
+
+.q-index {
+  flex-shrink: 0;
+  width: 40rpx;
+  height: 40rpx;
+  line-height: 40rpx;
+  text-align: center;
+  border-radius: 50%;
+  background: $status-info-soft;
+  color: $status-info-deep;
+  font-size: 22rpx;
+  margin-right: 12rpx;
+}
+
+.q-text {
+  flex: 1;
+  font-size: 28rpx;
+  color: $facade-text-strong;
+  line-height: 1.5;
+}
+
+.q-score {
+  flex-shrink: 0;
+  font-size: 22rpx;
+  color: $facade-text-muted;
+  margin-left: 10rpx;
+}
+
+.option-list {
+  display: flex;
+  flex-direction: column;
+  gap: 12rpx;
+}
+
+.option-item {
+  display: flex;
+  flex-direction: row;
+  align-items: center;
+  padding: 18rpx 20rpx;
+  border-radius: 12rpx;
+  background: $facade-fill-gray-50;
+  border: 1rpx solid $facade-gray-200;
+}
+
+.option-active {
+  background: $status-info-tint;
+  border-color: $status-info;
+}
+
+.option-key {
+  flex-shrink: 0;
+  width: 36rpx;
+  height: 36rpx;
+  line-height: 36rpx;
+  text-align: center;
+  border-radius: 50%;
+  background: $facade-fill-gray-100;
+  color: $facade-text-body;
+  font-size: 22rpx;
+  margin-right: 14rpx;
+}
+
+.option-active .option-key {
+  background: $status-info;
+  color: $app-surface;
+}
+
+.option-text {
+  flex: 1;
+  font-size: 27rpx;
+  color: $facade-text-deep;
+  line-height: 1.5;
+}
+
+/* ===== 结果 ===== */
+.result-card {
+  background: $app-surface;
+  border-radius: 20rpx;
+  padding: 60rpx 40rpx 40rpx;
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+  box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.05);
+}
+
+.result-icon {
+  font-size: 100rpx;
+  margin-bottom: 16rpx;
+}
+
+.result-icon.fail {
+  font-size: 80rpx;
+}
+
+.result-title {
+  font-size: 38rpx;
+  font-weight: bold;
+  color: $status-success-deep;
+  margin-bottom: 10rpx;
+}
+
+.result-title.fail {
+  color: $status-danger-deep;
+}
+
+.result-score {
+  font-size: 30rpx;
+  color: $facade-text-strong;
+  margin-bottom: 24rpx;
+}
+
+.result-desc {
+  border-radius: 14rpx;
+  padding: 20rpx;
+  margin-bottom: 32rpx;
+  line-height: 1.6;
+}
+
+.result-desc text {
+  font-size: 25rpx;
+  color: $facade-text-deep;
+}
+
+.result-desc.success {
+  background: $status-success-tint;
+  border-left: 6rpx solid $status-success;
+}
+
+.result-desc.fail {
+  background: $status-danger-tint-2;
+  border-left: 6rpx solid $status-danger;
+}
+
+.result-btn {
+  width: 100%;
+  background: linear-gradient(135deg, $status-success 0%, $status-success-deep 100%);
+  border-radius: 44rpx;
+  padding: 22rpx 0;
+  text-align: center;
+}
+
+.result-btn text {
+  color: $app-surface;
+  font-size: 30rpx;
+  font-weight: 500;
+}
+
+/* ===== 状态块 ===== */
+.state-block {
+  background: $app-surface;
+  border-radius: 20rpx;
+  padding: 70rpx 40rpx;
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+}
+
+.state-icon {
+  font-size: 80rpx;
+  margin-bottom: 16rpx;
+}
+
+.state-title {
+  font-size: 30rpx;
+  font-weight: bold;
+  color: $facade-text-strong;
+  margin-bottom: 10rpx;
+}
+
+.state-desc {
+  font-size: 25rpx;
+  color: $facade-text-muted;
+  text-align: center;
+  line-height: 1.6;
+  margin-bottom: 30rpx;
+}
+
+/* ===== 底部提交 ===== */
+.footer-bar {
+  position: fixed;
+  left: 0;
+  right: 0;
+  bottom: 0;
+  background: $app-surface;
+  padding: 16rpx 24rpx calc(16rpx + env(safe-area-inset-bottom));
+  display: flex;
+  flex-direction: row;
+  align-items: center;
+  gap: 20rpx;
+  border-top: 1rpx solid $facade-fill;
+}
+
+.answered-tip {
+  flex-shrink: 0;
+}
+
+.answered-tip text {
+  font-size: 24rpx;
+  color: $facade-text-muted;
+}
+
+.submit-btn {
+  flex: 1;
+  background: linear-gradient(135deg, $status-success 0%, $status-success-deep 100%);
+  border-radius: 44rpx;
+  padding: 20rpx 0;
+  text-align: center;
+}
+
+.submit-btn text {
+  color: $app-surface;
+  font-size: 30rpx;
+  font-weight: 500;
+}
+</style>

+ 858 - 0
cfc-frontend/pages/guide/training/index.vue

@@ -0,0 +1,858 @@
+<template>
+  <view class="container">
+    <!-- 顶部总览卡 -->
+    <view class="overview-card">
+      <view class="overview-title">培训认证中心</view>
+      <view class="overview-desc">完成必修课时并通过考核后,可持证提供服务</view>
+      <view class="overview-badge" v-if="baseCertReady">
+        <text>✓ 已通过基础认证,可接单</text>
+      </view>
+      <view class="overview-badge pending" v-else>
+        <text>待完成基础类别认证</text>
+      </view>
+    </view>
+
+    <!-- 类别 Tab -->
+    <view class="tabs" v-if="certList.length > 0">
+      <view
+        class="tab"
+        v-for="c in certList"
+        :key="c.categoryCode"
+        :class="currentTab === c.categoryCode ? 'tab-active' : ''"
+        @click="switchTab(c.categoryCode)"
+      >
+        <text>{{ c.categoryName }}</text>
+      </view>
+    </view>
+
+    <!-- 当前类别认证状态 -->
+    <view class="cert-card" v-if="currentCert">
+      <view class="cert-head">
+        <view class="cert-name">
+          <text>{{ currentCert.categoryName }}</text>
+          <text class="base-tag" v-if="currentCert.isBase === 1">基础类别</text>
+        </view>
+        <text class="cert-status" :class="currentStatusCss">{{ currentStatusText }}</text>
+      </view>
+
+      <!-- 课时进度 -->
+      <view class="progress-wrap">
+        <view class="progress-label-row">
+          <text class="progress-label">课时进度</text>
+          <text class="progress-value">{{ currentProgressText }}</text>
+        </view>
+        <view class="progress-bar">
+          <view class="progress-inner" :style="'width:' + currentProgressPercent + '%'"></view>
+        </view>
+      </view>
+
+      <view class="info-list">
+        <view class="info-row">
+          <text class="info-label">学习状态</text>
+          <text class="info-value">{{ currentLearningStatusText }}</text>
+        </view>
+        <view class="info-row" v-if="currentExamStatusText">
+          <text class="info-label">考核状态</text>
+          <text class="info-value">{{ currentExamStatusText }}</text>
+        </view>
+        <view class="info-row" v-if="currentExamAttempts > 0">
+          <text class="info-label">已参加考核</text>
+          <text class="info-value">{{ currentExamAttempts }} 次</text>
+        </view>
+        <view class="info-row" v-if="currentLastAttempt">
+          <text class="info-label">最近一次考核</text>
+          <text class="info-value">{{ currentLastAttempt.score }} 分 · {{ currentLastAttempt.passed === 1 ? '通过' : '未通过' }}</text>
+        </view>
+        <view class="info-row" v-if="currentCert.certNo">
+          <text class="info-label">证书编号</text>
+          <text class="info-value cert-no">{{ currentCert.certNo }}</text>
+        </view>
+        <view class="info-row" v-if="currentCert.certifiedAt">
+          <text class="info-label">认证时间</text>
+          <text class="info-value">{{ formatDateTime(currentCert.certifiedAt) }}</text>
+        </view>
+      </view>
+
+      <!-- 状态引导 / 失败态提示 -->
+      <view class="hint-block" :class="hintLevel">
+        <text class="hint-text">{{ currentHint }}</text>
+      </view>
+
+      <!-- 考核入口 -->
+      <view class="exam-btn" :class="{ disabled: !currentCert.canExam }" @click="goExam">
+        <text>{{ currentExamBtnText }}</text>
+      </view>
+    </view>
+
+    <view class="empty-block" v-else-if="!loading && certList.length === 0">
+      <text class="empty-icon">&#x1F393;</text>
+      <text class="empty-title">暂无认证信息</text>
+      <text class="empty-desc">如已完成成长规划师身份审核,请联系平台管理员补登认证记录</text>
+    </view>
+
+    <!-- 线上课程 -->
+    <view class="section" v-if="currentCert">
+      <view class="section-title">线上课程</view>
+      <view class="course-list" v-if="courses.length > 0">
+        <view class="course-item" v-for="c in courses" :key="c.id">
+          <view class="course-main">
+            <view class="course-title-row">
+              <text class="course-title">{{ c.title }}</text>
+              <text class="course-tag" v-if="c.isRequired === 1">必修</text>
+              <text class="course-tag optional" v-else>选修</text>
+            </view>
+            <text class="course-meta">要求课时 {{ hoursText(c.requiredHours) }}</text>
+          </view>
+        </view>
+      </view>
+      <view class="empty-mini" v-else>该类别暂无线上课程</view>
+    </view>
+
+    <!-- 线下培训打卡 -->
+    <view class="section" v-if="currentCert">
+      <view class="section-title">线下培训打卡</view>
+      <view class="activity-list" v-if="tabActivities.length > 0">
+        <view class="activity-item" v-for="a in tabActivities" :key="a.id">
+          <view class="activity-main">
+            <view class="activity-title-row">
+              <text class="activity-title">{{ a.title }}</text>
+              <text class="course-tag" v-if="a.isRequired === 1">必修</text>
+            </view>
+            <text class="activity-meta">{{ formatDateTime(a.startTime) }}</text>
+            <text class="activity-meta" v-if="a.location">{{ a.location }}</text>
+            <text class="activity-meta hours">签到计 {{ hoursText(a.durationHours) }} 课时</text>
+          </view>
+          <view class="checkin-btn" :class="a._checked ? 'checked' : ''" @click="handleCheckIn(a)">
+            <text>{{ a._checked ? '已签到' : '签到' }}</text>
+          </view>
+        </view>
+      </view>
+      <view class="empty-mini" v-else>该类别暂无可报名的培训活动</view>
+    </view>
+
+    <view class="loading-block" v-if="loading">
+      <text class="loading-text">加载中...</text>
+    </view>
+  </view>
+</template>
+
+<script>
+import {
+  getMyCertifications,
+  getPlannerCourses,
+  getPlannerTrainingActivities,
+  checkInTrainingActivity,
+  getPlannerExamResult
+} from '../../../utils/api.js'
+import { formatDateTime } from '../../../utils/format.js'
+import fontScaleMixin from '@/mixins/font-scale.js'
+
+export default {
+  mixins: [fontScaleMixin],
+  data() {
+    return {
+      certList: [],
+      currentTab: '',
+      courses: [],
+      activities: [],
+      loading: false,
+      examAttemptsMap: {},
+      submitting: false
+    }
+  },
+  computed: {
+    /** 当前选中类别的认证记录 */
+    currentCert() {
+      for (var i = 0; i < this.certList.length; i++) {
+        if (this.certList[i].categoryCode === this.currentTab) return this.certList[i]
+      }
+      return null
+    },
+    /** 当前类别下的线下培训活动 */
+    tabActivities() {
+      if (!this.currentCert) return []
+      var code = this.currentCert.categoryCode
+      var list = []
+      for (var i = 0; i < this.activities.length; i++) {
+        if (this.activities[i].categoryCode === code) list.push(this.activities[i])
+      }
+      return list
+    },
+    baseCertReady() {
+      for (var i = 0; i < this.certList.length; i++) {
+        var c = this.certList[i]
+        if (c.isBase === 1 && c.status === 'certified') return true
+      }
+      return false
+    },
+    currentProgressPercent() {
+      if (!this.currentCert) return 0
+      var required = parseFloat(this.currentCert.requiredHours)
+      var completed = parseFloat(this.currentCert.completedHours)
+      if (isNaN(required) || required <= 0) return completed > 0 ? 100 : 0
+      if (isNaN(completed)) completed = 0
+      var pct = (completed / required) * 100
+      if (pct > 100) pct = 100
+      return Math.round(pct * 10) / 10
+    },
+    currentProgressText() {
+      if (!this.currentCert) return '0 / 0'
+      return this.hoursText(this.currentCert.completedHours) + ' / ' + this.hoursText(this.currentCert.requiredHours)
+    },
+    currentStatusCss() {
+      if (!this.currentCert) return ''
+      var map = {
+        pending_cert: 'st-pending',
+        learning_completed: 'st-pending',
+        certified: 'st-done',
+        suspended: 'st-fail'
+      }
+      return map[this.currentCert.status] || 'st-pending'
+    },
+    currentStatusText() {
+      if (!this.currentCert) return ''
+      var map = {
+        pending_cert: '学习中',
+        learning_completed: '待考核',
+        certified: '已认证',
+        suspended: '已停用'
+      }
+      return map[this.currentCert.status] || this.currentCert.status || '学习中'
+    },
+    currentLearningStatusText() {
+      if (!this.currentCert) return ''
+      var map = { pending_learning: '学习进行中', learning_completed: '课时已达标' }
+      return map[this.currentCert.learningStatus] || '未开始'
+    },
+    currentExamStatusText() {
+      if (!this.currentCert) return ''
+      var st = this.currentCert.examStatus
+      if (st === 'none' || !st) return ''
+      var map = { exam_failed: '考核未通过', exam_passed: '考核已通过' }
+      var txt = map[st] || st
+      var score = this.currentCert.examScore
+      if (score !== null && score !== undefined) txt = txt + '(' + score + '分)'
+      return txt
+    },
+    currentExamAttempts() {
+      if (!this.currentCert) return 0
+      return parseInt(this.currentCert.examAttempts, 10) || 0
+    },
+    /** 最近一次考核记录(getPlannerExamResult 返回) */
+    currentLastAttempt() {
+      if (!this.currentCert) return null
+      return this.examAttemptsMap[this.currentCert.categoryId] || null
+    },
+    /** 考核按钮文案:已认证 / 可开考 / 需先完成课时 */
+    currentExamBtnText() {
+      if (!this.currentCert) return '开始考核'
+      if (this.currentCert.status === 'certified') return '✓ 已完成认证'
+      if (this.currentCert.canExam) {
+        return this.currentCert.examStatus === 'exam_failed' ? '重新参加考核' : '开始考核'
+      }
+      return '先完成必修课时'
+    },
+    hintLevel() {
+      if (!this.currentCert) return 'hint-info'
+      if (this.currentCert.status === 'certified') return 'hint-ok'
+      if (this.currentCert.status === 'suspended') return 'hint-fail'
+      if (this.currentCert.examStatus === 'exam_failed') return 'hint-fail'
+      if (this.currentCert.learningStatus === 'learning_completed') return 'hint-info'
+      return 'hint-warn'
+    },
+    /** 失败态 / 引导文案 */
+    currentHint() {
+      if (!this.currentCert) return ''
+      var c = this.currentCert
+      if (c.status === 'suspended') {
+        return '该类别认证已停用,无法提供对应服务,请联系平台处理。'
+      }
+      if (c.status === 'certified') {
+        if (c.isBase === 1) {
+          return '已通过基础类别认证,可接单提供成长规划师服务。'
+        }
+        return '已通过该类别认证,可承接对应类别的服务。'
+      }
+      if (c.learningStatus !== 'learning_completed') {
+        var need = this.hoursText(c.requiredHours)
+        var done = this.hoursText(c.completedHours)
+        var gap = Math.round((parseFloat(c.requiredHours) - parseFloat(c.completedHours)) * 10) / 10
+        return '课时未达标:已完成 ' + done + ' 课时,还差 ' + gap + ' 课时(共需 ' + need + ' 课时)。课时达标后方可参加考核。'
+      }
+      if (c.examStatus === 'exam_failed') {
+        return '课时已达标,但上次考核未通过。可重新参加考核,通过后即可认证。'
+      }
+      if (c.examStatus === 'none') {
+        return '课时已达标,尚未参加考核。完成考核后即可取得该类别认证。'
+      }
+      return ''
+    }
+  },
+  onLoad() {
+    this._onLoadFired = false
+    this.loadAll()
+    this._onLoadFired = true
+  },
+  onShow() {
+    // 首次进入由 onLoad 负责;返回本页(如考核页返回)时刷新数据
+    if (this._onLoadFired) {
+      this._onLoadFired = false
+    } else {
+      this.loadAll()
+    }
+  },
+  methods: {
+    loadAll() {
+      var self = this
+      if (this.loading) return
+      this.loading = true
+      var pending = 2
+      var done = function () {
+        pending--
+        if (pending <= 0) self.loading = false
+      }
+      getMyCertifications().then(function (res) {
+        if (res && res.code === 200 && res.data) {
+          self.certList = res.data
+          if (!self.currentTab && self.certList.length > 0) {
+            self.currentTab = self.certList[0].categoryCode
+          }
+          // 类别确定后再拉课程与最近考核,避免首屏 categoryId 尚未就绪
+          self.loadCategoryData()
+        }
+        done()
+      }).catch(function () { done() })
+      getPlannerTrainingActivities().then(function (res) {
+        if (res && res.code === 200 && res.data) {
+          var list = []
+          for (var i = 0; i < res.data.length; i++) {
+            var a = res.data[i]
+            a._checked = false
+            list.push(a)
+          }
+          self.activities = list
+        }
+        done()
+      }).catch(function () { done() })
+    },
+    /** 仅刷新认证状态(签到后课时会重算,列表接口结果不变,无需重复请求) */
+    refreshCerts() {
+      var self = this
+      // _skipDedup:签到触发课时重算后需即时拿到最新 completedHours,绕开 3 秒去重缓存
+      getMyCertifications({ _skipDedup: true }).then(function (res) {
+        if (res && res.code === 200 && res.data) {
+          self.certList = res.data
+          if (!self.currentTab && self.certList.length > 0) {
+            self.currentTab = self.certList[0].categoryCode
+          }
+        }
+      }).catch(function () {})
+    },
+    /** 加载当前类别的课程与最近一次考核结果(切换 Tab 时也走这里) */
+    loadCategoryData() {
+      var cert = this.currentCert
+      if (!cert) {
+        this.courses = []
+        return
+      }
+      var self = this
+      getPlannerCourses(cert.categoryId).then(function (res) {
+        if (res && res.code === 200 && res.data) self.courses = res.data
+      }).catch(function () { self.courses = [] })
+      getPlannerExamResult(cert.categoryId).then(function (res) {
+        if (res && res.code === 200 && res.data) {
+          self.$set(self.examAttemptsMap, cert.categoryId, res.data)
+        }
+      }).catch(function () {})
+    },
+    switchTab(categoryCode) {
+      if (this.currentTab === categoryCode) return
+      this.currentTab = categoryCode
+      this.courses = []
+      this.loadCategoryData()
+    },
+    goExam() {
+      var cert = this.currentCert
+      if (!cert) return
+      if (!cert.canExam) {
+        uni.showToast({ title: this.currentHint, icon: 'none', duration: 2600 })
+        return
+      }
+      uni.navigateTo({
+        url: '/pages/guide/training/exam?categoryId=' + cert.categoryId + '&categoryName=' + encodeURIComponent(cert.categoryName)
+      })
+    },
+    handleCheckIn(a) {
+      if (a._checked) {
+        uni.showToast({ title: '该活动已签到', icon: 'none' })
+        return
+      }
+      if (this.submitting) return
+      var self = this
+      this.submitting = true
+      checkInTrainingActivity(a.id).then(function (res) {
+        self.submitting = false
+        if (res && res.code === 200) {
+          self.$set(a, '_checked', true)
+          uni.showToast({ title: '签到成功', icon: 'success' })
+          self.refreshCerts()
+        } else {
+          uni.showToast({ title: (res && res.message) || '签到失败', icon: 'none' })
+        }
+      }).catch(function () {
+        self.submitting = false
+      })
+    },
+    formatDateTime(dateStr) {
+      return formatDateTime(dateStr)
+    },
+    hoursText(v) {
+      var n = parseFloat(v)
+      if (isNaN(n)) return '0'
+      var r = Math.round(n * 10) / 10
+      return String(r)
+    }
+  }
+}
+</script>
+
+<style scoped lang="scss">
+.container {
+  min-height: 100vh;
+  background: $app-bg;
+  padding: 20rpx;
+  padding-bottom: 60rpx;
+}
+
+/* ===== 总览卡 ===== */
+.overview-card {
+  background: linear-gradient(135deg, $status-success 0%, $status-success-deep 100%);
+  border-radius: 20rpx;
+  padding: 32rpx;
+  margin-bottom: 20rpx;
+  box-shadow: 0 4rpx 16rpx rgba(16, 185, 129, 0.25);
+}
+
+.overview-title {
+  font-size: 36rpx;
+  font-weight: bold;
+  color: $app-surface;
+  margin-bottom: 8rpx;
+}
+
+.overview-desc {
+  font-size: 24rpx;
+  color: rgba(255, 255, 255, 0.85);
+  margin-bottom: 20rpx;
+}
+
+.overview-badge {
+  display: inline-block;
+  background: rgba(255, 255, 255, 0.22);
+  border: 1rpx solid rgba(255, 255, 255, 0.4);
+  border-radius: 20rpx;
+  padding: 6rpx 20rpx;
+}
+
+.overview-badge text {
+  font-size: 24rpx;
+  color: $app-surface;
+}
+
+.overview-badge.pending {
+  background: rgba(0, 0, 0, 0.12);
+}
+
+/* ===== 类别 Tab ===== */
+.tabs {
+  display: flex;
+  flex-direction: row;
+  gap: 12rpx;
+  overflow-x: auto;
+  -webkit-overflow-scrolling: touch;
+  padding: 2rpx 0 18rpx;
+}
+
+.tab {
+  flex-shrink: 0;
+  padding: 12rpx 28rpx;
+  border-radius: 24rpx;
+  background: $app-surface;
+  border: 1rpx solid $facade-gray-200;
+}
+
+.tab-active {
+  background: $status-success-soft;
+  border-color: $status-success;
+}
+
+.tab text {
+  font-size: 26rpx;
+  color: $facade-text-body;
+  white-space: nowrap;
+}
+
+.tab-active text {
+  color: $status-success-deep;
+  font-weight: 500;
+}
+
+/* ===== 认证状态卡 ===== */
+.cert-card {
+  background: $app-surface;
+  border-radius: 20rpx;
+  padding: 28rpx;
+  margin-bottom: 20rpx;
+  box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.05);
+}
+
+.cert-head {
+  display: flex;
+  flex-direction: row;
+  justify-content: space-between;
+  align-items: center;
+  margin-bottom: 24rpx;
+}
+
+.cert-name {
+  flex: 1;
+  display: flex;
+  flex-direction: row;
+  align-items: center;
+  gap: 10rpx;
+}
+
+.cert-name text {
+  font-size: 32rpx;
+  font-weight: bold;
+  color: $facade-text-strong;
+}
+
+.base-tag {
+  font-size: 20rpx !important;
+  color: $app-surface !important;
+  background: $status-info !important;
+  border-radius: 8rpx;
+  padding: 2rpx 10rpx;
+  font-weight: normal !important;
+}
+
+.cert-status {
+  font-size: 24rpx;
+  padding: 4rpx 16rpx;
+  border-radius: 16rpx;
+}
+
+.st-pending {
+  background: $status-warning-soft;
+  color: $status-warning-deep;
+}
+
+.st-done {
+  background: $status-success-soft;
+  color: $status-success-deep;
+}
+
+.st-fail {
+  background: $status-danger-soft;
+  color: $status-danger-deep;
+}
+
+/* ===== 课时进度 ===== */
+.progress-wrap {
+  margin-bottom: 24rpx;
+}
+
+.progress-label-row {
+  display: flex;
+  flex-direction: row;
+  justify-content: space-between;
+  align-items: center;
+  margin-bottom: 10rpx;
+}
+
+.progress-label {
+  font-size: 26rpx;
+  color: $facade-text-body;
+}
+
+.progress-value {
+  font-size: 26rpx;
+  font-weight: 500;
+  color: $status-success-deep;
+}
+
+.progress-bar {
+  height: 14rpx;
+  background: $facade-fill-gray-100;
+  border-radius: 8rpx;
+  overflow: hidden;
+}
+
+.progress-inner {
+  height: 100%;
+  background: linear-gradient(90deg, $status-success 0%, $status-success-deep 100%);
+  border-radius: 8rpx;
+}
+
+/* ===== 信息行 ===== */
+.info-list {
+  background: $facade-fill-gray-50;
+  border-radius: 14rpx;
+  padding: 8rpx 20rpx;
+  margin-bottom: 20rpx;
+}
+
+.info-row {
+  display: flex;
+  flex-direction: row;
+  justify-content: space-between;
+  align-items: center;
+  padding: 16rpx 0;
+  border-bottom: 1rpx solid $facade-fill;
+}
+
+.info-row:last-child {
+  border-bottom: none;
+}
+
+.info-label {
+  font-size: 26rpx;
+  color: $facade-text-muted;
+}
+
+.info-value {
+  font-size: 26rpx;
+  color: $facade-text-strong;
+}
+
+.cert-no {
+  font-size: 24rpx;
+  color: $status-info-deep;
+}
+
+/* ===== 提示块 ===== */
+.hint-block {
+  border-radius: 14rpx;
+  padding: 18rpx 20rpx;
+  margin-bottom: 22rpx;
+  border-left: 6rpx solid transparent;
+}
+
+.hint-warn {
+  background: $status-warning-tint;
+  border-left-color: $status-warning-2;
+}
+
+.hint-info {
+  background: $status-info-tint;
+  border-left-color: $status-info;
+}
+
+.hint-ok {
+  background: $status-success-tint;
+  border-left-color: $status-success;
+}
+
+.hint-fail {
+  background: $status-danger-tint-2;
+  border-left-color: $status-danger;
+}
+
+.hint-text {
+  font-size: 25rpx;
+  line-height: 1.6;
+  color: $facade-text-deep;
+}
+
+/* ===== 考核按钮 ===== */
+.exam-btn {
+  background: linear-gradient(135deg, $status-success 0%, $status-success-deep 100%);
+  border-radius: 44rpx;
+  padding: 22rpx 0;
+  text-align: center;
+  box-shadow: 0 4rpx 16rpx rgba(16, 185, 129, 0.3);
+}
+
+.exam-btn text {
+  color: $app-surface;
+  font-size: 30rpx;
+  font-weight: 500;
+}
+
+.exam-btn.disabled {
+  background: $facade-fill-gray-100;
+  box-shadow: none;
+}
+
+.exam-btn.disabled text {
+  color: $facade-text-ghost-light;
+}
+
+/* ===== 空状态 ===== */
+.empty-block {
+  background: $app-surface;
+  border-radius: 20rpx;
+  padding: 80rpx 40rpx;
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+}
+
+.empty-icon {
+  font-size: 96rpx;
+  margin-bottom: 20rpx;
+}
+
+.empty-title {
+  font-size: 30rpx;
+  font-weight: bold;
+  color: $facade-text-strong;
+  margin-bottom: 10rpx;
+}
+
+.empty-desc {
+  font-size: 24rpx;
+  color: $facade-text-muted;
+  text-align: center;
+  line-height: 1.6;
+}
+
+/* ===== 区块 ===== */
+.section {
+  background: $app-surface;
+  border-radius: 20rpx;
+  padding: 24rpx;
+  margin-bottom: 20rpx;
+}
+
+.section-title {
+  font-size: 30rpx;
+  font-weight: bold;
+  color: $facade-text-strong;
+  margin-bottom: 18rpx;
+}
+
+.empty-mini {
+  font-size: 24rpx;
+  color: $facade-text-muted;
+  text-align: center;
+  padding: 24rpx 0;
+}
+
+/* ===== 课程列表 ===== */
+.course-item {
+  padding: 20rpx 0;
+  border-bottom: 1rpx solid $facade-fill;
+}
+
+.course-item:last-child {
+  border-bottom: none;
+}
+
+.course-title-row {
+  display: flex;
+  flex-direction: row;
+  align-items: center;
+  gap: 10rpx;
+  margin-bottom: 6rpx;
+}
+
+.course-title {
+  font-size: 28rpx;
+  color: $facade-text-strong;
+  flex: 1;
+}
+
+.course-tag {
+  flex-shrink: 0;
+  font-size: 20rpx;
+  color: $status-info-deep;
+  background: $status-info-soft;
+  border-radius: 8rpx;
+  padding: 2rpx 10rpx;
+}
+
+.course-tag.optional {
+  color: $facade-text-muted;
+  background: $facade-fill-gray-100;
+}
+
+.course-meta {
+  font-size: 24rpx;
+  color: $facade-text-faint;
+}
+
+/* ===== 活动列表 ===== */
+.activity-item {
+  display: flex;
+  flex-direction: row;
+  align-items: center;
+  padding: 20rpx 0;
+  border-bottom: 1rpx solid $facade-fill;
+}
+
+.activity-item:last-child {
+  border-bottom: none;
+}
+
+.activity-main {
+  flex: 1;
+  margin-right: 20rpx;
+}
+
+.activity-title-row {
+  display: flex;
+  flex-direction: row;
+  align-items: center;
+  gap: 10rpx;
+  margin-bottom: 6rpx;
+}
+
+.activity-title {
+  font-size: 28rpx;
+  color: $facade-text-strong;
+  flex: 1;
+}
+
+.activity-meta {
+  font-size: 23rpx;
+  color: $facade-text-faint;
+  line-height: 1.5;
+}
+
+.activity-meta.hours {
+  color: $status-success-deep;
+}
+
+.checkin-btn {
+  flex-shrink: 0;
+  background: $status-success;
+  border-radius: 26rpx;
+  padding: 12rpx 30rpx;
+}
+
+.checkin-btn.checked {
+  background: $facade-fill-gray-100;
+}
+
+.checkin-btn text {
+  font-size: 24rpx;
+  color: $app-surface;
+}
+
+.checkin-btn.checked text {
+  color: $facade-text-muted;
+}
+
+/* ===== 加载 ===== */
+.loading-block {
+  padding: 40rpx;
+  text-align: center;
+}
+
+.loading-text {
+  font-size: 26rpx;
+  color: $facade-text-muted;
+}
+</style>

+ 20 - 0
cfc-frontend/pages/tasks/tasks.vue

@@ -16,6 +16,7 @@
         :show-self="true"
         self-label="本人"
         :self-active="!selectedMemberId"
+        :pending-counts="memberPendingCounts"
         @select="onMemberSelect" />
     </view>
 
@@ -279,6 +280,7 @@ export default {
       showInputModal: false,
       activeInputTask: null,
       inputContent: '',
+      memberPendingCounts: {},
       newTask: {
         title: '',
         description: '',
@@ -460,10 +462,28 @@ export default {
         this.createdTasks = all.filter(function(t) {
           return t.creatorId != null && String(t.creatorId) === String(uid)
         })
+        // 复用同一次 familyWide 响应计算各成员待完成角标(pending + in_progress),
+        // 不额外发起请求(遵守同一 URL 单次请求审计规则)
+        this.memberPendingCounts = this.countTasksByMember(all)
       } catch (e) {
         console.error('加载创建的任务失败', e)
       }
     },
+    // 按成员统计待完成数(pending + in_progress),key 为 familyMemberId
+    countTasksByMember(tasks) {
+      var counts = {}
+      var arr = tasks instanceof Array ? tasks : []
+      for (var i = 0; i < arr.length; i++) {
+        var task = arr[i]
+        if (!task || !task.familyMemberId) continue
+        var memberId = task.familyMemberId
+        if (!counts[memberId]) counts[memberId] = 0
+        if (task.status === 'pending' || task.status === 'in_progress') {
+          counts[memberId] += 1
+        }
+      }
+      return counts
+    },
     async completeTask(task) {
       if (task.memberOnly === 1 && !this.isMember) {
         uni.showModal({

+ 7 - 0
cfc-frontend/pages/teacher/teacher-profile.vue

@@ -29,6 +29,10 @@
         <text>📊 我的成长记录</text>
         <text class="arrow">›</text>
       </view>
+      <view class="menu-item" @click="goToTraining">
+        <text>🎓 培训认证中心</text>
+        <text class="arrow">›</text>
+      </view>
 <!-- 聊天功能已隐藏(临时): <view class="menu-item" @click="goToMessages">
 <text>💬 消息中心</text>
 <text class="arrow">›</text>
@@ -123,6 +127,9 @@ export default {
     goToGrowth() {
       uni.reLaunch({ url: '/pages/growth-main/index' })
     },
+    goToTraining() {
+      uni.navigateTo({ url: '/pages/guide/training/index' })
+    },
     goToMessages() {
       uni.navigateTo({ url: '/pages/teacher/messages' })
     },

+ 58 - 0
cfc-frontend/utils/api.js

@@ -3514,3 +3514,61 @@ export const getContentRelated = (data) => request('/api/content/related-items',
 
 // 商品浏览停留时长埋点上报(支撑运营看板「商品停留时长 Top」)
 export const reportProductDwell = (data) => request('/api/stats/product-view', 'POST', data || {})
+
+// ===================== 规划师培训认证中心(W3)=====================
+/**
+ * 我的全部类别认证状态(课时/学习状态/考核状态/证书号)
+ * POST /api/planner/certification/my
+ * @param {object} [options] 请求配置项(如 { _skipDedup: true } 绕开 3 秒去重缓存)
+ */
+export const getMyCertifications = (options) =>
+  request('/api/planner/certification/my', 'POST', {}, options || {})
+
+/**
+ * 某类别线上课程列表
+ * POST /api/planner/courses  body: { categoryId }
+ */
+export const getPlannerCourses = (categoryId) =>
+  request('/api/planner/courses', 'POST', { categoryId })
+
+/**
+ * 可报名/签到的线下培训活动列表(复用 activities + planner_offline_course_map)
+ * POST /api/planner/training-activities
+ */
+export const getPlannerTrainingActivities = () =>
+  request('/api/planner/training-activities', 'POST', {})
+
+/**
+ * 线下培训签到 → 桥接发放课时(幂等)
+ * POST /api/planner/training-activities/check-in  body: { activityId }
+ */
+export const checkInTrainingActivity = (activityId) =>
+  request('/api/planner/training-activities/check-in', 'POST', { activityId })
+
+/**
+ * 开始某类别考核(返回试卷题面;前置校验课时达标)
+ * POST /api/planner/exam/start  body: { categoryId }
+ */
+export const startPlannerExam = (categoryId) =>
+  request('/api/planner/exam/start', 'POST', { categoryId })
+
+/**
+ * 提交考核判分
+ * POST /api/planner/exam/submit
+ * 注意:后端 answers 是 JSON 字符串字段(服务端 ObjectMapper 解析),此处必须 stringify
+ * @param {number|string} attemptId 考核记录ID
+ * @param {object} answers 题目ID → 选项key 映射(如 { 12: 'A', 13: 'C' })
+ */
+export const submitPlannerExam = (attemptId, answers) =>
+  request('/api/planner/exam/submit', 'POST', {
+    attemptId,
+    answers: JSON.stringify(answers || {})
+  })
+
+/**
+ * 最近一次考核结果
+ * POST /api/planner/exam/result  body: { categoryId }
+ * 返回 PlannerExamAttempt:{ id, score, passed(0/1), ... }
+ */
+export const getPlannerExamResult = (categoryId) =>
+  request('/api/planner/exam/result', 'POST', { categoryId })

+ 230 - 0
cfc-web/src/api/plannerCertification.js

@@ -0,0 +1,230 @@
+import request from '@/utils/request'
+
+/**
+ * 规划师培训认证(管理端)
+ *
+ * 后端控制器(全部 @PostMapping):
+ *  - AdminPlannerCertCategoryController   /api/admin/planner-cert-categories
+ *  - AdminPlannerCourseController         /api/admin/planner-courses
+ *  - AdminPlannerOfflineCourseController  /api/admin/planner-offline-course-map
+ *  - AdminPlannerExamController           /api/admin/planner-exam
+ *  - AdminPlannerCertificationController  /api/admin/planner-certifications
+ *
+ * 参数位置注意(后端签名差异,勿混用):
+ *  - @RequestParam 的接口 → axios `params`
+ *  - @RequestBody 的接口 → axios `data`
+ */
+
+// ===== 学习种类 / 认证类别 =====
+
+// 学习种类列表(后端 BACKEND_ROLES)
+export function getCertCategoryList() {
+  return request({
+    url: '/api/admin/planner-cert-categories/list',
+    method: 'post'
+  })
+}
+
+// 新增学习种类(PLATFORM_ROLES)
+export function createCertCategory(data) {
+  return request({
+    url: '/api/admin/planner-cert-categories/create',
+    method: 'post',
+    data: data
+  })
+}
+
+// 更新学习种类(PLATFORM_ROLES)
+export function updateCertCategory(data) {
+  return request({
+    url: '/api/admin/planner-cert-categories/update',
+    method: 'post',
+    data: data
+  })
+}
+
+// 删除学习种类(@RequestBody {id})
+export function deleteCertCategory(id) {
+  return request({
+    url: '/api/admin/planner-cert-categories/delete',
+    method: 'post',
+    data: { id: id }
+  })
+}
+
+// ===== 线上课程目录 =====
+
+// 线上课程列表(categoryId 可选;不传返回全部启用课程)
+export function getPlannerCourseList(params) {
+  return request({
+    url: '/api/admin/planner-courses/list',
+    method: 'post',
+    params: params
+  })
+}
+
+// 新增线上课程
+export function createPlannerCourse(data) {
+  return request({
+    url: '/api/admin/planner-courses/create',
+    method: 'post',
+    data: data
+  })
+}
+
+// 更新线上课程
+export function updatePlannerCourse(data) {
+  return request({
+    url: '/api/admin/planner-courses/update',
+    method: 'post',
+    data: data
+  })
+}
+
+// 删除线上课程(@RequestParam id)
+export function deletePlannerCourse(id) {
+  return request({
+    url: '/api/admin/planner-courses/delete',
+    method: 'post',
+    params: { id: id }
+  })
+}
+
+// ===== 线下课程映射(培训活动 ↔ 认证类别)=====
+
+// 线下课程映射列表
+export function getOfflineCourseMapList() {
+  return request({
+    url: '/api/admin/planner-offline-course-map/list',
+    method: 'post'
+  })
+}
+
+// 新增线下课程映射
+export function createOfflineCourseMap(data) {
+  return request({
+    url: '/api/admin/planner-offline-course-map/create',
+    method: 'post',
+    data: data
+  })
+}
+
+// 更新线下课程映射
+export function updateOfflineCourseMap(data) {
+  return request({
+    url: '/api/admin/planner-offline-course-map/update',
+    method: 'post',
+    data: data
+  })
+}
+
+// 删除线下课程映射(@RequestParam id)
+export function deleteOfflineCourseMap(id) {
+  return request({
+    url: '/api/admin/planner-offline-course-map/delete',
+    method: 'post',
+    params: { id: id }
+  })
+}
+
+// ===== 考核试卷 / 题库 =====
+
+// 试卷列表(按类别)
+export function getPlannerExamPapers(categoryId) {
+  return request({
+    url: '/api/admin/planner-exam/papers',
+    method: 'post',
+    params: { categoryId: categoryId }
+  })
+}
+
+// 新增试卷
+export function createPlannerExamPaper(data) {
+  return request({
+    url: '/api/admin/planner-exam/paper/create',
+    method: 'post',
+    data: data
+  })
+}
+
+// 更新试卷
+export function updatePlannerExamPaper(data) {
+  return request({
+    url: '/api/admin/planner-exam/paper/update',
+    method: 'post',
+    data: data
+  })
+}
+
+// 删除试卷(@RequestParam id)
+export function deletePlannerExamPaper(id) {
+  return request({
+    url: '/api/admin/planner-exam/paper/delete',
+    method: 'post',
+    params: { id: id }
+  })
+}
+
+// 试卷题目列表
+export function getPlannerExamQuestions(paperId) {
+  return request({
+    url: '/api/admin/planner-exam/questions',
+    method: 'post',
+    params: { paperId: paperId }
+  })
+}
+
+// 保存题目(整体替换,后端会先删后插并回写 questionCount)
+export function savePlannerExamQuestions(data) {
+  return request({
+    url: '/api/admin/planner-exam/questions/save',
+    method: 'post',
+    data: data
+  })
+}
+
+// ===== 认证看板 =====
+
+// 认证看板分页列表(status / categoryId / page / size 均为 @RequestParam)
+export function getCertificationList(params) {
+  return request({
+    url: '/api/admin/planner-certifications/list',
+    method: 'post',
+    params: params
+  })
+}
+
+// 手动同步线上课时(单条):{userId, courseId, hours, progressPercent}
+export function syncCertificationHours(data) {
+  return request({
+    url: '/api/admin/planner-certifications/sync-hours',
+    method: 'post',
+    data: data
+  })
+}
+
+// 批量手动同步线上课时:{rows: [{userId, courseId, hours, progressPercent}]}
+export function batchSyncCertificationHours(rows) {
+  return request({
+    url: '/api/admin/planner-certifications/sync-hours/batch',
+    method: 'post',
+    data: { rows: rows }
+  })
+}
+
+// 初始化某规划师全部类别认证
+export function initCertificationByUser(userId) {
+  return request({
+    url: '/api/admin/planner-certifications/init-by-user',
+    method: 'post',
+    data: { userId: userId }
+  })
+}
+
+// 全量补登(存量兼容,PLATFORM_ROLES,无请求体)
+export function backfillCertifications() {
+  return request({
+    url: '/api/admin/planner-certifications/backfill',
+    method: 'post'
+  })
+}

+ 19 - 0
cfc-web/src/router/index.js

@@ -975,6 +975,25 @@ const routes = [
         name: 'OrgDashboard',
         component: () => import('@/views/admin/org/Dashboard.vue'),
         meta: { title: '组织大屏', perm: 'org:*' }
+      },
+      // ========== 规划师培训认证管理 ==========
+      {
+        path: 'planner-cert-board',
+        name: 'PlannerCertBoard',
+        component: () => import('@/views/admin/planner-cert/CertificationBoard.vue'),
+        meta: { title: '规划师认证看板', perm: 'planner:*' }
+      },
+      {
+        path: 'planner-cert-courses',
+        name: 'PlannerCourseManage',
+        component: () => import('@/views/admin/planner-cert/CourseManage.vue'),
+        meta: { title: '课程与类别管理', perm: 'planner:*' }
+      },
+      {
+        path: 'planner-cert-exam',
+        name: 'PlannerExamManage',
+        component: () => import('@/views/admin/planner-cert/ExamManage.vue'),
+        meta: { title: '考核题库管理', perm: 'planner:*' }
       }
     ]
   }

+ 1 - 1
cfc-web/src/utils/permissions.js

@@ -10,7 +10,7 @@ const ROLE_PERMISSIONS = {
   // 超管:全部权限
   admin: ['*'],
   // 运营:审核全量、活动全量、任务全量、家庭/商城/知识/测评只读、组织管理
-  operator: ['dashboard', 'audit:*', 'activity:*', 'task:*', 'assessment:read', 'family:read', 'commerce:read', 'articles:read', 'knowledge:read', 'plan:*', 'org:*'],
+  operator: ['dashboard', 'audit:*', 'activity:*', 'task:*', 'assessment:read', 'family:read', 'commerce:read', 'articles:read', 'knowledge:read', 'plan:*', 'org:*', 'planner:*'],
   // 财务:财务/退款/提现、订单只读、CF值、商城营销、业务管理、组织管理
   finance: ['dashboard', 'finance:*', 'audit:withdraw', 'audit:refund', 'commerce:read', 'commerce:orders:read', 'biz:*', 'cf-value:*', 'org:*'],
   // 管家:家庭客服 + 规划师 + 营养师权限并集(getEffectivePermissions 中自动并入 teacher/nutritionist)

+ 7 - 0
cfc-web/src/views/Layout.vue

@@ -363,6 +363,13 @@ export default {
               ]},
             // --- 组织管理(平台运营创建组织;org_admin 由路由守卫分流到自身组织大屏) ---
             { path: '/org', label: '组织管理', icon: 'el-icon-office-building', perm: 'system:org' },
+            // --- 规划师培训认证(管理端:看板/课程类别/考核题库) ---
+            { title: '规划师认证', icon: 'el-icon-medal', perm: 'planner:*',
+              children: [
+                { path: '/planner-cert-board', label: '认证看板', icon: 'el-icon-data-line', perm: 'planner:*' },
+                { path: '/planner-cert-courses', label: '课程与类别', icon: 'el-icon-notebook-2', perm: 'planner:*' },
+                { path: '/planner-cert-exam', label: '考核题库', icon: 'el-icon-edit-outline', perm: 'planner:*' },
+              ]},
           ]},
       ],
       // 需要保持列表状态的页面组件 name(进入编辑/详情返回时保留筛选、页码、勾选)。

+ 527 - 0
cfc-web/src/views/admin/planner-cert/CertificationBoard.vue

@@ -0,0 +1,527 @@
+<template>
+  <div class="planner-cert-board admin-page">
+    <PageHeader title="规划师认证看板" subtitle="按学习种类查看课时进度、考核状态与证书信息,可手动补录线上课时(小鹅通同步失败的兜底通道)">
+      <div class="filters">
+        <el-select v-model="categoryIdFilter" placeholder="认证类别" clearable class="filter-select-160" @change="handleSearch">
+          <el-option v-for="c in categories" :key="c.id" :label="c.name" :value="c.id" />
+        </el-select>
+        <el-select v-model="statusFilter" placeholder="认证状态" clearable class="filter-select-140" @change="handleSearch">
+          <el-option label="待认证" value="pending_cert" />
+          <el-option label="已学完待考" value="learning_completed" />
+          <el-option label="已认证" value="certified" />
+          <el-option label="已停用" value="suspended" />
+        </el-select>
+        <el-button size="mini" icon="el-icon-refresh" @click="handleSearch">刷新</el-button>
+        <el-button size="mini" type="warning" icon="el-icon-s-operation" @click="openBatchSync">批量同步课时</el-button>
+        <el-button size="mini" type="warning" icon="el-icon-user" @click="openInitDialog">初始化认证</el-button>
+        <el-button size="mini" type="danger" plain icon="el-icon-refresh-left" @click="handleBackfill">全量补登</el-button>
+      </div>
+    </PageHeader>
+
+    <div class="adm-table-wrap">
+      <el-table :data="records" v-loading="loading" border stripe height="100%">
+        <el-table-column prop="id" label="ID" width="70" />
+        <el-table-column prop="userId" label="用户ID" width="90" />
+        <el-table-column label="认证类别" width="150">
+          <template slot-scope="{ row }">
+            {{ categoryName(row.categoryId) }}
+            <el-tag v-if="isBaseCategory(row.categoryId)" size="mini" type="primary" class="ml-4">基础</el-tag>
+          </template>
+        </el-table-column>
+        <el-table-column label="认证状态" width="110">
+          <template slot-scope="{ row }">
+            <el-tag size="mini" :type="certStatusTag(row.status)">{{ certStatusLabel(row.status) }}</el-tag>
+          </template>
+        </el-table-column>
+        <el-table-column label="学习进度" width="110">
+          <template slot-scope="{ row }">
+            <el-tag size="mini" :type="learningStatusTag(row.learningStatus)" effect="plain">{{ learningStatusLabel(row.learningStatus) }}</el-tag>
+          </template>
+        </el-table-column>
+        <el-table-column label="课时" width="170">
+          <template slot-scope="{ row }">
+            <el-progress
+              :percentage="hoursPercent(row)"
+              :stroke-width="12"
+              :format="progressText(row)"
+              :status="hoursPercent(row) >= 100 ? 'success' : undefined"
+            />
+          </template>
+        </el-table-column>
+        <el-table-column label="考核" width="150">
+          <template slot-scope="{ row }">
+            <el-tag size="mini" :type="examStatusTag(row.examStatus)">{{ examStatusLabel(row.examStatus) }}</el-tag>
+            <div class="exam-meta" v-if="row.examAttempts > 0">
+              {{ row.examAttempts }}次 / {{ row.examScore }}分
+            </div>
+          </template>
+        </el-table-column>
+        <el-table-column prop="certNo" label="证书编号" width="200" show-overflow-tooltip>
+          <template slot-scope="{ row }">
+            <span v-if="row.certNo">{{ row.certNo }}</span>
+            <span v-else class="text-muted">—</span>
+          </template>
+        </el-table-column>
+        <el-table-column label="认证时间" width="160">
+          <template slot-scope="{ row }">{{ fmtTime(row.certifiedAt) }}</template>
+        </el-table-column>
+        <el-table-column label="过期时间" width="120">
+          <template slot-scope="{ row }">{{ fmtDate(row.expireAt) }}</template>
+        </el-table-column>
+        <el-table-column label="更新时间" width="160">
+          <template slot-scope="{ row }">{{ fmtTime(row.updatedAt) }}</template>
+        </el-table-column>
+        <el-table-column label="操作" width="150" fixed="right">
+          <template slot-scope="{ row }">
+            <el-button size="mini" type="primary" @click="openSyncDialog(row)">同步课时</el-button>
+            <el-button size="mini" @click="initUser(row.userId)">初始化</el-button>
+          </template>
+        </el-table-column>
+      </el-table>
+    </div>
+
+    <div class="pagination-wrap">
+      <el-pagination
+        background
+        layout="total, sizes, prev, pager, next, jumper"
+        :total="total"
+        :current-page="page"
+        :page-size="size"
+        :page-sizes="[10, 20, 50, 100]"
+        @current-change="handlePageChange"
+        @size-change="handleSizeChange"
+      />
+    </div>
+
+    <!-- 单条同步课时 -->
+    <el-dialog title="手动同步线上课时" :visible.sync="syncDialogVisible" width="520px" :close-on-click-modal="false">
+      <el-form :model="syncForm" label-width="110px" size="small">
+        <el-form-item label="规划师ID" required>
+          <el-input v-model="syncForm.userId" placeholder="users.id" />
+        </el-form-item>
+        <el-form-item label="线上课程" required>
+          <el-select v-model="syncForm.courseId" filterable placeholder="选择小鹅通课程" class="form-full" :loading="coursesLoading">
+            <el-option
+              v-for="c in courses"
+              :key="c.id"
+              :label="courseLabel(c)"
+              :value="c.id"
+            />
+          </el-select>
+        </el-form-item>
+        <el-row :gutter="20">
+          <el-col :span="12">
+            <el-form-item label="完成课时" required>
+              <el-input-number v-model="syncForm.hours" :min="0" :step="0.5" :precision="1" class="form-full" />
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="进度(%)">
+              <el-input-number v-model="syncForm.progressPercent" :min="0" :max="100" class="form-full" />
+            </el-form-item>
+          </el-col>
+        </el-row>
+      </el-form>
+      <div class="dialog-tip">进度达到 100% 后,后端会将该课程课时计入所属认证类别,并重算可考核状态。</div>
+      <span slot="footer">
+        <el-button @click="syncDialogVisible = false">取消</el-button>
+        <el-button type="primary" :loading="syncing" @click="handleSync">确认同步</el-button>
+      </span>
+    </el-dialog>
+
+    <!-- 批量同步课时 -->
+    <el-dialog title="批量同步线上课时" :visible.sync="batchDialogVisible" width="760px" :close-on-click-modal="false" top="8vh">
+      <div class="batch-toolbar">
+        <el-button size="mini" type="primary" icon="el-icon-plus" @click="addBatchRow">添加一行</el-button>
+        <el-button size="mini" icon="el-icon-delete" @click="clearBatchRows">清空</el-button>
+        <span class="batch-count">共 {{ batchRows.length }} 条</span>
+      </div>
+      <el-table :data="batchRows" border size="mini" max-height="360">
+        <el-table-column label="规划师ID" width="150">
+          <template slot-scope="{ row }">
+            <el-input v-model="row.userId" placeholder="users.id" size="mini" />
+          </template>
+        </el-table-column>
+        <el-table-column label="线上课程" min-width="260">
+          <template slot-scope="{ row }">
+            <el-select v-model="row.courseId" filterable placeholder="选择课程" size="mini" class="form-full" :loading="coursesLoading">
+              <el-option v-for="c in courses" :key="c.id" :label="courseLabel(c)" :value="c.id" />
+            </el-select>
+          </template>
+        </el-table-column>
+        <el-table-column label="完成课时" width="150">
+          <template slot-scope="{ row }">
+            <el-input-number v-model="row.hours" :min="0" :step="0.5" :precision="1" size="mini" class="form-full" />
+          </template>
+        </el-table-column>
+        <el-table-column label="进度(%)" width="140">
+          <template slot-scope="{ row }">
+            <el-input-number v-model="row.progressPercent" :min="0" :max="100" size="mini" class="form-full" />
+          </template>
+        </el-table-column>
+        <el-table-column label="操作" width="80">
+          <template slot-scope="{ $index }">
+            <el-button size="mini" type="danger" plain icon="el-icon-close" @click="removeBatchRow($index)" />
+          </template>
+        </el-table-column>
+      </el-table>
+      <span slot="footer">
+        <el-button @click="batchDialogVisible = false">取消</el-button>
+        <el-button type="primary" :loading="batchSaving" @click="handleBatchSync">批量提交</el-button>
+      </span>
+    </el-dialog>
+
+    <!-- 初始化认证 -->
+    <el-dialog title="初始化规划师认证" :visible.sync="initDialogVisible" width="460px">
+      <el-form :model="initForm" label-width="110px" size="small">
+        <el-form-item label="规划师ID" required>
+          <el-input v-model="initForm.userId" placeholder="users.id" />
+        </el-form-item>
+      </el-form>
+      <div class="dialog-tip">为指定规划师按全部启用认证类别创建认证记录(已存在的记录会跳过)。</div>
+      <span slot="footer">
+        <el-button @click="initDialogVisible = false">取消</el-button>
+        <el-button type="primary" :loading="initLoading" @click="handleInit">确认初始化</el-button>
+      </span>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import PageHeader from '@/components/PageHeader.vue'
+import {
+  getCertificationList,
+  getCertCategoryList,
+  getPlannerCourseList,
+  syncCertificationHours,
+  batchSyncCertificationHours,
+  initCertificationByUser,
+  backfillCertifications
+} from '@/api/plannerCertification'
+
+const CERT_STATUS_MAP = {
+  pending_cert: { label: '待认证', type: 'info' },
+  learning_completed: { label: '已学完待考', type: 'warning' },
+  certified: { label: '已认证', type: 'success' },
+  suspended: { label: '已停用', type: 'danger' }
+}
+
+const LEARNING_STATUS_MAP = {
+  pending_learning: { label: '学习中', type: 'info' },
+  learning_completed: { label: '已学完', type: 'success' }
+}
+
+const EXAM_STATUS_MAP = {
+  none: { label: '未考核', type: 'info' },
+  exam_failed: { label: '未通过', type: 'danger' },
+  exam_passed: { label: '已通过', type: 'success' }
+}
+
+export default {
+  name: 'PlannerCertBoard',
+  components: { PageHeader },
+  data() {
+    return {
+      categoryIdFilter: null,
+      statusFilter: '',
+      records: [],
+      total: 0,
+      page: 1,
+      size: 10,
+      loading: false,
+      categories: [],
+      courses: [],
+      coursesLoading: false,
+      syncDialogVisible: false,
+      syncing: false,
+      syncForm: { userId: '', courseId: null, hours: 1, progressPercent: 100 },
+      batchDialogVisible: false,
+      batchSaving: false,
+      batchRows: [],
+      initDialogVisible: false,
+      initLoading: false,
+      initForm: { userId: '' }
+    }
+  },
+  mounted() {
+    this.loadCategories()
+    this.loadList()
+  },
+  methods: {
+    fmtTime(t) {
+      return t ? String(t).replace('T', ' ').substring(0, 19) : '-'
+    },
+    fmtDate(t) {
+      return t ? String(t).substring(0, 10) : '—'
+    },
+    async loadCategories() {
+      try {
+        const res = await getCertCategoryList()
+        if (res.code === 200) {
+          this.categories = res.data || []
+        }
+      } catch (e) {
+        this.categories = []
+      }
+    },
+    async loadCourses() {
+      if (this.courses.length > 0) return
+      this.coursesLoading = true
+      try {
+        const res = await getPlannerCourseList()
+        if (res.code === 200) {
+          this.courses = res.data || []
+        }
+      } catch (e) {
+        this.courses = []
+      } finally {
+        this.coursesLoading = false
+      }
+    },
+    courseLabel(course) {
+      const name = this.categoryName(course.categoryId)
+      return (course.title || ('课程 #' + course.id)) + (name ? '(' + name + ')' : '')
+    },
+    categoryName(categoryId) {
+      const cat = this.categories.find(function (c) { return c.id === categoryId })
+      return cat ? cat.name : ('类别 #' + categoryId)
+    },
+    isBaseCategory(categoryId) {
+      const cat = this.categories.find(function (c) { return c.id === categoryId })
+      return cat && cat.isBase === 1
+    },
+    certStatusLabel(status) {
+      return (CERT_STATUS_MAP[status] || {}).label || status || '未知'
+    },
+    certStatusTag(status) {
+      return (CERT_STATUS_MAP[status] || {}).type || 'info'
+    },
+    learningStatusLabel(status) {
+      return (LEARNING_STATUS_MAP[status] || {}).label || status || '未知'
+    },
+    learningStatusTag(status) {
+      return (LEARNING_STATUS_MAP[status] || {}).type || 'info'
+    },
+    examStatusLabel(status) {
+      return (EXAM_STATUS_MAP[status] || {}).label || status || '未考核'
+    },
+    examStatusTag(status) {
+      return (EXAM_STATUS_MAP[status] || {}).type || 'info'
+    },
+    hoursPercent(row) {
+      const required = Number(row.requiredHours) || 0
+      if (!required) return 0
+      const completed = Number(row.completedHours) || 0
+      return Math.min(100, Math.round(completed / required * 100))
+    },
+    progressText(row) {
+      return (Number(row.completedHours) || 0) + ' / ' + (Number(row.requiredHours) || 0) + ' 课时'
+    },
+    async loadList() {
+      this.loading = true
+      try {
+        const params = { page: this.page, size: this.size }
+        if (this.statusFilter) params.status = this.statusFilter
+        if (this.categoryIdFilter) params.categoryId = this.categoryIdFilter
+        const res = await getCertificationList(params)
+        if (res.code === 200 && res.data) {
+          this.records = res.data.records || []
+          this.total = res.data.total || 0
+        }
+      } finally {
+        this.loading = false
+      }
+    },
+    handleSearch() {
+      this.page = 1
+      this.loadList()
+    },
+    handlePageChange(page) {
+      this.page = page
+      this.loadList()
+    },
+    handleSizeChange(size) {
+      this.size = size
+      this.page = 1
+      this.loadList()
+    },
+    async openSyncDialog(row) {
+      await this.loadCourses()
+      this.syncForm = { userId: String(row.userId), courseId: null, hours: 1, progressPercent: 100 }
+      this.syncDialogVisible = true
+    },
+    async handleSync() {
+      if (!this.syncForm.userId) {
+        this.$message.warning('请填写规划师ID')
+        return
+      }
+      if (!this.syncForm.courseId) {
+        this.$message.warning('请选择线上课程')
+        return
+      }
+      this.syncing = true
+      try {
+        const res = await syncCertificationHours({
+          userId: Number(this.syncForm.userId),
+          courseId: Number(this.syncForm.courseId),
+          hours: Number(this.syncForm.hours),
+          progressPercent: Number(this.syncForm.progressPercent) || 100
+        })
+        if (res.code === 200) {
+          this.$message.success('课时已同步,正在重算认证状态')
+          this.syncDialogVisible = false
+          this.loadList()
+        }
+      } finally {
+        this.syncing = false
+      }
+    },
+    async openBatchSync() {
+      await this.loadCourses()
+      if (this.batchRows.length === 0) {
+        this.batchRows = [this.emptyBatchRow()]
+      }
+      this.batchDialogVisible = true
+    },
+    emptyBatchRow() {
+      return { userId: '', courseId: null, hours: 1, progressPercent: 100 }
+    },
+    addBatchRow() {
+      this.batchRows.push(this.emptyBatchRow())
+    },
+    removeBatchRow(index) {
+      this.batchRows.splice(index, 1)
+    },
+    clearBatchRows() {
+      this.batchRows = []
+    },
+    async handleBatchSync() {
+      const rows = this.batchRows.filter(function (r) {
+        return r.userId !== '' && r.courseId !== null
+      })
+      if (rows.length === 0) {
+        this.$message.warning('请至少填写一行完整的规划师ID与课程')
+        return
+      }
+      this.batchSaving = true
+      try {
+        const res = await batchSyncCertificationHours(rows.map(function (r) {
+          return {
+            userId: Number(r.userId),
+            courseId: Number(r.courseId),
+            hours: Number(r.hours),
+            progressPercent: Number(r.progressPercent) || 100
+          }
+        }))
+        if (res.code === 200) {
+          this.$message.success('已处理 ' + res.data + ' 条课时记录')
+          this.batchDialogVisible = false
+          this.loadList()
+        }
+      } finally {
+        this.batchSaving = false
+      }
+    },
+    openInitDialog() {
+      this.initForm = { userId: '' }
+      this.initDialogVisible = true
+    },
+    initUser(userId) {
+      this.initForm = { userId: String(userId) }
+      this.initDialogVisible = true
+    },
+    async handleInit() {
+      if (!this.initForm.userId) {
+        this.$message.warning('请填写规划师ID')
+        return
+      }
+      this.initLoading = true
+      try {
+        const res = await initCertificationByUser(Number(this.initForm.userId))
+        if (res.code === 200) {
+          this.$message.success('认证记录初始化完成')
+          this.initDialogVisible = false
+          this.handleSearch()
+        }
+      } finally {
+        this.initLoading = false
+      }
+    },
+    async handleBackfill() {
+      const confirmed = await this.$confirm(
+        '全量补登会为所有规划师按启用类别创建/补齐认证记录,可能影响存量数据,确认执行?',
+        '全量补登',
+        { confirmButtonText: '确认补登', cancelButtonText: '取消', type: 'warning' }
+      ).catch(function () { return false })
+      if (!confirmed) return
+      const res = await backfillCertifications()
+      if (res.code === 200) {
+        this.$message.success(res.data || '已执行存量补登')
+        this.handleSearch()
+      }
+    }
+  }
+}
+</script>
+
+<style scoped>
+.planner-cert-board {
+  display: flex;
+  flex-direction: column;
+  height: 100%;
+}
+
+.filters {
+  display: flex;
+  align-items: center;
+  gap: 8px;
+  flex-wrap: wrap;
+}
+
+.adm-table-wrap {
+  flex: 1;
+  min-height: 0;
+  margin-top: 4px;
+}
+
+.pagination-wrap {
+  display: flex;
+  justify-content: flex-end;
+  margin-top: 12px;
+}
+
+.exam-meta {
+  margin-top: 4px;
+  font-size: 12px;
+  color: var(--adm-text-45);
+}
+
+.ml-4 {
+  margin-left: 4px;
+}
+
+.form-full {
+  width: 100%;
+}
+
+.dialog-tip {
+  font-size: 12px;
+  color: var(--adm-text-45);
+  line-height: 18px;
+  padding: 8px 12px;
+  background: #f7f8fa;
+  border-radius: 4px;
+}
+
+.batch-toolbar {
+  display: flex;
+  align-items: center;
+  gap: 12px;
+  margin-bottom: 12px;
+}
+
+.batch-count {
+  font-size: 12px;
+  color: var(--adm-text-45);
+}
+</style>

+ 519 - 0
cfc-web/src/views/admin/planner-cert/CourseManage.vue

@@ -0,0 +1,519 @@
+<template>
+  <div class="planner-course-manage admin-page">
+    <PageHeader title="课程与类别管理" subtitle="维护学习种类(认证类别)、线上课程目录与线下培训活动映射">
+      <div class="filters">
+        <el-radio-group v-model="activeTab" size="small" @change="handleTabChange">
+          <el-radio-button label="categories">学习种类</el-radio-button>
+          <el-radio-button label="courses">线上课程</el-radio-button>
+          <el-radio-button label="offline">线下课程映射</el-radio-button>
+        </el-radio-group>
+        <el-select v-if="activeTab === 'courses'" v-model="courseCategoryFilter" placeholder="按类别筛选" clearable class="filter-select-160" @change="loadCourses">
+          <el-option v-for="c in categories" :key="c.id" :label="c.name" :value="c.id" />
+        </el-select>
+        <el-button v-if="activeTab === 'categories'" size="mini" type="primary" icon="el-icon-plus" @click="openCategoryDialog()">新增学习种类</el-button>
+        <el-button v-if="activeTab === 'courses'" size="mini" type="primary" icon="el-icon-plus" @click="openCourseDialog()">新增线上课程</el-button>
+        <el-button v-if="activeTab === 'offline'" size="mini" type="primary" icon="el-icon-plus" @click="openOfflineDialog()">新增线下映射</el-button>
+      </div>
+    </PageHeader>
+
+    <div class="adm-table-wrap" v-show="activeTab === 'categories'">
+      <el-table :data="categories" v-loading="categoriesLoading" border stripe height="100%">
+        <el-table-column prop="id" label="ID" width="70" />
+        <el-table-column prop="code" label="编码" width="140" />
+        <el-table-column prop="name" label="名称" width="160" />
+        <el-table-column prop="description" label="描述" min-width="200" show-overflow-tooltip />
+        <el-table-column label="要求课时" width="100">
+          <template slot-scope="{ row }">{{ row.requiredHours }} 课时</template>
+        </el-table-column>
+        <el-table-column label="基础类别" width="90">
+          <template slot-scope="{ row }">
+            <el-tag size="mini" :type="row.isBase === 1 ? 'primary' : 'info'">{{ row.isBase === 1 ? '是' : '否' }}</el-tag>
+          </template>
+        </el-table-column>
+        <el-table-column prop="orderIndex" label="排序" width="70" />
+        <el-table-column label="状态" width="80">
+          <template slot-scope="{ row }">
+            <el-tag size="mini" :type="row.status === 1 ? 'success' : 'danger'">{{ row.status === 1 ? '启用' : '停用' }}</el-tag>
+          </template>
+        </el-table-column>
+        <el-table-column label="操作" width="140" fixed="right">
+          <template slot-scope="{ row }">
+            <el-button size="mini" type="primary" @click="openCategoryDialog(row)">编辑</el-button>
+            <el-button size="mini" type="danger" plain @click="deleteCategory(row)">删除</el-button>
+          </template>
+        </el-table-column>
+      </el-table>
+    </div>
+
+    <div class="adm-table-wrap" v-show="activeTab === 'courses'">
+      <el-table :data="courses" v-loading="coursesLoading" border stripe height="100%">
+        <el-table-column prop="id" label="ID" width="70" />
+        <el-table-column label="所属类别" width="150">
+          <template slot-scope="{ row }">{{ categoryName(row.categoryId) }}</template>
+        </el-table-column>
+        <el-table-column prop="title" label="课程标题" min-width="220" show-overflow-tooltip />
+        <el-table-column prop="xiaoeResourceId" label="小鹅通资源ID" width="180" show-overflow-tooltip />
+        <el-table-column label="要求课时" width="100">
+          <template slot-scope="{ row }">{{ row.requiredHours }} 课时</template>
+        </el-table-column>
+        <el-table-column label="必修" width="70">
+          <template slot-scope="{ row }">
+            <el-tag size="mini" :type="row.isRequired === 1 ? 'warning' : 'info'">{{ row.isRequired === 1 ? '必修' : '选修' }}</el-tag>
+          </template>
+        </el-table-column>
+        <el-table-column prop="orderIndex" label="排序" width="70" />
+        <el-table-column label="状态" width="80">
+          <template slot-scope="{ row }">
+            <el-tag size="mini" :type="row.status === 1 ? 'success' : 'danger'">{{ row.status === 1 ? '启用' : '停用' }}</el-tag>
+          </template>
+        </el-table-column>
+        <el-table-column label="操作" width="140" fixed="right">
+          <template slot-scope="{ row }">
+            <el-button size="mini" type="primary" @click="openCourseDialog(row)">编辑</el-button>
+            <el-button size="mini" type="danger" plain @click="deleteCourse(row)">删除</el-button>
+          </template>
+        </el-table-column>
+      </el-table>
+    </div>
+
+    <div class="adm-table-wrap" v-show="activeTab === 'offline'">
+      <el-table :data="offlineMaps" v-loading="offlineLoading" border stripe height="100%">
+        <el-table-column prop="id" label="ID" width="70" />
+        <el-table-column prop="activityId" label="活动ID" width="90" />
+        <el-table-column label="培训活动" min-width="220" show-overflow-tooltip>
+          <template slot-scope="{ row }">{{ activityTitle(row.activityId) }}</template>
+        </el-table-column>
+        <el-table-column label="所属类别" width="150">
+          <template slot-scope="{ row }">{{ categoryName(row.categoryId) }}</template>
+        </el-table-column>
+        <el-table-column label="计入学时" width="100">
+          <template slot-scope="{ row }">{{ row.durationHours }} 课时</template>
+        </el-table-column>
+        <el-table-column label="必修" width="70">
+          <template slot-scope="{ row }">
+            <el-tag size="mini" :type="row.isRequired === 1 ? 'warning' : 'info'">{{ row.isRequired === 1 ? '必修' : '选修' }}</el-tag>
+          </template>
+        </el-table-column>
+        <el-table-column label="状态" width="80">
+          <template slot-scope="{ row }">
+            <el-tag size="mini" :type="row.status === 1 ? 'success' : 'danger'">{{ row.status === 1 ? '启用' : '停用' }}</el-tag>
+          </template>
+        </el-table-column>
+        <el-table-column label="操作" width="140" fixed="right">
+          <template slot-scope="{ row }">
+            <el-button size="mini" type="primary" @click="openOfflineDialog(row)">编辑</el-button>
+            <el-button size="mini" type="danger" plain @click="deleteOfflineMap(row)">删除</el-button>
+          </template>
+        </el-table-column>
+      </el-table>
+    </div>
+
+    <!-- 学习种类编辑 -->
+    <el-dialog :title="categoryForm.id ? '编辑学习种类' : '新增学习种类'" :visible.sync="categoryDialogVisible" width="560px" :close-on-click-modal="false">
+      <el-form :model="categoryForm" label-width="110px" size="small">
+        <el-row :gutter="20">
+          <el-col :span="12">
+            <el-form-item label="编码" required>
+              <el-input v-model="categoryForm.code" placeholder="planner / nutritionist / assessor" />
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="名称" required>
+              <el-input v-model="categoryForm.name" placeholder="如:成长规划师" />
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-form-item label="描述">
+          <el-input v-model="categoryForm.description" type="textarea" :rows="2" placeholder="该类别对应的服务能力说明" />
+        </el-form-item>
+        <el-row :gutter="20">
+          <el-col :span="8">
+            <el-form-item label="要求课时" required>
+              <el-input-number v-model="categoryForm.requiredHours" :min="0" :step="0.5" :precision="1" class="form-full" />
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="排序">
+              <el-input-number v-model="categoryForm.orderIndex" :min="0" class="form-full" />
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="状态">
+              <el-switch v-model="categoryForm.status" :active-value="1" :inactive-value="0" active-text="启用" inactive-text="停用" />
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-form-item label="基础类别">
+          <el-switch v-model="categoryForm.isBase" :active-value="1" :inactive-value="0" />
+          <span class="form-tip">基础类别认证通过后,规划师 Guide.status 自动置为 active(可接单)</span>
+        </el-form-item>
+      </el-form>
+      <span slot="footer">
+        <el-button @click="categoryDialogVisible = false">取消</el-button>
+        <el-button type="primary" :loading="categorySaving" @click="saveCategory">保存</el-button>
+      </span>
+    </el-dialog>
+
+    <!-- 线上课程编辑 -->
+    <el-dialog :title="courseForm.id ? '编辑线上课程' : '新增线上课程'" :visible.sync="courseDialogVisible" width="560px" :close-on-click-modal="false">
+      <el-form :model="courseForm" label-width="120px" size="small">
+        <el-form-item label="所属类别" required>
+          <el-select v-model="courseForm.categoryId" class="form-full" placeholder="选择学习种类">
+            <el-option v-for="c in categories" :key="c.id" :label="c.name" :value="c.id" />
+          </el-select>
+        </el-form-item>
+        <el-form-item label="课程标题" required>
+          <el-input v-model="courseForm.title" placeholder="小鹅通课程/专栏名称" />
+        </el-form-item>
+        <el-form-item label="小鹅通资源ID">
+          <el-input v-model="courseForm.xiaoeResourceId" placeholder="课程/专栏/商品ID" />
+        </el-form-item>
+        <el-row :gutter="20">
+          <el-col :span="8">
+            <el-form-item label="要求课时" required>
+              <el-input-number v-model="courseForm.requiredHours" :min="0" :step="0.5" :precision="1" class="form-full" />
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="排序">
+              <el-input-number v-model="courseForm.orderIndex" :min="0" class="form-full" />
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="状态">
+              <el-switch v-model="courseForm.status" :active-value="1" :inactive-value="0" active-text="启用" inactive-text="停用" />
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-form-item label="是否必修">
+          <el-switch v-model="courseForm.isRequired" :active-value="1" :inactive-value="0" />
+          <span class="form-tip">必修课程进度未达标时,该类别不可进入考核</span>
+        </el-form-item>
+      </el-form>
+      <span slot="footer">
+        <el-button @click="courseDialogVisible = false">取消</el-button>
+        <el-button type="primary" :loading="courseSaving" @click="saveCourse">保存</el-button>
+      </span>
+    </el-dialog>
+
+    <!-- 线下课程映射编辑 -->
+    <el-dialog :title="offlineForm.id ? '编辑线下课程映射' : '新增线下课程映射'" :visible.sync="offlineDialogVisible" width="560px" :close-on-click-modal="false">
+      <el-form :model="offlineForm" label-width="120px" size="small">
+        <el-form-item label="培训活动" required>
+          <el-select v-model="offlineForm.activityId" filterable class="form-full" placeholder="选择已建好的线下培训活动" :loading="activitiesLoading">
+            <el-option v-for="a in activities" :key="a.id" :label="activityOptionLabel(a)" :value="a.id" />
+          </el-select>
+        </el-form-item>
+        <el-form-item label="所属类别" required>
+          <el-select v-model="offlineForm.categoryId" class="form-full" placeholder="选择学习种类">
+            <el-option v-for="c in categories" :key="c.id" :label="c.name" :value="c.id" />
+          </el-select>
+        </el-form-item>
+        <el-row :gutter="20">
+          <el-col :span="8">
+            <el-form-item label="计入学时" required>
+              <el-input-number v-model="offlineForm.durationHours" :min="0" :step="0.5" :precision="1" class="form-full" />
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="必修">
+              <el-switch v-model="offlineForm.isRequired" :active-value="1" :inactive-value="0" />
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="状态">
+              <el-switch v-model="offlineForm.status" :active-value="1" :inactive-value="0" active-text="启用" inactive-text="停用" />
+            </el-form-item>
+          </el-col>
+        </el-row>
+      </el-form>
+      <div class="dialog-tip">规划师在该活动扫码签到时,自动为该类别累计 durationHours 课时(签到幂等)。</div>
+      <span slot="footer">
+        <el-button @click="offlineDialogVisible = false">取消</el-button>
+        <el-button type="primary" :loading="offlineSaving" @click="saveOfflineMap">保存</el-button>
+      </span>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import PageHeader from '@/components/PageHeader.vue'
+import { getActivityList } from '@/api/activity'
+import {
+  getCertCategoryList,
+  createCertCategory,
+  updateCertCategory,
+  deleteCertCategory,
+  getPlannerCourseList,
+  createPlannerCourse,
+  updatePlannerCourse,
+  deletePlannerCourse,
+  getOfflineCourseMapList,
+  createOfflineCourseMap,
+  updateOfflineCourseMap,
+  deleteOfflineCourseMap
+} from '@/api/plannerCertification'
+
+export default {
+  name: 'PlannerCourseManage',
+  components: { PageHeader },
+  data() {
+    return {
+      activeTab: 'categories',
+      categories: [],
+      categoriesLoading: false,
+      courses: [],
+      coursesLoading: false,
+      offlineMaps: [],
+      offlineLoading: false,
+      courseCategoryFilter: null,
+      activities: [],
+      activitiesLoading: false,
+      // 学习种类
+      categoryDialogVisible: false,
+      categorySaving: false,
+      categoryForm: {},
+      // 线上课程
+      courseDialogVisible: false,
+      courseSaving: false,
+      courseForm: {},
+      // 线下映射
+      offlineDialogVisible: false,
+      offlineSaving: false,
+      offlineForm: {}
+    }
+  },
+  mounted() {
+    this.loadCategories()
+    this.loadCourses()
+    this.loadOfflineMaps()
+  },
+  methods: {
+    async loadCategories() {
+      this.categoriesLoading = true
+      try {
+        const res = await getCertCategoryList()
+        if (res.code === 200) this.categories = res.data || []
+      } finally {
+        this.categoriesLoading = false
+      }
+    },
+    async loadCourses() {
+      this.coursesLoading = true
+      try {
+        const params = {}
+        if (this.courseCategoryFilter) params.categoryId = this.courseCategoryFilter
+        const res = await getPlannerCourseList(params)
+        if (res.code === 200) this.courses = res.data || []
+      } finally {
+        this.coursesLoading = false
+      }
+    },
+    async loadOfflineMaps() {
+      this.offlineLoading = true
+      try {
+        const res = await getOfflineCourseMapList()
+        if (res.code === 200) this.offlineMaps = res.data || []
+      } finally {
+        this.offlineLoading = false
+      }
+    },
+    async loadActivities() {
+      if (this.activities.length > 0) return
+      this.activitiesLoading = true
+      try {
+        const res = await getActivityList({ page: 1, size: 100 })
+        if (res.code === 200 && res.data) {
+          this.activities = res.data.records || []
+        }
+      } catch (e) {
+        this.activities = []
+      } finally {
+        this.activitiesLoading = false
+      }
+    },
+    categoryName(categoryId) {
+      const cat = this.categories.find(function (c) { return c.id === categoryId })
+      return cat ? cat.name : ('类别 #' + categoryId)
+    },
+    activityTitle(activityId) {
+      const a = this.activities.find(function (x) { return x.id === activityId })
+      return a ? a.title : ('活动 #' + activityId)
+    },
+    activityOptionLabel(a) {
+      return '#' + a.id + ' ' + (a.title || '')
+    },
+    handleTabChange() {
+      if (this.activeTab === 'offline' && this.activities.length === 0) {
+        this.loadActivities()
+      }
+    },
+    // ---- 学习种类 ----
+    openCategoryDialog(row) {
+      if (row) {
+        this.categoryForm = Object.assign({}, row)
+      } else {
+        this.categoryForm = { code: '', name: '', description: '', requiredHours: 0, orderIndex: 0, isBase: 0, status: 1 }
+      }
+      this.categoryDialogVisible = true
+    },
+    async saveCategory() {
+      if (!this.categoryForm.code || !this.categoryForm.name) {
+        this.$message.warning('请填写编码与名称')
+        return
+      }
+      this.categorySaving = true
+      try {
+        const payload = Object.assign({}, this.categoryForm, {
+          requiredHours: Number(this.categoryForm.requiredHours) || 0
+        })
+        const res = this.categoryForm.id ? await updateCertCategory(payload) : await createCertCategory(payload)
+        if (res.code === 200) {
+          this.$message.success('已保存')
+          this.categoryDialogVisible = false
+          this.loadCategories()
+        }
+      } finally {
+        this.categorySaving = false
+      }
+    },
+    async deleteCategory(row) {
+      const confirmed = await this.$confirm('删除学习种类「' + (row.name || row.code) + '」将影响其下的课程/认证记录,确认删除?', '删除确认', { type: 'warning' }).catch(function () { return false })
+      if (!confirmed) return
+      const res = await deleteCertCategory(row.id)
+      if (res.code === 200) {
+        this.$message.success('已删除')
+        this.loadCategories()
+      }
+    },
+    // ---- 线上课程 ----
+    openCourseDialog(row) {
+      if (row) {
+        this.courseForm = Object.assign({}, row)
+      } else {
+        this.courseForm = { categoryId: this.courseCategoryFilter || null, title: '', xiaoeResourceId: '', requiredHours: 0, orderIndex: 0, isRequired: 0, status: 1 }
+      }
+      this.courseDialogVisible = true
+    },
+    async saveCourse() {
+      if (!this.courseForm.categoryId) {
+        this.$message.warning('请选择所属类别')
+        return
+      }
+      if (!this.courseForm.title) {
+        this.$message.warning('请填写课程标题')
+        return
+      }
+      this.courseSaving = true
+      try {
+        const payload = Object.assign({}, this.courseForm, {
+          categoryId: Number(this.courseForm.categoryId),
+          requiredHours: Number(this.courseForm.requiredHours) || 0
+        })
+        const res = this.courseForm.id ? await updatePlannerCourse(payload) : await createPlannerCourse(payload)
+        if (res.code === 200) {
+          this.$message.success('已保存')
+          this.courseDialogVisible = false
+          this.loadCourses()
+        }
+      } finally {
+        this.courseSaving = false
+      }
+    },
+    async deleteCourse(row) {
+      const confirmed = await this.$confirm('确认删除线上课程「' + (row.title || '#' + row.id) + '」?', '删除确认', { type: 'warning' }).catch(function () { return false })
+      if (!confirmed) return
+      const res = await deletePlannerCourse(row.id)
+      if (res.code === 200) {
+        this.$message.success('已删除')
+        this.loadCourses()
+      }
+    },
+    // ---- 线下映射 ----
+    async openOfflineDialog(row) {
+      await this.loadActivities()
+      if (row) {
+        this.offlineForm = Object.assign({}, row)
+      } else {
+        this.offlineForm = { activityId: null, categoryId: null, durationHours: 1, isRequired: 0, status: 1 }
+      }
+      this.offlineDialogVisible = true
+    },
+    async saveOfflineMap() {
+      if (!this.offlineForm.activityId) {
+        this.$message.warning('请选择培训活动')
+        return
+      }
+      if (!this.offlineForm.categoryId) {
+        this.$message.warning('请选择所属类别')
+        return
+      }
+      this.offlineSaving = true
+      try {
+        const payload = Object.assign({}, this.offlineForm, {
+          activityId: Number(this.offlineForm.activityId),
+          categoryId: Number(this.offlineForm.categoryId),
+          durationHours: Number(this.offlineForm.durationHours) || 0
+        })
+        const res = this.offlineForm.id ? await updateOfflineCourseMap(payload) : await createOfflineCourseMap(payload)
+        if (res.code === 200) {
+          this.$message.success('已保存')
+          this.offlineDialogVisible = false
+          this.loadOfflineMaps()
+        }
+      } finally {
+        this.offlineSaving = false
+      }
+    },
+    async deleteOfflineMap(row) {
+      const confirmed = await this.$confirm('确认删除活动 #' + row.activityId + ' 的线下课程映射?', '删除确认', { type: 'warning' }).catch(function () { return false })
+      if (!confirmed) return
+      const res = await deleteOfflineCourseMap(row.id)
+      if (res.code === 200) {
+        this.$message.success('已删除')
+        this.loadOfflineMaps()
+      }
+    }
+  }
+}
+</script>
+
+<style scoped>
+.planner-course-manage {
+  display: flex;
+  flex-direction: column;
+  height: 100%;
+}
+
+.filters {
+  display: flex;
+  align-items: center;
+  gap: 8px;
+  flex-wrap: wrap;
+}
+
+.adm-table-wrap {
+  flex: 1;
+  min-height: 0;
+  margin-top: 4px;
+}
+
+.form-full {
+  width: 100%;
+}
+
+.form-tip {
+  margin-left: 10px;
+  font-size: 12px;
+  color: var(--adm-text-45);
+}
+
+.dialog-tip {
+  font-size: 12px;
+  color: var(--adm-text-45);
+  line-height: 18px;
+  padding: 8px 12px;
+  background: #f7f8fa;
+  border-radius: 4px;
+}
+</style>

+ 466 - 0
cfc-web/src/views/admin/planner-cert/ExamManage.vue

@@ -0,0 +1,466 @@
+<template>
+  <div class="planner-exam-manage admin-page">
+    <PageHeader title="考核题库管理" subtitle="按学习种类维护考核试卷与题目,试卷可配置及格分与限时">
+      <div class="filters">
+        <el-select v-model="categoryId" placeholder="选择学习种类" class="filter-select-180" @change="handleCategoryChange">
+          <el-option v-for="c in categories" :key="c.id" :label="c.name" :value="c.id" />
+        </el-select>
+        <el-button size="mini" icon="el-icon-refresh" @click="loadPapers">刷新</el-button>
+        <el-button size="mini" type="primary" icon="el-icon-plus" :disabled="!categoryId" @click="openPaperDialog()">新增试卷</el-button>
+      </div>
+    </PageHeader>
+
+    <div class="adm-table-wrap">
+      <el-table :data="papers" v-loading="loading" border stripe height="100%">
+        <el-table-column prop="id" label="ID" width="70" />
+        <el-table-column prop="title" label="试卷名称" min-width="200" show-overflow-tooltip />
+        <el-table-column label="所属类别" width="150">
+          <template slot-scope="{ row }">{{ categoryName(row.categoryId) }}</template>
+        </el-table-column>
+        <el-table-column label="及格分" width="80">
+          <template slot-scope="{ row }">{{ row.passScore }}</template>
+        </el-table-column>
+        <el-table-column label="限时(分钟)" width="100">
+          <template slot-scope="{ row }">{{ row.durationMinutes }}</template>
+        </el-table-column>
+        <el-table-column label="题目数" width="80">
+          <template slot-scope="{ row }">{{ row.questionCount }}</template>
+        </el-table-column>
+        <el-table-column label="状态" width="80">
+          <template slot-scope="{ row }">
+            <el-tag size="mini" :type="row.status === 1 ? 'success' : 'danger'">{{ row.status === 1 ? '启用' : '停用' }}</el-tag>
+          </template>
+        </el-table-column>
+        <el-table-column label="创建时间" width="160">
+          <template slot-scope="{ row }">{{ fmtTime(row.createdAt) }}</template>
+        </el-table-column>
+        <el-table-column label="操作" width="200" fixed="right">
+          <template slot-scope="{ row }">
+            <el-button size="mini" type="primary" @click="openQuestionDialog(row)">维护题库</el-button>
+            <el-button size="mini" @click="openPaperDialog(row)">编辑</el-button>
+            <el-button size="mini" type="danger" plain @click="deletePaper(row)">删除</el-button>
+          </template>
+        </el-table-column>
+      </el-table>
+    </div>
+
+    <!-- 试卷编辑 -->
+    <el-dialog :title="paperForm.id ? '编辑试卷' : '新增试卷'" :visible.sync="paperDialogVisible" width="520px" :close-on-click-modal="false">
+      <el-form :model="paperForm" label-width="100px" size="small">
+        <el-form-item label="所属类别" required>
+          <el-select v-model="paperForm.categoryId" class="form-full" :disabled="true" placeholder="选择学习种类">
+            <el-option v-for="c in categories" :key="c.id" :label="c.name" :value="c.id" />
+          </el-select>
+        </el-form-item>
+        <el-form-item label="试卷名称" required>
+          <el-input v-model="paperForm.title" placeholder="如:成长规划师认证考核卷" />
+        </el-form-item>
+        <el-row :gutter="20">
+          <el-col :span="8">
+            <el-form-item label="及格分" required>
+              <el-input-number v-model="paperForm.passScore" :min="1" :max="1000" class="form-full" />
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="限时(分钟)" required>
+              <el-input-number v-model="paperForm.durationMinutes" :min="1" :max="300" class="form-full" />
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="状态">
+              <el-switch v-model="paperForm.status" :active-value="1" :inactive-value="0" active-text="启用" inactive-text="停用" />
+            </el-form-item>
+          </el-col>
+        </el-row>
+      </el-form>
+      <div class="dialog-tip">题目数由「维护题库」保存时自动回写;规划师端取该类别下第一套启用试卷。</div>
+      <span slot="footer">
+        <el-button @click="paperDialogVisible = false">取消</el-button>
+        <el-button type="primary" :loading="paperSaving" @click="savePaper">保存</el-button>
+      </span>
+    </el-dialog>
+
+    <!-- 题库维护 -->
+    <el-dialog :title="'题库维护 · ' + (currentPaper ? currentPaper.title : '')" :visible.sync="questionDialogVisible" width="900px" top="5vh" :close-on-click-modal="false">
+      <div v-loading="questionLoading">
+        <div class="question-editor" v-for="(q, index) in questionList" :key="index">
+          <div class="question-editor__head">
+            <span class="question-editor__index">第 {{ index + 1 }} 题</span>
+            <el-button size="mini" type="danger" plain icon="el-icon-delete" @click="removeQuestion(index)">删除本题</el-button>
+          </div>
+          <el-form label-width="70px" size="small">
+            <el-form-item label="题干" required>
+              <el-input v-model="q.question" type="textarea" :rows="2" placeholder="请输入题干" />
+            </el-form-item>
+            <el-form-item label="选项">
+              <div class="option-editor">
+                <div class="option-editor__row" v-for="(opt, oi) in q.options" :key="oi">
+                  <span class="option-editor__letter">{{ letterOf(oi) }}</span>
+                  <el-input v-model="q.options[oi]" placeholder="选项内容" size="small" />
+                  <el-button size="mini" type="danger" plain icon="el-icon-close" @click="removeOption(index, oi)" />
+                </div>
+                <el-button size="mini" icon="el-icon-plus" :disabled="q.options.length >= 6" @click="addOption(index)">添加选项</el-button>
+                <span class="option-editor__tip">选项按顺序对应 A/B/C…,正确答案即选项字母</span>
+              </div>
+            </el-form-item>
+            <el-row :gutter="20">
+              <el-col :span="12">
+                <el-form-item label="正确答案" required>
+                  <el-select v-model="q.answer" class="form-full" placeholder="选择正确选项">
+                    <el-option v-for="(opt, oi) in q.options" :key="oi" :label="letterOf(oi) + '. ' + opt" :value="letterOf(oi)" />
+                  </el-select>
+                </el-form-item>
+              </el-col>
+              <el-col :span="12">
+                <el-form-item label="分值">
+                  <el-input-number v-model="q.score" :min="1" :max="100" class="form-full" />
+                </el-form-item>
+              </el-col>
+            </el-row>
+          </el-form>
+        </div>
+        <el-button size="mini" type="primary" plain icon="el-icon-plus" @click="addQuestion">添加题目</el-button>
+      </div>
+      <span slot="footer">
+        <el-button @click="questionDialogVisible = false">取消</el-button>
+        <el-button type="primary" :loading="questionSaving" @click="saveQuestions">保存题库</el-button>
+      </span>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import PageHeader from '@/components/PageHeader.vue'
+import {
+  getCertCategoryList,
+  getPlannerExamPapers,
+  createPlannerExamPaper,
+  updatePlannerExamPaper,
+  deletePlannerExamPaper,
+  getPlannerExamQuestions,
+  savePlannerExamQuestions
+} from '@/api/plannerCertification'
+
+const LETTERS = ['A', 'B', 'C', 'D', 'E', 'F']
+
+export default {
+  name: 'PlannerExamManage',
+  components: { PageHeader },
+  data() {
+    return {
+      categoryId: null,
+      categories: [],
+      papers: [],
+      loading: false,
+      paperDialogVisible: false,
+      paperSaving: false,
+      paperForm: {},
+      questionDialogVisible: false,
+      questionLoading: false,
+      questionSaving: false,
+      currentPaper: null,
+      questionList: []
+    }
+  },
+  mounted() {
+    this.loadCategories()
+  },
+  methods: {
+    fmtTime(t) {
+      return t ? String(t).replace('T', ' ').substring(0, 19) : '-'
+    },
+    letterOf(index) {
+      return LETTERS[index] || ('O' + index)
+    },
+    async loadCategories() {
+      try {
+        const res = await getCertCategoryList()
+        if (res.code === 200) {
+          this.categories = res.data || []
+          if (!this.categoryId && this.categories.length > 0) {
+            this.categoryId = this.categories[0].id
+            this.loadPapers()
+          }
+        }
+      } catch (e) {
+        this.categories = []
+      }
+    },
+    categoryName(categoryId) {
+      const cat = this.categories.find(function (c) { return c.id === categoryId })
+      return cat ? cat.name : ('类别 #' + categoryId)
+    },
+    handleCategoryChange() {
+      this.loadPapers()
+    },
+    async loadPapers() {
+      if (!this.categoryId) {
+        this.papers = []
+        return
+      }
+      this.loading = true
+      try {
+        const res = await getPlannerExamPapers(this.categoryId)
+        if (res.code === 200) this.papers = res.data || []
+      } finally {
+        this.loading = false
+      }
+    },
+    openPaperDialog(row) {
+      if (row) {
+        this.paperForm = Object.assign({}, row)
+      } else {
+        this.paperForm = {
+          categoryId: this.categoryId,
+          title: '',
+          passScore: 60,
+          durationMinutes: 30,
+          questionCount: 0,
+          status: 1
+        }
+      }
+      this.paperDialogVisible = true
+    },
+    async savePaper() {
+      if (!this.paperForm.categoryId) {
+        this.$message.warning('请选择所属类别')
+        return
+      }
+      if (!this.paperForm.title) {
+        this.$message.warning('请填写试卷名称')
+        return
+      }
+      this.paperSaving = true
+      try {
+        const payload = Object.assign({}, this.paperForm, {
+          categoryId: Number(this.paperForm.categoryId),
+          passScore: Number(this.paperForm.passScore) || 60,
+          durationMinutes: Number(this.paperForm.durationMinutes) || 30
+        })
+        const res = this.paperForm.id ? await updatePlannerExamPaper(payload) : await createPlannerExamPaper(payload)
+        if (res.code === 200) {
+          this.$message.success('已保存')
+          this.paperDialogVisible = false
+          this.loadPapers()
+        }
+      } finally {
+        this.paperSaving = false
+      }
+    },
+    async deletePaper(row) {
+      const confirmed = await this.$confirm('确认删除试卷「' + (row.title || '#' + row.id) + '」及其题目?', '删除确认', { type: 'warning' }).catch(function () { return false })
+      if (!confirmed) return
+      const res = await deletePlannerExamPaper(row.id)
+      if (res.code === 200) {
+        this.$message.success('已删除')
+        this.loadPapers()
+      }
+    },
+    async openQuestionDialog(paper) {
+      this.currentPaper = paper
+      this.questionDialogVisible = true
+      this.questionLoading = true
+      this.questionList = []
+      try {
+        const res = await getPlannerExamQuestions(paper.id)
+        if (res.code === 200) {
+          this.questionList = (res.data || []).map(this.toEditorModel)
+        }
+      } finally {
+        this.questionLoading = false
+      }
+    },
+    /** 后端 options 为 JSON 字符串,answer 为选项字母;统一转为编辑模型 */
+    toEditorModel(q) {
+      const options = this.parseOptions(q.options)
+      const answer = this.normalizeAnswer(q.answer, options)
+      return {
+        question: q.question || '',
+        options: options,
+        answer: answer,
+        score: q.score || 1
+      }
+    },
+    parseOptions(raw) {
+      let arr = []
+      if (typeof raw === 'string') {
+        try {
+          arr = JSON.parse(raw)
+        } catch (e) {
+          arr = []
+        }
+      } else if (raw && typeof raw.length === 'number') {
+        arr = raw
+      }
+      const texts = []
+      for (let i = 0; i < arr.length; i++) {
+        const item = arr[i]
+        if (item && typeof item === 'object') {
+          texts.push(item.text || item.content || item.label || '')
+        } else {
+          texts.push(String(item))
+        }
+      }
+      return texts.length > 0 ? texts : ['', '']
+    },
+    normalizeAnswer(answer, options) {
+      if (!answer) return 'A'
+      const upper = String(answer).toUpperCase()
+      const letterIndex = LETTERS.indexOf(upper)
+      if (letterIndex >= 0) return upper
+      const textIndex = options.findIndex(function (opt) { return opt && opt.toUpperCase() === upper })
+      if (textIndex >= 0) return LETTERS[textIndex]
+      return 'A'
+    },
+    addQuestion() {
+      this.questionList.push({ question: '', options: ['', ''], answer: 'A', score: 1 })
+    },
+    removeQuestion(index) {
+      this.questionList.splice(index, 1)
+    },
+    addOption(index) {
+      if (this.questionList[index].options.length >= 6) return
+      this.questionList[index].options.push('')
+    },
+    removeOption(qIndex, oIndex) {
+      const q = this.questionList[qIndex]
+      if (q.options.length <= 2) {
+        this.$message.warning('每题至少保留 2 个选项')
+        return
+      }
+      q.options.splice(oIndex, 1)
+      if (q.answer && LETTERS.indexOf(q.answer) >= q.options.length) {
+        q.answer = 'A'
+      }
+    },
+    async saveQuestions() {
+      if (!this.currentPaper) return
+      if (this.questionList.length === 0) {
+        this.$message.warning('请至少添加 1 道题目')
+        return
+      }
+      const payload = []
+      for (let i = 0; i < this.questionList.length; i++) {
+        const q = this.questionList[i]
+        if (!q.question) {
+          this.$message.warning('第 ' + (i + 1) + ' 题题干未填写')
+          return
+        }
+        const options = []
+        for (let j = 0; j < q.options.length; j++) {
+          if (!q.options[j]) {
+            this.$message.warning('第 ' + (i + 1) + ' 题存在空选项')
+            return
+          }
+          options.push(q.options[j])
+        }
+        const answerIndex = LETTERS.indexOf(String(q.answer).toUpperCase())
+        if (answerIndex < 0 || answerIndex >= options.length) {
+          this.$message.warning('第 ' + (i + 1) + ' 题正确答案未对应到有效选项')
+          return
+        }
+        payload.push({
+          question: q.question,
+          options: JSON.stringify(options),
+          answer: q.answer || 'A',
+          score: Number(q.score) || 1
+        })      }
+      this.questionSaving = true
+      try {
+        const res = await savePlannerExamQuestions({ paperId: this.currentPaper.id, questions: payload })
+        if (res.code === 200) {
+          this.$message.success('题库已保存')
+          this.questionDialogVisible = false
+          this.loadPapers()
+        }
+      } finally {
+        this.questionSaving = false
+      }
+    }
+  }
+}
+</script>
+
+<style scoped>
+.planner-exam-manage {
+  display: flex;
+  flex-direction: column;
+  height: 100%;
+}
+
+.filters {
+  display: flex;
+  align-items: center;
+  gap: 8px;
+  flex-wrap: wrap;
+}
+
+.adm-table-wrap {
+  flex: 1;
+  min-height: 0;
+  margin-top: 4px;
+}
+
+.form-full {
+  width: 100%;
+}
+
+.dialog-tip {
+  font-size: 12px;
+  color: var(--adm-text-45);
+  line-height: 18px;
+  padding: 8px 12px;
+  background: #f7f8fa;
+  border-radius: 4px;
+}
+
+.question-editor {
+  border: 1px solid #ebeef5;
+  border-radius: 6px;
+  padding: 14px 16px 2px;
+  margin-bottom: 14px;
+  background: #fafbfc;
+}
+
+.question-editor__head {
+  display: flex;
+  align-items: center;
+  justify-content: space-between;
+  margin-bottom: 10px;
+}
+
+.question-editor__index {
+  font-size: 13px;
+  font-weight: 600;
+  color: var(--adm-text-88);
+}
+
+.option-editor {
+  width: 100%;
+}
+
+.option-editor__row {
+  display: flex;
+  align-items: center;
+  gap: 8px;
+  margin-bottom: 8px;
+}
+
+.option-editor__letter {
+  width: 22px;
+  height: 22px;
+  line-height: 22px;
+  text-align: center;
+  border-radius: 50%;
+  background: #e8f0fe;
+  color: #1677ff;
+  font-size: 12px;
+  flex-shrink: 0;
+}
+
+.option-editor__tip {
+  margin-left: 10px;
+  font-size: 12px;
+  color: var(--adm-text-45);
+}
+</style>