index.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. <template>
  2. <view class="page-index">
  3. <view class="status_bar"></view>
  4. <div class="title">
  5. <text class="tab" :class="type==='user'?'active':''" @click="changeTab('user')">我的</text>
  6. <text class="tab" :class="type==='group'?'active':''" @click="changeTab('group')">部门</text>
  7. </div>
  8. <div class="statistics">
  9. <div class="head">任务统计</div>
  10. <div class="container">
  11. <div class="item">
  12. <image class="icon" src="@/static/index/wait.png" alt=""></image>
  13. <text>待巡检{{statistics.wait}}个</text>
  14. </div>
  15. <div class="item">
  16. <image class="icon" src="@/static/index/expire.png" alt=""></image>
  17. <text>已逾期{{statistics.expire}}个</text>
  18. </div>
  19. <div class="item">
  20. <image class="icon" src="@/static/index/complete.png" alt=""></image>
  21. <text>已完成{{statistics.complete}}个</text>
  22. </div>
  23. </div>
  24. </div>
  25. <div class="task-list">
  26. <div class="head">待办任务</div>
  27. <div class="item" v-for="(item,index) in items" :key="index" @click="linkTo(item)">
  28. <div class="task-title">{{item.taskTitle}}</div>
  29. <div class="time">{{item.expectedStartDate}}-{{item.expectedEndDate}}</div>
  30. </div>
  31. </div>
  32. </view>
  33. </template>
  34. <script>
  35. import {getCheckTaskByList} from '@/api/task.js'
  36. export default {
  37. data() {
  38. return {
  39. statusBarHeight:0,
  40. type:'user',
  41. statistics: {
  42. wait:0,
  43. expire:0,
  44. complete:0
  45. },
  46. items:[]
  47. }
  48. },
  49. onLoad(){
  50. this.initStatusBarHeight()
  51. },
  52. onShow() {
  53. this.init()
  54. },
  55. methods: {
  56. initStatusBarHeight(){
  57. this.statusBarHeight=uni.getSystemInfoSync().statusBarHeight
  58. },
  59. init(){
  60. getCheckTaskByList({
  61. status:0
  62. }).then((res)=>{
  63. this.items=res.data
  64. this.statistics.wait=res.data.length
  65. // this.statistics.expire=res.data.filter(item=>item.status==1).length
  66. // this.statistics.complete=res.data.filter(item=>item.status==2).length
  67. })
  68. },
  69. changeTab(type){
  70. this.type=type
  71. if(type==='group'){
  72. }else{
  73. }
  74. },
  75. linkTo(item){
  76. uni.setStorageSync('task-item',item)
  77. uni.navigateTo({
  78. url:'/pages/task/task'
  79. })
  80. }
  81. }
  82. }
  83. </script>
  84. <style lang="scss" scoped>
  85. .page-index{
  86. background: linear-gradient(180deg, #4D73FF 0%, rgba(77, 115, 255, 0) 100%);
  87. padding: 0 30upx;
  88. .title{
  89. .tab{
  90. font-size: 34upx;
  91. line-height: 50upx;
  92. margin-right: 32upx;
  93. color: rgba(255, 255, 255, 0.6);
  94. &.active{
  95. color: #fff;
  96. }
  97. }
  98. }
  99. .statistics{
  100. &{
  101. border-radius: 24upx;
  102. background-color: #fff;
  103. padding:36upx 0 44upx 24upx;
  104. margin-top: 48upx;
  105. }
  106. .head{
  107. font-weight: 900;
  108. font-size: 34upx;
  109. line-height: 50upx;
  110. color: #151515;
  111. }
  112. .container{
  113. display: flex;
  114. justify-content: center;
  115. align-items: center;
  116. .item{
  117. width: 33.33%;
  118. display: flex;
  119. justify-content: center;
  120. align-items: center;
  121. flex-direction: column;
  122. .icon{
  123. display: block;
  124. width:88upx;
  125. height: 88upx;
  126. }
  127. text{
  128. font-size: 28upx;
  129. line-height: 42upx;
  130. color: #151515;
  131. padding-top: 18upx;
  132. }
  133. }
  134. }
  135. }
  136. .task-list{
  137. border-radius: 24upx;
  138. background-color: #fff;
  139. margin-top: 24upx;
  140. padding: 36upx 24upx;
  141. .head{
  142. font-weight: 900;
  143. font-size: 34upx;
  144. line-height: 50upx;
  145. color: #151515;
  146. }
  147. .item{
  148. padding: 30upx 40upx 38upx 40upx;
  149. .task-title{
  150. color: #212121;
  151. font-size: 32upx;
  152. padding-bottom: 24upx;
  153. }
  154. .time{
  155. background-image: url(/static/index/time.png);
  156. background-repeat: no-repeat;
  157. background-position: left center;
  158. background-size: 24upx 24upx;
  159. padding-left: 36upx;
  160. color: #999;
  161. font-size: 24upx;
  162. }
  163. }
  164. }
  165. }
  166. .container {
  167. padding: 20px;
  168. font-size: 14px;
  169. line-height: 24px;
  170. }
  171. </style>