From 74ee8c2efe37d444431d30f583764ebf5b6c00de Mon Sep 17 00:00:00 2001 From: JasonBai007 Date: Wed, 5 Dec 2018 13:57:03 +0800 Subject: [PATCH] =?UTF-8?q?Flag:=E8=A7=A3=E5=86=B3=E6=A0=B7=E5=BC=8F?= =?UTF-8?q?=E9=9A=BE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/assets/scss/global.scss | 1 + src/mock/index.js | 108 ++++++++++++++++-------------- src/router/index.js | 10 +-- src/views/AuthorityTest/index.vue | 2 +- src/views/ProjectInfo/index.vue | 64 +++++++++--------- src/views/Signin/index.vue | 2 +- 6 files changed, 99 insertions(+), 88 deletions(-) diff --git a/src/assets/scss/global.scss b/src/assets/scss/global.scss index 7c4f8c8..30bd054 100644 --- a/src/assets/scss/global.scss +++ b/src/assets/scss/global.scss @@ -29,6 +29,7 @@ body { // 宽度还得自己设定,坑死 .el-menu { width: 100%; + border-right: none!important; } .el-menu-item [class^='el-icon-'] { vertical-align: middle; diff --git a/src/mock/index.js b/src/mock/index.js index ee591d5..f1c3ac2 100644 --- a/src/mock/index.js +++ b/src/mock/index.js @@ -1,54 +1,62 @@ -import Mock from 'mockjs' +import Mock from "mockjs"; let debug = 1; if (debug) { - Mock.mock(/login/, { - "data": { - userId: "@integer(1,10)", - "userName|1": ["鲁班七号", "后裔", "蔡文姬", "王昭君", "妲己", "铠"], - token: '@string(30)' + Mock.mock(/login/, { + data: { + userId: "@integer(1,10)", + "userName|1": ["鲁班七号", "夏侯惇", "蔡文姬", "王昭君", "妲己"], + token: "@string(30)" + }, + msg: "Success", + status: "YQ-000" + }); + Mock.mock(/getMenu/, { + data: { + menu: [ + { + name: "项目管理", + name_en: "Projects", + router: "/", + icon: "el-icon-time", + children: [ + { + name: "开发备忘", + name_en: "Notes", + router: "/notes", + icon: "el-icon-date" + }, + { + name: "关于作者", + name_en: "About", + router: "/about", + icon: "el-icon-document" + } + ] }, - "msg": "Success", - "status": "YQ-000" - }) - Mock.mock(/getMenu/, { - "data": { - menu: [{ - name: '项目管理', - name_en: 'Projects', - router: '', - icon: 'el-icon-time', - children: [{ - name: '开发备忘', - name_en: 'Notes', - router: '/project-info', - icon: 'el-icon-date' - }, { - name: '关于作者', - name_en: 'About', - router: '/enroll-list', - icon: 'el-icon-document' - }] - }, { - name: '天气预报', - name_en: 'Weather', - router: '/weather', - icon: 'el-icon-picture-outline', - children: [] - }, { - name: '魔幻立方', - name_en: 'Cube', - router: '/cube', - icon: 'el-icon-menu', - children: [] - }, { - name: '权限测试', - name_en: 'Authority', - router: '/authority-test', - icon: 'el-icon-setting', - children: [] - }] + { + name: "天气预报", + name_en: "Weather", + router: "/weather", + icon: "el-icon-picture-outline", + children: [] }, - "msg": "Success", - "status": "YQ-000" - }) -} \ No newline at end of file + { + name: "魔幻立方", + name_en: "Cube", + router: "/cube", + icon: "el-icon-menu", + children: [] + }, + { + name: "权限测试", + name_en: "Authority", + router: "/authority", + icon: "el-icon-setting", + children: [] + } + ] + }, + msg: "Success", + status: "YQ-000" + }); +} diff --git a/src/router/index.js b/src/router/index.js index 302b3a2..86e8dec 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -42,15 +42,15 @@ const router = new Router({ requireAuth: true }, component: Layout, - // redirect: '/project-info', // 重定向到第一个子路由,否则只渲染Layout组件,这块儿使用时解除注释 + // redirect: '/notes', // 重定向到第一个子路由,否则只渲染Layout组件,这块儿使用时解除注释 redirect: '/signin', // 这里重定向到登录页面,是为了展示使用,实际用这个项目开发时,需要注释这行,解除上一行的注释 children: [{ - path: 'project-info', + path: 'notes', meta: { requireAuth: true }, component: ProjectInfo }, { - path: 'enroll-list', + path: 'about', meta: { requireAuth: true }, component: About }, @@ -65,7 +65,7 @@ const router = new Router({ component: Cube }, { - path: 'authority-test', + path: 'authority', meta: { requireAuth: true }, component: AuthorityTest } @@ -84,7 +84,7 @@ const router = new Router({ router.beforeEach((to, from, next) => { // 如果已经登录,并且要去登录页,就不让TA去登录页,重定向到首页 if (to.path === '/signin' && localStorage.token) { - next('/project-info') + next('/notes') } else { next() } diff --git a/src/views/AuthorityTest/index.vue b/src/views/AuthorityTest/index.vue index 243f738..3ddd98d 100644 --- a/src/views/AuthorityTest/index.vue +++ b/src/views/AuthorityTest/index.vue @@ -23,7 +23,7 @@ export default { menu[0].children.push({ name: "关于作者", name_en: 'About', - router: "/enroll-list", + router: "/about", icon: "el-icon-document" }); localStorage.menu = JSON.stringify(menu); diff --git a/src/views/ProjectInfo/index.vue b/src/views/ProjectInfo/index.vue index 901c128..7aaef2e 100644 --- a/src/views/ProjectInfo/index.vue +++ b/src/views/ProjectInfo/index.vue @@ -1,46 +1,48 @@ diff --git a/src/views/Signin/index.vue b/src/views/Signin/index.vue index 18580ed..fe02775 100644 --- a/src/views/Signin/index.vue +++ b/src/views/Signin/index.vue @@ -126,7 +126,7 @@ export default { // 提取菜单数组,交给本地存储 let menu = res.data.data.menu; localStorage.menu = JSON.stringify(menu); - this.$router.push("project-info"); + this.$router.push("notes"); }); }, openMsg() {