homework.vue 15 KB

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