From 5cd7fb81b971f3dcb0c55296fa7dc16960eedf6d Mon Sep 17 00:00:00 2001 From: zhl Date: Wed, 20 Jan 2021 23:12:53 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E4=B8=BB=E8=8F=9C=E5=8D=95,?= =?UTF-8?q?=20=E5=A2=9E=E5=8A=A0=E8=A7=92=E8=89=B2=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 6 +- src/lang/en.ts | 1 + src/lang/zh.ts | 1 + src/layout/components/Sidebar/SidebarItem.vue | 6 + src/router/index.ts | 56 +--- src/router/modules/system.ts | 45 ++++ src/views/system/role.vue | 254 ++++++++++++++++++ 7 files changed, 322 insertions(+), 47 deletions(-) create mode 100644 src/router/modules/system.ts create mode 100644 src/views/system/role.vue diff --git a/package.json b/package.json index 64a1dd8..6868d9f 100644 --- a/package.json +++ b/package.json @@ -15,6 +15,7 @@ "clipboard": "^2.0.6", "element-ui": "^2.14.0", "file-saver": "^2.0.5", + "fuse.js": "^6.4.3", "js-cookie": "^2.2.1", "jszip": "^3.5.0", "lodash": "^4.17.20", @@ -22,6 +23,7 @@ "nprogress": "^0.2.0", "path-to-regexp": "^6.2.0", "register-service-worker": "^1.7.1", + "screenfull": "^5.0.2", "tinymce": "^5.5.1", "vue": "^2.6.12", "vue-class-component": "^7.2.6", @@ -30,8 +32,6 @@ "vue-router": "^3.4.8", "vue-svgicon": "^3.2.9", "vuex": "^3.5.1", - "screenfull": "^5.0.2", - "fuse.js": "^6.4.3", "vuex-module-decorators": "^1.0.1", "xlsx": "^0.16.8" }, @@ -43,6 +43,7 @@ "@types/lodash": "^4.14.168", "@types/node": "^14.14.6", "@types/nprogress": "^0.2.0", + "@types/tinymce": "^4.6.0", "@types/webpack-env": "^1.15.3", "@typescript-eslint/eslint-plugin": "^4.6.0", "@typescript-eslint/parser": "^4.6.0", @@ -71,7 +72,6 @@ "sass": "^1.28.0", "sass-loader": "^10.0.4", "style-resources-loader": "^1.3.3", - "@types/tinymce": "^4.6.0", "ts-jest": "^26.4.3", "typescript": "^4.0.5", "vue-cli-plugin-element": "^1.0.1", diff --git a/src/lang/en.ts b/src/lang/en.ts index ec5583f..94e1349 100644 --- a/src/lang/en.ts +++ b/src/lang/en.ts @@ -1,6 +1,7 @@ export default { route: { dashboard: 'Dashboard', + system: 'System', documentation: 'Documentation', guide: 'Guide', permission: 'Permission', diff --git a/src/lang/zh.ts b/src/lang/zh.ts index 178a051..99a67fb 100644 --- a/src/lang/zh.ts +++ b/src/lang/zh.ts @@ -2,6 +2,7 @@ export default { route: { dashboard: '首页', documentation: '文档', + system: '系统', guide: '引导页', permission: '权限测试页', rolePermission: '角色权限', diff --git a/src/layout/components/Sidebar/SidebarItem.vue b/src/layout/components/Sidebar/SidebarItem.vue index 7be0eb4..ec6cbc7 100644 --- a/src/layout/components/Sidebar/SidebarItem.vue +++ b/src/layout/components/Sidebar/SidebarItem.vue @@ -16,6 +16,9 @@ v-if="theOnlyOneChild.meta.icon" :name="theOnlyOneChild.meta.icon" /> + + import(/* webpackChunkName: "permission-role" */ '@/views/form/index.vue'), + name: 'Form', + meta: { + title: 'form', + roles: ['admin'] + } } ] }, @@ -264,38 +264,6 @@ export const asyncRoutes: RouteConfig[] = [ } ] }, - { - path: '/theme', - component: Layout, - redirect: 'noredirect', - children: [ - { - path: 'index', - component: () => import(/* webpackChunkName: "theme" */ '@/views/theme/index.vue'), - name: 'Theme', - meta: { - title: 'theme', - icon: 'theme' - } - } - ] - }, - - { - path: '/i18n', - component: Layout, - children: [ - { - path: 'index', - component: () => import(/* webpackChunkName: "i18n-demo" */ '@/views/i18n-demo/index.vue'), - name: 'I18n', - meta: { - title: 'i18n', - icon: 'international' - } - } - ] - }, { path: '*', redirect: '/404', diff --git a/src/router/modules/system.ts b/src/router/modules/system.ts new file mode 100644 index 0000000..7be741d --- /dev/null +++ b/src/router/modules/system.ts @@ -0,0 +1,45 @@ +import { RouteConfig } from 'vue-router' +import Layout from '@/layout/index.vue' + +const systemRoutes: RouteConfig = { + path: '/system', + component: Layout, + redirect: '/system/list', + meta: { + title: 'system', + icon: 'component', + alwaysShow: true + }, + children: [ + { + path: 'role', + component: () => import('@/views/system/role.vue'), + name: 'RolePermission', + meta: { + title: 'rolePermission', + permissions: ['role:read'], + elicon: 'el-icon-arrow-right' + } + }, + { + path: 'i18n', + component: () => import(/* webpackChunkName: "i18n-demo" */ '@/views/i18n-demo/index.vue'), + name: 'I18n', + meta: { + title: 'i18n', + elicon: 'el-icon-arrow-right' + } + }, + { + path: 'theme', + component: () => import(/* webpackChunkName: "theme" */ '@/views/theme/index.vue'), + name: 'Theme', + meta: { + title: 'theme', + elicon: 'el-icon-arrow-right' + } + } + ] +} + +export default systemRoutes diff --git a/src/views/system/role.vue b/src/views/system/role.vue new file mode 100644 index 0000000..9fb7060 --- /dev/null +++ b/src/views/system/role.vue @@ -0,0 +1,254 @@ + + + + +