navigation.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. <template>
  2. <view class="nav">
  3. <view
  4. class="nav-item"
  5. v-for="(item, index) in workList"
  6. @click="toNav(item.link_url)"
  7. >
  8. <span :class="item.class"></span>
  9. <i class="badge" v-if="item.badge">{{ item.badge }}</i>
  10. <label>{{ item.title }}</label>
  11. </view>
  12. </view>
  13. </template>
  14. <script>
  15. import { postJ } from '@/utils/api'
  16. export default {
  17. data () {
  18. return {
  19. workList: [
  20. {
  21. class: 'iconfont icon-bianji',
  22. title: '我的工单',
  23. link_url: '/pages/home/work/work',
  24. badge: 0
  25. },
  26. {
  27. class: 'iconfont icon-dangqiangaojing',
  28. title: '我的消息',
  29. link_url: '/pages/home/msg/msg',
  30. badge: 0
  31. // "num": 1
  32. },
  33. {
  34. class: 'iconfont icon-kuneipandian ',
  35. title: '我的待办',
  36. link_url: '/pages/home/backlog/backlog',
  37. badge: 0
  38. // "num": 1
  39. },
  40. {
  41. class: 'iconfont icon-yizhihang_1',
  42. title: '我的已办',
  43. link_url: '/pages/home/havedone/havedone'
  44. // badge:0
  45. // "num": 1
  46. }
  47. ],
  48. information: 0,
  49. done: 0,
  50. backlog: 0,
  51. workOrderNum: 0
  52. }
  53. },
  54. created () {
  55. this.getCount()
  56. },
  57. methods: {
  58. toNav (url) {
  59. uni.navigateTo({
  60. url: url
  61. })
  62. },
  63. getCount () {
  64. // Promise.all(
  65. // [
  66. // '/myMessage/getMyMessageMenuCount',
  67. // '/myHandle/getMyHandleMenuCount',
  68. // '/workOrder/getMyWorkOrderMenuCount'
  69. // ].map(url => postJ(this.apiUrl + url, null, null, false))
  70. // ).then(result => {
  71. // if (result) {
  72. // this.workList[0].badge = result[2].data.menuCount
  73. // this.workList[1].badge = result[0].data.menuCount
  74. // this.workList[2].badge = result[1].data.waitHandleCount
  75. // // this.workList[3].badge = result[1].data.doneCount
  76. // }
  77. // })
  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>