index.vue 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. <template>
  2. <view>
  3. <view class="app-wrapper" :style="{height: bodyHeight}">
  4. <dataIndex v-if="templateView == 'dataIndex'"></dataIndex>
  5. <liveIndex v-show="templateView == 'liveIndex'"></liveIndex>
  6. <courseIndex v-show="templateView == 'courseIndex'"></courseIndex>
  7. <vipIndex v-show="templateView == 'vipIndex'"></vipIndex>
  8. </view>
  9. <view class="myTabBar x-f x-bc">
  10. <view class="myTabBar-item x-f y-f" @click="handleTab('dataIndex')">
  11. <image src="../../static/logo.png" mode="aspectFill"></image>
  12. <text>数据</text>
  13. </view>
  14. <view class="myTabBar-item x-f y-f" @click="handleTab('liveIndex')">
  15. <image src="../../static/logo.png" mode="aspectFill"></image>
  16. <text>直播课</text>
  17. </view>
  18. <view class="myTabBar-item x-f y-f" @click="handleTab('courseIndex')">
  19. <image src="../../static/logo.png" mode="aspectFill"></image>
  20. <text>训练营</text>
  21. </view>
  22. <view class="myTabBar-item x-f y-f" @click="handleTab('vipIndex')">
  23. <image src="../../static/logo.png" mode="aspectFill"></image>
  24. <text>会员</text>
  25. </view>
  26. </view>
  27. </view>
  28. </template>
  29. <script>
  30. import dataIndex from "./dataIndex/index.vue"
  31. import liveIndex from "./live/index.vue"
  32. import courseIndex from "./course/index.vue"
  33. import vipIndex from "./vip/index.vue"
  34. export default {
  35. components: {
  36. dataIndex,
  37. liveIndex,
  38. courseIndex,
  39. vipIndex
  40. },
  41. data() {
  42. return {
  43. templateView: 'vipIndex',
  44. statusBarHeight: uni.getSystemInfoSync().statusBarHeight,
  45. windowHeight: uni.getSystemInfoSync().windowHeight,
  46. bodyHeight: 0,
  47. }
  48. },
  49. onLoad() {
  50. this.bodyHeight = `calc(${this.windowHeight}px - 56px)`
  51. uni.setNavigationBarTitle({
  52. title: '数据'
  53. });
  54. },
  55. methods: {
  56. handleTab(tem) {
  57. this.templateView = tem
  58. }
  59. }
  60. }
  61. </script>
  62. <style scoped lang="scss">
  63. .app-wrapper {
  64. width: 100%;
  65. }
  66. .myTabBar {
  67. height: 56px;
  68. border-top: 1px solid #f5f5f5;
  69. box-sizing: border-box;
  70. width: 100%;
  71. background-color: #fff;
  72. position: fixed;
  73. bottom: var(--window-bottom);
  74. left: 0;
  75. font-size: 10px;
  76. image {
  77. width: 24px;
  78. height: 24px;
  79. margin-bottom: 3px;
  80. }
  81. &-item {
  82. flex: 1;
  83. }
  84. }
  85. </style>