navigation.vue 3.3 KB

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