navigation.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  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 } 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/msg/msg',
  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-yizhihang_1',
  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. }
  100. }
  101. }
  102. </script>
  103. <style lang="scss" scoped>
  104. // 选项卡
  105. .nav {
  106. width: 94%;
  107. margin: 25rpx auto;
  108. padding: 30rpx 0;
  109. display: flex;
  110. align-items: center;
  111. justify-content: space-around;
  112. background-color: #fff;
  113. font-size: $uni-font-size-base;
  114. color: $uni-text-regular-color;
  115. border-radius: 10rpx;
  116. .nav-item {
  117. position: relative;
  118. display: flex;
  119. flex-direction: column;
  120. align-items: center;
  121. margin-top: 5rpx;
  122. align-items: center;
  123. flex: 1;
  124. span {
  125. padding: 18rpx;
  126. color: #ffffff;
  127. margin-bottom: 14rpx;
  128. border-radius: 50%;
  129. }
  130. .badge {
  131. position: absolute;
  132. top: -8rpx;
  133. left: 100rpx;
  134. font-size: 24rpx;
  135. padding: 0rpx 10rpx;
  136. border-radius: 38rpx;
  137. background-color: #ff4949;
  138. color: #fff;
  139. font-style: normal;
  140. }
  141. }
  142. .nav-item:nth-child(1) span {
  143. background-color: $uni-color-success;
  144. }
  145. .nav-item:nth-child(2) span {
  146. background-color: $uni-color-warning;
  147. }
  148. .nav-item:nth-child(3) span {
  149. background-color: $uni-color-primary;
  150. }
  151. .nav-item:nth-child(4) span {
  152. background-color: $uni-color-error;
  153. }
  154. }
  155. </style>