homework.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. <template>
  2. <view class="homework-container">
  3. <!-- 头部区域 -->
  4. <top-box :timeStamp="timeStamp"></top-box>
  5. <view class="module-container">
  6. <u-tabs :list="list" :current="current" @change="changeModule"
  7. :activeStyle="{color: '#5b7cff',fontWeight: 'bold',transform: 'scale(1.04)',}"
  8. :inactiveStyle="{fontWeight: 'bold',transform: 'scale(1)'}" lineColor="#5b7cff" lineWidth="60"></u-tabs>
  9. <!-- 详情头部卡片 -->
  10. <view class="module-box" v-for="(item,index) in card" :key="index" v-if="current == index">
  11. <view class="card" :style="{backgroundColor: `${item.color}`}">
  12. <view style="display: flex; flex-direction: column;">
  13. <text class="card-title">{{item.title}}{{item.num}}</text>
  14. <text class="card-subtitle">{{item.subtitle}}{{item.finish}}</text>
  15. </view>
  16. <view class="image" :style="{backgroundImage:`url(${item.image})`}"></view>
  17. </view>
  18. <view style="display: flex; align-items: center;">
  19. <view class="cut-off">{{item.detail.nav}}</view>
  20. <!-- <u-button text="获得报表" :plain="true" :hairline="true" shape="circle" size="small"></u-button> -->
  21. </view>
  22. <view class="detail-box">
  23. <view class="detail-box-item">
  24. <view class="item-info">
  25. <view class="t-icon t-icon-ceping"></view>
  26. <view class="item-text">评测完成率</view>
  27. </view>
  28. </view>
  29. <view class="detail-box-item"></view>
  30. <view class="detail-box-item" style="height: 100%;"></view>
  31. </view>
  32. </view>
  33. </view>
  34. </view>
  35. </template>
  36. <script>
  37. import {
  38. mapState
  39. } from 'vuex'
  40. export default {
  41. computed:{
  42. ...mapState('m_chart', ['todayData']),
  43. },
  44. data() {
  45. return {
  46. //模块名
  47. list: [{
  48. name: '评测详情'
  49. }, {
  50. name: '作业详情'
  51. }, {
  52. name: '活动详情'
  53. }],
  54. //当前模块
  55. current: 0,
  56. //时间戳
  57. timeStamp: '',
  58. //卡片内容
  59. card: [{
  60. title: '今日评测数:' + '\xa0\xa0\xa0',
  61. num: 5,
  62. subtitle: '评测已完成:' + '\xa0\xa0\xa0',
  63. finish: 3,
  64. color: '#0080ff;',
  65. image: 'https://ouch-cdn2.icons8.com/T8L5Wxx8kgo2JxDuk2xDweDxuU8WaImv6jndeuNsyVs/rs:fit:912:912/czM6Ly9pY29uczgu/b3VjaC1wcm9kLmFz/c2V0cy9wbmcvNTI3/LzA5ZWEzOGY3LTFh/NTMtNGEyOC05ZGQ2/LTE0ODQ0YTc0NzM2/MC5wbmc.png',
  66. detail: {
  67. nav: '评测信息'
  68. }
  69. }, {
  70. title: '今日作业数:' + '\xa0\xa0\xa0',
  71. num: 3,
  72. subtitle: '作业已完成:' + '\xa0\xa0\xa0',
  73. finish: 3,
  74. color: '#ff8caf;',
  75. image: 'https://ouch-cdn2.icons8.com/BYU619A_iHObQVrS3QMw03-pLb9GS_IiJwZ1w1p5B44/rs:fit:912:912/czM6Ly9pY29uczgu/b3VjaC1wcm9kLmFz/c2V0cy9wbmcvNzAy/L2M5ZWU1M2JmLWQ5/ZWEtNDc2Yi1hZDc0/LTM0MmViZjcwMzU2/ZC5wbmc.png',
  76. detail: {
  77. nav: '作业信息'
  78. }
  79. }, {
  80. title: '今日活动数:' + '\xa0\xa0\xa0',
  81. num: 6,
  82. subtitle: '活动已完成:' + '\xa0\xa0\xa0',
  83. finish: 5,
  84. color: '#f9c752;',
  85. image: 'https://ouch-cdn2.icons8.com/i0qqxE6yUmy-zGPwKqmTGiaxmA2amq9prgLg-LJ75Ow/rs:fit:912:912/czM6Ly9pY29uczgu/b3VjaC1wcm9kLmFz/c2V0cy9wbmcvMjIy/L2Y2N2Q4MjRjLTY1/ZWEtNDNkMS1iZmY2/LTY0NDQwMGVmYTI0/My5wbmc.png',
  86. detail: {
  87. nav: '活动信息'
  88. }
  89. }]
  90. };
  91. },
  92. onLoad() {
  93. this.$getTimeStamp()
  94. },
  95. //刷新页面
  96. onPullDownRefresh() {
  97. this.$getTimeStamp()
  98. console.log('refresh');
  99. setTimeout(function() {
  100. uni.stopPullDownRefresh();
  101. }, 1000);
  102. },
  103. methods: {
  104. //更改模块
  105. changeModule(index) {
  106. this.current = index.index
  107. },
  108. }
  109. }
  110. </script>
  111. <style lang="scss">
  112. .homework-container {
  113. .home-topinfo {
  114. background: linear-gradient($color-green, $page-background-color) !important;
  115. }
  116. }
  117. .module-container {
  118. margin: -70rpx 20rpx 0 20rpx;
  119. .card {
  120. display: flex;
  121. justify-content: space-around;
  122. margin: 20rpx auto 20rpx auto;
  123. height: 260rpx;
  124. width: 96%;
  125. // background: linear-gradient(to right, #ff95007a,#ff8419);
  126. border-radius: $card-border-radius;
  127. .card-title {
  128. margin: 40rpx 0 0 30rpx;
  129. font-size: 45rpx;
  130. font-weight: bold;
  131. color: #FFF;
  132. }
  133. .card-subtitle {
  134. margin: 20rpx 30rpx;
  135. font-size: 35rpx;
  136. font-weight: bold;
  137. color: #FFF;
  138. }
  139. .image {
  140. position: relative;
  141. top: -40rpx;
  142. right: -30rpx;
  143. height: 300rpx;
  144. width: 300rpx;
  145. background-size: contain;
  146. background-repeat: no-repeat;
  147. z-index: 2;
  148. }
  149. }
  150. .cut-off {
  151. font-size: 35rpx;
  152. font-weight: bold;
  153. color: #606266;
  154. margin-left: 20rpx;
  155. }
  156. .detail-box {
  157. display: flex;
  158. flex-flow: column wrap;
  159. justify-content: space-between;
  160. margin: 20rpx auto 20rpx auto;
  161. height: 47vh;
  162. width: 100%;
  163. .detail-box-item {
  164. margin: 0 2%;
  165. height: 48%;
  166. width: auto;
  167. background-color: #FFF;
  168. border-radius: $card-border-radius;
  169. .item-info {
  170. display: flex;
  171. align-items: center;
  172. padding: 20rpx;
  173. .t-icon {
  174. width: 40rpx;
  175. height: 40rpx;
  176. }
  177. .item-text {
  178. font-size: 30rpx;
  179. font-weight: bold;
  180. color: #3B4144;
  181. margin-left: 10rpx;
  182. }
  183. }
  184. }
  185. }
  186. }
  187. .t-icon {
  188. margin: 20rpx;
  189. width: 110rpx;
  190. height: 110rpx;
  191. }
  192. </style>