diff --git a/src/layout/dashboard/TopNavbar.vue b/src/layout/dashboard/TopNavbar.vue index 725678c..1a704c0 100644 --- a/src/layout/dashboard/TopNavbar.vue +++ b/src/layout/dashboard/TopNavbar.vue @@ -45,17 +45,17 @@ > - + --> - - + --> + @@ -139,11 +143,12 @@ diff --git a/src/pages/login/index.vue b/src/pages/login/index.vue new file mode 100644 index 0000000..fe0c238 --- /dev/null +++ b/src/pages/login/index.vue @@ -0,0 +1,92 @@ + + diff --git a/src/router/index.js b/src/router/index.js index 1670c1f..7d8872f 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -5,13 +5,20 @@ import routes from "./routes"; const router = new VueRouter({ routes, // short for routes: routes linkExactActiveClass: "active", - scrollBehavior: (to) => { + scrollBehavior: to => { if (to.hash) { - return {selector: to.hash} + return { selector: to.hash }; } else { - return { x: 0, y: 0 } + return { x: 0, y: 0 }; } } }); +router.beforeEach((to, from, next) => { + if (to.meta.auth && !localStorage.getItem("robotToken")) { + + } else { + next(); + } +}); export default router; diff --git a/src/router/routes.js b/src/router/routes.js index 8a74024..26639af 100644 --- a/src/router/routes.js +++ b/src/router/routes.js @@ -16,40 +16,53 @@ const Edit = () => import("@/pages/Robot/edit.vue"); const WinRate = () => import("@/pages/WinRate"); const ReCheck = () => import("@/pages/ReCheck"); const Capital = () => import("@/pages/Profit"); +const Prev = () => import("@/pages/Prev"); const routes = [ { path: "/", component: DashboardLayout, - redirect: "/robot/0", + redirect: "/prev", children: [ + { + path: "prev", + name: "prev", + meta: { auth: false }, + component: Prev + }, { path: "robot/:type", name: "robot", + meta: { auth: true }, component: Robot }, { path: "edit/:id", name: "edit", + meta: { auth: true }, component: Edit }, { path: "winRate", name: "winRate", + meta: { auth: true }, component: WinRate }, { path: "account/:type", name: "account", + meta: { auth: true }, component: Account }, { path: "reCheck", name: "reCheck", + meta: { auth: true }, component: ReCheck }, { path: "capital", name: "capital", + meta: { auth: true }, component: Capital } // {