tab_exam.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353
  1. <template>
  2. <view class="page-view">
  3. <!-- 统计 -->
  4. <view class="bg1">
  5. <view class="circle-line1"></view>
  6. <view class="circle-line2"></view>
  7. <view class="circle-line3"></view>
  8. <top-info :timeStamp="timeStamp"></top-info>
  9. <scroll-view class="scroll-view" scroll-x="true" :scroll-with-animation="true" scroll-left="0">
  10. <view class="view-box">
  11. <view class="scroll-view-item" v-for="(item,index) in cardList" :key="index"
  12. @click="navGradeList(index)">
  13. <view class="card-info">
  14. <view :class="item.icon"></view>
  15. <view class="title">{{item.title}}</view>
  16. </view>
  17. <view class="chart-box">
  18. <qiun-data-charts :type="item.type" :chartData="item.data" />
  19. </view>
  20. </view>
  21. </view>
  22. </scroll-view>
  23. </view>
  24. <!-- 统计卡片 -->
  25. <view class="card-view">
  26. <view class="stat-card">
  27. <view class="card-column">
  28. <view class="flex-baseline">
  29. <text class="_title">今日评测</text>
  30. <text class="_title" style="margin-left: 20rpx;">{{examData.length}}</text>
  31. <text class="_unit">例</text>
  32. </view>
  33. <view class="flex-baseline">
  34. <text class="_subtitle">已完成</text>
  35. <text class="_subtitle" style="margin-left: 20rpx;">{{finishData.length}}</text>
  36. <text class="_unit">例</text>
  37. </view>
  38. <view class="flex-baseline">
  39. <text class="_subtitle">完成情况</text>
  40. <text class="_subtitle" style="margin-left: 20rpx;">{{performance}}</text>
  41. </view>
  42. </view>
  43. <view class="card-image" :style="{backgroundImage:`url(${image})`}"></view>
  44. </view>
  45. <!-- 列表卡片 -->
  46. <view class="card-item" style="width: 100%;">
  47. <view class="card-title">
  48. <view class="front-tag"></view>
  49. <view class="title">今日评测</view>
  50. <view class="flex-row" style="margin: 0 0 0 auto;" @click="navExamList" v-if="examData.length != 0">
  51. <view class="t-icon t-icon-fenlei"></view>
  52. <view class="title" style="color: #4169E1;margin-left: 10rpx;">评测列表</view>
  53. </view>
  54. </view>
  55. <view class="data-list">
  56. <view class="data-item" :style="{borderImage: none}" v-for="(item,index) in examData" :key="index"
  57. @click="navExamReport(index)" v-if="examData.length != 0">
  58. <view class="flex-row" style="margin: 0 20rpx;">
  59. <view class="t-icon t-icon-examicon" style="width: 60rpx; height: 60rpx;"></view>
  60. <view class="flex-column" style="height:92rpx;justify-content: space-between;">
  61. <view class="flex-row" style="margin-left: 20rpx;">
  62. <view class="item-title">{{item.examInfo.name}}</view>
  63. </view>
  64. <view class="flex-row">
  65. <view class="tag-fill">
  66. <view class="tag-text">{{item.examInfo.subjects[0].name}}</view>
  67. </view>
  68. <view class="tag-fill">
  69. <view class="tag-text">{{item.examInfo.examType.name}}</view>
  70. </view>
  71. <view class="tag-fill"
  72. :style="{backgroundColor: item.examInfo.progress === 'finish'? '#23b46c':'#ff5959'}">
  73. <view class="tag-text">{{item.examInfo.progress === 'finish' ? '已完成' : '进行中'}}
  74. </view>
  75. </view>
  76. </view>
  77. </view>
  78. </view>
  79. </view>
  80. <view class="image-box" v-if="examData.length === 0">
  81. <view class="detail-image-none" :style="{backgroundImage:`url(${image1})`}"></view>
  82. <view class="subtitle">今日孩子暂无评测活动</view>
  83. </view>
  84. </view>
  85. </view>
  86. <view class="flex-column" style="margin: 15rpx 0 10rpx 20rpx;">
  87. <view class="title" style="font-size: 32rpx;">评测练习</view>
  88. <view class="bottom-tag"></view>
  89. </view>
  90. <view class="flex-row" style="width: 70%;"></view>
  91. </view>
  92. <scroll-view class="scroll-view-bottom" scroll-x="true" :scroll-with-animation="true" scroll-left="0">
  93. <view class="scroll-item" v-for="(item,index) in examPractice" :key="index"
  94. @click="navExamPractice(index)">
  95. <view class="flex-column" style="height: 320rpx;">
  96. <view class="flex-row" style="margin: 10rpx;">
  97. <view :class="subjectIcon.find(x=>x.name === item.subject).icon"></view>
  98. <view class="flex-title">
  99. <view class="YS-title" style="font-size: 40rpx;">{{item.subject}}</view>
  100. <view class="tag-fill">
  101. <view class="t-icon t-icon-zhengceguizhang"></view>
  102. <view class="tag-text">{{item.type}}</view>
  103. </view>
  104. </view>
  105. </view>
  106. <view class="flex-desc">
  107. <view class="YS-title">{{item.title}}</view>
  108. <view class="YS-title" style="font-size: 30rpx;">「 {{item.modality}} 」</view>
  109. <view class="flex-baseline">
  110. <view class="desc">评测题量,共</view>
  111. <view class="num" style="margin-left: 4rpx;">
  112. {{item.amount}}
  113. </view>
  114. <view class="desc" style="margin-left: 4rpx;">题</view>
  115. </view>
  116. </view>
  117. </view>
  118. </view>
  119. </scroll-view>
  120. </view>
  121. </template>
  122. <script>
  123. import {
  124. mapState
  125. } from 'vuex'
  126. export default {
  127. computed: {
  128. ...mapState('m_chart', ['examChartData']),
  129. ...mapState('m_children', ['examData', 'examPractice'])
  130. },
  131. data() {
  132. return {
  133. cardList: [{
  134. icon: 't-icon t-icon-zoushi',
  135. title: '总成绩走势',
  136. type: 'mini-area',
  137. data: ''
  138. }, {
  139. icon: 't-icon t-icon-shuju',
  140. title: '单次考试分析',
  141. type: 'mini-column',
  142. data: ''
  143. }, {
  144. icon: 't-icon t-icon-jiangzhang',
  145. title: '排行占比分析',
  146. type: 'mini-area',
  147. data: ''
  148. }, {
  149. icon: 't-icon t-icon-yingyong',
  150. title: '优劣科目分析',
  151. type: 'mini-rose',
  152. data: ''
  153. }, {
  154. icon: 't-icon t-icon-yunwei',
  155. title: '考试能力分析',
  156. type: 'mini-column',
  157. data: ''
  158. }],
  159. subjectIcon: [{
  160. icon: 't-icon t-icon-yuwen',
  161. name: '语文'
  162. }, {
  163. icon: 't-icon t-icon-shuxue',
  164. name: '数学'
  165. }, {
  166. icon: 't-icon t-icon-yingyu',
  167. name: '英语'
  168. }, {
  169. icon: 't-icon t-icon-tiyu',
  170. name: '体育'
  171. }, {
  172. icon: 't-icon t-icon-tianwen',
  173. name: '科学'
  174. }, {
  175. icon: 't-icon t-icon-zuixinkecheng',
  176. name: '思品'
  177. }, {
  178. icon: 't-icon t-icon-wuli',
  179. name: '物理'
  180. }, {
  181. icon: 't-icon t-icon-huaxue',
  182. name: '化学'
  183. }, {
  184. icon: 't-icon t-icon-meishu',
  185. name: '美术'
  186. }, {
  187. icon: 't-icon t-icon-yinle',
  188. name: '音乐'
  189. }, {
  190. icon: 't-icon t-icon-dili',
  191. name: '地理'
  192. }, {
  193. icon: 't-icon t-icon-lishi',
  194. name: '历史'
  195. }],
  196. image: 'https://ouch-cdn2.icons8.com/yFl5NWU3aVehLBlQf9ctvnZPqtm5U0hqM3IzWvFDCaQ/rs:fit:912:912/czM6Ly9pY29uczgu/b3VjaC1wcm9kLmFz/c2V0cy9wbmcvNzY5/LzY1ZTQxZmZjLTg1/YWQtNDYyMi1hYzU0/LWQ3NDEzZmY2NGI1/YS5wbmc.png',
  197. //完成情况
  198. performance: '',
  199. //完成数据
  200. finishData: '',
  201. finishRate: '',
  202. timeStamp: '',
  203. image1: 'https://image.meiye.art/pic_1631411821365LA63Wc70BLbmyHhj2XjiL',
  204. };
  205. },
  206. onLoad() {
  207. this.init()
  208. },
  209. //刷新页面
  210. onPullDownRefresh() {
  211. this.init()
  212. setTimeout(function() {
  213. uni.stopPullDownRefresh();
  214. }, 1000);
  215. },
  216. methods: {
  217. //初始化
  218. init() {
  219. this.timeStamp = (new Date()).format("hh:mm")
  220. this.$initExam()
  221. this.getChartData()
  222. this.getPerformance()
  223. },
  224. //初始化cardList数据
  225. getChartData() {
  226. this.cardList[0].data = this.examChartData.totalChartData[0]
  227. this.cardList[1].data = this.examChartData.singleChartData[0]
  228. this.cardList[2].data = this.examChartData.rankChartData[0]
  229. this.cardList[3].data = this.examChartData.subjectChartData[0]
  230. this.cardList[4].data = this.examChartData.levelChartData[0]
  231. },
  232. //获得评判信息
  233. getPerformance() {
  234. if (this.examData.length != 0) {
  235. this.finishData = this.examData.filter(x => x.examInfo.progress === 'finish')
  236. this.finishRate = (this.finishData.length * 100 / this.examData.length).toFixed(0)
  237. this.performance = this.finishData.length / this.examData.length >= 0.4 ?
  238. (this.finishData.length / this.examData.length >= 0.7 ? '优秀' : '良好') : '较差'
  239. } else {
  240. this.finishData = []
  241. this.finishRate = 0
  242. this.performance = '无评测'
  243. }
  244. },
  245. //导航
  246. navGradeList(index) {
  247. let urlArr = ['/subpkg/exam/total',
  248. '/subpkg/exam/single',
  249. '/subpkg/exam/rank',
  250. '/subpkg/exam/subject',
  251. '/subpkg/exam/level'
  252. ]
  253. uni.navigateTo({
  254. url: urlArr[index]
  255. })
  256. },
  257. navExamList() {
  258. let value = this.finishRate
  259. uni.navigateTo({
  260. url: `/subpkg/datalist/examList?value=${value}`
  261. })
  262. },
  263. navExamReport(index) {
  264. uni.navigateTo({
  265. url: `/subpkg/datalist/examReport?index=${index}`
  266. })
  267. },
  268. navExamPractice(index) {
  269. uni.navigateTo({
  270. url: `/subpkg/exam/examPractice?index=${index}`
  271. })
  272. }
  273. }
  274. }
  275. </script>
  276. <style lang="scss">
  277. @import '@/pages/style/tab_pages.scss';
  278. .bg1 {
  279. background-color: $color-pink;
  280. }
  281. .tag-fill {
  282. background-color: $color-pink;
  283. margin-left: 20rpx;
  284. }
  285. .circle-line1 {
  286. background-image: linear-gradient(to right, #ff8caf, #ff8caf), linear-gradient(90deg, #FFF -50%, rgba(255, 255, 255, 0.0));
  287. }
  288. .circle-line2 {
  289. background-image: linear-gradient(to right, #ff8caf, #ff8caf), linear-gradient(180deg, #FFF -50%, rgba(255, 255, 255, 0.0));
  290. }
  291. .circle-line3 {
  292. background-image: linear-gradient(to right, #ff8caf, #ff8caf), linear-gradient(0deg, #FFF -50%, rgba(255, 255, 255, 0.0));
  293. }
  294. .flex-title {
  295. display: flex;
  296. flex-direction: column;
  297. height: 100rpx;
  298. justify-content: space-around;
  299. .tag-fill {
  300. background-color: #d8deff;
  301. width: fit-content;
  302. margin-left: 0;
  303. padding: 5rpx 10rpx;
  304. .t-icon {
  305. width: 30rpx;
  306. height: 30rpx;
  307. margin-right: 5rpx;
  308. }
  309. .tag-text {
  310. color: #4169E1;
  311. }
  312. }
  313. }
  314. .flex-desc {
  315. display: flex;
  316. flex-direction: column;
  317. height: 100%;
  318. justify-content: space-around;
  319. margin: 0 30rpx 20rpx 30rpx;
  320. .desc {
  321. line-height: 28rpx;
  322. font-size: 28rpx;
  323. color: $subtitle;
  324. }
  325. .num {
  326. line-height: 40rpx;
  327. font-size: 40rpx;
  328. color: $subtitle;
  329. }
  330. }
  331. </style>