index.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. <template>
  2. <view class="container">
  3. <view class="navBarBox">
  4. <!-- 状态栏占位 -->
  5. <view class="statusBar" :style="{ paddingTop: statusBarHeight + 'px' }"></view>
  6. <!-- 真正的导航栏内容 -->
  7. <view class="navBar">
  8. 书架
  9. </view>
  10. </view>
  11. <view class="side_help">
  12. <view class="help">
  13. <image class="w-30 h-30 mgb-10" src="/static//image/index/help.png" mode="scaleToFill" />
  14. <view class="text">帮助</view>
  15. </view>
  16. <view class="mgt-20">
  17. <image class="w-30 h-30 mgb-10" src="/static//image/index/complaint.png" mode="scaleToFill" />
  18. <view class="text">投诉</view>
  19. </view>
  20. </view>
  21. <view class="tools" @click="toTools">
  22. <image class="w-80 h-80" src="/static/image/index/tools_icon.png" mode="scaleToFill" />
  23. <view class="title">工具广场</view>
  24. </view>
  25. </view>
  26. <!-- 引入自定义 TabBar -->
  27. <custom-tabbar :currentIndex='0' />
  28. </template>
  29. <script setup>
  30. import { ref, onBeforeMount } from "vue";
  31. import CustomTabbar from "@/components/custom-tabbar.vue";
  32. // 状态栏高度
  33. let statusBarHeight = ref(0);
  34. // 导航栏高度
  35. let navBarHeight = ref(0);
  36. onBeforeMount(() => {
  37. statusBarHeight.value = uni.getSystemInfoSync()['statusBarHeight'];
  38. const custom = uni.getMenuButtonBoundingClientRect();
  39. // 导航栏的高度 = 胶囊的高度 + (胶囊距离顶部的距离 - 状态栏的高度)* 2
  40. // 即胶囊的上下边距
  41. navBarHeight.value = custom.height + (custom.top - statusBarHeight.value) * 2;
  42. });
  43. const toTools = () => {
  44. console.log(111)
  45. uni.navigateTo({
  46. url: "/pages/toolsMall/index",
  47. });
  48. }
  49. </script>
  50. <style lang="scss" scoped>
  51. .container {
  52. .navBarBox {
  53. .navBar {
  54. width: 100%;
  55. height: 80rpx !important;
  56. line-height: 80rpx;
  57. padding-left: 30rpx;
  58. font-size: 32rpx;
  59. color: #333;
  60. }
  61. }
  62. .side_help {
  63. position: fixed;
  64. left: 0;
  65. bottom: 20%;
  66. width: 50rpx;
  67. background-color: red;
  68. display: flex;
  69. flex-direction: column;
  70. align-items: center;
  71. justify-content: center;
  72. color: #fff;
  73. text-align: center;
  74. padding: 20rpx 0;
  75. border-radius: 0 30rpx 30rpx 0;
  76. .text {
  77. text-align: center;
  78. }
  79. }
  80. .tools {
  81. position: fixed;
  82. right: 20rpx;
  83. bottom: 33%;
  84. display: flex;
  85. flex-direction: column;
  86. align-items: center;
  87. justify-content: center;
  88. .title {
  89. margin-top: 2rpx;
  90. font-size: 20rpx;
  91. width: 100rpx;
  92. height: 30rpx;
  93. display: flex;
  94. align-items: center;
  95. justify-content: center;
  96. background: linear-gradient(to right, #c7dae2, #84c9e6);
  97. border-radius: 50rpx;
  98. color: #fff;
  99. }
  100. }
  101. }
  102. </style>