index.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. <template>
  2. <view>
  3. <view class="app-wrapper" :style="{height: '100vh'}">
  4. <dataIndex v-if="templateView == 'dataIndex'"></dataIndex>
  5. <liveIndex ref="mescrollItem1" v-show="templateView == 'liveIndex'"></liveIndex>
  6. <operationIndex ref="mescrollItem1" :key="templateView" v-show="templateView == 'operationIndex'">
  7. </operationIndex>
  8. <courseIndex ref="mescrollItem2" v-show="templateView == 'courseIndex'"></courseIndex>
  9. <vipIndex ref="mescrollItem3" v-show="templateView == 'vipIndex'"></vipIndex>
  10. <manageIndex ref="mescrollItem3" v-show="templateView == 'manageIndex'"></manageIndex>
  11. </view>
  12. <view class="myTabBar x-f x-bc">
  13. <view class="myTabBar-item x-f y-f" @click="handleTab('dataIndex')">
  14. <image src="@/static/manageTabIcon/data.png" mode="aspectFill" v-if="templateView!=='dataIndex'">
  15. </image>
  16. <image src="@/static/manageTabIcon/data_on.png" mode="aspectFill" v-else></image>
  17. <text :class="templateView=='dataIndex'?'base-color':''">数据</text>
  18. </view>
  19. <view class="myTabBar-item x-f y-f" @click="handleTab('operationIndex')" v-if="user.userType==0">
  20. <image src="@/static/manageTabIcon/liveclasses.png" mode="aspectFill"
  21. v-if="templateView!=='operationIndex'"></image>
  22. <image src="@/static/manageTabIcon/liveclasses_on.png" mode="aspectFill" v-else></image>
  23. <text :class="templateView=='operationIndex'?'base-color':''">运营</text>
  24. </view>
  25. <view class="myTabBar-item x-f y-f" @click="handleTab('liveIndex')" v-if="user.userType==1">
  26. <image src="@/static/manageTabIcon/liveclasses.png" mode="aspectFill" v-if="templateView!=='liveIndex'">
  27. </image>
  28. <image src="@/static/manageTabIcon/liveclasses_on.png" mode="aspectFill" v-else></image>
  29. <text :class="templateView=='liveIndex'?'base-color':''">直播课</text>
  30. </view>
  31. <view class="myTabBar-item x-f y-f" @click="handleTab('courseIndex')">
  32. <image src="@/static/manageTabIcon/training.png" mode="aspectFill" v-if="templateView!=='courseIndex'">
  33. </image>
  34. <image src="@/static/manageTabIcon/training_on.png" mode="aspectFill" v-else></image>
  35. <text :class="templateView=='courseIndex'?'base-color':''" v-if="user.userType==1">训练营</text>
  36. <text :class="templateView=='courseIndex'?'base-color':''" v-else>课程库</text>
  37. </view>
  38. <view class="myTabBar-item x-f y-f" @click="handleTab('vipIndex')">
  39. <image src="@/static/manageTabIcon/vip.png" mode="aspectFill" v-if="templateView!=='vipIndex'"></image>
  40. <image src="@/static/manageTabIcon/vip_on.png" mode="aspectFill" v-else></image>
  41. <text :class="templateView=='vipIndex'?'base-color':''">会员</text>
  42. </view>
  43. <view class="myTabBar-item x-f y-f" @click="handleTab('manageIndex')" v-if="user.userType==0">
  44. <image src="@/static/manageTabIcon/manage.png" mode="aspectFill" v-if="templateView!=='manageIndex'">
  45. </image>
  46. <image src="@/static/manageTabIcon/manage_on.png" mode="aspectFill" v-else></image>
  47. <text :class="templateView=='manageIndex'?'base-color':''">管理</text>
  48. </view>
  49. </view>
  50. </view>
  51. </template>
  52. <script>
  53. import MescrollCompMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mixins/mescroll-comp.js";
  54. import MescrollMoreMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mixins/mescroll-more.js";
  55. import dataIndex from "./dataIndex/index.vue"
  56. import liveIndex from "./live/index.vue"
  57. import courseIndex from "./course/index.vue"
  58. import vipIndex from "./vip/index.vue"
  59. import operationIndex from './operation/index.vue'
  60. import manageIndex from './manage/index.vue'
  61. export default {
  62. mixins: [ MescrollCompMixin,MescrollMoreMixin], //mescroll-body写在子组件时
  63. components: {
  64. dataIndex,
  65. liveIndex,
  66. courseIndex,
  67. vipIndex,
  68. operationIndex,
  69. manageIndex
  70. },
  71. data() {
  72. return {
  73. templateView: 'vipIndex',
  74. statusBarHeight: uni.getSystemInfoSync().statusBarHeight,
  75. windowHeight: uni.getSystemInfoSync().windowHeight,
  76. bodyHeight: 0,
  77. tabIndex: 0,
  78. user: []
  79. }
  80. },
  81. onLoad() {
  82. // console.log(this.windowHeight);
  83. this.bodyHeight = `calc(${this.windowHeight}px - 56px)`
  84. uni.setNavigationBarTitle({
  85. title: '数据'
  86. });
  87. },
  88. mounted() {
  89. this.user = uni.getStorageSync("companyUserInfo") ? JSON.parse(uni.getStorageSync("companyUserInfo")) : {}
  90. if (this.user.userType == 0) {
  91. this.templateView = 'manageIndex'
  92. } else {
  93. this.templateView = 'vipIndex'
  94. }
  95. },
  96. methods: {
  97. handleTab(tem) {
  98. this.templateView = tem
  99. // console.log(tem)
  100. }
  101. }
  102. }
  103. </script>
  104. <style scoped lang="scss">
  105. .app-wrapper {
  106. width: 100%;
  107. }
  108. .myTabBar {
  109. height: 64px;
  110. border-top: 1px solid #f5f5f5;
  111. box-sizing: border-box;
  112. width: 100%;
  113. background-color: #fff;
  114. position: fixed;
  115. bottom: var(--window-bottom);
  116. left: 0;
  117. font-size: 10px;
  118. image {
  119. width: 24px;
  120. height: 24px;
  121. margin-bottom: 3px;
  122. }
  123. &-item {
  124. flex: 1;
  125. }
  126. }
  127. </style>