navigation.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  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. 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. // const res = await getTodoList({}, false)
  86. // this.workList[0].badge = res.count
  87. const messageCount = await getUnreadNotifyMessageCountAPI()
  88. this.workList[2].badge = Number(messageCount)
  89. }
  90. }
  91. }
  92. </script>
  93. <style lang="scss" scoped>
  94. // 选项卡
  95. .nav {
  96. display: flex;
  97. width: 100%;
  98. padding: 32rpx 0;
  99. margin-bottom: 24rpx;
  100. align-items: center;
  101. justify-content: space-around;
  102. background-color: #fff;
  103. font-size: $uni-font-size-sm;
  104. color: $uni-text-color;
  105. border-radius: 16rpx;
  106. .nav-item {
  107. position: relative;
  108. display: flex;
  109. flex-direction: column;
  110. align-items: center;
  111. margin-top: 5rpx;
  112. align-items: center;
  113. flex: 1;
  114. span {
  115. padding: 18rpx;
  116. color: #ffffff;
  117. margin-bottom: 14rpx;
  118. border-radius: 50%;
  119. }
  120. .badge {
  121. position: absolute;
  122. top: -8rpx;
  123. left: 100rpx;
  124. font-size: 24rpx;
  125. padding: 0rpx 10rpx;
  126. border-radius: 38rpx;
  127. background-color: #ff4949;
  128. color: #fff;
  129. font-style: normal;
  130. }
  131. }
  132. .nav-item:nth-child(1) span {
  133. background-color: $uni-color-success;
  134. }
  135. .nav-item:nth-child(2) span {
  136. background-color: $uni-color-warning;
  137. }
  138. .nav-item:nth-child(3) span {
  139. background-color: $uni-color-primary;
  140. }
  141. .nav-item:nth-child(4) span {
  142. background-color: $uni-color-error;
  143. }
  144. .nav-item:nth-child(5) span {
  145. background-color: $uni-color-success;
  146. }
  147. }
  148. </style>