navigation.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. <template>
  2. <view class="nav">
  3. <view class="nav-item" v-for="(item, index) in workList" @click="toNav(item.link_url)">
  4. <span :class="item.class"></span>
  5. <i class="badge" v-if="item.badge">{{ item.badge }}</i>
  6. <label>{{ item.title }}</label>
  7. </view>
  8. </view>
  9. </template>
  10. <script>
  11. import {
  12. getTodoTaskPage,
  13. getUnreadNotifyMessageCountAPI
  14. } from '@/api/wt/index.js'
  15. export default {
  16. props: {
  17. workOrder: {
  18. default: {}
  19. }
  20. },
  21. data() {
  22. return {
  23. workList: [{
  24. class: 'iconfont icon-bianji',
  25. title: '工单待办',
  26. link_url: '/pages/home/myTicket/myTicket?orderType=1',
  27. badge: 0
  28. },
  29. {
  30. class: 'iconfont icon-bianji',
  31. title: '工单已办',
  32. link_url: '/pages/home/myTicket/myTicket?orderType=2',
  33. badge: 0
  34. },
  35. {
  36. class: 'iconfont icon-dangqiangaojing',
  37. title: '我的消息',
  38. link_url: '/pages/home/wt/message/message',
  39. badge: 0
  40. // "num": 1
  41. },
  42. {
  43. class: 'iconfont icon-kuneipandian',
  44. title: '流程待办',
  45. link_url: '/pages/home/wt/todo/todo',
  46. badge: 0
  47. // "num": 1
  48. },
  49. {
  50. class: 'iconfont icon-kuneipandian',
  51. title: '流程已办',
  52. link_url: '/pages/home/wt/done/done'
  53. // badge: 0
  54. // badge:0
  55. // "num": 1
  56. }
  57. ],
  58. information: 0,
  59. done: 0,
  60. backlog: 0,
  61. workOrderNum: 0
  62. }
  63. },
  64. watch: {
  65. workOrder: {
  66. handler(newV, oldV) {
  67. this.workList[0].badge = newV.total
  68. },
  69. deep: true
  70. }
  71. },
  72. created() {
  73. this.getCount()
  74. // this.$nextTick(()=>{
  75. // this.workList[0].badge = String(this.workOrder.total)
  76. // })
  77. },
  78. methods: {
  79. toNav(url) {
  80. uni.navigateTo({
  81. url: url
  82. })
  83. },
  84. async getCount() {
  85. // Promise.all(
  86. // [
  87. // '/myMessage/getMyMessageMenuCount',
  88. // '/myHandle/getMyHandleMenuCount',
  89. // '/workOrder/getMyWorkOrderMenuCount'
  90. // ].map(url => postJ(this.apiUrl + url, null, null, false))
  91. // ).then(result => {
  92. // if (result) {
  93. // this.workList[0].badge = result[2].data.menuCount
  94. // this.workList[1].badge = result[0].data.menuCount
  95. // this.workList[2].badge = result[1].data.waitHandleCount
  96. // // this.workList[3].badge = result[1].data.doneCount
  97. // }
  98. // })
  99. const res = await getTodoTaskPage({}, false)
  100. this.workList[2].badge = res.count
  101. const messageCount = await getUnreadNotifyMessageCountAPI()
  102. this.workList[1].badge = Number(messageCount)
  103. }
  104. }
  105. }
  106. </script>
  107. <style lang="scss" scoped>
  108. // 选项卡
  109. .nav {
  110. display: flex;
  111. width: 100%;
  112. padding: 32rpx 0;
  113. margin-bottom: 24rpx;
  114. align-items: center;
  115. justify-content: space-around;
  116. background-color: #fff;
  117. font-size: $uni-font-size-sm;
  118. color: $uni-text-color;
  119. border-radius: 16rpx;
  120. .nav-item {
  121. position: relative;
  122. display: flex;
  123. flex-direction: column;
  124. align-items: center;
  125. margin-top: 5rpx;
  126. align-items: center;
  127. flex: 1;
  128. span {
  129. padding: 18rpx;
  130. color: #ffffff;
  131. margin-bottom: 14rpx;
  132. border-radius: 50%;
  133. }
  134. .badge {
  135. position: absolute;
  136. top: -8rpx;
  137. left: 100rpx;
  138. font-size: 24rpx;
  139. padding: 0rpx 10rpx;
  140. border-radius: 38rpx;
  141. background-color: #ff4949;
  142. color: #fff;
  143. font-style: normal;
  144. }
  145. }
  146. .nav-item:nth-child(1) span {
  147. background-color: $uni-color-success;
  148. }
  149. .nav-item:nth-child(2) span {
  150. background-color: $uni-color-warning;
  151. }
  152. .nav-item:nth-child(3) span {
  153. background-color: $uni-color-primary;
  154. }
  155. .nav-item:nth-child(4) span {
  156. background-color: $uni-color-error;
  157. }
  158. .nav-item:nth-child(5) span {
  159. background-color: $uni-color-success;
  160. }
  161. }
  162. </style>