grade.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325
  1. <template>
  2. <view class="home-container">
  3. <!-- 头部区域 -->
  4. <top-box v-bind:timeStamp="timeStamp"></top-box>
  5. <!-- 缩略图区域 -->
  6. <view class="mini-chart-list">
  7. <!-- 成绩走势 -->
  8. <view class="mini-chart-item" style="width: 100%;">
  9. <view class="chart-container" @click="navGeneral">
  10. <view class="chart-name">
  11. <view :class="icon.general"></view>
  12. <text class="chart-name-text">成绩走势</text>
  13. </view>
  14. <view class="charts-box">
  15. <qiun-data-charts class="chart" :canvas2d='true' canvasId='canvans1' type="mainline"
  16. :chartData="gradeData.semesterLineChart.generalComparison" :loadingType="4"
  17. tooltipFormat='tooltipScore' />
  18. </view>
  19. </view>
  20. </view>
  21. <!-- 单次考试 -->
  22. <view class="mini-chart-item">
  23. <view class="chart-container" @click="navSingle">
  24. <view class="chart-name">
  25. <view :class="icon.RecentTest"></view>
  26. <text class="chart-name-text">单次考试分析</text>
  27. </view>
  28. <view class="charts-box">
  29. <qiun-data-charts type="mini-column" :chartData="gradeData.recentTestChart.recentComparison"
  30. :loadingType="4" :tapLegend="false" :canvas2d='true' canvasId='canvans2' />
  31. </view>
  32. </view>
  33. </view>
  34. <!-- 成绩占比 -->
  35. <view class="mini-chart-item">
  36. <view class="chart-container" @click="navRank">
  37. <view class="chart-name">
  38. <view :class="icon.Rank"></view>
  39. <text class="chart-name-text">排行占比分析</text>
  40. </view>
  41. <view class="charts-box">
  42. <qiun-data-charts type="mini-area" :chartData="gradeData.rankChart.semesterRank"
  43. :loadingType="4" :tapLegend="false" :canvas2d='true' canvasId='canvans3' />
  44. </view>
  45. </view>
  46. </view>
  47. <!-- 优劣科目分析 -->
  48. <view class="mini-chart-item">
  49. <view class="chart-container" @click="navSubject">
  50. <view class="chart-name">
  51. <view :class="icon.Advantage"></view>
  52. <text class="chart-name-text">优劣科目分析</text>
  53. </view>
  54. <view class="charts-box">
  55. <qiun-data-charts type="mini-rose" :chartData="gradeData.advantageRoseChart.recentAdvantage"
  56. :loadingType="4" :tapLegend="false" :canvas2d='true' canvasId='canvans4' />
  57. </view>
  58. </view>
  59. </view>
  60. <!-- 考试能力分析 -->
  61. <view class="mini-chart-item">
  62. <view class="chart-container" @click="navAbility">
  63. <view class="chart-name">
  64. <view :class="icon.Ability"></view>
  65. <text class="chart-name-text">考试能力分析</text>
  66. </view>
  67. <view class="charts-box">
  68. <qiun-data-charts type="mini-column" :chartData="gradeData.abilityChart.importantAnalyse"
  69. :loadingType="4" :tapLegend="false" :canvas2d='true' canvasId='canvans5' />
  70. </view>
  71. </view>
  72. </view>
  73. <!-- 成绩表单 -->
  74. <view class="mini-chart-item" style="width: 100%; height: auto;">
  75. <view class="chart-container" style="height: 100%">
  76. <view class="chart-name">
  77. <view :class="icon.table"></view>
  78. <text class="chart-name-text">成绩表单</text>
  79. </view>
  80. <z-table class="table" :tableData="tableData" :columns="columns"
  81. showBottomSum="true">
  82. </z-table>
  83. </view>
  84. </view>
  85. </view>
  86. </view>
  87. </template>
  88. <script>
  89. import {
  90. mapState
  91. } from 'vuex'
  92. export default {
  93. computed: {
  94. ...mapState('m_children', ['childreninfo', 'semester']),
  95. ...mapState('m_chart', ['gradeData'])
  96. },
  97. data() {
  98. return {
  99. //图标
  100. icon:{
  101. general: 't-icon t-icon-pingjia',
  102. RecentTest: 't-icon t-icon-zhishi',
  103. Rank: 't-icon t-icon-fengxianpinggu',
  104. Advantage: 't-icon t-icon-gaishuai',
  105. Ability: 't-icon t-icon-tongji',
  106. table: 't-icon t-icon-baike'
  107. },
  108. //时间戳
  109. timeStamp: '',
  110. //成绩表
  111. columns: [{
  112. 'title': '考试',
  113. 'key': '考试',
  114. 'width': 220,
  115. },
  116. {
  117. 'title': '语文',
  118. 'key': '语文',
  119. },
  120. {
  121. 'title': '数学',
  122. 'key': '数学',
  123. },
  124. {
  125. 'title': '英语',
  126. 'key': '英语',
  127. },
  128. {
  129. 'title': '体育',
  130. 'key': '体育',
  131. },
  132. {
  133. 'title': '思品',
  134. 'key': '思品',
  135. },
  136. {
  137. 'title': '科学',
  138. 'key': '科学',
  139. }
  140. ],
  141. //表格数据
  142. tableData: [{
  143. '考试': '开学',
  144. '语文': 83,
  145. '数学': 95,
  146. '英语': 95,
  147. '体育': 92,
  148. '思品': 88,
  149. '科学': 90,
  150. },
  151. {
  152. '考试': '四月月考',
  153. '语文': 93,
  154. '数学': 92,
  155. '英语': 90,
  156. '体育': 82,
  157. '思品': 90,
  158. '科学': 99,
  159. },
  160. {
  161. '考试': '期中',
  162. '语文': 99,
  163. '数学': 91,
  164. '英语': 82,
  165. '体育': 94,
  166. '思品': 85,
  167. '科学': 100,
  168. },
  169. {
  170. '考试': '五月月考',
  171. '语文': 99,
  172. '数学': 92,
  173. '英语': 97,
  174. '体育': 92,
  175. '思品': 98,
  176. '科学': 88,
  177. },
  178. {
  179. '考试': '六月月考',
  180. '语文': 99,
  181. '数学': 90,
  182. '英语': 92,
  183. '体育': 92,
  184. '思品': 80,
  185. '科学': 90,
  186. },
  187. {
  188. '考试': '期末',
  189. '语文': 99,
  190. '数学': 85,
  191. '英语': 92,
  192. '体育': 95,
  193. '思品': 91,
  194. '科学': 99,
  195. }
  196. ],
  197. }
  198. },
  199. onLoad() {
  200. this.$getTimeStamp()
  201. //获取成绩数据
  202. this.$initGrade()
  203. },
  204. //刷新页面
  205. onPullDownRefresh() {
  206. this.$getTimeStamp()
  207. console.log('refresh');
  208. setTimeout(function() {
  209. uni.stopPullDownRefresh();
  210. }, 1000);
  211. },
  212. methods: {
  213. //导航成绩走势
  214. navGeneral(e) {
  215. uni.navigateTo({
  216. url: "/gradepkg/general-chart/general-chart"
  217. })
  218. },
  219. //导航单次考试
  220. navSingle(e) {
  221. uni.navigateTo({
  222. url: "/gradepkg/single-chart/single-chart"
  223. })
  224. },
  225. //导航排行占比
  226. navRank(e) {
  227. uni.navigateTo({
  228. url: "/gradepkg/rank-chart/rank-chart"
  229. })
  230. },
  231. //导航优劣科目
  232. navSubject(e) {
  233. uni.navigateTo({
  234. url: "/gradepkg/subject-chart/subject-chart"
  235. })
  236. },
  237. //导航考试能力
  238. navAbility(e) {
  239. uni.navigateTo({
  240. url: "/gradepkg/ability-chart/ability-chart"
  241. })
  242. },
  243. },
  244. }
  245. </script>
  246. <style lang="scss">
  247. .home-container {
  248. width: 100%;
  249. height: 100%;
  250. overflow-x: hidden; //隐藏多余的页面
  251. .home-topinfo {
  252. background: linear-gradient($color-pink, $page-background-color);
  253. }
  254. //缩略图列表
  255. .mini-chart-list {
  256. display: flex;
  257. align-items: center;
  258. flex-wrap: wrap;
  259. margin: -50rpx 20rpx 10rpx 20rpx;
  260. justify-content: space-between;
  261. .mini-chart-item {
  262. margin: 2% 0;
  263. width: 48%;
  264. display: flex;
  265. flex-direction: column;
  266. }
  267. }
  268. }
  269. //图表卡片
  270. .chart-container {
  271. border-radius: $card-border-radius;
  272. display: flex;
  273. align-items: center;
  274. justify-content: center;
  275. flex-direction: column;
  276. background-color: #FFFFFF;
  277. // box-shadow: 0 4rpx 8rpx rgba(0, 0, 0, 0.05);
  278. width: 100%;
  279. height: 345rpx;
  280. .chart-name {
  281. display: flex;
  282. align-items: center;
  283. justify-content: flex-start;
  284. width: 100%;
  285. margin: 20rpx 0 35rpx 40rpx;
  286. .chart-name-text {
  287. margin-left: 15rpx;
  288. font-size: 30rpx;
  289. font-weight: bold;
  290. color: $color-title;
  291. }
  292. }
  293. .charts-box {
  294. width: 100%;
  295. height: 250rpx;
  296. }
  297. }
  298. .table {
  299. margin-bottom: 20rpx;
  300. width: 93%;
  301. height: 100%;
  302. }
  303. .t-icon {
  304. width: 40rpx;
  305. height: 40rpx;
  306. }
  307. </style>