tab_work.vue 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312
  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" @click="navWorkStats">
  12. <view class="card-info">
  13. <view :class="item.icon"></view>
  14. <view class="title">{{item.title}}</view>
  15. </view>
  16. <view class="chart-box">
  17. <qiun-data-charts :type="item.type" :chartData="item.data" />
  18. </view>
  19. </view>
  20. </view>
  21. </scroll-view>
  22. </view>
  23. <!-- 统计卡片 -->
  24. <view class="card-view">
  25. <view class="stat-card" style="background-color:#f9c752">
  26. <view class="card-column">
  27. <view class="flex-baseline">
  28. <text class="_title">今日作业</text>
  29. <text class="_title" style="margin-left: 20rpx;">{{workData.length}}</text>
  30. <text class="_unit">例</text>
  31. </view>
  32. <view class="flex-baseline">
  33. <text class="_subtitle">已完成</text>
  34. <text class="_subtitle" style="margin-left: 20rpx;">{{finishData.length}}</text>
  35. <text class="_unit">例</text>
  36. </view>
  37. <view class="flex-baseline">
  38. <text class="_subtitle">完成情况</text>
  39. <text class="_subtitle" style="margin-left: 20rpx;">{{performance}}</text>
  40. </view>
  41. </view>
  42. <view class="card-image" :style="{backgroundImage:`url(${image})`}"></view>
  43. </view>
  44. <!-- 列表卡片 -->
  45. <view class="card-item" style="width: 100%;">
  46. <view class="card-title">
  47. <view class="front-tag"></view>
  48. <view class="title">今日作业</view>
  49. <view class="flex-row" style="margin: 0 0 0 auto;" @click="navWorkList" v-if="workData.length != 0">
  50. <view class="t-icon t-icon-fenlei"></view>
  51. <view class="title" style="color: #4169E1;margin-left: 10rpx;">作业列表</view>
  52. </view>
  53. </view>
  54. <view class="data-list">
  55. <view class="data-item"
  56. :style="{borderImage: none}"
  57. v-for="(item,index) in workData" :key="index" @click="navWorkReport(index)"
  58. v-if="workData.length != 0">
  59. <view class="flex-row" style="margin: 0 20rpx;">
  60. <view class="t-icon t-icon-workicon" style="width: 60rpx; height: 60rpx;"></view>
  61. <view class="flex-column">
  62. <view class="flex-row">
  63. <view class="item-title">{{item.work.name}}</view>
  64. <view class="tag-fill" style="background-color: #f9c752;">
  65. <view class="tag-text">{{item.work.scope === 'private' ? '个人':'学校'}}</view>
  66. </view>
  67. <view class="tag-fill"
  68. :style="{backgroundColor: item.work.progress === 'finish'? '#23b46c':'#ff5959'}">
  69. <view class="tag-text">{{item.work.progress === 'finish' ? '已完成' : '进行中'}}
  70. </view>
  71. </view>
  72. </view>
  73. <view class="row-desc">
  74. <view class="item-subtitle" style="font-size: 26rpx;font-weight: 400;">
  75. {{item.work.description}}
  76. </view>
  77. </view>
  78. </view>
  79. </view>
  80. </view>
  81. <view class="image-box" v-if="workData.length === 0">
  82. <view class="detail-image-none" :style="{backgroundImage:`url(${image1})`}"></view>
  83. <view class="subtitle">今日孩子暂无作业活动</view>
  84. </view>
  85. </view>
  86. </view>
  87. <view class="flex-column" style="margin: 15rpx 0 10rpx 20rpx;">
  88. <view class="title" style="font-size: 32rpx;">错题本</view>
  89. <view class="bottom-tag"></view>
  90. </view>
  91. <view class="flex-row" style="width: 70%;"></view>
  92. </view>
  93. <scroll-view class="scroll-view-bottom" scroll-x="true" :scroll-with-animation="true" scroll-left="0">
  94. <view class="scroll-item" v-for="(item,index) in mistakeData" :key="index" @click="navWrongBook(index)">
  95. <view class="flex-column-book" :style="{backgroundColor: item.color}">
  96. <view class="book-shadow"></view>
  97. <view class="bg-title">{{item.subject}}</view>
  98. <view class="book-info">
  99. <view class="book-title">{{item.subject}}</view>
  100. <view class="flex-baseline" style="margin-left: auto;">
  101. <view class="book-subtitle" style="margin-left: 0;">收录错题</view>
  102. <view class="book-subtitle" style="font-size: 40rpx;">{{item.amount}}</view>
  103. <view class="book-subtitle">道</view>
  104. </view>
  105. </view>
  106. </view>
  107. </view>
  108. </scroll-view>
  109. </view>
  110. </template>
  111. <script>
  112. import {
  113. mapState
  114. } from 'vuex'
  115. export default {
  116. computed: {
  117. ...mapState('m_children', ['workData', 'mistakeData']),
  118. ...mapState('m_chart', ['workChartData'])
  119. },
  120. data() {
  121. return {
  122. cardList: [{
  123. icon: 't-icon t-icon-gongzuo',
  124. title: '近期作业完成率',
  125. type: 'mini-column',
  126. data: ''
  127. }, {
  128. icon: 't-icon t-icon-renzheng',
  129. title: '近期作业得分率',
  130. type: 'mini-area',
  131. data: ''
  132. }],
  133. image: 'https://ouch-cdn2.icons8.com/AVOwJ9emg_ZOeHvQaunQAZlgeLsG-b1cGhiYvgoJ06g/rs:fit:912:912/czM6Ly9pY29uczgu/b3VjaC1wcm9kLmFz/c2V0cy9wbmcvNTAw/LzI5YjU1YWQ4LWMw/YTEtNDE1MS1iYmQw/LWIyMDdhYmRkOTE0/Mi5wbmc.png',
  134. //完成情况
  135. performance: '',
  136. //完成数据
  137. finishData: '',
  138. finishRate: '',
  139. timeStamp: '',
  140. image1: 'https://image.meiye.art/pic_16314118207650DBDbJB8Ao3fE8_1bY3Fj',
  141. };
  142. },
  143. onLoad() {
  144. this.init()
  145. },
  146. //刷新页面
  147. onPullDownRefresh() {
  148. this.init()
  149. setTimeout(function() {
  150. uni.stopPullDownRefresh();
  151. }, 1000);
  152. },
  153. methods: {
  154. //初始化
  155. init() {
  156. this.timeStamp = (new Date()).format("hh:mm")
  157. this.$initWork()
  158. this.getWorkChartData()
  159. this.getPerformance()
  160. },
  161. //获得作业图表信息
  162. getWorkChartData() {
  163. this.cardList[0].data = this.workChartData[0]
  164. this.cardList[1].data = this.workChartData[1]
  165. },
  166. //获得评判信息
  167. getPerformance() {
  168. if (this.workData.length != 0) {
  169. this.finishData = this.workData.filter(x => x.work.progress === 'finish')
  170. this.finishRate = (this.finishData.length * 100 / this.workData.length).toFixed(0)
  171. this.performance = this.finishData.length / this.workData.length >= 0.4 ?
  172. (this.finishData.length / this.workData.length >= 0.7 ? '优秀' : '良好') : '较差'
  173. } else {
  174. this.finishData = []
  175. this.finishRate = 0
  176. this.performance = '无作业'
  177. }
  178. },
  179. navWorkStats() {
  180. uni.navigateTo({
  181. url: '/subpkg/work/workStats'
  182. })
  183. },
  184. navWorkList() {
  185. let value = this.finishRate
  186. uni.navigateTo({
  187. url: `/subpkg/datalist/workList?value=${value}`
  188. })
  189. },
  190. navWorkReport(index) {
  191. uni.navigateTo({
  192. url: `/subpkg/datalist/workReport?index=${index}`
  193. })
  194. },
  195. navWrongBook(index){
  196. uni.navigateTo({
  197. url: `/subpkg/work/wrongBook?index=${index}`
  198. })
  199. }
  200. }
  201. }
  202. </script>
  203. <style lang="scss">
  204. @import '@/pages/style/tab_pages.scss';
  205. .bg1 {
  206. background-color: $color-yellow;
  207. }
  208. .flex-row {
  209. margin: 5rpx 20rpx;
  210. }
  211. .row-desc{
  212. margin: 5rpx 20rpx;
  213. display: flex;
  214. align-items: center;
  215. width: 510rpx;
  216. overflow: hidden;
  217. white-space: nowrap;
  218. text-overflow: ellipsis
  219. }
  220. .tag-fill {
  221. background-color: $color-pink;
  222. margin-left: 20rpx;
  223. }
  224. .image {
  225. top: -50rpx;
  226. }
  227. .circle-line1 {
  228. background-image: linear-gradient(to right, #f9c752, #f9c752), linear-gradient(90deg, #FFF -50%, rgba(255, 255, 255, 0.0));
  229. }
  230. .circle-line2 {
  231. background-image: linear-gradient(to right, #f9c752, #f9c752), linear-gradient(180deg, #FFF -50%, rgba(255, 255, 255, 0.0));
  232. }
  233. .circle-line3 {
  234. background-image: linear-gradient(to right, #f9c752, #f9c752), linear-gradient(0deg, #FFF -50%, rgba(255, 255, 255, 0.0));
  235. }
  236. .scroll-view-bottom {
  237. margin-top: -10rpx;
  238. .scroll-item {
  239. margin: 10rpx 20rpx 0 20rpx;
  240. display: inline-block;
  241. vertical-align: top;
  242. background-color: #FFF;
  243. border-radius: $border-radius;
  244. height: 300rpx;
  245. width: 240rpx;
  246. z-index: 55;
  247. box-shadow: 1px 0px 2px #ffffff, 2px -1px 2px #d2d2d2, 3px -2px 2px #b4b4b4;
  248. }
  249. }
  250. .flex-column-book {
  251. display: flex;
  252. flex-direction: column;
  253. height: 100%;
  254. width: 100%;
  255. overflow: hidden;
  256. }
  257. .bg-title {
  258. position: absolute;
  259. margin-top: 60rpx;
  260. margin-left: 80rpx;
  261. font-size: 130rpx;
  262. font-weight: 600;
  263. color: #FFF;
  264. opacity: 0.2;
  265. writing-mode: vertical-lr;
  266. }
  267. .book-shadow {
  268. position: absolute;
  269. margin-left: 20rpx;
  270. height: 300rpx;
  271. width: 20rpx;
  272. background-image: linear-gradient(to right, rgba(105, 105, 105, 0.1), rgba(255, 255, 255, 0.1));
  273. }
  274. .book-info {
  275. display: flex;
  276. flex-direction: column;
  277. height: 100rpx;
  278. width: 200rpx;
  279. margin: 160rpx 20rpx 40rpx 20rpx;
  280. justify-content: space-between;
  281. z-index: 99;
  282. .book-title{
  283. line-height: 60rpx;
  284. font-family: YSfont;
  285. color: #FFF;
  286. font-size: 60rpx;
  287. margin-left: auto;
  288. }
  289. .book-subtitle{
  290. font-size: 28rpx;
  291. color: #FFF;
  292. margin-left: 4rpx;
  293. }
  294. }
  295. </style>