navigation.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  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. 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/msg/msg',
  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. }
  77. }
  78. }
  79. </script>
  80. <style lang="scss" scoped>
  81. // 选项卡
  82. .nav {
  83. width: 94%;
  84. margin: 25rpx auto;
  85. padding: 30rpx 0;
  86. display: flex;
  87. align-items: center;
  88. justify-content: space-around;
  89. background-color: #fff;
  90. font-size: $uni-font-size-base;
  91. color: $uni-text-regular-color;
  92. border-radius: 10rpx;
  93. .nav-item {
  94. position: relative;
  95. display: flex;
  96. flex-direction: column;
  97. align-items: center;
  98. margin-top: 5rpx;
  99. align-items: center;
  100. flex: 1;
  101. span {
  102. padding: 18rpx;
  103. color: #ffffff;
  104. margin-bottom: 14rpx;
  105. border-radius: 50%;
  106. }
  107. .badge {
  108. position: absolute;
  109. top: 0;
  110. left: 115rpx;
  111. padding: 0rpx 10rpx;
  112. border-radius: 38rpx;
  113. background-color: #ff4949;
  114. color: #fff;
  115. font-style: normal;
  116. }
  117. }
  118. .nav-item:nth-child(1) span {
  119. background-color: $uni-color-success;
  120. }
  121. .nav-item:nth-child(2) span {
  122. background-color: $uni-color-warning;
  123. }
  124. .nav-item:nth-child(3) span {
  125. background-color: $uni-color-primary;
  126. }
  127. .nav-item:nth-child(4) span {
  128. background-color: $uni-color-error;
  129. }
  130. }
  131. </style>