App.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  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. </div>
  20. <PageFooter v-if="$route.path !== '/'" />
  21. <ul v-else class="contents">
  22. <li><router-link to="/login">登录</router-link></li>
  23. <li><router-link to="/account">账号信息</router-link></li>
  24. <li><router-link to="/password/reset">密码找回</router-link></li>
  25. <li><router-link to="/order">我的订单</router-link></li>
  26. <li><router-link to="/gift-card">我的礼品卡</router-link></li>
  27. <li><router-link to="/order/1">会员权益</router-link></li>
  28. <li><router-link to="/renewal">续费管理</router-link></li>
  29. <li><router-link to="/mailing">邮寄商品</router-link></li>
  30. <li><router-link to="/fill-order">购买下单</router-link></li>
  31. <li><router-link to="/pay-result/success">支付成功</router-link></li>
  32. <li><router-link to="/pay-result/fail">支付失败</router-link></li>
  33. <li><router-link to="/imei/bind">绑定IMEI</router-link></li>
  34. <li><router-link to="/repaire/appointment">维修预约</router-link></li>
  35. <li><router-link to="/repaire/history">维修记录</router-link></li>
  36. <li><router-link to="/invite">邀请好友</router-link></li>
  37. </ul>
  38. </template>
  39. <script setup lang="ts">
  40. import { computed, watch, onMounted } from 'vue'
  41. import { useRoute } from 'vue-router'
  42. import { state } from './store'
  43. import NavBar from './components/nav-bar/index.vue'
  44. import PageFooter from './components/footer/index.vue'
  45. import getLocation from './utils/getLocation'
  46. const route = useRoute()
  47. const navBarIgnore = ['/login', '/register']
  48. const showNavBar = computed(() => !navBarIgnore.includes(route.path))
  49. watch(
  50. () => route.path,
  51. () => (state.bgWhite = false)
  52. )
  53. onMounted(getLocation)
  54. </script>
  55. <style lang="scss">
  56. .main-container {
  57. min-height: 100vh;
  58. padding-bottom: 48px;
  59. background: #f7f7f7;
  60. overflow: hidden;
  61. &:first-child {
  62. background: $primary-color url(@img/bg-sm.png) no-repeat;
  63. background-size: contain;
  64. @include media-breakpoint-up(md) {
  65. background: lightblue;
  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. margin-top: var(--nav-bar-height);
  107. padding-top: 50px;
  108. text-align: center;
  109. line-height: 74px;
  110. font-size: 36px;
  111. a {
  112. color: $primary-color;
  113. text-decoration: underline;
  114. }
  115. }
  116. </style>