App.vue 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. <template>
  2. <NavBar
  3. v-if="showNavBar"
  4. :show-nav-icons="!/^\/password/.test($route.path)"
  5. :fixed="true"
  6. />
  7. <div class="main-container" :class="{ 'white-down-md': state.bgWhite }">
  8. <router-view
  9. :class="[
  10. 'main-wrapper',
  11. { 'main-wrapper-fluid': $route.path === '/invite' },
  12. ]"
  13. />
  14. </div>
  15. <PageFooter v-if="$route.path !== '/'" />
  16. </template>
  17. <script setup lang="ts">
  18. import { computed, watch, onMounted } from 'vue'
  19. import { useRoute } from 'vue-router'
  20. import { state } from './store'
  21. import NavBar from './components/nav-bar/index.vue'
  22. import PageFooter from './components/footer/index.vue'
  23. import getLocation from './utils/getLocation'
  24. const route = useRoute()
  25. const navBarIgnore = ['/login', '/register']
  26. const showNavBar = computed(() => !navBarIgnore.includes(route.path))
  27. watch(
  28. () => route.path,
  29. () => (state.bgWhite = false)
  30. )
  31. onMounted(getLocation)
  32. </script>
  33. <style lang="scss">
  34. .main-container {
  35. min-height: 100vh;
  36. padding-bottom: 48px;
  37. background: #f7f7f7;
  38. overflow: hidden;
  39. &:first-child {
  40. background: $primary-color url(@img/bg-sm.png) no-repeat;
  41. background-size: contain;
  42. @include media-breakpoint-up(md) {
  43. background-image: url(@img/bg-lg.jpeg);
  44. background-size: cover;
  45. }
  46. }
  47. &.white-down-md {
  48. @include media-breakpoint-down(md) {
  49. background: #fff;
  50. }
  51. }
  52. @include media-breakpoint-up(md) {
  53. min-height: auto;
  54. }
  55. @include media-breakpoint-only(md) {
  56. padding-bottom: 0;
  57. }
  58. @include media-breakpoint-up(lg) {
  59. padding-bottom: 64px;
  60. }
  61. .nav-bar + & {
  62. padding-top: var(--nav-bar-height);
  63. }
  64. }
  65. .main-wrapper {
  66. margin: auto;
  67. overflow: hidden;
  68. @include media-breakpoint-up(lg) {
  69. width: 768px * 2;
  70. }
  71. @include media-breakpoint-up(xl) {
  72. width: 999px * 2;
  73. }
  74. &-fluid {
  75. width: 100%;
  76. }
  77. .white-down-md & {
  78. background: #fff;
  79. @include media-breakpoint-up(lg) {
  80. margin-top: 64px;
  81. }
  82. }
  83. }
  84. .contents {
  85. padding-top: 50px;
  86. text-align: center;
  87. line-height: 74px;
  88. font-size: 36px;
  89. a {
  90. color: $primary-color;
  91. text-decoration: underline;
  92. }
  93. }
  94. </style>