homework.vue 13 KB

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