Browse Source

细节优化

冯诚 2 years ago
parent
commit
b2d53314a6
7 changed files with 47 additions and 15 deletions
  1. 14 12
      src/App.vue
  2. 1 1
      src/components/nav-bar/index.vue
  3. 8 0
      src/pages/404/index.ts
  4. 1 1
      src/pages/dashboard/index.vue
  5. 12 0
      src/pages/invite/index.vue
  6. 10 1
      src/router.ts
  7. 1 0
      src/store.ts

+ 14 - 12
src/App.vue

@@ -1,18 +1,20 @@
 <template>
-  <NavBar
-    v-if="showNavBar"
-    :show-nav-icons="!/^\/password/.test($route.path)"
-    :fixed="true"
-  />
-  <div class="main-container" :class="{ 'white-down-md': state.bgWhite }">
-    <router-view
-      :class="[
-        'main-wrapper',
-        { 'main-wrapper-fluid': $route.path === '/invite' },
-      ]"
+  <div v-if="state.ready && $route.name !== 'NotFound'">
+    <NavBar
+      v-if="showNavBar"
+      :show-nav-icons="!/^\/password/.test($route.path)"
+      :fixed="true"
     />
+    <div class="main-container" :class="{ 'white-down-md': state.bgWhite }">
+      <router-view
+        :class="[
+          'main-wrapper',
+          { 'main-wrapper-fluid': $route.path === '/invite' },
+        ]"
+      />
+    </div>
+    <PageFooter v-if="$route.path !== '/'" />
   </div>
-  <PageFooter v-if="$route.path !== '/'" />
 </template>
 
 <script setup lang="ts">

+ 1 - 1
src/components/nav-bar/index.vue

@@ -254,7 +254,7 @@ async function signOut() {
     confirmText: 'YES',
   })
   await logout()
-  router.push('/')
+  location.href = '/care/'
 }
 </script>
 

+ 8 - 0
src/pages/404/index.ts

@@ -0,0 +1,8 @@
+import { defineComponent, h } from 'vue'
+
+export default defineComponent({
+  beforeRouteEnter() {
+    location.replace('/care/')
+  },
+  render: () => h('div'),
+})

+ 1 - 1
src/pages/dashboard/index.vue

@@ -113,7 +113,7 @@ async function signOut() {
     confirmText: 'YES',
   })
   await logout()
-  router.push('/')
+  location.href = '/care/'
 }
 </script>
 

+ 12 - 0
src/pages/invite/index.vue

@@ -161,6 +161,18 @@ export default defineComponent({
     @include media-breakpoint-up(md) {
       padding: 40px 0 64px;
     }
+    @include media-breakpoint-up(xl) {
+      display: block;
+      text-align: center;
+      .award,
+      .desc {
+        display: inline-block;
+        vertical-align: middle;
+      }
+      .methods {
+        margin: 36px auto 0;
+      }
+    }
   }
   .p-bottom {
     margin: auto;

+ 10 - 1
src/router.ts

@@ -2,6 +2,7 @@ import { createRouter, createWebHistory } from 'vue-router'
 import { state } from './store'
 import NProgress from 'nprogress'
 import Dashboard from './pages/dashboard/index.vue'
+import NotFound from './pages/404'
 
 NProgress.configure({ showSpinner: false })
 
@@ -94,6 +95,11 @@ const router = createRouter({
       component: Dashboard,
       meta: { auth: true },
     },
+    {
+      path: '/:pathMatch(.*)*',
+      name: 'NotFound',
+      component: NotFound,
+    },
   ],
 })
 
@@ -109,7 +115,10 @@ router.beforeEach(to => {
   }
   NProgress.start()
 })
-router.afterEach(() => NProgress.done())
+router.afterEach(() => {
+  state.ready = true
+  NProgress.done()
+})
 router.onError(() => {
   NProgress.status = null
   NProgress.remove()

+ 1 - 0
src/store.ts

@@ -3,6 +3,7 @@ import * as api from '@/service/user'
 import { getOrderInfo, getDiscountInfo } from '@/service/order'
 
 export const state = reactive({
+  ready: false,
   bgWhite: false,
   userInfo: null as ApiUser.Info.Response | null,
   // 拉新优惠券信息