diff --git a/src/router/index.js b/src/router/index.js index 11e245b..571d578 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -65,7 +65,7 @@ export const loadMenus = (next, to) => { const sdata = JSON.parse(JSON.stringify(res)) const rdata = JSON.parse(JSON.stringify(res)) const sidebarRoutes = filterAsyncRouter(sdata) - const rewriteRoutes = filterAsyncRouter(rdata, true) + const rewriteRoutes = filterAsyncRouter(rdata, false, true) rewriteRoutes.push({ path: '*', redirect: '/404', hidden: true }) store.dispatch('GenerateRoutes', rewriteRoutes).then(() => { // 存储路由 diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js index 49e4778..513e259 100644 --- a/src/store/modules/permission.js +++ b/src/store/modules/permission.js @@ -27,9 +27,9 @@ const permission = { } } -export const filterAsyncRouter = (routers, isRewrite = false) => { // 遍历后台传来的路由字符串,转换为组件对象 +export const filterAsyncRouter = (routers, lastRouter = false, type = false) => { // 遍历后台传来的路由字符串,转换为组件对象 return routers.filter(router => { - if (isRewrite && router.children) { + if (type && router.children) { router.children = filterChildren(router.children) } if (router.component) { @@ -42,14 +42,17 @@ export const filterAsyncRouter = (routers, isRewrite = false) => { // 遍历后 router.component = loadView(component) } } - if (router.children && router.children.length) { - router.children = filterAsyncRouter(router.children, router, isRewrite) + if (router.children != null && router.children && router.children.length) { + router.children = filterAsyncRouter(router.children, router, type) + } else { + delete router['children'] + delete router['redirect'] } return true }) } -function filterChildren(childrenMap) { +function filterChildren(childrenMap, lastRouter = false) { var children = [] childrenMap.forEach((el, index) => { if (el.children && el.children.length) { @@ -65,6 +68,9 @@ function filterChildren(childrenMap) { return } } + if (lastRouter) { + el.path = lastRouter.path + '/' + el.path + } children = children.concat(el) }) return children diff --git a/src/utils/rsaEncrypt.js b/src/utils/rsaEncrypt.js index d2dd553..1948ddd 100644 --- a/src/utils/rsaEncrypt.js +++ b/src/utils/rsaEncrypt.js @@ -5,15 +5,6 @@ import JSEncrypt from 'jsencrypt/bin/jsencrypt.min' const publicKey = 'MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBANL378k3RiZHWx5AfJqdH9xRNBmD9wGD\n' + '2iRe41HdTNF8RUhNnHit5NpMNtGL0NPTSSpPjjI1kJfVorRvaQerUgkCAwEAAQ==' -const privateKey = 'MIIBUwIBADANBgkqhkiG9w0BAQEFAASCAT0wggE5AgEAAkEA0vfvyTdGJkdbHkB8\n' + - 'mp0f3FE0GYP3AYPaJF7jUd1M0XxFSE2ceK3k2kw20YvQ09NJKk+OMjWQl9WitG9p\n' + - 'B6tSCQIDAQABAkA2SimBrWC2/wvauBuYqjCFwLvYiRYqZKThUS3MZlebXJiLB+Ue\n' + - '/gUifAAKIg1avttUZsHBHrop4qfJCwAI0+YRAiEA+W3NK/RaXtnRqmoUUkb59zsZ\n' + - 'UBLpvZgQPfj1MhyHDz0CIQDYhsAhPJ3mgS64NbUZmGWuuNKp5coY2GIj/zYDMJp6\n' + - 'vQIgUueLFXv/eZ1ekgz2Oi67MNCk5jeTF2BurZqNLR3MSmUCIFT3Q6uHMtsB9Eha\n' + - '4u7hS31tj1UWE+D+ADzp59MGnoftAiBeHT7gDMuqeJHPL4b+kC+gzV4FGTfhR9q3\n' + - 'tTbklZkD2A==' - // 加密 export function encrypt(txt) { const encryptor = new JSEncrypt() @@ -21,10 +12,3 @@ export function encrypt(txt) { return encryptor.encrypt(txt) // 对需要加密的数据进行加密 } -// 解密 -export function decrypt(txt) { - const encryptor = new JSEncrypt() - encryptor.setPrivateKey(privateKey) - return encryptor.decrypt(txt) -} - diff --git a/src/views/components/Editor.vue b/src/views/components/Editor.vue index b602d70..13a3481 100644 --- a/src/views/components/Editor.vue +++ b/src/views/components/Editor.vue @@ -41,7 +41,7 @@ export default { const _this = this var editor = new E(this.$refs.editor) // 自定义菜单配置 - editor.customConfig.zIndex = 10 + editor.customConfig.zIndex = 5 // 文件上传 editor.customConfig.customUploadImg = function(files, insert) { // files 是 input 中选中的文件列表 diff --git a/src/views/components/MarkDown.vue b/src/views/components/MarkDown.vue index 4eff05c..bb5a10e 100644 --- a/src/views/components/MarkDown.vue +++ b/src/views/components/MarkDown.vue @@ -43,4 +43,7 @@ export default {