navigation.vue 3.7 KB

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