academicYearStats.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. <!-- 学年数据统计 -->
  2. <template>
  3. <view class="academicYearStats-component">
  4. <view class="card">
  5. <view class="card-header">
  6. <text class="card-title">📊 学年数据统计</text>
  7. <view class="btn-outline" @click="handleShowReport">成绩报告</view>
  8. </view>
  9. <view class="card-body">
  10. <view class="year-row" v-for="(item, index) in yearStatsList" :key="index">
  11. <text class="year-label">{{ item.year }}</text>
  12. <text :class="['year-status', item.statusClass]">{{ item.statusText }}</text>
  13. </view>
  14. <view v-if="!yearStatsList.length" class="empty-tip">暂无统计数据</view>
  15. </view>
  16. </view>
  17. </view>
  18. </template>
  19. <script>
  20. import {
  21. examElLabEduRelationAcademicYearProgress,
  22. } from '@/pages_safetyEducationExamination/api/index.js'
  23. export default {
  24. // components: {
  25. // workbench,
  26. // },
  27. data() {
  28. return {
  29. yearStatsList: [],
  30. }
  31. },
  32. created() {
  33. },
  34. mounted() {
  35. this.examElLabEduRelationAcademicYearProgress();
  36. },
  37. methods: {
  38. //年度数据
  39. async examElLabEduRelationAcademicYearProgress() {
  40. try {
  41. const { data } = await examElLabEduRelationAcademicYearProgress();
  42. if (data.code === 200) {
  43. this.yearStatsList = (data.data || []).map(item => ({
  44. year: item.academicYear,
  45. statusText: item.statusCode == '0' ? `未开始` : (item.statusCode == '2' ? `通过 · `+item.score+` 分` : (item.statusCode == '1' ? `进行中` : '未通过')),
  46. statusClass: item.statusCode == '2' ? 'year-status-pass' : (item.statusCode == '1' ? 'year-status-going' : 'year-status-text')
  47. }));
  48. }
  49. } catch (e) { console.error('获取学年统计失败', e); }
  50. },
  51. },
  52. }
  53. </script>
  54. <style lang="stylus" scoped>
  55. .academicYearStats-component {
  56. margin:0 32rpx 32rpx;
  57. .card {
  58. background: #fff;
  59. border-radius: 24rpx;
  60. overflow: hidden;
  61. margin-bottom: 24rpx;
  62. box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.03);
  63. border: 1px solid #dde3ed;
  64. }
  65. .card-header {
  66. background: #f4f6fa;
  67. padding: 20rpx 28rpx;
  68. display: flex;
  69. justify-content: space-between;
  70. align-items: center;
  71. .card-title {
  72. font-size: 28rpx;
  73. font-weight: 700;
  74. color: #333;
  75. }
  76. .header-link {
  77. font-size: 24rpx;
  78. color: #1857d4;
  79. }
  80. }
  81. .card-body {
  82. padding: 16rpx 28rpx 24rpx;
  83. // 学年统计样式
  84. .year-row {
  85. display: flex;
  86. justify-content: space-between;
  87. align-items: center;
  88. padding: 12rpx 0;
  89. border-bottom: 1px solid #f4f6fa;
  90. &:last-child { border-bottom: none; }
  91. }
  92. .year-label { font-size: 26rpx; color: #333; font-weight: 500; }
  93. .year-status { font-size: 24rpx; font-weight: 500; }
  94. .year-status-pass { color: #0d8f6f;font-weight:600; }
  95. .year-status-going { color: #1857d4; }
  96. .year-status-text { color: #333; }
  97. .empty-tip { text-align: center; padding: 30rpx 0; color: #ccc; font-size: 24rpx; }
  98. }
  99. }
  100. </style>