navigation.vue 3.1 KB

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