pageFoot.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. <template>
  2. <!-- 底部导航 -->
  3. <view :data-theme="theme">
  4. <view>
  5. <view class="page-footer" id="target">
  6. <view class="foot-item" v-for="(item,index) in bottomNavigationList" :key="index"
  7. @click="goRouter(item)">
  8. <block v-if="item.link.split('?')[0] == activeRouter">
  9. <image :src="item.imgList[0]"></image>
  10. <view class="txt">{{item.name}}</view>
  11. </block>
  12. <block v-else>
  13. <image :src="item.imgList[1]"></image>
  14. <view class="unchecked">{{item.name}}</view>
  15. </block>
  16. </view>
  17. </view>
  18. </view>
  19. </view>
  20. </template>
  21. <script>
  22. // +----------------------------------------------------------------------
  23. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  24. // +----------------------------------------------------------------------
  25. // | Copyright (c) 2016~2025 https://www.crmeb.com All rights reserved.
  26. // +----------------------------------------------------------------------
  27. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  28. // +----------------------------------------------------------------------
  29. // | Author: CRMEB Team <admin@crmeb.com>
  30. // +----------------------------------------------------------------------
  31. import {
  32. mapState,
  33. mapGetters
  34. } from "vuex"
  35. import {
  36. getBottomNavigationApi
  37. } from '@/api/api.js';
  38. let app = getApp();
  39. export default {
  40. name: 'pageFooter',
  41. props: {
  42. dataConfig: {
  43. type: Object,
  44. default: () => {}
  45. },
  46. },
  47. data() {
  48. return {
  49. activeRouter: ''
  50. };
  51. },
  52. created() {
  53. let routes = getCurrentPages(); //获取当前打开过的页面路由数组
  54. let curRoute = routes[routes.length - 1].route //获取当前页面路由
  55. this.activeRouter = '/' + curRoute
  56. },
  57. computed: {
  58. bottomNavigationList() {
  59. return this.dataConfig.menuList.list
  60. },
  61. // cover() {
  62. // return this.dataConfig.cover.url
  63. // },
  64. // link() {
  65. // return this.dataConfig.link.val
  66. // },
  67. boxStyle() {
  68. return {
  69. background: `linear-gradient(${this.dataConfig.bgColor.color[0].item}, ${this.dataConfig.bgColor.color[1].item})`,
  70. margin: this.dataConfig.mbConfig.val * 2 + 'rpx' + ' ' + this.dataConfig.lrConfig.val * 2 + 'rpx' +
  71. ' ' + 0,
  72. padding: this.dataConfig.upConfig.val * 2 + 'rpx' + ' ' + 0 + ' ' + this.dataConfig.downConfig.val *
  73. 2 + 'rpx'
  74. }
  75. },
  76. }
  77. }
  78. </script>
  79. <style scoped lang="scss">
  80. .unchecked {
  81. color: #333;
  82. font-size: 24rpx;
  83. }
  84. .page-footer {
  85. position: fixed;
  86. bottom: 0;
  87. z-index: 9;
  88. display: flex;
  89. align-items: center;
  90. justify-content: space-around;
  91. width: 100%;
  92. height: calc(98rpx+ constant(safe-area-inset-bottom)); ///兼容 IOS<11.2/
  93. height: calc(98rpx + env(safe-area-inset-bottom)); ///兼容 IOS>11.2/
  94. box-sizing: border-box;
  95. border-top: solid 1rpx #F3F3F3;
  96. background-color: #fff;
  97. box-shadow: 0px 0px 17rpx 1rpx rgba(206, 206, 206, 0.32);
  98. padding-bottom: constant(safe-area-inset-bottom); ///兼容 IOS<11.2/
  99. padding-bottom: env(safe-area-inset-bottom); ///兼容 IOS>11.2/
  100. .foot-item {
  101. display: flex;
  102. width: max-content;
  103. align-items: center;
  104. justify-content: center;
  105. flex-direction: column;
  106. position: relative;
  107. .count-num {
  108. position: absolute;
  109. display: flex;
  110. justify-content: center;
  111. align-items: center;
  112. width: 40rpx;
  113. height: 40rpx;
  114. top: 0rpx;
  115. right: -15rpx;
  116. color: #fff;
  117. font-size: 20rpx;
  118. background-color: #FD502F;
  119. border-radius: 50%;
  120. padding: 4rpx;
  121. }
  122. }
  123. .foot-item image {
  124. height: 50rpx;
  125. width: 50rpx;
  126. text-align: center;
  127. margin: 0 auto;
  128. }
  129. .foot-item .txt {
  130. font-size: 24rpx;
  131. @include main-color(theme);
  132. &.active {}
  133. }
  134. }
  135. </style>