index.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. <template>
  2. <!-- 底部导航 -->
  3. <view class="page-footer">
  4. <view class="foot-item" :class="item.pagePath == activeRouter?'active':''" v-for="(item,index) in footerList"
  5. :key="index" @click="goRouter(item)" v-if="!(item.role!='0'&&!selectMerchantRole.split(',').includes(item.role))">
  6. <block v-if="item.pagePath == activeRouter">
  7. <image :src="item.selectedIconPath"></image>
  8. <view class="txt">{{item.text}}</view>
  9. </block>
  10. <block v-else>
  11. <image :src="item.iconPath"></image>
  12. <view class="txt">{{item.text}}</view>
  13. </block>
  14. </view>
  15. </view>
  16. </template>
  17. <script>
  18. import {
  19. mapGetters
  20. } from "vuex";
  21. export default {
  22. name: 'footerPage',
  23. props: {},
  24. computed: {
  25. ...mapGetters(['selectMerchantRole']),
  26. },
  27. created() {
  28. let routes = getCurrentPages(); //获取当前打开过的页面路由数组
  29. let curRoute = routes[routes.length - 1].route //获取当前页面路由
  30. this.activeRouter = '/' + curRoute
  31. },
  32. mounted() {},
  33. data() {
  34. return {
  35. activeRouter: '',
  36. footerList: [{
  37. pagePath: "/pages/rider_index/work/index",
  38. iconPath: require("../../static/gzth.png"),
  39. selectedIconPath: require("../../static/gztl.png"),
  40. text: "工作台",
  41. role: '0'
  42. },
  43. {
  44. pagePath: "/pages/rider_index/order/index?type=all&orderType=-1",
  45. iconPath: require("../../static/ddh.png"),
  46. selectedIconPath: require("../../static/ddl.png"),
  47. text: "跑腿记录",
  48. role: '1'
  49. },
  50. {
  51. pagePath: "/pages/users/user_spread_user/index",
  52. iconPath: require("../../static/shh.png"),
  53. selectedIconPath: require("../../static/shl.png"),
  54. text: "提现",
  55. role: '3'
  56. }
  57. // {
  58. // pagePath: "/pages/admin/goods/index",
  59. // iconPath: require("../../static/sph.png"),
  60. // selectedIconPath: require("../../static/spl.png"),
  61. // text: "商品",
  62. // role: '2'
  63. // }
  64. ]
  65. }
  66. },
  67. methods: {
  68. goRouter(item) {
  69. var pages = getCurrentPages();
  70. var page = (pages[pages.length - 1]).$page.fullPath;
  71. if (item.pagePath == page) return
  72. console.log(item.pagePath+"----------------")
  73. uni.redirectTo({
  74. url: item.pagePath,
  75. animationType: 'none' // 关闭默认的滑动效果
  76. });
  77. }
  78. }
  79. }
  80. </script>
  81. <style scoped lang="scss">
  82. .page-footer {
  83. position: fixed;
  84. bottom: 0;
  85. left: 0;
  86. z-index: 20;
  87. display: flex;
  88. align-items: center;
  89. justify-content: space-around;
  90. width: 100%;
  91. height: calc(100rpx+ constant(safe-area-inset-bottom)); ///兼容 IOS<11.2/
  92. height: calc(100rpx + env(safe-area-inset-bottom)); ///兼容 IOS>11.2/
  93. box-sizing: border-box;
  94. border-top: solid 1rpx #F3F3F3;
  95. background-color: #fff;
  96. // box-shadow: 0px 0px 17rpx 1rpx rgba(206, 206, 206, 0.32);
  97. padding-bottom: constant(safe-area-inset-bottom); ///兼容 IOS<11.2/
  98. padding-bottom: env(safe-area-inset-bottom); ///兼容 IOS>11.2/
  99. .foot-item {
  100. display: flex;
  101. width: max-content;
  102. align-items: center;
  103. justify-content: center;
  104. flex-direction: column;
  105. position: relative;
  106. padding: 0 20rpx;
  107. &.active {
  108. color: #2A7EFB
  109. }
  110. }
  111. .foot-item image {
  112. height: 40rpx;
  113. width: 40rpx;
  114. text-align: center;
  115. margin: 0 auto;
  116. }
  117. .foot-item .txt {
  118. font-size: 20rpx;
  119. margin-top: 6rpx;
  120. }
  121. }
  122. </style>