navigation.vue 2.9 KB

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