page-foot.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. <template>
  2. <!-- 底部导航开始 /////////////////////////////////////////////////////////////-->
  3. <!-- is_lhp判断是否为刘海屏在main.js里,好像uniapp有一个css变量获取刘海屏的安全区域 -->
  4. <view class="tabBar" :style="{height:is_lhp?'140rpx':'98rpx'}" v-show="isShow">
  5. <!-- 导航的中间圆圈 -->
  6. <view class="border_box" :style="{paddingBottom:is_lhp?'40rpx':''}">
  7. <view class="tabBar_miden_border"></view>
  8. </view>
  9. <view class="tabBar_list" :style="{paddingBottom:is_lhp?'40rpx':''}">
  10. <view v-for="(item) in tab_nav_list" :key="item.id" :class="{'tabBar_item':item.id!=2,'tabBar_item2':item.id==2}"
  11. @tap="cut_index(item.id)">
  12. <image v-if="show_index == item.id" :src="`/static/tabBar/${item.id+1}${item.id+1}.png`"></image>
  13. <image v-else :src="`/static/tabBar/${item.id+1}.png`"></image>
  14. <view :class="{'tabBar_name':true,'nav_active':show_index == item.id}">{{item.name}}</view>
  15. </view>
  16. </view>
  17. </view>
  18. <!-- 底部导航结束 /////////////////////////////////////////////////////////////-->
  19. </template>
  20. <script>
  21. export default {
  22. props: {
  23. //是否显示底部导航
  24. isShow: {
  25. type: Boolean,
  26. default: true
  27. },
  28. //底部导航栏哪个高亮显示
  29. showIndex: {
  30. type: Number,
  31. default: 0
  32. },
  33. },
  34. data() {
  35. return {
  36. /* 底部导航 */
  37. show_index: 0, //控制显示那个组件
  38. tab_nav_list: [{
  39. 'id': 0,
  40. 'name': '首页'
  41. }, {
  42. 'id': 1,
  43. 'name': '签证申请'
  44. }, {
  45. 'id': 2,
  46. 'name': '入库单'
  47. }, {
  48. 'id': 3,
  49. 'name': '领料单'
  50. }, {
  51. 'id': 4,
  52. 'name': '质量检查'
  53. }], //菜单列表
  54. is_lhp: false,
  55. }
  56. },
  57. created(){
  58. this.show_index=this.showIndex;
  59. },
  60. methods: {
  61. // 切换组件
  62. cut_index(type) {
  63. console.log('----------------------------------', type)
  64. let _this = this
  65. _this.show_index = type
  66. if (_this.show_index == 0) {
  67. uni.navigateTo({
  68. url: '/pages/index/index'
  69. })
  70. } else if (_this.show_index == 1) {
  71. uni.navigateTo({
  72. url: '/pages/template/requisitionlist/requisitionlist'
  73. })
  74. } else if (_this.show_index == 2) {
  75. uni.navigateTo({
  76. url: '/pages/template/GetMaterialIns/GetMaterialIns'
  77. })
  78. } else if (_this.show_index == 3) {
  79. uni.navigateTo({
  80. url: '/pages/template/GetMaterialOuts/GetMaterialOuts'
  81. })
  82. } else if (_this.show_index == 4) {
  83. uni.navigateTo({
  84. url: '/pages/template/GetSafeQualityCheckDTOs/GetSafeQualityCheckDTOs?type=0'
  85. })
  86. }
  87. }
  88. }
  89. }
  90. </script>
  91. <style scoped>
  92. /* 底部导航 */
  93. .tabBar {
  94. width: 100%;
  95. height: 105rpx;
  96. background: #fff;
  97. border-top: 1px solid #E5E5E5;
  98. position: fixed;
  99. bottom: 0px;
  100. left: 0px;
  101. right: 0px;
  102. display: flex;
  103. align-items: center;
  104. justify-content: center;
  105. }
  106. .tabBar .tabBar_list {
  107. width: 98%;
  108. display: flex;
  109. justify-content: space-between;
  110. }
  111. .tabBar .tabBar_list image {
  112. width: 48rpx;
  113. height: 48rpx;
  114. margin-bottom: 2rpx
  115. }
  116. .tabBar .tabBar_list .tabBar_item {
  117. width: 25%;
  118. display: flex;
  119. justify-content: center;
  120. align-items: center;
  121. flex-direction: column;
  122. font-size: 16rpx;
  123. color: #969BA3;
  124. }
  125. .tabBar .tabBar_list .tabBar_item2 {
  126. width: 25%;
  127. height: 100%;
  128. display: flex;
  129. justify-content: center;
  130. align-items: center;
  131. flex-direction: column;
  132. font-size: 16rpx;
  133. color: #969BA3;
  134. margin-top: -20rpx;
  135. position: relative;
  136. z-index: 101;
  137. }
  138. .tabBar .tabBar_list .tabBar_item2 image {
  139. width: 68rpx;
  140. height: 68rpx;
  141. }
  142. .border_box {
  143. // pointer-events: none; 事件穿透解决z-index层级问题
  144. width: 100%;
  145. height: 100rpx;
  146. display: flex;
  147. justify-content: center;
  148. align-items: center;
  149. position: fixed;
  150. left: 0px;
  151. bottom: 50rpx;
  152. z-index: 100;
  153. pointer-events: none;
  154. .tabBar_miden_border {
  155. width: 100rpx;
  156. height: 50rpx;
  157. border-top: 2rpx solid #E5E5E5;
  158. border-radius: 50rpx 50rpx 0 0;
  159. /* 左上、右上、右下、左下 */
  160. background: #fff;
  161. }
  162. }
  163. .nav_active {
  164. color: #007AFF;
  165. }
  166. </style>