navigation.vue 3.1 KB

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