App.vue 3.3 KB

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