subject.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. <template>
  2. <view class="page-view">
  3. <top-return color="#FFF" text="优劣科目"></top-return>
  4. <!-- 背景 -->
  5. <view class="bg-box1"></view>
  6. <!-- 头部学期信息 -->
  7. <top-semester></top-semester>
  8. <!-- 分析列表 -->
  9. <view class="card-view">
  10. <view class="card-item" v-for="(item,index) in analysisData" :key="index"
  11. :style="{background: item.color,height: 200+ 'rpx'}">
  12. <view class="analysis-box">
  13. <view class="flex-baseline">
  14. <view class="analysis-text">{{item.title}}</view>
  15. <view class="analysis-text" style="font-size: 40rpx; margin-left: 20rpx;"> {{item.data.name}}
  16. </view>
  17. </view>
  18. <view class="flex-baseline">
  19. <view class="analysis-data">{{item.data.value}}%</view>
  20. <view class="analysis-text" style="margin-left: 20rpx;">得分率</view>
  21. </view>
  22. </view>
  23. <view class="icon-box">
  24. <view :class="item.data.value>=40?(item.data.value>=70?'t-icon t-icon-a-bianzu6':'t-icon t-icon-a-bianzu7'): 't-icon t-icon-a-bianzu8'"></view>
  25. </view>
  26. </view>
  27. <!-- 图表 -->
  28. <view class="card-item" style="width: 100%;">
  29. <view class="card-title">
  30. <view class="front-tag"></view>
  31. <view class="title">最近考试得分率对比</view>
  32. </view>
  33. <view class="chart-box">
  34. <qiun-data-charts type="rose" :chartData="examChartData.subjectChartData[0]" :tapLegend="true"
  35. tooltipFormat='tooltipScoreShort' :canvas2d="true" canvasId="subject_chart1"/>
  36. </view>
  37. </view>
  38. <view class="card-item" style="width: 100%;">
  39. <view class="card-title">
  40. <view class="front-tag"></view>
  41. <view class="title">学期平均得分率对比</view>
  42. </view>
  43. <view class="chart-box">
  44. <qiun-data-charts type="rose" :chartData="examChartData.subjectChartData[1]" :tapLegend="true"
  45. tooltipFormat='tooltipScoreShort' :canvas2d="true" canvasId="subject_chart2"/>
  46. </view>
  47. </view>
  48. </view>
  49. </view>
  50. </template>
  51. <script>
  52. import {
  53. mapState
  54. } from 'vuex'
  55. export default {
  56. computed: {
  57. ...mapState('m_chart', ['examChartData']),
  58. },
  59. data() {
  60. return {
  61. //分析模块数据
  62. analysisData: [{
  63. title: '优势科目',
  64. data: '',
  65. color: '#4169E1'
  66. }, {
  67. title: '劣势科目',
  68. data: '',
  69. color: '#ff8caf',
  70. }]
  71. }
  72. },
  73. onLoad() {
  74. this.init()
  75. },
  76. methods: {
  77. init() {
  78. this.getAnalysisData()
  79. },
  80. getAnalysisData() {
  81. //获取成绩最好科目
  82. this.analysisData[0].data = this.examChartData.subjectChartData[1].series[0].data.reduce((pre, cur) => pre
  83. .value > cur.value ? pre : cur)
  84. //劣势科目
  85. this.analysisData[1].data = this.examChartData.subjectChartData[1].series[0].data.reduce((pre, cur) => pre
  86. .value < cur.value ? pre : cur)
  87. }
  88. }
  89. }
  90. </script>
  91. <style lang="scss">
  92. @import 'gradelist_pages.scss';
  93. </style>