page-foot.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  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}" @tap="cut_index(item.id)">
  11. <i class="fa fa-home iconSize" aria-hidden="true" v-if="0 == item.id"></i>
  12. <image class="img bgWhite" mode="aspectFit" src="/static/icon/qianzhengshenqing.svg" v-if="1 == item.id" ></image>
  13. <image class="img bgWhite" mode="aspectFit" src="/static/icon/in.svg" v-if="2 == item.id" ></image>
  14. <image class="img bgWhite" mode="aspectFit" src="/static/icon/lingliao.svg" v-if="3 == item.id"/>
  15. <image class="img bgWhite" mode="aspectFit" src="/static/icon/quality.svg" v-if="4 == item.id"/>
  16. <view :class="{'tabBar_name':true,'nav_active':show_index == item.id}">{{item.name}}</view>
  17. </view>
  18. </view>
  19. </view>
  20. <!-- 底部导航结束 /////////////////////////////////////////////////////////////-->
  21. </template>
  22. <script>
  23. export default {
  24. props: {
  25. //是否显示底部导航
  26. isShow: {
  27. type: Boolean,
  28. default: true
  29. },
  30. //底部导航栏哪个高亮显示
  31. showIndex: {
  32. type: Number,
  33. default: 0
  34. },
  35. },
  36. data() {
  37. return {
  38. /* 底部导航 */
  39. show_index: 0, //控制显示那个组件
  40. tab_nav_list: [{
  41. 'id': 0,
  42. 'name': '首页'
  43. }, {
  44. 'id': 1,
  45. 'name': '签证申请'
  46. }, {
  47. 'id': 2,
  48. 'name': '入库单'
  49. }, {
  50. 'id': 3,
  51. 'name': '领料单'
  52. }, {
  53. 'id': 4,
  54. 'name': '质量检查'
  55. }], //菜单列表
  56. is_lhp: false,
  57. }
  58. },
  59. created(){
  60. this.show_index=this.showIndex;
  61. },
  62. methods: {
  63. // 切换组件
  64. cut_index(type) {
  65. console.log('----------------------------------', type)
  66. let _this = this
  67. _this.show_index = type
  68. if (_this.show_index == 0) {
  69. uni.navigateTo({
  70. url: '/pages/index/index'
  71. })
  72. } else if (_this.show_index == 1) {
  73. uni.navigateTo({
  74. url: '/pages/template/requisitionlist/requisitionlist'
  75. })
  76. } else if (_this.show_index == 2) {
  77. uni.navigateTo({
  78. url: '/pages/template/GetMaterialIns/GetMaterialIns'
  79. })
  80. } else if (_this.show_index == 3) {
  81. uni.navigateTo({
  82. url: '/pages/template/GetMaterialOuts/GetMaterialOuts'
  83. })
  84. } else if (_this.show_index == 4) {
  85. uni.navigateTo({
  86. url: '/pages/template/GetSafeQualityCheckDTOs/GetSafeQualityCheckDTOs?type=0'
  87. })
  88. }
  89. }
  90. }
  91. }
  92. </script>
  93. <style lang="scss" scoped>
  94. /* 底部导航 */
  95. .tabBar {
  96. width: 100%;
  97. height: 105rpx;
  98. background: $uni-bg-color-red;
  99. border-top: 1px solid #E5E5E5;
  100. position: fixed;
  101. bottom: 0px;
  102. left: 0px;
  103. right: 0px;
  104. display: flex;
  105. align-items: center;
  106. justify-content: center;
  107. }
  108. .tabBar .tabBar_list {
  109. width: 98%;
  110. display: flex;
  111. justify-content: space-between;
  112. }
  113. .tabBar .tabBar_list image {
  114. width: 30rpx;
  115. height: 30rpx;
  116. margin-bottom: 2rpx;
  117. margin-top:2rpx;
  118. }
  119. .tabBar .tabBar_list .tabBar_item {
  120. width: 25%;
  121. display: flex;
  122. justify-content: center;
  123. align-items: center;
  124. flex-direction: column;
  125. color: #fff;
  126. }
  127. .tabBar .tabBar_list .tabBar_item2 {
  128. width: 25%;
  129. height: 100%;
  130. display: flex;
  131. justify-content: center;
  132. align-items: center;
  133. flex-direction: column;
  134. color: #fff;
  135. /* margin-top: -20rpx; */
  136. position: relative;
  137. z-index: 101;
  138. }
  139. .tabBar .tabBar_list .tabBar_item2 image {
  140. width: 40rpx;
  141. height: 40rpx;
  142. }
  143. .border_box {
  144. //pointer-events: none; 事件穿透解决z-index层级问题
  145. width: 100%;
  146. height: 100rpx;
  147. display: flex;
  148. justify-content: center;
  149. align-items: center;
  150. position: fixed;
  151. left: 0px;
  152. bottom: 50rpx;
  153. z-index: 100;
  154. pointer-events: none;
  155. }
  156. .tabBar_miden_border {
  157. width: 100rpx;
  158. height: 50rpx;
  159. border-top: 2rpx solid #E5E5E5;
  160. border-radius: 50rpx 50rpx 0 0;
  161. /* 左上、右上、右下、左下 */
  162. }
  163. .nav_active {
  164. font-size: 12px;
  165. color: #fff;
  166. }
  167. .tabBar_name{
  168. font-size: 12px;
  169. color:#fff;
  170. }
  171. .iconSize{
  172. font-size:18px;
  173. padding-top:5px;
  174. }
  175. .bgWhite{
  176. border:#fff solid 1px;
  177. background-color: #fff;
  178. }
  179. </style>