certification-center.vue 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634
  1. <template>
  2. <view class="container" :style="{ '--font-scale': fontScale }">
  3. <!-- 顶部导航 -->
  4. <view class="nav-bar">
  5. <text class="nav-title">培训认证中心</text>
  6. <view class="nav-sub">按类别独立认证,通过后方可接单</view>
  7. </view>
  8. <BaseLoading :loading="loading" text="加载认证状态..." />
  9. <template v-if="!loading">
  10. <!-- 类别Tab -->
  11. <view class="tab-bar" v-if="certifications.length > 0">
  12. <scroll-view scroll-x :enhanced="true" show-scrollbar="false" class="tab-scroll">
  13. <view class="tab-inner">
  14. <view
  15. v-for="(cert, idx) in certifications"
  16. :key="cert.categoryId"
  17. class="tab-item"
  18. :class="{ active: activeTabIdx === idx }"
  19. @click="switchTab(idx)">
  20. <text class="tab-text">{{ cert.categoryName }}</text>
  21. <view v-if="cert.isBase" class="base-badge">基础</view>
  22. <view v-if="cert.canService" class="service-badge">可接单</view>
  23. <view v-else-if="cert.canExam" class="exam-badge">可考核</view>
  24. <view v-else class="learning-badge">学习中</view>
  25. </view>
  26. </view>
  27. </scroll-view>
  28. </view>
  29. <!-- 当前类别详情 -->
  30. <view v-if="currentCert" class="cert-detail">
  31. <!-- 进度概览卡片 -->
  32. <view class="progress-card">
  33. <view class="progress-header">
  34. <text class="progress-title">{{ currentCert.categoryName }} 认证进度</text>
  35. <view class="progress-status" :class="statusClass">
  36. {{ statusText }}
  37. </view>
  38. </view>
  39. <view class="progress-bars">
  40. <!-- 课时进度 -->
  41. <view class="progress-item">
  42. <view class="progress-label">
  43. <text>课时进度</text>
  44. <text>{{ formatHours(currentCert.completedHours) }} / {{ formatHours(currentCert.requiredHours) }}</text>
  45. </view>
  46. <view class="progress-bar-track">
  47. <view class="progress-bar-fill" :style="{ width: hoursPercent + '%' }"></view>
  48. </view>
  49. </view>
  50. <!-- 考核状态 -->
  51. <view class="progress-item" v-if="currentCert.examStatus !== 'none'">
  52. <view class="progress-label">
  53. <text>考核状态</text>
  54. <text>{{ examStatusText }}</text>
  55. </view>
  56. </view>
  57. </view>
  58. </view>
  59. <!-- 线上课程 -->
  60. <view class="section">
  61. <view class="section-title">
  62. <text>📚 线上课程(小鹅通)</text>
  63. </view>
  64. <view class="course-list" v-if="courses.length > 0">
  65. <view class="course-item" v-for="course in courses" :key="course.id" @click="goToCourse(course)">
  66. <view class="course-info">
  67. <text class="course-title">{{ course.title }}</text>
  68. <view class="course-meta">
  69. <text v-if="course.isRequired" class="required-tag">必修</text>
  70. <text>{{ formatHours(course.requiredHours) }} 课时</text>
  71. </view>
  72. </view>
  73. <view class="course-progress">
  74. <text class="course-open-tag">去学习</text>
  75. </view>
  76. </view>
  77. </view>
  78. <view class="empty-state" v-else>
  79. <text>暂无线上课程</text>
  80. </view>
  81. </view>
  82. <!-- 线下培训活动 -->
  83. <view class="section">
  84. <view class="section-title">
  85. <text>🏫 线下培训课程</text>
  86. </view>
  87. <view class="activity-list" v-if="activities.length > 0">
  88. <view class="activity-item" v-for="act in activities" :key="act.id">
  89. <view class="activity-info">
  90. <text class="activity-title">{{ act.title }}</text>
  91. <view class="activity-meta">
  92. <text>{{ formatTime(act.startTime) }} · {{ act.location }}</text>
  93. <text class="hours-tag">{{ formatHours(act.durationHours) }} 课时</text>
  94. </view>
  95. </view>
  96. <view class="activity-actions">
  97. <button
  98. class="btn-checkin"
  99. v-if="!act.checkedIn"
  100. @click.stop="doCheckIn(act)"
  101. :loading="checkingIn === act.id">
  102. 扫码签到
  103. </button>
  104. <view v-else class="checked-tag">已签到</view>
  105. </view>
  106. </view>
  107. </view>
  108. <view class="empty-state" v-else>
  109. <text>暂无线下培训课程</text>
  110. </view>
  111. </view>
  112. <!-- 考核入口 -->
  113. <view class="section exam-section">
  114. <view class="section-title">
  115. <text>📝 考核测试</text>
  116. </view>
  117. <view class="exam-card">
  118. <view class="exam-status" v-if="currentCert.examStatus !== 'none'">
  119. <text>{{ examStatusText }}</text>
  120. <text v-if="currentCert.examScore != null" class="exam-score">分数:{{ currentCert.examScore }}</text>
  121. </view>
  122. <view class="exam-actions">
  123. <button
  124. class="btn-exam"
  125. v-if="currentCert.canExam && currentCert.examStatus !== 'exam_passed'"
  126. @click="startExam"
  127. :loading="examLoading">
  128. {{ currentCert.examStatus === 'exam_failed' ? '重新考核' : '开始考核' }}
  129. </button>
  130. <button
  131. class="btn-result"
  132. v-if="currentCert.examStatus === 'exam_passed'"
  133. @click="viewResult">
  134. 查看证书
  135. </button>
  136. <view v-else-if="!currentCert.canExam" class="exam-locked">
  137. 完成课时要求({{ formatHours(currentCert.completedHours) }}/{{ formatHours(currentCert.requiredHours) }})后开放考核
  138. </view>
  139. </view>
  140. </view>
  141. </view>
  142. <!-- 证书展示 -->
  143. <view class="section" v-if="currentCert.status === 'certified' && currentCert.certNo">
  144. <view class="section-title">
  145. <text>🏆 证书信息</text>
  146. </view>
  147. <view class="cert-card">
  148. <view class="cert-row">
  149. <text class="cert-label">证书编号</text>
  150. <text class="cert-value">{{ currentCert.certNo }}</text>
  151. </view>
  152. <view class="cert-row">
  153. <text class="cert-label">获得时间</text>
  154. <text class="cert-value">{{ formatTime(currentCert.certifiedAt) }}</text>
  155. </view>
  156. <view class="cert-row" v-if="currentCert.expireAt">
  157. <text class="cert-label">有效期至</text>
  158. <text class="cert-value">{{ formatTime(currentCert.expireAt) }}</text>
  159. </view>
  160. </view>
  161. </view>
  162. </view>
  163. <!-- 空态 -->
  164. <view class="empty-main" v-else>
  165. <text class="empty-icon">📋</text>
  166. <text class="empty-text">暂无认证类别,请联系管理员配置</text>
  167. </view>
  168. </template>
  169. <!-- 考核弹窗 -->
  170. <view class="modal-mask" v-if="showExamModal" @click="closeExamModal">
  171. <view class="modal-exam" @click.stop>
  172. <view class="modal-header">
  173. <text class="modal-title">{{ currentExamPaper.title || '考核测试' }}</text>
  174. <view class="modal-timer" v-if="examTimeLeft > 0">
  175. ⏱ 剩余 {{ formatExamTime(examTimeLeft) }}
  176. </view>
  177. </view>
  178. <view class="exam-questions">
  179. <view v-for="(q, idx) in examQuestions" :key="q.id" class="question-item">
  180. <view class="question-header">
  181. <text class="question-num">{{ idx + 1 }}.</text>
  182. <text class="question-score">({{ q.score }}分)</text>
  183. </view>
  184. <text class="question-text">{{ q.question }}</text>
  185. <view class="options">
  186. <view
  187. v-for="(opt, oi) in parseOptions(q.options)"
  188. :key="oi"
  189. class="option"
  190. :class="{ selected: userAnswers[q.id] === opt.value }"
  191. @click="selectOption(q.id, opt.value)">
  192. <text class="opt-label">{{ opt.label }}.</text>
  193. <text class="opt-text">{{ opt.text }}</text>
  194. </view>
  195. </view>
  196. </view>
  197. </view>
  198. <view class="modal-footer">
  199. <button class="btn-submit" @click="submitExam" :loading="submittingExam" :disabled="!canSubmit">
  200. 提交试卷
  201. </button>
  202. <button class="btn-cancel" @click="closeExamModal">取消</button>
  203. </view>
  204. </view>
  205. </view>
  206. <!-- 证书查看弹窗 -->
  207. <view class="modal-mask" v-if="showCertModal" @click="closeCertModal">
  208. <view class="modal-cert" @click.stop>
  209. <view class="cert-modal-header">
  210. <text class="cert-modal-title">{{ currentCert.categoryName }} 认证证书</text>
  211. </view>
  212. <view class="cert-modal-body">
  213. <view class="cert-modal-no">{{ currentCert.certNo }}</view>
  214. <view class="cert-modal-name">{{ userNickname }}</view>
  215. <view class="cert-modal-date">颁发日期:{{ formatTime(currentCert.certifiedAt) }}</view>
  216. </view>
  217. <button class="btn-close-modal" @click="closeCertModal">关闭</button>
  218. </view>
  219. </view>
  220. </view>
  221. </template>
  222. <script>
  223. import fontScaleMixin from '@/mixins/font-scale.js'
  224. import BaseLoading from '@/components/BaseLoading.vue'
  225. import {
  226. getPlannerCertifications,
  227. getPlannerCourses,
  228. getPlannerTrainingActivities,
  229. plannerTrainingCheckIn,
  230. plannerExamStart,
  231. plannerExamSubmit
  232. } from '@/utils/api.js'
  233. export default {
  234. mixins: [fontScaleMixin],
  235. components: {
  236. BaseLoading
  237. },
  238. data() {
  239. return {
  240. loading: true,
  241. certifications: [],
  242. activeTabIdx: 0,
  243. courses: [],
  244. activities: [],
  245. currentExamPaper: null,
  246. examQuestions: [],
  247. userAnswers: {},
  248. examTimeLeft: 0,
  249. examTimer: null,
  250. showExamModal: false,
  251. showCertModal: false,
  252. examLoading: false,
  253. submittingExam: false,
  254. checkingIn: null,
  255. userNickname: ''
  256. }
  257. },
  258. computed: {
  259. currentCert() {
  260. return this.certifications[this.activeTabIdx] || null
  261. },
  262. statusClass() {
  263. if (!this.currentCert) return ''
  264. const status = this.currentCert.status
  265. if (status === 'certified') return 'status-certified'
  266. if (status === 'learning_completed') return 'status-ready-exam'
  267. if (status === 'exam_failed') return 'status-exam-failed'
  268. return 'status-learning'
  269. },
  270. statusText() {
  271. if (!this.currentCert) return ''
  272. const map = {
  273. 'pending_cert': '待认证',
  274. 'pending_learning': '学习中',
  275. 'learning_completed': '可参加考核',
  276. 'certified': '已认证',
  277. 'suspended': '已暂停',
  278. 'exam_failed': '考核未通过'
  279. }
  280. return map[this.currentCert.status] || this.currentCert.status
  281. },
  282. examStatusText() {
  283. if (!this.currentCert) return ''
  284. const map = {
  285. 'none': '未参加',
  286. 'exam_failed': '未通过',
  287. 'exam_passed': '已通过'
  288. }
  289. return map[this.currentCert.examStatus] || this.currentCert.examStatus
  290. },
  291. hoursPercent() {
  292. if (!this.currentCert || !this.currentCert.requiredHours) return 0
  293. const completed = parseFloat(this.currentCert.completedHours) || 0
  294. const required = parseFloat(this.currentCert.requiredHours) || 1
  295. return Math.min(100, Math.round((completed / required) * 100))
  296. },
  297. canSubmit() {
  298. return Object.keys(this.userAnswers).length === this.examQuestions.length
  299. }
  300. },
  301. onLoad() {
  302. this.loadUserInfo()
  303. this.loadCertifications()
  304. },
  305. onShow() {
  306. this.loadUserInfo()
  307. },
  308. onUnload() {
  309. this.clearExamTimer()
  310. },
  311. methods: {
  312. loadUserInfo() {
  313. const userInfo = uni.getStorageSync('userInfo')
  314. this.userNickname = (userInfo && userInfo.nickname) || ''
  315. },
  316. async loadCertifications() {
  317. this.loading = true
  318. try {
  319. const res = await getPlannerCertifications()
  320. if (res.code === 200 && Array.isArray(res.data)) {
  321. this.certifications = res.data
  322. this.activeTabIdx = 0
  323. await this.loadCategoryData(this.certifications[0])
  324. }
  325. } catch (e) {
  326. console.error('加载认证状态失败', e)
  327. uni.showToast({ title: '加载失败', icon: 'none' })
  328. } finally {
  329. this.loading = false
  330. }
  331. },
  332. async loadCategoryData(cert) {
  333. if (!cert) return
  334. // 并行加载课程和活动
  335. await Promise.all([
  336. this.loadCourses(cert.categoryId),
  337. this.loadActivities()
  338. ])
  339. },
  340. async loadCourses(categoryId) {
  341. try {
  342. const res = await getPlannerCourses(categoryId)
  343. if (res.code === 200 && Array.isArray(res.data)) {
  344. this.courses = res.data
  345. }
  346. } catch (e) {
  347. console.error('加载课程失败', e)
  348. }
  349. },
  350. async loadActivities() {
  351. try {
  352. const res = await getPlannerTrainingActivities()
  353. if (res.code === 200 && Array.isArray(res.data)) {
  354. this.activities = res.data
  355. }
  356. } catch (e) {
  357. console.error('加载活动失败', e)
  358. }
  359. },
  360. switchTab(idx) {
  361. if (idx === this.activeTabIdx) return
  362. this.activeTabIdx = idx
  363. this.loadCategoryData(this.certifications[idx])
  364. },
  365. formatHours(val) {
  366. if (val == null) return '0'
  367. const num = parseFloat(val)
  368. return num === Math.floor(num) ? num.toString() : num.toFixed(1)
  369. },
  370. formatTime(str) {
  371. if (!str) return '-'
  372. return str.replace('T', ' ').substring(0, 16)
  373. },
  374. goToCourse(course) {
  375. if (course.xiaoeResourceId) {
  376. // TODO: 跳转小鹅通小程序/H5
  377. uni.showToast({ title: '即将跳转小鹅通', icon: 'none' })
  378. }
  379. },
  380. async doCheckIn(activity) {
  381. this.checkingIn = activity.id
  382. try {
  383. const res = await plannerTrainingCheckIn(activity.id)
  384. if (res.code === 200) {
  385. uni.showToast({ title: '签到成功,课时已计入', icon: 'success' })
  386. activity.checkedIn = true
  387. // 刷新当前类别进度
  388. const cert = this.certifications[this.activeTabIdx]
  389. if (cert && cert.categoryId === activity.categoryId) {
  390. await this.loadCategoryData(cert)
  391. }
  392. } else {
  393. uni.showToast({ title: res.message || '签到失败', icon: 'none' })
  394. }
  395. } catch (e) {
  396. console.error('签到失败', e)
  397. uni.showToast({ title: '签到失败', icon: 'none' })
  398. } finally {
  399. this.checkingIn = null
  400. }
  401. },
  402. async startExam() {
  403. if (!this.currentCert) return
  404. this.examLoading = true
  405. try {
  406. const res = await plannerExamStart(this.currentCert.categoryId)
  407. if (res.code === 200 && res.data) {
  408. const data = res.data
  409. this.currentExamPaper = { id: data.paperId, title: data.paperTitle || '考核试卷', durationMinutes: data.durationMinutes, passScore: data.passScore, attemptId: data.attemptId }
  410. this.examQuestions = data.questions || []
  411. this.userAnswers = {}
  412. this.examTimeLeft = (data.durationMinutes || 30) * 60
  413. this.showExamModal = true
  414. this.startExamTimer()
  415. } else {
  416. uni.showToast({ title: res.message || '获取试卷失败', icon: 'none' })
  417. }
  418. } catch (e) {
  419. console.error('开始考核失败', e)
  420. uni.showToast({ title: '开始考核失败', icon: 'none' })
  421. } finally {
  422. this.examLoading = false
  423. }
  424. },
  425. startExamTimer() {
  426. this.clearExamTimer()
  427. this.examTimer = setInterval(() => {
  428. if (this.examTimeLeft > 0) {
  429. this.examTimeLeft--
  430. } else {
  431. this.clearExamTimer()
  432. this.submitExam()
  433. }
  434. }, 1000)
  435. },
  436. clearExamTimer() {
  437. if (this.examTimer) {
  438. clearInterval(this.examTimer)
  439. this.examTimer = null
  440. }
  441. },
  442. parseOptions(optionsStr) {
  443. try {
  444. const arr = JSON.parse(optionsStr || '[]')
  445. return arr.map((opt, i) => ({ label: String.fromCharCode(65 + i), value: String.fromCharCode(65 + i), text: opt }))
  446. } catch (e) {
  447. return []
  448. }
  449. },
  450. selectOption(questionId, value) {
  451. this.$set(this.userAnswers, questionId, value)
  452. },
  453. async submitExam() {
  454. this.clearExamTimer()
  455. if (!this.currentExamPaper) return
  456. this.submittingExam = true
  457. try {
  458. const res = await plannerExamSubmit(
  459. this.currentExamPaper.attemptId || this.currentExamPaper.id,
  460. JSON.stringify(this.userAnswers)
  461. )
  462. if (res.code === 200) {
  463. uni.showToast({ title: res.data.passed ? '考核通过!' : '考核未通过,请重新学习', icon: res.data.passed ? 'success' : 'none' })
  464. this.showExamModal = false
  465. this.examQuestions = []
  466. this.userAnswers = {}
  467. // 刷新认证状态
  468. await this.loadCertifications()
  469. if (res.data.passed && this.currentCert) {
  470. this.showCertModal = true
  471. }
  472. } else {
  473. uni.showToast({ title: res.message || '提交失败', icon: 'none' })
  474. }
  475. } catch (e) {
  476. console.error('提交考核失败', e)
  477. uni.showToast({ title: '提交失败', icon: 'none' })
  478. } finally {
  479. this.submittingExam = false
  480. }
  481. },
  482. viewResult() {
  483. this.showCertModal = true
  484. },
  485. closeExamModal() {
  486. this.clearExamTimer()
  487. this.showExamModal = false
  488. },
  489. closeCertModal() {
  490. this.showCertModal = false
  491. }
  492. }
  493. }
  494. </script>
  495. <style scoped lang="scss">
  496. .container {
  497. background: $tint-sky-ghost;
  498. min-height: 100vh;
  499. padding-bottom: 80rpx;
  500. }
  501. .nav-bar {
  502. background: linear-gradient(135deg, $brand-primary, $brand-secondary);
  503. padding: 32rpx 24rpx;
  504. color: $app-surface;
  505. }
  506. .nav-title { font-size: calc(36rpx * var(--font-scale, 1)); font-weight: bold; display: block; margin-bottom: 8rpx; }
  507. .nav-sub { font-size: calc(24rpx * var(--font-scale, 1)); opacity: 0.9; }
  508. .tab-bar { background: $app-surface; border-bottom: 1rpx solid $facade-border-soft; position: sticky; top: 0; z-index: 10; }
  509. .tab-scroll { padding: 0 24rpx; }
  510. .tab-inner { display: inline-flex; gap: 16rpx; padding: 16rpx 0; }
  511. .tab-item { display: flex; flex-direction: column; align-items: center; padding: 8rpx 16rpx; border-radius: 20rpx; background: $facade-fill; transition: background-color 0.2s, color 0.2s; min-width: 120rpx; }
  512. .tab-item.active { background: $brand-primary; color: $app-surface; }
  513. .tab-text { font-size: calc(26rpx * var(--font-scale, 1)); font-weight: 500; }
  514. .tab-item .base-badge { font-size: calc(20rpx * var(--font-scale, 1)); padding: 2rpx 8rpx; border-radius: 10rpx; background: $status-warning-soft; color: $status-warning-deep; margin-top: 4rpx; }
  515. .tab-item .service-badge { font-size: calc(20rpx * var(--font-scale, 1)); padding: 2rpx 8rpx; border-radius: 10rpx; background: $status-success-tint; color: $status-success-deep; margin-top: 4rpx; }
  516. .tab-item .exam-badge { font-size: calc(20rpx * var(--font-scale, 1)); padding: 2rpx 8rpx; border-radius: 10rpx; background: $status-info-soft; color: $status-info-deep; margin-top: 4rpx; }
  517. .tab-item .learning-badge { font-size: calc(20rpx * var(--font-scale, 1)); padding: 2rpx 8rpx; border-radius: 10rpx; background: $facade-fill-2; color: $facade-text-muted; margin-top: 4rpx; }
  518. .cert-detail { padding: 24rpx; }
  519. .progress-card { background: $app-surface; border-radius: 16rpx; padding: 24rpx; margin-bottom: 24rpx; box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.04); }
  520. .progress-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20rpx; }
  521. .progress-title { font-size: calc(30rpx * var(--font-scale, 1)); font-weight: 600; color: $facade-text-strong; }
  522. .progress-status { font-size: calc(24rpx * var(--font-scale, 1)); padding: 4rpx 16rpx; border-radius: 16rpx; font-weight: 500; }
  523. .status-certified { background: $status-success-tint; color: $status-success-deep; }
  524. .status-ready-exam { background: $status-info-soft; color: $status-info-deep; }
  525. .status-exam-failed { background: $status-danger-tint-2; color: $status-danger-deep; }
  526. .status-learning { background: $status-warning-soft; color: $status-warning-deep; }
  527. .progress-bars { display: flex; flex-direction: column; gap: 16rpx; }
  528. .progress-item { }
  529. .progress-label { display: flex; justify-content: space-between; font-size: calc(24rpx * var(--font-scale, 1)); margin-bottom: 8rpx; color: $facade-text-muted; }
  530. .progress-bar-track { height: 8rpx; background: $facade-border-soft; border-radius: 4rpx; overflow: hidden; }
  531. .progress-bar-fill { height: 100%; background: linear-gradient(90deg, $brand-primary, $brand-secondary); border-radius: 4rpx; transition: width 0.3s; }
  532. .mini-bar { height: 4rpx; background: $facade-border-soft; border-radius: 2rpx; margin-top: 4rpx; overflow: hidden; }
  533. .mini-fill { height: 100%; background: $brand-primary; border-radius: 2rpx; }
  534. .section { background: $app-surface; border-radius: 16rpx; padding: 24rpx; margin-bottom: 24rpx; box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.04); }
  535. .section-title { font-size: calc(28rpx * var(--font-scale, 1)); font-weight: 600; color: $facade-text-strong; margin-bottom: 16rpx; }
  536. .course-list { display: flex; flex-direction: column; gap: 12rpx; }
  537. .course-item { display: flex; justify-content: space-between; align-items: center; padding: 16rpx; background: $facade-fill; border-radius: 12rpx; }
  538. .course-info { flex: 1; }
  539. .course-title { display: block; font-size: calc(28rpx * var(--font-scale, 1)); font-weight: 500; color: $facade-text-strong; margin-bottom: 4rpx; }
  540. .course-meta { display: flex; gap: 12rpx; font-size: calc(22rpx * var(--font-scale, 1)); color: $facade-text-muted; }
  541. .required-tag { background: $status-warning-soft; color: $status-warning-deep; padding: 2rpx 6rpx; border-radius: 4rpx; font-size: calc(20rpx * var(--font-scale, 1)); }
  542. .course-open-tag { font-size: calc(24rpx * var(--font-scale, 1)); color: $brand-primary; font-weight: 500; }
  543. .mini-bar { height: 4rpx; background: $facade-border-soft; border-radius: 2rpx; margin-top: 4rpx; }
  544. .mini-fill { height: 100%; background: $brand-primary; border-radius: 2rpx; }
  545. .activity-list { display: flex; flex-direction: column; gap: 12rpx; }
  546. .activity-item { display: flex; justify-content: space-between; align-items: center; padding: 16rpx; background: $facade-fill; border-radius: 12rpx; flex-wrap: wrap; gap: 12rpx; }
  547. .activity-info { flex: 1; min-width: 200rpx; }
  548. .activity-title { display: block; font-size: calc(28rpx * var(--font-scale, 1)); font-weight: 500; color: $facade-text-strong; margin-bottom: 4rpx; }
  549. .activity-meta { display: flex; gap: 12rpx; font-size: calc(22rpx * var(--font-scale, 1)); color: $facade-text-muted; flex-wrap: wrap; }
  550. .hours-tag { background: $brand-primary-soft; color: $brand-primary-deep; padding: 2rpx 8rpx; border-radius: 4rpx; font-size: calc(20rpx * var(--font-scale, 1)); }
  551. .activity-actions { display: flex; gap: 8rpx; }
  552. .btn-checkin { background: $brand-primary; color: $app-surface; padding: 10rpx 20rpx; border-radius: 8rpx; font-size: calc(24rpx * var(--font-scale, 1)); border: none; }
  553. .btn-checkin:disabled { opacity: 0.6; }
  554. .checked-tag { font-size: calc(24rpx * var(--font-scale, 1)); color: $status-success-deep; background: $status-success-tint; padding: 8rpx 16rpx; border-radius: 8rpx; }
  555. .exam-section { background: $app-surface; border-radius: 16rpx; padding: 24rpx; margin-bottom: 24rpx; box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.04); border-left: 4rpx solid $brand-primary; }
  556. .exam-card { background: $facade-fill; border-radius: 12rpx; padding: 20rpx; }
  557. .exam-status { font-size: calc(26rpx * var(--font-scale, 1)); font-weight: 500; margin-bottom: 12rpx; }
  558. .exam-status .exam-score { margin-left: 16rpx; color: $brand-primary; }
  559. .exam-actions { display: flex; gap: 12rpx; flex-wrap: wrap; align-items: center; }
  560. .btn-exam { background: $status-info; color: $app-surface; padding: 14rpx 28rpx; border-radius: 8rpx; font-size: calc(26rpx * var(--font-scale, 1)); font-weight: 500; border: none; }
  561. .btn-exam:disabled { opacity: 0.6; }
  562. .btn-result { background: $brand-primary; color: $app-surface; padding: 14rpx 28rpx; border-radius: 8rpx; font-size: calc(26rpx * var(--font-scale, 1)); font-weight: 500; border: none; }
  563. .exam-locked { font-size: calc(24rpx * var(--font-scale, 1)); color: $facade-text-muted; flex: 1; }
  564. .cert-card { background: linear-gradient(135deg, $brand-primary, $brand-secondary); border-radius: 16rpx; padding: 24rpx; color: $app-surface; }
  565. .cert-row { display: flex; justify-content: space-between; align-items: center; padding: 12rpx 0; border-bottom: 1rpx solid rgba(255,255,255,0.2); }
  566. .cert-row:last-child { border-bottom: none; }
  567. .cert-label { font-size: calc(24rpx * var(--font-scale, 1)); opacity: 0.8; }
  568. .cert-value { font-size: calc(28rpx * var(--font-scale, 1)); font-weight: 600; }
  569. .empty-state { text-align: center; padding: 40rpx; color: $facade-text-muted; font-size: calc(26rpx * var(--font-scale, 1)); }
  570. .empty-main { text-align: center; padding: 120rpx 24rpx; }
  571. .empty-icon { font-size: calc($uni-font-size-5xl * var(--font-scale, 1)); display: block; margin-bottom: 16rpx; }
  572. .empty-text { font-size: calc(28rpx * var(--font-scale, 1)); color: $facade-text-muted; }
  573. /* 考核弹窗 */
  574. .modal-mask { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 24rpx; }
  575. .modal-exam { background: $app-surface; border-radius: 16rpx; width: 100%; max-width: 680rpx; max-height: 90vh; overflow: hidden; display: flex; flex-direction: column; }
  576. .modal-header { display: flex; justify-content: space-between; align-items: center; padding: 20rpx 24rpx; border-bottom: 1rpx solid $facade-border-soft; }
  577. .modal-title { font-size: calc(30rpx * var(--font-scale, 1)); font-weight: 600; }
  578. .modal-timer { font-size: calc(24rpx * var(--font-scale, 1)); color: $status-danger-deep; background: $status-danger-tint-2; padding: 4rpx 12rpx; border-radius: 12rpx; }
  579. .exam-questions { flex: 1; overflow-y: auto; padding: 20rpx 24rpx; }
  580. .question-item { margin-bottom: 24rpx; }
  581. .question-header { display: flex; align-items: center; gap: 8rpx; margin-bottom: 8rpx; font-size: calc(24rpx * var(--font-scale, 1)); color: $facade-text-muted; }
  582. .question-num { font-weight: 600; color: $facade-text-strong; }
  583. .question-text { font-size: calc(28rpx * var(--font-scale, 1)); color: $facade-text-strong; margin-bottom: 12rpx; line-height: 1.5; }
  584. .options { display: flex; flex-direction: column; gap: 8rpx; }
  585. .option { display: flex; align-items: center; gap: 12rpx; padding: 16rpx; background: $facade-fill; border-radius: 8rpx; border: 2rpx solid transparent; transition: background-color 0.2s, border-color 0.2s; }
  586. .option.selected { border-color: $brand-primary; background: $brand-primary-soft; }
  587. .option:active { transform: scale(0.99); }
  588. .opt-label { width: 32rpx; height: 32rpx; border-radius: 50%; border: 2rpx solid $facade-border-soft; display: flex; align-items: center; justify-content: center; font-size: calc(24rpx * var(--font-scale, 1)); font-weight: bold; color: $facade-text-muted; }
  589. .option.selected .opt-label { border-color: $brand-primary; background: $brand-primary; color: $app-surface; }
  590. .opt-text { font-size: calc(26rpx * var(--font-scale, 1)); color: $facade-text-strong; flex: 1; }
  591. .modal-footer { display: flex; gap: 12rpx; padding: 20rpx 24rpx; border-top: 1rpx solid $facade-border-soft; }
  592. .btn-submit { flex: 1; background: $brand-primary; color: $app-surface; padding: 16rpx; border-radius: 8rpx; font-size: calc(28rpx * var(--font-scale, 1)); font-weight: 500; border: none; }
  593. .btn-submit:disabled { opacity: 0.5; }
  594. .btn-cancel { background: $facade-fill-2; color: $facade-text-strong; padding: 16rpx 28rpx; border-radius: 8rpx; font-size: calc(28rpx * var(--font-scale, 1)); border: none; }
  595. /* 证书弹窗 */
  596. .modal-cert { background: $app-surface; border-radius: 16rpx; width: 100%; max-width: 560rpx; padding: 32rpx 24rpx; text-align: center; }
  597. .cert-modal-header { margin-bottom: 24rpx; }
  598. .cert-modal-title { font-size: calc(32rpx * var(--font-scale, 1)); font-weight: 600; color: $facade-text-strong; }
  599. .cert-modal-body { background: linear-gradient(135deg, $brand-primary, $brand-secondary); border-radius: 16rpx; padding: 32rpx; color: $app-surface; margin-bottom: 24rpx; }
  600. .cert-modal-no { font-size: calc(26rpx * var(--font-scale, 1)); opacity: 0.8; margin-bottom: 16rpx; letter-spacing: 2rpx; }
  601. .cert-modal-name { font-size: calc(40rpx * var(--font-scale, 1)); font-weight: bold; margin-bottom: 16rpx; }
  602. .cert-modal-date { font-size: calc(24rpx * var(--font-scale, 1)); opacity: 0.8; }
  603. .btn-close-modal { background: $brand-primary; color: $app-surface; padding: 16rpx 48rpx; border-radius: 8rpx; font-size: calc(28rpx * var(--font-scale, 1)); font-weight: 500; border: none; width: 100%; }
  604. </style>