homework.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471
  1. <template>
  2. <view class="homework-container">
  3. <!-- 头部区域 -->
  4. <top-box :timeStamp="timeStamp" />
  5. <view class="module-container">
  6. <view style="margin: 0 20rpx;">
  7. <u-tabs :list="list" :current="current" @change="changeModule"
  8. :activeStyle="{color: '#5b7cff',fontWeight: 'bold',transform: 'scale(1.04)',}"
  9. :inactiveStyle="{fontWeight: 'bold',transform: 'scale(1)'}" lineColor="#5b7cff" lineWidth="60">
  10. </u-tabs>
  11. </view>
  12. <!-- 详情头部卡片 -->
  13. <view class="module-box" v-for="(item,index) in card" :key="index" v-if="current == index">
  14. <view class="card" :style="{backgroundColor: `${item.color}`}">
  15. <view style="display: flex; flex-direction: column;">
  16. <text class="card-title">{{item.title}}{{item.detail.data.length}}</text>
  17. <text class="card-subtitle">{{item.subtitle}}{{item.detail.finishData.length}}</text>
  18. <text class="card-subtitle">完成情况: {{item.level}}</text>
  19. </view>
  20. <view class="image" :style="{backgroundImage:`url(${item.image})`}"></view>
  21. </view>
  22. <!-- 中间标题 -->
  23. <view style="display: flex; align-items: center;">
  24. <view class="cut-off">{{item.detail.nav}}</view>
  25. <!-- <u-button text="获得报表" :plain="true" :hairline="true" shape="circle" size="small"></u-button> -->
  26. </view>
  27. <!-- 列表 -->
  28. <view class="detail-box" v-if="current == index">
  29. <view class="detail-box-item">
  30. <view class="item-info">
  31. <view class="t-icon t-icon-ceping"></view>
  32. <view class="item-text">近七天完成率</view>
  33. </view>
  34. <!-- 图表部分 -->
  35. <view class="charts-box" v-if="current == 0">
  36. <qiun-data-charts type="fin-area" :chartData="homeworkData.testData" :loadingType="4" :canvas2d='true' tooltipFormat='HomeworkPercent' canvasId='canvans0980111' />
  37. </view>
  38. <view class="charts-box" v-if="current == 1">
  39. <qiun-data-charts type="fin-area" :chartData="homeworkData.homeworkData" :loadingType="4" :canvas2d='true' tooltipFormat='HomeworkPercent' canvasId='canvans0933511' />
  40. </view>
  41. <view class="charts-box" v-if="current == 2">
  42. <qiun-data-charts type="fin-area" :chartData="homeworkData.activityData" :loadingType="4" :canvas2d='true' tooltipFormat='HomeworkPercent' canvasId='canvans0531032' />
  43. </view>
  44. </view>
  45. <view class="detail-box-item">
  46. <view class="item-info">
  47. <view class="t-icon t-icon-shenhe"></view>
  48. <view class="item-text">今日已完成</view>
  49. </view>
  50. <view style="display: flex; flex-wrap: wrap;">
  51. <view class="block-finish" v-for="(j,y) in item.detail.finishData" :key="y">
  52. <view class="title">{{j.name}}</view>
  53. <view style="display: flex;">
  54. <view class="tag-box">
  55. <view class="tag">{{j.subject}}</view>
  56. </view>
  57. <view class="tag-box">
  58. <view class="tag">{{j.teacher}}</view>
  59. </view>
  60. </view>
  61. </view>
  62. </view>
  63. </view>
  64. <view class="detail-box-item">
  65. <view class="item-info">
  66. <view class="t-icon t-icon-daiban"></view>
  67. <view class="item-text">{{item.detail.title}}</view>
  68. </view>
  69. <view class="class-block" v-for="(i,x) in item.detail.data" :key="x">
  70. <view class="block-title">{{i.name}}</view>
  71. <view class="block-tag-box">
  72. <view class="block-tag">{{i.subject}}</view>
  73. </view>
  74. <view class="block-tag-box">
  75. <view class="block-tag">{{i.teacher}}</view>
  76. </view>
  77. <view class="block-subtitle">{{i.description}}</view>
  78. </view>
  79. </view>
  80. </view>
  81. </view>
  82. </view>
  83. </view>
  84. </template>
  85. <script>
  86. import {
  87. mapState,
  88. mapMutations
  89. } from 'vuex'
  90. export default {
  91. computed: {
  92. ...mapState('m_chart', ['homeworkData', 'todayData']),
  93. },
  94. data() {
  95. return {
  96. //模块名
  97. list: [{
  98. name: '评测详情'
  99. }, {
  100. name: '作业详情'
  101. }, {
  102. name: '活动详情'
  103. }],
  104. //当前模块
  105. current: 0,
  106. //时间戳
  107. timeStamp: '',
  108. //卡片内容
  109. card: [{
  110. title: '今日评测数:' + '\xa0\xa0\xa0',
  111. subtitle: '评测已完成:' + '\xa0\xa0\xa0',
  112. level: '良好',
  113. color: '#0080ff;',
  114. image: 'https://ouch-cdn2.icons8.com/gpV8ZT40juL5H5uR0cv7ptJaV0vbUu64ANLmkch6cr4/rs:fit:1289:912/czM6Ly9pY29uczgu/b3VjaC1wcm9kLmFz/c2V0cy9zdmcvNTE3/L2M0Zjg4MDUzLTMx/ZDUtNDlhZS05M2Nj/LWU4YWM3YTNjODAx/My5zdmc.png',
  115. detail: {
  116. nav: '评测信息',
  117. title: '评测列表',
  118. data: [{
  119. name: '评测数据1',
  120. subject: '数学',
  121. teacher: '王老师',
  122. description: '这里是评测描述信息'
  123. }, {
  124. name: '评测数据2',
  125. subject: '语文',
  126. teacher: '张老师',
  127. description: '这里是评测描述信息'
  128. }, {
  129. name: '评测数据3',
  130. subject: '语文',
  131. teacher: '张老师',
  132. description: '这里是评测描述信息'
  133. }, {
  134. name: '评测数据4',
  135. subject: '思品',
  136. teacher: '李老师',
  137. description: '这里是评测描述信息'
  138. }, {
  139. name: '评测数据5',
  140. subject: '科学',
  141. teacher: '李老师',
  142. description: '这里是评测描述信息'
  143. }],
  144. finishData: [{
  145. name: '评测数据1',
  146. subject: '数学',
  147. teacher: '王老师',
  148. description: '这里是评测描述信息'
  149. }, {
  150. name: '评测数据2',
  151. subject: '语文',
  152. teacher: '张老师',
  153. description: '这里是评测描述信息'
  154. }, {
  155. name: '评测数据3',
  156. subject: '语文',
  157. teacher: '张老师',
  158. description: '这里是评测描述信息'
  159. }]
  160. }
  161. }, {
  162. title: '今日作业数:' + '\xa0\xa0\xa0',
  163. subtitle: '作业已完成:' + '\xa0\xa0\xa0',
  164. level: '完美',
  165. color: '#ff8caf;',
  166. image: 'https://ouch-cdn2.icons8.com/XuAMXajgkDqsOY7cp6uY1LQivtTxahNZjWM1Qk2bfoY/rs:fit:1216:912/czM6Ly9pY29uczgu/b3VjaC1wcm9kLmFz/c2V0cy9zdmcvMzE4/LzdjYTU2NDM4LTc4/MTktNDVhNi1hMjZh/LTMyZWE5NDE4YzI5/My5zdmc.png',
  167. detail: {
  168. nav: '作业信息',
  169. title: '作业列表',
  170. data: [{
  171. name: '作业数据1',
  172. subject: '数学',
  173. teacher: '王老师',
  174. description: '这里是作业描述信息'
  175. }, {
  176. name: '作业数据2',
  177. subject: '数学',
  178. teacher: '王老师',
  179. description: '这里是作业描述信息'
  180. }, {
  181. name: '作业数据3',
  182. subject: '数学',
  183. teacher: '王老师',
  184. description: '这里是作业描述信息'
  185. }],
  186. finishData:[{
  187. name: '作业数据1',
  188. subject: '数学',
  189. teacher: '王老师',
  190. description: '这里是作业描述信息'
  191. }, {
  192. name: '作业数据2',
  193. subject: '数学',
  194. teacher: '王老师',
  195. description: '这里是作业描述信息'
  196. }, {
  197. name: '作业数据3',
  198. subject: '数学',
  199. teacher: '王老师',
  200. description: '这里是作业描述信息'
  201. }]
  202. }
  203. }, {
  204. title: '今日活动数:' + '\xa0\xa0\xa0',
  205. subtitle: '活动已完成:' + '\xa0\xa0\xa0',
  206. level: '优秀',
  207. color: '#f9c752;',
  208. image: 'https://ouch-cdn2.icons8.com/xrmiKHmKAqKegMFWYXXUHk6mqTXXTqoU0wsTFULoboQ/rs:fit:1002:912/czM6Ly9pY29uczgu/b3VjaC1wcm9kLmFz/c2V0cy9zdmcvNzcy/LzczYWVmZjhkLTk4/N2ItNDI2Ny04NmNk/LTA1NTI4YjhiMTIw/Ni5zdmc.png',
  209. detail: {
  210. nav: '活动信息',
  211. title: '活动列表',
  212. data: [{
  213. name: '活动数据1',
  214. subject: '数学',
  215. teacher: '王老师',
  216. description: '这里是活动描述信息'
  217. }, {
  218. name: '活动数据2',
  219. subject: '语文',
  220. teacher: '张老师',
  221. description: '这里是活动描述信息'
  222. }, {
  223. name: '活动数据3',
  224. subject: '语文',
  225. teacher: '张老师',
  226. description: '这里是活动描述信息'
  227. }, {
  228. name: '活动数据4',
  229. subject: '数学',
  230. teacher: '王老师',
  231. description: '这里是活动描述信息'
  232. }, {
  233. name: '活动数据5',
  234. subject: '数学',
  235. teacher: '王老师',
  236. description: '这里是活动描述信息'
  237. }, {
  238. name: '活动数据6',
  239. subject: '数学',
  240. teacher: '王老师',
  241. description: '这里是活动描述信息'
  242. }],
  243. finishData:[{
  244. name: '活动数据1',
  245. subject: '数学',
  246. teacher: '王老师',
  247. description: '这里是活动描述信息'
  248. }, {
  249. name: '活动数据2',
  250. subject: '语文',
  251. teacher: '张老师',
  252. description: '这里是活动描述信息'
  253. }, {
  254. name: '活动数据3',
  255. subject: '语文',
  256. teacher: '张老师',
  257. description: '这里是活动描述信息'
  258. }, {
  259. name: '活动数据4',
  260. subject: '数学',
  261. teacher: '王老师',
  262. description: '这里是活动描述信息'
  263. }, {
  264. name: '活动数据5',
  265. subject: '数学',
  266. teacher: '王老师',
  267. description: '这里是活动描述信息'
  268. }]
  269. }
  270. }],
  271. //历史数据
  272. historyData: {
  273. test: [90, 89, 98, 100, 50, 55, 77],
  274. homework: [10, 29, 38, 60, 50, 88, 100],
  275. activity: [70, 19, 28, 40, 60, 100, 100]
  276. },
  277. };
  278. },
  279. onLoad() {
  280. this.$getTimeStamp()
  281. this.saveToStudyChart()
  282. let routes = getCurrentPages(); // 获取当前打开过的页面路由数组
  283. let curParam = routes[routes.length - 1].options; //获取路由参数
  284. this.current = curParam.index
  285. },
  286. //刷新页面
  287. onPullDownRefresh() {
  288. this.$getTimeStamp()
  289. console.log('refresh');
  290. setTimeout(function() {
  291. uni.stopPullDownRefresh();
  292. }, 1000);
  293. },
  294. methods: {
  295. ...mapMutations('m_chart', ['updateTestColumn', 'updateHomeworkColumn', 'updateActivityColumn']),
  296. //更改模块
  297. changeModule(index) {
  298. this.current = index.index
  299. },
  300. //记录到图表
  301. saveToStudyChart() {
  302. let temp = {
  303. categories: [],
  304. series: [{
  305. "name": "",
  306. "data": []
  307. }]
  308. }
  309. //时间
  310. temp.categories = this.$getRecentDateArray(7)
  311. //数据
  312. //解除对象指向同一块内存(拷贝)
  313. temp.series[0].data = this.historyData.test
  314. let testDataTemp = JSON.parse(JSON.stringify(temp))
  315. this.updateTestColumn(testDataTemp)
  316. temp.series[0].data = this.historyData.homework
  317. let homeworkDataTemp = JSON.parse(JSON.stringify(temp))
  318. this.updateHomeworkColumn(homeworkDataTemp)
  319. temp.series[0].data = this.historyData.activity
  320. let activityDataTemp = JSON.parse(JSON.stringify(temp))
  321. this.updateActivityColumn(activityDataTemp)
  322. }
  323. }
  324. }
  325. </script>
  326. <style lang="scss">
  327. @import '@/pages/common/blockmsg.scss';
  328. .home-topinfo {
  329. background: linear-gradient($color-green, $page-background-color) !important;
  330. }
  331. .module-container {
  332. margin-top: -70rpx;
  333. .card {
  334. display: flex;
  335. justify-content: space-around;
  336. margin: 20rpx auto 20rpx auto;
  337. height: 250rpx;
  338. width: 96%;
  339. // background: linear-gradient(to right, #ff95007a,#ff8419);
  340. border-radius: $card-border-radius;
  341. .card-title {
  342. margin: 30rpx 0 20rpx 20rpx;
  343. font-size: 45rpx;
  344. font-weight: bold;
  345. color: #FFF;
  346. }
  347. .card-subtitle {
  348. margin: 10rpx 20rpx;
  349. font-size: 28rpx;
  350. color: #FFF;
  351. }
  352. .image {
  353. position: relative;
  354. top: -40rpx;
  355. right: -30rpx;
  356. height: 300rpx;
  357. width: 300rpx;
  358. background-size: contain;
  359. background-repeat: no-repeat;
  360. z-index: 2;
  361. }
  362. }
  363. .cut-off {
  364. font-size: 35rpx;
  365. font-weight: bold;
  366. color: #606266;
  367. margin-left: 40rpx;
  368. }
  369. .detail-box {
  370. display: flex;
  371. flex-flow: row wrap;
  372. margin: 20rpx;
  373. justify-content: space-between;
  374. .detail-box-item {
  375. margin: 2% 0;
  376. width: 100%;
  377. height: auto;
  378. background-color: #FFF;
  379. border-radius: $card-border-radius;
  380. .item-info {
  381. display: flex;
  382. align-items: center;
  383. padding: 20rpx;
  384. .t-icon {
  385. width: 40rpx;
  386. height: 40rpx;
  387. }
  388. .item-text {
  389. font-size: 30rpx;
  390. font-weight: bold;
  391. color: $color-title;
  392. margin-left: 15rpx;
  393. }
  394. }
  395. }
  396. }
  397. }
  398. .block-finish{
  399. display: flex;
  400. flex-direction: column;
  401. align-items: center;
  402. justify-content: space-around;
  403. background-color: #f6f6f6;
  404. margin: 10rpx auto 10rpx auto;
  405. padding: 5rpx;
  406. width: 44%;
  407. height: 120rpx;
  408. border-radius: $card-border-radius;
  409. .title {
  410. font-size: 30rpx;
  411. font-weight: bold;
  412. color: $color-title;
  413. }
  414. .subtitle {
  415. font-size: 22rpx;
  416. color: $color-title;
  417. }
  418. .tag-box{
  419. border-radius: 20rpx;
  420. border: 1rpx solid #3C9CFF;
  421. padding: 6rpx;
  422. margin: 10rpx;
  423. .tag{
  424. font-size: 22rpx;
  425. color: #3C9CFF;
  426. }
  427. }
  428. }
  429. .charts-box {
  430. width: 100%;
  431. height: 230rpx;
  432. margin-bottom: 20rpx;
  433. }
  434. </style>