tab_work.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  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;font-weight: bold;">{{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" :style="{borderImage: item.work.progress === 'finish'?none:'linear-gradient(to right, #f9c752, #FFF) 1'}" v-for="(item,index) in workData" :key="index" @click="navWorkData(index)" v-if="workData.length != 0">
  56. <view class="flex_row" style="margin: 0 20rpx;">
  57. <view class="t-icon t-icon-workicon" style="width: 60rpx; height: 60rpx;"></view>
  58. <view class="flex_cloumn">
  59. <view class="flex_row">
  60. <view class="class_item_title">{{item.work.name}}</view>
  61. <view class="tag_fill" style="background-color: #f9c752;">
  62. <view class="tag_text">{{item.work.scope === 'private' ? '个人':'学校'}}</view>
  63. </view>
  64. <view class="tag_fill"
  65. :style="{backgroundColor: item.work.progress === 'finish'? '#23b46c':'#ff5959'}">
  66. <view class="tag_text">{{item.work.progress === 'finish' ? '已完成' : '进行中'}}
  67. </view>
  68. </view>
  69. </view>
  70. <view class="flex_row"
  71. style="width:510rpx;overflow: hidden;white-space: nowrap;text-overflow: ellipsis">
  72. <view class="class_item_subtitle" style="font-size: 26rpx;font-weight: 400;">
  73. {{item.work.description}}</view>
  74. </view>
  75. </view>
  76. </view>
  77. </view>
  78. <view class="image_box" v-if="workData.length === 0">
  79. <view class="detail_image_none" :style="{backgroundImage:`url(${image1})`}"></view>
  80. <view class="subtitle">今日孩子暂无作业活动</view>
  81. </view>
  82. </view>
  83. </view>
  84. <view class="flex_cloumn" style="margin: 15rpx 0 10rpx 20rpx;">
  85. <view class="title" style="font-size: 32rpx;">作业例题</view>
  86. <view class="bottom_tag"></view>
  87. </view>
  88. <view class="flex_row" style="width: 70%;"></view>
  89. </view>
  90. <scroll-view class="scroll_view_bottom" scroll-x="true" :scroll-with-animation="true" scroll-left="0">
  91. <view class="_item"></view>
  92. <view class="_item"></view>
  93. <view class="_item"></view>
  94. <view class="_item"></view>
  95. <view class="_item"></view>
  96. </scroll-view>
  97. </view>
  98. </template>
  99. <script>
  100. import {
  101. mapState
  102. } from 'vuex'
  103. export default {
  104. computed: {
  105. ...mapState('m_children', ['workData']),
  106. ...mapState('m_chart', ['workChartData'])
  107. },
  108. data() {
  109. return {
  110. cardList: [{
  111. icon: 't-icon t-icon-gongzuo',
  112. title: '近期作业完成率',
  113. type: 'mini-column',
  114. data: ''
  115. }, {
  116. icon: 't-icon t-icon-renzheng',
  117. title: '近期作业得分率',
  118. type: 'mini-area',
  119. data: ''
  120. }],
  121. image: 'https://ouch-cdn2.icons8.com/AVOwJ9emg_ZOeHvQaunQAZlgeLsG-b1cGhiYvgoJ06g/rs:fit:912:912/czM6Ly9pY29uczgu/b3VjaC1wcm9kLmFz/c2V0cy9wbmcvNTAw/LzI5YjU1YWQ4LWMw/YTEtNDE1MS1iYmQw/LWIyMDdhYmRkOTE0/Mi5wbmc.png',
  122. //完成情况
  123. performance: '',
  124. //完成数据
  125. finishData: '',
  126. timeStamp: '',
  127. image1: 'https://image.meiye.art/pic_16314118207650DBDbJB8Ao3fE8_1bY3Fj'
  128. };
  129. },
  130. onLoad() {
  131. this.init()
  132. },
  133. //刷新页面
  134. onPullDownRefresh() {
  135. this.init()
  136. setTimeout(function() {
  137. uni.stopPullDownRefresh();
  138. }, 1000);
  139. },
  140. methods: {
  141. //初始化
  142. init() {
  143. this.timeStamp = (new Date()).format("hh:mm")
  144. this.$initWork()
  145. this.getWorkChartData()
  146. this.getPerformance()
  147. },
  148. //获得作业图表信息
  149. getWorkChartData() {
  150. this.cardList[0].data = this.workChartData[0]
  151. this.cardList[1].data = this.workChartData[1]
  152. },
  153. //获得评判信息
  154. getPerformance() {
  155. if (this.workData.length != 0) {
  156. this.finishData = this.workData.filter(x => x.work.progress === 'finish')
  157. this.performance = this.finishData.length / this.workData.length >= 0.4 ?
  158. (this.finishData.length / this.workData.length >= 0.7 ? '优秀' : '良好') : '较差'
  159. } else {
  160. this.finishData = []
  161. this.performance = '无作业'
  162. }
  163. },
  164. navWorkStats() {
  165. uni.navigateTo({
  166. url: '/subpkg/statslist/workstats'
  167. })
  168. },
  169. navWorkList() {
  170. let value = this.performance
  171. uni.navigateTo({
  172. url: `/subpkg/datalist/worklist?value=${value}`
  173. })
  174. },
  175. navWorkData(index) {
  176. uni.navigateTo({
  177. url: `/subpkg/datalist/workdata?index=${index}`
  178. })
  179. }
  180. }
  181. }
  182. </script>
  183. <style lang="scss">
  184. @import '@/pages/style/tab_pages.scss';
  185. .bg1 {
  186. background-color: $color-yellow;
  187. }
  188. .flex_row {
  189. margin: 5rpx 20rpx;
  190. }
  191. .tag_fill {
  192. background-color: $color-pink;
  193. margin-left: 20rpx;
  194. }
  195. .image {
  196. top: -50rpx;
  197. }
  198. .circle_line1 {
  199. background-image: linear-gradient(to right, #f9c752, #f9c752), linear-gradient(90deg, #FFF -50%, rgba(255, 255, 255, 0.0));
  200. }
  201. .circle_line2 {
  202. background-image: linear-gradient(to right, #f9c752, #f9c752), linear-gradient(180deg, #FFF -50%, rgba(255, 255, 255, 0.0));
  203. }
  204. .circle_line3 {
  205. background-image: linear-gradient(to right, #f9c752, #f9c752), linear-gradient(0deg, #FFF -50%, rgba(255, 255, 255, 0.0));
  206. }
  207. </style>