tab_work.vue 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301
  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="total_card" style="background-color:#f9c752">
  26. <view class="flex_cloumn" style="justify-content: space-around;margin: 20rpx 0 20rpx 20rpx;">
  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="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="class_list">
  55. <view class="class_item"
  56. :style="{borderImage: none}"
  57. v-for="(item,index) in workData" :key="index" @click="navWorkData(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_cloumn">
  62. <view class="flex_row">
  63. <view class="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="flex_row"
  74. style="width:510rpx;overflow: hidden;white-space: nowrap;text-overflow: ellipsis">
  75. <view class="class_item_subtitle" style="font-size: 26rpx;font-weight: 400;">
  76. {{item.work.description}}
  77. </view>
  78. </view>
  79. </view>
  80. </view>
  81. </view>
  82. <view class="image_box" v-if="workData.length === 0">
  83. <view class="detail_image_none" :style="{backgroundImage:`url(${image1})`}"></view>
  84. <view class="subtitle">今日孩子暂无作业活动</view>
  85. </view>
  86. </view>
  87. </view>
  88. <view class="flex_cloumn" style="margin: 15rpx 0 10rpx 20rpx;">
  89. <view class="title" style="font-size: 32rpx;">错题本</view>
  90. <view class="bottom-tag"></view>
  91. </view>
  92. <view class="flex_row" style="width: 70%;"></view>
  93. </view>
  94. <scroll-view class="scroll_view_bottom" scroll-x="true" :scroll-with-animation="true" scroll-left="0">
  95. <view class="_item" v-for="(item,index) in mistakeData" :key="index" @click="navWrongBookInfo(index)">
  96. <view class="flex_cloumn_book" :style="{backgroundColor: item.color}">
  97. <view class="book_shadow"></view>
  98. <view class="book_title">{{item.subject}}</view>
  99. <view class="flex_cloumn_box">
  100. <view class="YS-title" style="color: #FFF;font-size: 60rpx;margin-left: auto;">{{item.subject}}
  101. </view>
  102. <view class="flex_baseline" style="margin-left: auto;">
  103. <view class="subtitle" style="font-size: 28rpx;color: #FFF;font-weight: 400;">收录错题</view>
  104. <view class="subtitle"
  105. style="color: #FFF;font-weight: 400;font-size: 40rpx;margin-left: 4rpx;">
  106. {{item.amount}}
  107. </view>
  108. <view class="subtitle"
  109. style="font-size: 28rpx;color: #FFF;font-weight: 400;margin-left: 4rpx;">道</view>
  110. </view>
  111. </view>
  112. </view>
  113. </view>
  114. </scroll-view>
  115. </view>
  116. </template>
  117. <script>
  118. import {
  119. mapState
  120. } from 'vuex'
  121. export default {
  122. computed: {
  123. ...mapState('m_children', ['workData', 'mistakeData']),
  124. ...mapState('m_chart', ['workChartData'])
  125. },
  126. data() {
  127. return {
  128. cardList: [{
  129. icon: 't-icon t-icon-gongzuo',
  130. title: '近期作业完成率',
  131. type: 'mini-column',
  132. data: ''
  133. }, {
  134. icon: 't-icon t-icon-renzheng',
  135. title: '近期作业得分率',
  136. type: 'mini-area',
  137. data: ''
  138. }],
  139. image: 'https://ouch-cdn2.icons8.com/AVOwJ9emg_ZOeHvQaunQAZlgeLsG-b1cGhiYvgoJ06g/rs:fit:912:912/czM6Ly9pY29uczgu/b3VjaC1wcm9kLmFz/c2V0cy9wbmcvNTAw/LzI5YjU1YWQ4LWMw/YTEtNDE1MS1iYmQw/LWIyMDdhYmRkOTE0/Mi5wbmc.png',
  140. //完成情况
  141. performance: '',
  142. //完成数据
  143. finishData: '',
  144. finishRate: '',
  145. timeStamp: '',
  146. image1: 'https://image.meiye.art/pic_16314118207650DBDbJB8Ao3fE8_1bY3Fj',
  147. };
  148. },
  149. onLoad() {
  150. this.init()
  151. },
  152. //刷新页面
  153. onPullDownRefresh() {
  154. this.init()
  155. setTimeout(function() {
  156. uni.stopPullDownRefresh();
  157. }, 1000);
  158. },
  159. methods: {
  160. //初始化
  161. init() {
  162. this.timeStamp = (new Date()).format("hh:mm")
  163. this.$initWork()
  164. this.getWorkChartData()
  165. this.getPerformance()
  166. },
  167. //获得作业图表信息
  168. getWorkChartData() {
  169. this.cardList[0].data = this.workChartData[0]
  170. this.cardList[1].data = this.workChartData[1]
  171. },
  172. //获得评判信息
  173. getPerformance() {
  174. if (this.workData.length != 0) {
  175. this.finishData = this.workData.filter(x => x.work.progress === 'finish')
  176. this.finishRate = (this.finishData.length * 100 / this.workData.length).toFixed(0)
  177. this.performance = this.finishData.length / this.workData.length >= 0.4 ?
  178. (this.finishData.length / this.workData.length >= 0.7 ? '优秀' : '良好') : '较差'
  179. } else {
  180. this.finishData = []
  181. this.finishRate = 0
  182. this.performance = '无作业'
  183. }
  184. },
  185. navWorkStats() {
  186. uni.navigateTo({
  187. url: '/subpkg/work/workstats'
  188. })
  189. },
  190. navWorkList() {
  191. let value = this.finishRate
  192. uni.navigateTo({
  193. url: `/subpkg/datalist/worklist?value=${value}`
  194. })
  195. },
  196. navWorkData(index) {
  197. uni.navigateTo({
  198. url: `/subpkg/datalist/workdata?index=${index}`
  199. })
  200. },
  201. navWrongBookInfo(index){
  202. uni.navigateTo({
  203. url: `/subpkg/work/wrongbookinfo?index=${index}`
  204. })
  205. }
  206. }
  207. }
  208. </script>
  209. <style lang="scss">
  210. @import '@/pages/style/tab_pages.scss';
  211. .bg1 {
  212. background-color: $color-yellow;
  213. }
  214. .flex_row {
  215. margin: 5rpx 20rpx;
  216. }
  217. .tag-fill {
  218. background-color: $color-pink;
  219. margin-left: 20rpx;
  220. }
  221. .image {
  222. top: -50rpx;
  223. }
  224. .circle_line1 {
  225. background-image: linear-gradient(to right, #f9c752, #f9c752), linear-gradient(90deg, #FFF -50%, rgba(255, 255, 255, 0.0));
  226. }
  227. .circle_line2 {
  228. background-image: linear-gradient(to right, #f9c752, #f9c752), linear-gradient(180deg, #FFF -50%, rgba(255, 255, 255, 0.0));
  229. }
  230. .circle_line3 {
  231. background-image: linear-gradient(to right, #f9c752, #f9c752), linear-gradient(0deg, #FFF -50%, rgba(255, 255, 255, 0.0));
  232. }
  233. .scroll_view_bottom {
  234. white-space: nowrap;
  235. height: 350rpx;
  236. ._item {
  237. margin: 4rpx 20rpx 0 20rpx;
  238. display: inline-block;
  239. vertical-align: top;
  240. background-color: #FFF;
  241. border-radius: $border-radius;
  242. height: 300rpx;
  243. width: 240rpx;
  244. z-index: 55;
  245. box-shadow: 1px 0px 2px #ffffff, 2px -1px 2px #d2d2d2, 3px -2px 2px #b4b4b4;
  246. }
  247. }
  248. .flex_cloumn_book {
  249. display: flex;
  250. flex-direction: column;
  251. height: 100%;
  252. width: 100%;
  253. overflow: hidden;
  254. }
  255. .book_title {
  256. position: absolute;
  257. margin-top: 60rpx;
  258. margin-left: 80rpx;
  259. font-size: 130rpx;
  260. font-weight: 600;
  261. color: #FFF;
  262. opacity: 0.2;
  263. writing-mode: vertical-lr;
  264. }
  265. .book_shadow {
  266. position: absolute;
  267. margin-left: 20rpx;
  268. height: 300rpx;
  269. width: 20rpx;
  270. background-image: linear-gradient(to right, rgba(105, 105, 105, 0.1), rgba(255, 255, 255, 0.1));
  271. }
  272. .flex_cloumn_box {
  273. display: flex;
  274. flex-direction: column;
  275. height: 100rpx;
  276. width: 200rpx;
  277. margin: 160rpx 20rpx 40rpx 20rpx;
  278. justify-content: space-between;
  279. z-index: 99;
  280. }
  281. </style>