subject.vue 2.9 KB

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