cwg-page-wrapper.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <template>
  2. <view class="page-wrapper">
  3. <match-media :min-width="991" v-if="!isLoginPage">
  4. <view class="left-sidebar">
  5. <cwg-sidebar />
  6. <cwg-submenu v-if="sidebarVisible" :items="submenuItems" @submenu-click="onSubmenuClick" />
  7. </view>
  8. </match-media>
  9. <cwg-progress />
  10. <view class="page-content">
  11. <match-media :min-width="991" v-if="!isLoginPage">
  12. <cwg-pc-header @toggle-sidebar="toggleSidebar" />
  13. </match-media>
  14. <match-media :max-width="991">
  15. <cwg-header v-if="!isHeaderFixed" />
  16. </match-media>
  17. <view class="content-wrapper">
  18. <slot />
  19. </view>
  20. <view :style="{ height: isTabBarPage ? '60px' : '0px' }" />
  21. </view>
  22. <match-media :max-width="991">
  23. <cwg-tab-bar v-model:isTabBarPage="isTabBarPage" />
  24. </match-media>
  25. </view>
  26. </template>
  27. <script setup lang="ts">
  28. import { ref } from "vue";
  29. import { onLoad, onShow } from '@dcloudio/uni-app'
  30. import { updateRoute } from '@/hooks/useRoute'
  31. interface MenuItem {
  32. key: string;
  33. label: string;
  34. icon?: string;
  35. children?: MenuItem[];
  36. }
  37. const props = defineProps({
  38. isHeaderFixed: {
  39. type: Boolean,
  40. default: false
  41. },
  42. isLoginPage: {
  43. type: Boolean,
  44. default: false
  45. }
  46. })
  47. const isTabBarPage = ref(false)
  48. const submenuItems = ref<MenuItem[]>([{ key: 'client', label: 'Client Zone', icon: 'icon-client' },
  49. { key: 'promotion', label: 'Promotion Center', icon: 'icon-promotion' },
  50. { key: 'deposit', label: 'Deposit', icon: 'icon-deposit' },
  51. { key: 'withdrawal', label: 'Withdrawal', icon: 'icon-withdrawal' },
  52. { key: 'payment', label: 'Payment History', icon: 'icon-payment' },
  53. { key: 'transfer', label: 'Internal Transfer', icon: 'icon-transfer' },
  54. { key: 'application', label: 'Application History', icon: 'icon-application' },
  55. { key: 'ib', label: 'IB Zone', icon: 'icon-ib' },
  56. { key: 'copy', label: 'Copy Trading', icon: 'icon-copy' },
  57. { key: 'platform', label: 'Trading Platform', icon: 'icon-platform' },
  58. { key: 'chat', label: 'Online Chat', icon: 'icon-chat' },])
  59. const sidebarVisible = ref(true)
  60. function toggleSidebar() {
  61. sidebarVisible.value = !sidebarVisible.value;
  62. }
  63. onLoad(() => {
  64. updateRoute()
  65. })
  66. onShow(() => {
  67. updateRoute()
  68. })
  69. </script>
  70. <style lang="scss" scoped>
  71. @import "@/uni.scss";
  72. .page-wrapper {
  73. display: flex;
  74. flex-direction: row;
  75. height: 100vh;
  76. overflow: hidden;
  77. }
  78. .left-sidebar {
  79. display: flex;
  80. flex-direction: row;
  81. }
  82. .page-content {
  83. flex: 1;
  84. display: flex;
  85. flex-direction: column;
  86. }
  87. .content-wrapper {
  88. flex: 1;
  89. // padding: 0 px2rpx(24) px2rpx(0) px2rpx(24);
  90. box-sizing: border-box;
  91. overflow-y: auto;
  92. }
  93. </style>