Merge branch 'master' into deploy

This commit is contained in:
Zheng Jie
2021-11-16 21:27:08 +08:00
5 changed files with 16 additions and 23 deletions

View File

@@ -65,7 +65,7 @@ export const loadMenus = (next, to) => {
const sdata = JSON.parse(JSON.stringify(res)) const sdata = JSON.parse(JSON.stringify(res))
const rdata = JSON.parse(JSON.stringify(res)) const rdata = JSON.parse(JSON.stringify(res))
const sidebarRoutes = filterAsyncRouter(sdata) const sidebarRoutes = filterAsyncRouter(sdata)
const rewriteRoutes = filterAsyncRouter(rdata, true) const rewriteRoutes = filterAsyncRouter(rdata, false, true)
rewriteRoutes.push({ path: '*', redirect: '/404', hidden: true }) rewriteRoutes.push({ path: '*', redirect: '/404', hidden: true })
store.dispatch('GenerateRoutes', rewriteRoutes).then(() => { // 存储路由 store.dispatch('GenerateRoutes', rewriteRoutes).then(() => { // 存储路由

View File

@@ -27,9 +27,9 @@ const permission = {
} }
} }
export const filterAsyncRouter = (routers, isRewrite = false) => { // 遍历后台传来的路由字符串,转换为组件对象 export const filterAsyncRouter = (routers, lastRouter = false, type = false) => { // 遍历后台传来的路由字符串,转换为组件对象
return routers.filter(router => { return routers.filter(router => {
if (isRewrite && router.children) { if (type && router.children) {
router.children = filterChildren(router.children) router.children = filterChildren(router.children)
} }
if (router.component) { if (router.component) {
@@ -42,14 +42,17 @@ export const filterAsyncRouter = (routers, isRewrite = false) => { // 遍历后
router.component = loadView(component) router.component = loadView(component)
} }
} }
if (router.children && router.children.length) { if (router.children != null && router.children && router.children.length) {
router.children = filterAsyncRouter(router.children, router, isRewrite) router.children = filterAsyncRouter(router.children, router, type)
} else {
delete router['children']
delete router['redirect']
} }
return true return true
}) })
} }
function filterChildren(childrenMap) { function filterChildren(childrenMap, lastRouter = false) {
var children = [] var children = []
childrenMap.forEach((el, index) => { childrenMap.forEach((el, index) => {
if (el.children && el.children.length) { if (el.children && el.children.length) {
@@ -65,6 +68,9 @@ function filterChildren(childrenMap) {
return return
} }
} }
if (lastRouter) {
el.path = lastRouter.path + '/' + el.path
}
children = children.concat(el) children = children.concat(el)
}) })
return children return children

View File

@@ -5,15 +5,6 @@ import JSEncrypt from 'jsencrypt/bin/jsencrypt.min'
const publicKey = 'MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBANL378k3RiZHWx5AfJqdH9xRNBmD9wGD\n' + const publicKey = 'MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBANL378k3RiZHWx5AfJqdH9xRNBmD9wGD\n' +
'2iRe41HdTNF8RUhNnHit5NpMNtGL0NPTSSpPjjI1kJfVorRvaQerUgkCAwEAAQ==' '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) { export function encrypt(txt) {
const encryptor = new JSEncrypt() const encryptor = new JSEncrypt()
@@ -21,10 +12,3 @@ export function encrypt(txt) {
return encryptor.encrypt(txt) // 对需要加密的数据进行加密 return encryptor.encrypt(txt) // 对需要加密的数据进行加密
} }
// 解密
export function decrypt(txt) {
const encryptor = new JSEncrypt()
encryptor.setPrivateKey(privateKey)
return encryptor.decrypt(txt)
}

View File

@@ -41,7 +41,7 @@ export default {
const _this = this const _this = this
var editor = new E(this.$refs.editor) var editor = new E(this.$refs.editor)
// 自定义菜单配置 // 自定义菜单配置
editor.customConfig.zIndex = 10 editor.customConfig.zIndex = 5
// 文件上传 // 文件上传
editor.customConfig.customUploadImg = function(files, insert) { editor.customConfig.customUploadImg = function(files, insert) {
// files 是 input 中选中的文件列表 // files 是 input 中选中的文件列表

View File

@@ -43,4 +43,7 @@ export default {
</script> </script>
<style scoped> <style scoped>
.v-note-wrapper.shadow {
z-index: 5;
}
</style> </style>