diff --git a/src/permission.js b/src/permission.js index b9843f4..4e673bf 100644 --- a/src/permission.js +++ b/src/permission.js @@ -9,36 +9,37 @@ import { const whiteList = ['/login'] router.beforeEach((to, from, next) => { NProgress.start() - if (getToken()) { - if (to.path === '/login') { - next({ - path: '/' - }) - } else { - if (store.getters.roles.length === 0) { - store.dispatch('GetInfo').then(res => { - const roles = res.data.Roles - store.dispatch('GenerateRoutes', { - roles - }).then(() => { - router.addRoutes(store.getters.addRouters) - next({ ...to - }) - }) - }) - } else { - next() - } - } + next() + // if (getToken()) { + // if (to.path === '/login') { + // next({ + // path: '/' + // }) + // } else { + // if (store.getters.roles.length === 0) { + // store.dispatch('GetInfo').then(res => { + // const roles = res.data.Roles + // store.dispatch('GenerateRoutes', { + // roles + // }).then(() => { + // router.addRoutes(store.getters.addRouters) + // next({ ...to + // }) + // }) + // }) + // } else { + // next() + // } + // } - } else { - if (whiteList.indexOf(to.path) !== -1) { - next() - } else { - next('/login') - NProgress.done() - } - } + // } else { + // if (whiteList.indexOf(to.path) !== -1) { + // next() + // } else { + // next('/login') + // NProgress.done() + // } + // } }) router.afterEach(() => { diff --git a/src/router/index.js b/src/router/index.js index b2abf42..3442fb5 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -31,6 +31,18 @@ export const constantRouterMap = [ meta: { title: '首页', icon: 'dashboard', noCache: true } }] }, + + { + path: '/DouBan', + component: Layout, + redirect: '/DouBan/movie', + name:"DouBan", + title:"豆瓣查询" , + icon:'tubiao', + children: [{ path: 'movie', name: 'movie', component: _import('DouBan/movie'),meta:{title:"热映电影"}}, + { path: 'music', name: 'music', component: _import('DouBan/music'),meta:{title:"热门音乐"}}, + { path: 'book', name: 'book', component: _import('DouBan/book'),meta:{title:"热门书籍"}}] + } ] export default new Router({ diff --git a/src/views/login/index.vue b/src/views/login/index.vue index 5a1641e..563888d 100644 --- a/src/views/login/index.vue +++ b/src/views/login/index.vue @@ -42,21 +42,26 @@ export default { methods: { handleLogin() { this.loading = true; - this.$store - .dispatch("Login", this.loginForm) - .then(response => { - this.loading = false; + // this.$store + // .dispatch("Login", this.loginForm) + // .then(response => { + // this.loading = false; - setTimeout(() => { + // setTimeout(() => { + // this.$router.push({ + // path: "/" + // }); + // }, 2000); + // }) + // .catch(error => { + // this.$message.error(error); + // this.loading = false; + // }); + setTimeout(() => { this.$router.push({ path: "/" }); }, 2000); - }) - .catch(error => { - this.$message.error(error); - this.loading = false; - }); } } };