index.vue 4.4 KB

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