App.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. <template>
  2. <NavBar
  3. v-if="showNavBar"
  4. :show-nav-icons="!/^\/password/.test($route.path)"
  5. :fixed="true"
  6. />
  7. <div
  8. class="main-container"
  9. :class="{ 'white-down-md': state.bgWhite }"
  10. :style="$route.path === '/' ? 'min-height: auto; padding-bottom: 0;' : ''"
  11. >
  12. <!-- <router-view
  13. :key="$route.fullPath"
  14. :class="[
  15. 'main-wrapper',
  16. { 'main-wrapper-fluid': $route.path === '/invite' },
  17. ]"
  18. /> -->
  19. <router-view v-slot="{ Component }">
  20. <suspense>
  21. <component
  22. :is="Component"
  23. :key="$route.fullPath"
  24. :class="[
  25. 'main-wrapper',
  26. { 'main-wrapper-fluid': $route.path === '/invite' },
  27. ]"
  28. />
  29. </suspense>
  30. </router-view>
  31. </div>
  32. <PageFooter v-if="$route.path !== '/'" />
  33. <ul v-else class="contents">
  34. <li><router-link to="/login">登录</router-link></li>
  35. <li><router-link to="/account">账号信息</router-link></li>
  36. <li><router-link to="/password/reset">密码找回</router-link></li>
  37. <li><router-link to="/order">我的订单</router-link></li>
  38. <li><router-link to="/gift-card">我的礼品卡</router-link></li>
  39. <li><router-link to="/order/1">会员权益</router-link></li>
  40. <li><router-link to="/renewal">续费管理</router-link></li>
  41. <li><router-link to="/mailing">邮寄商品</router-link></li>
  42. <li><router-link to="/fill-order">购买下单</router-link></li>
  43. <li><router-link to="/pay-result/success">支付成功</router-link></li>
  44. <li><router-link to="/pay-result/fail">支付失败</router-link></li>
  45. <li><router-link to="/imei/bind">绑定IMEI</router-link></li>
  46. <li><router-link to="/appointment">维修预约</router-link></li>
  47. <li><router-link to="/appointment-list">维修记录</router-link></li>
  48. <li><router-link to="/invite">邀请好友</router-link></li>
  49. </ul>
  50. </template>
  51. <script setup lang="ts">
  52. import { computed, watch } from 'vue'
  53. import { useRoute } from 'vue-router'
  54. import { state } from './store'
  55. import NavBar from './components/nav-bar/index.vue'
  56. import PageFooter from './components/footer/index.vue'
  57. const route = useRoute()
  58. const navBarIgnore = ['/login', '/register']
  59. const showNavBar = computed(() => !navBarIgnore.includes(route.path))
  60. watch(
  61. () => route.path,
  62. () => (state.bgWhite = false)
  63. )
  64. </script>
  65. <style lang="scss">
  66. .main-container {
  67. min-height: 100vh;
  68. padding-bottom: 48px;
  69. background: #f7f7f7;
  70. overflow: hidden;
  71. &:first-child {
  72. background: lightblue;
  73. }
  74. &.white-down-md {
  75. @include media-breakpoint-down(md) {
  76. background: #fff;
  77. }
  78. }
  79. @include media-breakpoint-up(md) {
  80. min-height: auto;
  81. }
  82. @include media-breakpoint-only(md) {
  83. padding-bottom: 0;
  84. }
  85. @include media-breakpoint-up(lg) {
  86. padding-bottom: 64px;
  87. }
  88. .nav-bar + & {
  89. padding-top: var(--nav-bar-height);
  90. }
  91. }
  92. .main-wrapper {
  93. margin: auto;
  94. overflow: hidden;
  95. @include media-breakpoint-up(lg) {
  96. width: 768px * 2;
  97. }
  98. @include media-breakpoint-up(xl) {
  99. width: 999px * 2;
  100. }
  101. &-fluid {
  102. width: 100%;
  103. }
  104. .white-down-md & {
  105. background: #fff;
  106. @include media-breakpoint-up(lg) {
  107. margin-top: 64px;
  108. }
  109. }
  110. }
  111. .contents {
  112. margin-top: var(--nav-bar-height);
  113. padding-top: 50px;
  114. text-align: center;
  115. line-height: 74px;
  116. font-size: 36px;
  117. a {
  118. color: $primary-color;
  119. text-decoration: underline;
  120. }
  121. }
  122. </style>