navigation.vue 3.3 KB

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