mirror of
https://gitee.com/lyt-top/vue-next-admin
synced 2026-06-06 16:21:43 +08:00
'admin-21.12.16:优化更新请看CHANGELOG.md文件'
This commit is contained in:
@ -17,5 +17,6 @@ module.exports = {
|
||||
'no-extra-semi': 'off',
|
||||
'no-constant-condition': 'off',
|
||||
'no-console': 'error',
|
||||
'vue/multi-word-component-names': 'off',
|
||||
},
|
||||
};
|
||||
|
||||
10
CHANGELOG.md
10
CHANGELOG.md
@ -2,6 +2,16 @@
|
||||
|
||||
🎉🎉🔥 `vue-prev-admin` 基于 vue2.x + webpack + element ui,适配手机、平板、pc 的后台开源免费模板库(vue3.x 请切换 master 分支)
|
||||
|
||||
## 1.0.8
|
||||
|
||||
`2021.12.16`
|
||||
|
||||
- 🌟 更新 依赖更新最新版本
|
||||
- 🎯 优化 登录界面逻辑、权限管理逻辑
|
||||
- 🎯 优化 同步 vue-next-admin-images 后端控制菜单模拟数据
|
||||
- 🎯 优化 菜单格式(对象改数组)
|
||||
- 🐞 修复 登录页手机端样式问题
|
||||
|
||||
## 1.0.7
|
||||
|
||||
`2021.11.27`
|
||||
|
||||
16
README.md
16
README.md
@ -60,19 +60,10 @@ cnpm run dev
|
||||
cnpm run build
|
||||
```
|
||||
|
||||
#### 🍉 git 命令
|
||||
|
||||
- 在本地新建一个分支:`git branch newBranch`
|
||||
- 切换到你的新分支:`git checkout newBranch`
|
||||
- 将新分支发布在 github、gitee 上:`git push origin newBranch`
|
||||
- 在本地删除一个分支:`git branch -d newBranch`
|
||||
- 在 github 远程端删除一个分支:`git push origin :newBranch (分支名前的冒号代表删除)`
|
||||
- 注意删除远程分支后,如果有对应的本地分支,本地分支并不会同步删除!
|
||||
|
||||
#### 💯 学习交流加 QQ 群
|
||||
|
||||
- 若加群了没同意(一般不会超过一天),那就是群满了,请换一个群试试
|
||||
- 查看开发文档、<a href="https://lyt-top.gitee.io/vue-next-admin-preview/#/login" target="_blank">vue-next-admin</a> 开发文档正在编写中...
|
||||
- 查看开发文档:<a href="https://lyt-top.gitee.io/vue-next-admin-doc-preview" target="_blank">vue-next-admin-doc</a>
|
||||
- 群号码:
|
||||
1 群:<a target="_blank" href="https://qm.qq.com/cgi-bin/qm/qr?k=RdUY97Vx0T0vZ_1OOu-X1yFNkWgDwbjC&jump_from=webapi">665452019</a>
|
||||
2 群:<a target="_blank" href="https://qm.qq.com/cgi-bin/qm/qr?k=zVfy3gNy7pNWVK3kMduDzwU369PZg2fw&jump_from=webapi">766356862</a>
|
||||
@ -84,6 +75,11 @@ cnpm run build
|
||||
<img src="https://gitee.com/lyt-top/vue-next-admin-images/raw/master/user/qq2.png" width="220" height="220" alt="vue-next-admin 讨论群" title="vue-next-admin 讨论群2"/>
|
||||
</a>
|
||||
|
||||
#### 💒 集成后端
|
||||
|
||||
- <a target="_blank" href="https://github.com/PandaGoAdmin/PandaX">@熊猫 PandaGoAdmin</a>
|
||||
- <a target="_blank" href="https://www.gnet.top/public">@甜蜜蜜 GoPro 平台</a>
|
||||
|
||||
#### ❤️ 鸣谢列表
|
||||
|
||||
- <a href="https://github.com/vuejs/vue" target="_blank">vue</a>
|
||||
|
||||
15
package.json
15
package.json
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "vue-prev-admin",
|
||||
"version": "1.0.7",
|
||||
"version": "1.0.8",
|
||||
"private": true,
|
||||
"description": "vue2 webpack admin template",
|
||||
"author": "lyt_20201208",
|
||||
@ -18,7 +18,7 @@
|
||||
"echarts": "^5.2.2",
|
||||
"element-ui": "^2.15.6",
|
||||
"nprogress": "^0.2.0",
|
||||
"screenfull": "^5.2.0",
|
||||
"screenfull": "5.2.0",
|
||||
"sign-canvas": "^1.1.4",
|
||||
"vue": "^2.6.14",
|
||||
"vue-i18n": "^8.26.7",
|
||||
@ -28,17 +28,16 @@
|
||||
"vuex": "^3.6.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/eslint-parser": "^7.16.3",
|
||||
"@babel/eslint-parser": "^7.16.5",
|
||||
"@vue/cli-plugin-babel": "~4.5.15",
|
||||
"@vue/cli-plugin-eslint": "~4.5.15",
|
||||
"@vue/cli-plugin-router": "~4.5.15",
|
||||
"@vue/cli-plugin-vuex": "~4.5.15",
|
||||
"@vue/cli-service": "~4.5.15",
|
||||
"eslint": "^8.3.0",
|
||||
"eslint-plugin-vue": "^8.1.1",
|
||||
"sass": "^1.43.5",
|
||||
"sass-loader": "^10.1.1",
|
||||
"screenfull": "^6.0.0",
|
||||
"eslint": "^8.4.1",
|
||||
"eslint-plugin-vue": "^8.2.0",
|
||||
"sass": "1.45.0",
|
||||
"sass-loader": "10.1.1",
|
||||
"vue-template-compiler": "^2.6.14"
|
||||
},
|
||||
"browserslist": [
|
||||
|
||||
@ -1,296 +1,290 @@
|
||||
{
|
||||
"code": 0,
|
||||
"data": {
|
||||
"path": "/",
|
||||
"name": "/",
|
||||
"redirect": "/home",
|
||||
"component": "layout/index",
|
||||
"children": [
|
||||
{
|
||||
"path": "/home",
|
||||
"name": "home",
|
||||
"component": "home",
|
||||
"meta": {
|
||||
"title": "message.router.home",
|
||||
"isLink": "",
|
||||
"isHide": false,
|
||||
"isKeepAlive": true,
|
||||
"isAffix": true,
|
||||
"isIframe": false,
|
||||
"auth": ["admin", "test"],
|
||||
"icon": "iconfont icon-shouye"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "/tools",
|
||||
"name": "tools",
|
||||
"component": "tools",
|
||||
"meta": {
|
||||
"title": "message.router.tools",
|
||||
"isLink": "",
|
||||
"isHide": false,
|
||||
"isKeepAlive": true,
|
||||
"isAffix": false,
|
||||
"isIframe": false,
|
||||
"auth": ["admin", "test"],
|
||||
"icon": "iconfont icon-gongju"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "/menu",
|
||||
"name": "menu",
|
||||
"component": "layout/routerView/parent",
|
||||
"redirect": "/menu/menu1",
|
||||
"meta": {
|
||||
"title": "message.router.menu",
|
||||
"isLink": "",
|
||||
"isHide": false,
|
||||
"isKeepAlive": true,
|
||||
"isAffix": false,
|
||||
"isIframe": false,
|
||||
"auth": ["admin", "test"],
|
||||
"icon": "iconfont icon-caidan"
|
||||
},
|
||||
"children": [
|
||||
{
|
||||
"path": "/menu/menu1",
|
||||
"name": "menu1",
|
||||
"component": "layout/routerView/parent",
|
||||
"redirect": "/menu/menu1/menu11",
|
||||
"meta": {
|
||||
"title": "message.router.menu1",
|
||||
"isLink": "",
|
||||
"isHide": false,
|
||||
"isKeepAlive": true,
|
||||
"isAffix": false,
|
||||
"isIframe": false,
|
||||
"auth": ["admin", "test"],
|
||||
"icon": "iconfont icon-caidan"
|
||||
},
|
||||
"children": [
|
||||
{
|
||||
"path": "/menu/menu1/menu11",
|
||||
"name": "menu11",
|
||||
"component": "menu/menu1/menu11/index",
|
||||
"meta": {
|
||||
"title": "message.router.menu11",
|
||||
"isLink": "",
|
||||
"isHide": false,
|
||||
"isKeepAlive": true,
|
||||
"isAffix": false,
|
||||
"isIframe": false,
|
||||
"auth": ["admin", "test"],
|
||||
"icon": "iconfont icon-caidan"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "/menu/menu1/menu12",
|
||||
"name": "menu12",
|
||||
"component": "layout/routerView/parent",
|
||||
"redirect": "/menu/menu1/menu12/menu121",
|
||||
"meta": {
|
||||
"title": "message.router.menu12",
|
||||
"isLink": "",
|
||||
"isHide": false,
|
||||
"isKeepAlive": true,
|
||||
"isAffix": false,
|
||||
"isIframe": false,
|
||||
"auth": ["admin", "test"],
|
||||
"icon": "iconfont icon-caidan"
|
||||
},
|
||||
"children": [
|
||||
{
|
||||
"path": "/menu/menu1/menu12/menu121",
|
||||
"name": "menu121",
|
||||
"component": "menu/menu1/menu12/menu121/index",
|
||||
"meta": {
|
||||
"title": "message.router.menu121",
|
||||
"isLink": "",
|
||||
"isHide": false,
|
||||
"isKeepAlive": true,
|
||||
"isAffix": false,
|
||||
"isIframe": false,
|
||||
"auth": ["admin", "test"],
|
||||
"icon": "iconfont icon-caidan"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "/menu/menu1/menu12/menu122",
|
||||
"name": "menu122",
|
||||
"component": "menu/menu1/menu12/menu122/index",
|
||||
"meta": {
|
||||
"title": "message.router.menu122",
|
||||
"isLink": "",
|
||||
"isHide": false,
|
||||
"isKeepAlive": true,
|
||||
"isAffix": false,
|
||||
"isIframe": false,
|
||||
"auth": ["admin", "test"],
|
||||
"icon": "iconfont icon-caidan"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"path": "/menu/menu1/menu13",
|
||||
"name": "menu13",
|
||||
"component": "menu/menu1/menu13/index",
|
||||
"meta": {
|
||||
"title": "message.router.menu13",
|
||||
"isLink": "",
|
||||
"isHide": false,
|
||||
"isKeepAlive": true,
|
||||
"isAffix": false,
|
||||
"isIframe": false,
|
||||
"auth": ["admin", "test"],
|
||||
"icon": "iconfont icon-caidan"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"path": "/menu/menu2",
|
||||
"name": "menu2",
|
||||
"component": "menu/menu2/index",
|
||||
"meta": {
|
||||
"title": "message.router.menu2",
|
||||
"isLink": "",
|
||||
"isHide": false,
|
||||
"isKeepAlive": true,
|
||||
"isAffix": false,
|
||||
"isIframe": false,
|
||||
"auth": ["admin", "test"],
|
||||
"icon": "iconfont icon-caidan"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"path": "/fun",
|
||||
"name": "funIndex",
|
||||
"component": "layout/routerView/parent",
|
||||
"redirect": "/fun/tagsView",
|
||||
"meta": {
|
||||
"title": "message.router.funIndex",
|
||||
"isLink": "",
|
||||
"isHide": false,
|
||||
"isKeepAlive": true,
|
||||
"isAffix": false,
|
||||
"isIframe": false,
|
||||
"auth": ["admin", "test"],
|
||||
"icon": "iconfont icon-crew_feature"
|
||||
},
|
||||
"children": [
|
||||
{
|
||||
"path": "/fun/tagsView",
|
||||
"name": "funTagsView",
|
||||
"component": "fun/tagsView/index",
|
||||
"meta": {
|
||||
"title": "message.router.funTagsView",
|
||||
"isLink": "",
|
||||
"isHide": false,
|
||||
"isKeepAlive": true,
|
||||
"isAffix": false,
|
||||
"isIframe": false,
|
||||
"auth": ["admin", "test"],
|
||||
"icon": "el-icon-thumb"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "/fun/signCanvas",
|
||||
"name": "funSignCanvas",
|
||||
"component": "fun/signCanvas/index",
|
||||
"meta": {
|
||||
"title": "message.router.funSignCanvas",
|
||||
"isLink": "",
|
||||
"isHide": false,
|
||||
"isKeepAlive": true,
|
||||
"isAffix": false,
|
||||
"isIframe": false,
|
||||
"auth": ["admin", "test"],
|
||||
"icon": "el-icon-edit"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"path": "/pages",
|
||||
"name": "pagesIndex",
|
||||
"component": "layout/routerView/parent",
|
||||
"redirect": "/pages/formAdapt",
|
||||
"meta": {
|
||||
"title": "message.router.pagesIndex",
|
||||
"isLink": "",
|
||||
"isHide": false,
|
||||
"isKeepAlive": true,
|
||||
"isAffix": false,
|
||||
"isIframe": false,
|
||||
"auth": ["admin", "test"],
|
||||
"icon": "iconfont icon-fuzhiyemian"
|
||||
},
|
||||
"children": [
|
||||
{
|
||||
"path": "/pages/formAdapt",
|
||||
"name": "pagesFormAdapt",
|
||||
"component": "pages/formAdapt/index",
|
||||
"meta": {
|
||||
"title": "message.router.pagesFormAdapt",
|
||||
"isLink": "",
|
||||
"isHide": false,
|
||||
"isKeepAlive": true,
|
||||
"isAffix": false,
|
||||
"isIframe": false,
|
||||
"auth": ["admin", "test"],
|
||||
"icon": "iconfont icon-biaodan"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"path": "/personal",
|
||||
"name": "personal",
|
||||
"component": "personal/index",
|
||||
"meta": {
|
||||
"title": "message.router.personal",
|
||||
"isLink": "",
|
||||
"isHide": false,
|
||||
"isKeepAlive": true,
|
||||
"isAffix": false,
|
||||
"isIframe": false,
|
||||
"auth": ["admin", "test"],
|
||||
"icon": "iconfont icon-gerenzhongxin"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "/link",
|
||||
"name": "layoutLinkView",
|
||||
"component": "layout/routerView/parent",
|
||||
"meta": {
|
||||
"title": "message.router.layoutLinkView",
|
||||
"isLink": "https://element-plus.gitee.io/#/zh-CN/component/installation",
|
||||
"isHide": false,
|
||||
"isKeepAlive": false,
|
||||
"isAffix": false,
|
||||
"isIframe": false,
|
||||
"auth": ["admin"],
|
||||
"icon": "iconfont icon-caozuo-wailian"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "/iframes",
|
||||
"name": "layoutIfameView",
|
||||
"component": "layout/routerView/parent",
|
||||
"meta": {
|
||||
"title": "message.router.layoutIfameView",
|
||||
"isLink": "https://element-plus.gitee.io/zh-CN/#/zh-CN/component/installation",
|
||||
"isHide": false,
|
||||
"isKeepAlive": false,
|
||||
"isAffix": true,
|
||||
"isIframe": true,
|
||||
"auth": ["admin"],
|
||||
"icon": "iconfont icon-neiqianshujuchucun"
|
||||
}
|
||||
"data": [
|
||||
{
|
||||
"path": "/home",
|
||||
"name": "home",
|
||||
"component": "home",
|
||||
"meta": {
|
||||
"title": "message.router.home",
|
||||
"isLink": "",
|
||||
"isHide": false,
|
||||
"isKeepAlive": true,
|
||||
"isAffix": true,
|
||||
"isIframe": false,
|
||||
"roles": ["admin", "common"],
|
||||
"icon": "iconfont icon-shouye"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "/tools",
|
||||
"name": "tools",
|
||||
"component": "tools",
|
||||
"meta": {
|
||||
"title": "message.router.tools",
|
||||
"isLink": "",
|
||||
"isHide": false,
|
||||
"isKeepAlive": true,
|
||||
"isAffix": false,
|
||||
"isIframe": false,
|
||||
"roles": ["admin", "common"],
|
||||
"icon": "iconfont icon-gongju"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "/menu",
|
||||
"name": "menu",
|
||||
"component": "layout/routerView/parent",
|
||||
"redirect": "/menu/menu1",
|
||||
"meta": {
|
||||
"title": "message.router.menu",
|
||||
"isLink": "",
|
||||
"isHide": false,
|
||||
"isKeepAlive": true,
|
||||
"isAffix": false,
|
||||
"isIframe": false,
|
||||
"roles": ["admin", "common"],
|
||||
"icon": "iconfont icon-caidan"
|
||||
},
|
||||
"children": [
|
||||
{
|
||||
"path": "/menu/menu1",
|
||||
"name": "menu1",
|
||||
"component": "layout/routerView/parent",
|
||||
"redirect": "/menu/menu1/menu11",
|
||||
"meta": {
|
||||
"title": "message.router.menu1",
|
||||
"isLink": "",
|
||||
"isHide": false,
|
||||
"isKeepAlive": true,
|
||||
"isAffix": false,
|
||||
"isIframe": false,
|
||||
"roles": ["admin", "common"],
|
||||
"icon": "iconfont icon-caidan"
|
||||
},
|
||||
"children": [
|
||||
{
|
||||
"path": "/menu/menu1/menu11",
|
||||
"name": "menu11",
|
||||
"component": "menu/menu1/menu11/index",
|
||||
"meta": {
|
||||
"title": "message.router.menu11",
|
||||
"isLink": "",
|
||||
"isHide": false,
|
||||
"isKeepAlive": true,
|
||||
"isAffix": false,
|
||||
"isIframe": false,
|
||||
"roles": ["admin", "common"],
|
||||
"icon": "iconfont icon-caidan"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "/menu/menu1/menu12",
|
||||
"name": "menu12",
|
||||
"component": "layout/routerView/parent",
|
||||
"redirect": "/menu/menu1/menu12/menu121",
|
||||
"meta": {
|
||||
"title": "message.router.menu12",
|
||||
"isLink": "",
|
||||
"isHide": false,
|
||||
"isKeepAlive": true,
|
||||
"isAffix": false,
|
||||
"isIframe": false,
|
||||
"roles": ["admin", "common"],
|
||||
"icon": "iconfont icon-caidan"
|
||||
},
|
||||
"children": [
|
||||
{
|
||||
"path": "/menu/menu1/menu12/menu121",
|
||||
"name": "menu121",
|
||||
"component": "menu/menu1/menu12/menu121/index",
|
||||
"meta": {
|
||||
"title": "message.router.menu121",
|
||||
"isLink": "",
|
||||
"isHide": false,
|
||||
"isKeepAlive": true,
|
||||
"isAffix": false,
|
||||
"isIframe": false,
|
||||
"roles": ["admin", "common"],
|
||||
"icon": "iconfont icon-caidan"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "/menu/menu1/menu12/menu122",
|
||||
"name": "menu122",
|
||||
"component": "menu/menu1/menu12/menu122/index",
|
||||
"meta": {
|
||||
"title": "message.router.menu122",
|
||||
"isLink": "",
|
||||
"isHide": false,
|
||||
"isKeepAlive": true,
|
||||
"isAffix": false,
|
||||
"isIframe": false,
|
||||
"roles": ["admin", "common"],
|
||||
"icon": "iconfont icon-caidan"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"path": "/menu/menu1/menu13",
|
||||
"name": "menu13",
|
||||
"component": "menu/menu1/menu13/index",
|
||||
"meta": {
|
||||
"title": "message.router.menu13",
|
||||
"isLink": "",
|
||||
"isHide": false,
|
||||
"isKeepAlive": true,
|
||||
"isAffix": false,
|
||||
"isIframe": false,
|
||||
"roles": ["admin", "common"],
|
||||
"icon": "iconfont icon-caidan"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"path": "/menu/menu2",
|
||||
"name": "menu2",
|
||||
"component": "menu/menu2/index",
|
||||
"meta": {
|
||||
"title": "message.router.menu2",
|
||||
"isLink": "",
|
||||
"isHide": false,
|
||||
"isKeepAlive": true,
|
||||
"isAffix": false,
|
||||
"isIframe": false,
|
||||
"roles": ["admin", "common"],
|
||||
"icon": "iconfont icon-caidan"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"path": "/fun",
|
||||
"name": "funIndex",
|
||||
"component": "layout/routerView/parent",
|
||||
"redirect": "/fun/tagsView",
|
||||
"meta": {
|
||||
"title": "message.router.funIndex",
|
||||
"isLink": "",
|
||||
"isHide": false,
|
||||
"isKeepAlive": true,
|
||||
"isAffix": false,
|
||||
"isIframe": false,
|
||||
"roles": ["admin", "common"],
|
||||
"icon": "iconfont icon-crew_feature"
|
||||
},
|
||||
"children": [
|
||||
{
|
||||
"path": "/fun/tagsView",
|
||||
"name": "funTagsView",
|
||||
"component": "fun/tagsView/index",
|
||||
"meta": {
|
||||
"title": "message.router.funTagsView",
|
||||
"isLink": "",
|
||||
"isHide": false,
|
||||
"isKeepAlive": true,
|
||||
"isAffix": false,
|
||||
"isIframe": false,
|
||||
"roles": ["admin", "common"],
|
||||
"icon": "el-icon-thumb"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "/fun/signCanvas",
|
||||
"name": "funSignCanvas",
|
||||
"component": "fun/signCanvas/index",
|
||||
"meta": {
|
||||
"title": "message.router.funSignCanvas",
|
||||
"isLink": "",
|
||||
"isHide": false,
|
||||
"isKeepAlive": true,
|
||||
"isAffix": false,
|
||||
"isIframe": false,
|
||||
"roles": ["admin", "common"],
|
||||
"icon": "el-icon-edit"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"path": "/pages",
|
||||
"name": "pagesIndex",
|
||||
"component": "layout/routerView/parent",
|
||||
"redirect": "/pages/formAdapt",
|
||||
"meta": {
|
||||
"title": "message.router.pagesIndex",
|
||||
"isLink": "",
|
||||
"isHide": false,
|
||||
"isKeepAlive": true,
|
||||
"isAffix": false,
|
||||
"isIframe": false,
|
||||
"roles": ["admin", "common"],
|
||||
"icon": "iconfont icon-fuzhiyemian"
|
||||
},
|
||||
"children": [
|
||||
{
|
||||
"path": "/pages/formAdapt",
|
||||
"name": "pagesFormAdapt",
|
||||
"component": "pages/formAdapt/index",
|
||||
"meta": {
|
||||
"title": "message.router.pagesFormAdapt",
|
||||
"isLink": "",
|
||||
"isHide": false,
|
||||
"isKeepAlive": true,
|
||||
"isAffix": false,
|
||||
"isIframe": false,
|
||||
"roles": ["admin", "common"],
|
||||
"icon": "iconfont icon-biaodan"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"path": "/personal",
|
||||
"name": "personal",
|
||||
"component": "personal/index",
|
||||
"meta": {
|
||||
"title": "message.router.personal",
|
||||
"isLink": "",
|
||||
"isHide": false,
|
||||
"isKeepAlive": true,
|
||||
"isAffix": false,
|
||||
"isIframe": false,
|
||||
"roles": ["admin", "common"],
|
||||
"icon": "iconfont icon-gerenzhongxin"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "/link",
|
||||
"name": "layoutLinkView",
|
||||
"component": "layout/routerView/parent",
|
||||
"meta": {
|
||||
"title": "message.router.layoutLinkView",
|
||||
"isLink": "https://element-plus.gitee.io/#/zh-CN/component/installation",
|
||||
"isHide": false,
|
||||
"isKeepAlive": false,
|
||||
"isAffix": false,
|
||||
"isIframe": false,
|
||||
"roles": ["admin"],
|
||||
"icon": "iconfont icon-caozuo-wailian"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "/iframes",
|
||||
"name": "layoutIfameView",
|
||||
"component": "layout/routerView/parent",
|
||||
"meta": {
|
||||
"title": "message.router.layoutIfameView",
|
||||
"isLink": "https://element-plus.gitee.io/zh-CN/#/zh-CN/component/installation",
|
||||
"isHide": false,
|
||||
"isKeepAlive": false,
|
||||
"isAffix": true,
|
||||
"isIframe": true,
|
||||
"roles": ["admin"],
|
||||
"icon": "iconfont icon-neiqianshujuchucun"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
452
public/test.json
452
public/test.json
@ -1,233 +1,227 @@
|
||||
{
|
||||
"code": 0,
|
||||
"data": {
|
||||
"path": "/",
|
||||
"name": "/",
|
||||
"redirect": "/home",
|
||||
"component": "layout/index",
|
||||
"children": [
|
||||
{
|
||||
"path": "/home",
|
||||
"name": "home",
|
||||
"component": "home",
|
||||
"meta": {
|
||||
"title": "message.router.home",
|
||||
"isLink": "",
|
||||
"isHide": false,
|
||||
"isKeepAlive": true,
|
||||
"isAffix": true,
|
||||
"isIframe": false,
|
||||
"auth": ["admin", "test"],
|
||||
"icon": "iconfont icon-shouye"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "/tools",
|
||||
"name": "tools",
|
||||
"component": "tools",
|
||||
"meta": {
|
||||
"title": "message.router.tools",
|
||||
"isLink": "",
|
||||
"isHide": false,
|
||||
"isKeepAlive": true,
|
||||
"isAffix": false,
|
||||
"isIframe": false,
|
||||
"auth": ["admin"],
|
||||
"icon": "iconfont icon-gongju"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "/menu",
|
||||
"name": "menu",
|
||||
"component": "layout/routerView/parent",
|
||||
"redirect": "/menu/menu1",
|
||||
"meta": {
|
||||
"title": "message.router.menu",
|
||||
"isLink": "",
|
||||
"isHide": false,
|
||||
"isKeepAlive": true,
|
||||
"isAffix": false,
|
||||
"isIframe": false,
|
||||
"auth": ["admin"],
|
||||
"icon": "iconfont icon-caidan"
|
||||
},
|
||||
"children": [
|
||||
{
|
||||
"path": "/menu/menu1",
|
||||
"name": "menu1",
|
||||
"component": "layout/routerView/parent",
|
||||
"redirect": "/menu/menu1/menu11",
|
||||
"meta": {
|
||||
"title": "message.router.menu1",
|
||||
"isLink": "",
|
||||
"isHide": false,
|
||||
"isKeepAlive": true,
|
||||
"isAffix": false,
|
||||
"isIframe": false,
|
||||
"auth": ["admin", "test"],
|
||||
"icon": "iconfont icon-caidan"
|
||||
},
|
||||
"children": [
|
||||
{
|
||||
"path": "/menu/menu1/menu11",
|
||||
"name": "menu11",
|
||||
"component": "menu/menu1/menu11/index",
|
||||
"meta": {
|
||||
"title": "message.router.menu11",
|
||||
"isLink": "",
|
||||
"isHide": false,
|
||||
"isKeepAlive": true,
|
||||
"isAffix": false,
|
||||
"isIframe": false,
|
||||
"auth": ["admin", "test"],
|
||||
"icon": "iconfont icon-caidan"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "/menu/menu1/menu12",
|
||||
"name": "menu12",
|
||||
"component": "layout/routerView/parent",
|
||||
"redirect": "/menu/menu1/menu12/menu121",
|
||||
"meta": {
|
||||
"title": "message.router.menu12",
|
||||
"isLink": "",
|
||||
"isHide": false,
|
||||
"isKeepAlive": true,
|
||||
"isAffix": false,
|
||||
"isIframe": false,
|
||||
"auth": ["admin", "test"],
|
||||
"icon": "iconfont icon-caidan"
|
||||
},
|
||||
"children": [
|
||||
{
|
||||
"path": "/menu/menu1/menu12/menu121",
|
||||
"name": "menu121",
|
||||
"component": "menu/menu1/menu12/menu121/index",
|
||||
"meta": {
|
||||
"title": "message.router.menu121",
|
||||
"isLink": "",
|
||||
"isHide": false,
|
||||
"isKeepAlive": true,
|
||||
"isAffix": false,
|
||||
"isIframe": false,
|
||||
"auth": ["admin", "test"],
|
||||
"icon": "iconfont icon-caidan"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "/menu/menu1/menu12/menu122",
|
||||
"name": "menu122",
|
||||
"component": "menu/menu1/menu12/menu122/index",
|
||||
"meta": {
|
||||
"title": "message.router.menu122",
|
||||
"isLink": "",
|
||||
"isHide": false,
|
||||
"isKeepAlive": true,
|
||||
"isAffix": false,
|
||||
"isIframe": false,
|
||||
"auth": ["admin", "test"],
|
||||
"icon": "iconfont icon-caidan"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"path": "/menu/menu1/menu13",
|
||||
"name": "menu13",
|
||||
"component": "menu/menu1/menu13/index",
|
||||
"meta": {
|
||||
"title": "message.router.menu13",
|
||||
"isLink": "",
|
||||
"isHide": false,
|
||||
"isKeepAlive": true,
|
||||
"isAffix": false,
|
||||
"isIframe": false,
|
||||
"auth": ["admin", "test"],
|
||||
"icon": "iconfont icon-caidan"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"path": "/menu/menu2",
|
||||
"name": "menu2",
|
||||
"component": "menu/menu2/index",
|
||||
"meta": {
|
||||
"title": "message.router.menu2",
|
||||
"isLink": "",
|
||||
"isHide": false,
|
||||
"isKeepAlive": true,
|
||||
"isAffix": false,
|
||||
"isIframe": false,
|
||||
"auth": ["admin", "test"],
|
||||
"icon": "iconfont icon-caidan"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"path": "/fun",
|
||||
"name": "funIndex",
|
||||
"component": "layout/routerView/parent",
|
||||
"redirect": "/fun/tagsView",
|
||||
"meta": {
|
||||
"title": "message.router.funIndex",
|
||||
"isLink": "",
|
||||
"isHide": false,
|
||||
"isKeepAlive": true,
|
||||
"isAffix": false,
|
||||
"isIframe": false,
|
||||
"auth": ["admin", "test"],
|
||||
"icon": "iconfont icon-crew_feature"
|
||||
},
|
||||
"children": [
|
||||
{
|
||||
"path": "/fun/tagsView",
|
||||
"name": "funTagsView",
|
||||
"component": "fun/tagsView/index",
|
||||
"meta": {
|
||||
"title": "message.router.funTagsView",
|
||||
"isLink": "",
|
||||
"isHide": false,
|
||||
"isKeepAlive": true,
|
||||
"isAffix": false,
|
||||
"isIframe": false,
|
||||
"auth": ["admin", "test"],
|
||||
"icon": "el-icon-thumb"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"path": "/link",
|
||||
"name": "layoutLinkView",
|
||||
"component": "layout/routerView/parent",
|
||||
"meta": {
|
||||
"title": "message.router.layoutLinkView",
|
||||
"isLink": "https://element-plus.gitee.io/#/zh-CN/component/installation",
|
||||
"isHide": false,
|
||||
"isKeepAlive": false,
|
||||
"isAffix": false,
|
||||
"isIframe": false,
|
||||
"auth": ["admin"],
|
||||
"icon": "iconfont icon-caozuo-wailian"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "/iframes",
|
||||
"name": "layoutIfameView",
|
||||
"component": "layout/routerView/parent",
|
||||
"meta": {
|
||||
"title": "message.router.layoutIfameView",
|
||||
"isLink": "https://gitee.com/lyt-top/vue-next-admin",
|
||||
"isHide": false,
|
||||
"isKeepAlive": false,
|
||||
"isAffix": true,
|
||||
"isIframe": true,
|
||||
"auth": ["admin"],
|
||||
"icon": "iconfont icon-neiqianshujuchucun"
|
||||
}
|
||||
"data": [
|
||||
{
|
||||
"path": "/home",
|
||||
"name": "home",
|
||||
"component": "home",
|
||||
"meta": {
|
||||
"title": "message.router.home",
|
||||
"isLink": "",
|
||||
"isHide": false,
|
||||
"isKeepAlive": true,
|
||||
"isAffix": true,
|
||||
"isIframe": false,
|
||||
"roles": ["admin", "common"],
|
||||
"icon": "iconfont icon-shouye"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "/tools",
|
||||
"name": "tools",
|
||||
"component": "tools",
|
||||
"meta": {
|
||||
"title": "message.router.tools",
|
||||
"isLink": "",
|
||||
"isHide": false,
|
||||
"isKeepAlive": true,
|
||||
"isAffix": false,
|
||||
"isIframe": false,
|
||||
"roles": ["admin"],
|
||||
"icon": "iconfont icon-gongju"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "/menu",
|
||||
"name": "menu",
|
||||
"component": "layout/routerView/parent",
|
||||
"redirect": "/menu/menu1",
|
||||
"meta": {
|
||||
"title": "message.router.menu",
|
||||
"isLink": "",
|
||||
"isHide": false,
|
||||
"isKeepAlive": true,
|
||||
"isAffix": false,
|
||||
"isIframe": false,
|
||||
"roles": ["admin"],
|
||||
"icon": "iconfont icon-caidan"
|
||||
},
|
||||
"children": [
|
||||
{
|
||||
"path": "/menu/menu1",
|
||||
"name": "menu1",
|
||||
"component": "layout/routerView/parent",
|
||||
"redirect": "/menu/menu1/menu11",
|
||||
"meta": {
|
||||
"title": "message.router.menu1",
|
||||
"isLink": "",
|
||||
"isHide": false,
|
||||
"isKeepAlive": true,
|
||||
"isAffix": false,
|
||||
"isIframe": false,
|
||||
"roles": ["admin", "common"],
|
||||
"icon": "iconfont icon-caidan"
|
||||
},
|
||||
"children": [
|
||||
{
|
||||
"path": "/menu/menu1/menu11",
|
||||
"name": "menu11",
|
||||
"component": "menu/menu1/menu11/index",
|
||||
"meta": {
|
||||
"title": "message.router.menu11",
|
||||
"isLink": "",
|
||||
"isHide": false,
|
||||
"isKeepAlive": true,
|
||||
"isAffix": false,
|
||||
"isIframe": false,
|
||||
"roles": ["admin", "common"],
|
||||
"icon": "iconfont icon-caidan"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "/menu/menu1/menu12",
|
||||
"name": "menu12",
|
||||
"component": "layout/routerView/parent",
|
||||
"redirect": "/menu/menu1/menu12/menu121",
|
||||
"meta": {
|
||||
"title": "message.router.menu12",
|
||||
"isLink": "",
|
||||
"isHide": false,
|
||||
"isKeepAlive": true,
|
||||
"isAffix": false,
|
||||
"isIframe": false,
|
||||
"roles": ["admin", "common"],
|
||||
"icon": "iconfont icon-caidan"
|
||||
},
|
||||
"children": [
|
||||
{
|
||||
"path": "/menu/menu1/menu12/menu121",
|
||||
"name": "menu121",
|
||||
"component": "menu/menu1/menu12/menu121/index",
|
||||
"meta": {
|
||||
"title": "message.router.menu121",
|
||||
"isLink": "",
|
||||
"isHide": false,
|
||||
"isKeepAlive": true,
|
||||
"isAffix": false,
|
||||
"isIframe": false,
|
||||
"roles": ["admin", "common"],
|
||||
"icon": "iconfont icon-caidan"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "/menu/menu1/menu12/menu122",
|
||||
"name": "menu122",
|
||||
"component": "menu/menu1/menu12/menu122/index",
|
||||
"meta": {
|
||||
"title": "message.router.menu122",
|
||||
"isLink": "",
|
||||
"isHide": false,
|
||||
"isKeepAlive": true,
|
||||
"isAffix": false,
|
||||
"isIframe": false,
|
||||
"roles": ["admin", "common"],
|
||||
"icon": "iconfont icon-caidan"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"path": "/menu/menu1/menu13",
|
||||
"name": "menu13",
|
||||
"component": "menu/menu1/menu13/index",
|
||||
"meta": {
|
||||
"title": "message.router.menu13",
|
||||
"isLink": "",
|
||||
"isHide": false,
|
||||
"isKeepAlive": true,
|
||||
"isAffix": false,
|
||||
"isIframe": false,
|
||||
"roles": ["admin", "common"],
|
||||
"icon": "iconfont icon-caidan"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"path": "/menu/menu2",
|
||||
"name": "menu2",
|
||||
"component": "menu/menu2/index",
|
||||
"meta": {
|
||||
"title": "message.router.menu2",
|
||||
"isLink": "",
|
||||
"isHide": false,
|
||||
"isKeepAlive": true,
|
||||
"isAffix": false,
|
||||
"isIframe": false,
|
||||
"roles": ["admin", "common"],
|
||||
"icon": "iconfont icon-caidan"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"path": "/fun",
|
||||
"name": "funIndex",
|
||||
"component": "layout/routerView/parent",
|
||||
"redirect": "/fun/tagsView",
|
||||
"meta": {
|
||||
"title": "message.router.funIndex",
|
||||
"isLink": "",
|
||||
"isHide": false,
|
||||
"isKeepAlive": true,
|
||||
"isAffix": false,
|
||||
"isIframe": false,
|
||||
"roles": ["admin", "common"],
|
||||
"icon": "iconfont icon-crew_feature"
|
||||
},
|
||||
"children": [
|
||||
{
|
||||
"path": "/fun/tagsView",
|
||||
"name": "funTagsView",
|
||||
"component": "fun/tagsView/index",
|
||||
"meta": {
|
||||
"title": "message.router.funTagsView",
|
||||
"isLink": "",
|
||||
"isHide": false,
|
||||
"isKeepAlive": true,
|
||||
"isAffix": false,
|
||||
"isIframe": false,
|
||||
"roles": ["admin", "common"],
|
||||
"icon": "el-icon-thumb"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"path": "/link",
|
||||
"name": "layoutLinkView",
|
||||
"component": "layout/routerView/parent",
|
||||
"meta": {
|
||||
"title": "message.router.layoutLinkView",
|
||||
"isLink": "https://element-plus.gitee.io/#/zh-CN/component/installation",
|
||||
"isHide": false,
|
||||
"isKeepAlive": false,
|
||||
"isAffix": false,
|
||||
"isIframe": false,
|
||||
"roles": ["admin"],
|
||||
"icon": "iconfont icon-caozuo-wailian"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "/iframes",
|
||||
"name": "layoutIfameView",
|
||||
"component": "layout/routerView/parent",
|
||||
"meta": {
|
||||
"title": "message.router.layoutIfameView",
|
||||
"isLink": "https://gitee.com/lyt-top/vue-next-admin",
|
||||
"isHide": false,
|
||||
"isKeepAlive": false,
|
||||
"isAffix": true,
|
||||
"isIframe": true,
|
||||
"roles": ["admin"],
|
||||
"icon": "iconfont icon-neiqianshujuchucun"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@ -51,6 +51,11 @@ export default {
|
||||
layoutLinkView: 'LinkView',
|
||||
layoutIfameView: 'IfameView',
|
||||
},
|
||||
staticRoutes: {
|
||||
signIn: 'signIn',
|
||||
notFound: 'notFound',
|
||||
noPower: 'noPower',
|
||||
},
|
||||
user: {
|
||||
title0: 'Component size',
|
||||
title1: 'Language switching',
|
||||
|
||||
@ -51,6 +51,11 @@ export default {
|
||||
layoutLinkView: '外链',
|
||||
layoutIfameView: '内嵌 iframe',
|
||||
},
|
||||
staticRoutes: {
|
||||
signIn: '登录',
|
||||
notFound: '找不到此页面',
|
||||
noPower: '没有权限',
|
||||
},
|
||||
user: {
|
||||
title0: '组件大小',
|
||||
title1: '语言切换',
|
||||
|
||||
@ -51,6 +51,11 @@ export default {
|
||||
layoutLinkView: '外鏈',
|
||||
layoutIfameView: '内嵌 iframe',
|
||||
},
|
||||
staticRoutes: {
|
||||
signIn: '登入',
|
||||
notFound: '找不到此頁面',
|
||||
noPower: '沒有許可權',
|
||||
},
|
||||
user: {
|
||||
title0: '組件大小',
|
||||
title1: '語言切換',
|
||||
|
||||
@ -16,6 +16,20 @@ VueRouter.prototype.push = function push(location) {
|
||||
// 安装 VueRouter 插件
|
||||
Vue.use(VueRouter);
|
||||
|
||||
// 定义动态路由
|
||||
const dynamicRoutes = [
|
||||
{
|
||||
path: '/',
|
||||
name: '/',
|
||||
component: 'layout/index',
|
||||
redirect: '/home',
|
||||
meta: {
|
||||
isKeepAlive: true,
|
||||
},
|
||||
children: [],
|
||||
},
|
||||
];
|
||||
|
||||
// 定义静态路由
|
||||
const staticRoutes = [
|
||||
{
|
||||
@ -31,7 +45,7 @@ const staticRoutes = [
|
||||
name: 'notFound',
|
||||
component: () => import('@/views/error/404.vue'),
|
||||
meta: {
|
||||
title: '找不到此页面',
|
||||
title: 'message.staticRoutes.notFound',
|
||||
},
|
||||
},
|
||||
{
|
||||
@ -39,7 +53,7 @@ const staticRoutes = [
|
||||
name: 'noPower',
|
||||
component: () => import('@/views/error/401.vue'),
|
||||
meta: {
|
||||
title: '没有权限',
|
||||
title: 'message.staticRoutes.noPower',
|
||||
},
|
||||
},
|
||||
];
|
||||
@ -81,19 +95,19 @@ export function formatTwoStageRoutes(arr) {
|
||||
return newArr;
|
||||
}
|
||||
|
||||
// 判断路由 auth 中是否包含当前登录用户权限字段
|
||||
export function hasAuth(auths, route) {
|
||||
if (route.meta && route.meta.auth) return auths.some((auth) => route.meta.auth.includes(auth));
|
||||
// 判断路由 meta.roles 中是否包含当前登录用户权限字段
|
||||
export function hasAuth(roles, route) {
|
||||
if (route.meta && route.meta.roles) return roles.some((role) => route.meta.roles.includes(role));
|
||||
else return true;
|
||||
}
|
||||
|
||||
// 递归过滤有权限的路由
|
||||
export function setFilterMenuFun(routes, auth) {
|
||||
export function setFilterMenuFun(routes, role) {
|
||||
const menu = [];
|
||||
routes.forEach((route) => {
|
||||
const item = { ...route };
|
||||
if (hasAuth(auth, item)) {
|
||||
if (item.children) item.children = setFilterMenuFun(item.children, auth);
|
||||
if (hasAuth(role, item)) {
|
||||
if (item.children) item.children = setFilterMenuFun(item.children, role);
|
||||
menu.push(item);
|
||||
}
|
||||
});
|
||||
@ -103,9 +117,9 @@ export function setFilterMenuFun(routes, auth) {
|
||||
// 缓存多级嵌套数组处理后的一维数组(tagsView、菜单搜索中使用:未过滤隐藏的(isHide))
|
||||
export function setCacheTagsViewRoutes(arr) {
|
||||
// 先处理有权限的路由,否则 tagsView、菜单搜索中无权限的路由也将显示
|
||||
let authsRoutes = setFilterMenuFun(arr, store.state.userInfos.userInfos.authPageList);
|
||||
let rolesRoutes = setFilterMenuFun(arr, store.state.userInfos.userInfos.roles);
|
||||
// 添加到 vuex setTagsViewRoutes 中
|
||||
store.dispatch('tagsViewRoutes/setTagsViewRoutes', formatTwoStageRoutes(formatFlatteningRoutes(authsRoutes)));
|
||||
store.dispatch('tagsViewRoutes/setTagsViewRoutes', formatTwoStageRoutes(formatFlatteningRoutes(rolesRoutes)));
|
||||
}
|
||||
|
||||
// 递归处理多余的 layout : <router-view>,让需要访问的组件保持在第一层 layout 层。
|
||||
@ -139,10 +153,12 @@ export function loadView(path) {
|
||||
}
|
||||
|
||||
// 递归处理每一项 `component` 中的路径
|
||||
export function dynamicRouter(view) {
|
||||
if (view.component) view.component = loadView(view.component);
|
||||
if (view.children) view.children.map((item) => dynamicRouter(item));
|
||||
return view;
|
||||
export function dynamicRouter(routes) {
|
||||
return routes.map((view) => {
|
||||
if (view.component) view.component = loadView(view.component);
|
||||
if (view.children) dynamicRouter(view.children);
|
||||
return view;
|
||||
});
|
||||
}
|
||||
|
||||
// 添加路由,模拟数据与方法,可自行进行修改 admin
|
||||
@ -152,15 +168,16 @@ export function dynamicRouter(view) {
|
||||
export function adminUser(router, to, next) {
|
||||
resetRouter();
|
||||
getMenuAdmin()
|
||||
.then((res) => {
|
||||
.then(async (res) => {
|
||||
// 读取用户信息,获取对应权限进行判断
|
||||
store.dispatch('userInfos/setUserInfos');
|
||||
store.dispatch('routesList/setRoutesList', setFilterMenuFun(res.data.children, store.state.userInfos.userInfos.authPageList));
|
||||
res.data.children = store.state.routesList.routesList;
|
||||
[dynamicRouter(res.data), { path: '*', redirect: '/404' }].forEach((route) => {
|
||||
store.dispatch('routesList/setRoutesList', setFilterMenuFun(res.data, store.state.userInfos.userInfos.roles));
|
||||
dynamicRoutes[0].children = res.data;
|
||||
const awaitRoute = await dynamicRouter(dynamicRoutes);
|
||||
[...awaitRoute, { path: '*', redirect: '/404' }].forEach((route) => {
|
||||
router.addRoute({ ...route });
|
||||
});
|
||||
setCacheTagsViewRoutes(JSON.parse(JSON.stringify(res.data.children)));
|
||||
setCacheTagsViewRoutes(JSON.parse(JSON.stringify(res.data)));
|
||||
next({ ...to, replace: true });
|
||||
})
|
||||
.catch(() => {});
|
||||
@ -171,15 +188,16 @@ export function adminUser(router, to, next) {
|
||||
export function testUser(router, to, next) {
|
||||
resetRouter();
|
||||
getMenuTest()
|
||||
.then((res) => {
|
||||
.then(async (res) => {
|
||||
// 读取用户信息,获取对应权限进行判断
|
||||
store.dispatch('userInfos/setUserInfos');
|
||||
store.dispatch('routesList/setRoutesList', setFilterMenuFun(res.data.children, store.state.userInfos.userInfos.authPageList));
|
||||
res.data.children = store.state.routesList.routesList;
|
||||
[dynamicRouter(res.data), { path: '*', redirect: '/404' }].forEach((route) => {
|
||||
store.dispatch('routesList/setRoutesList', setFilterMenuFun(res.data, store.state.userInfos.userInfos.roles));
|
||||
dynamicRoutes[0].children = res.data;
|
||||
const awaitRoute = await dynamicRouter(dynamicRoutes);
|
||||
[...awaitRoute, { path: '*', redirect: '/404' }].forEach((route) => {
|
||||
router.addRoute({ ...route });
|
||||
});
|
||||
setCacheTagsViewRoutes(JSON.parse(JSON.stringify(res.data.children)));
|
||||
setCacheTagsViewRoutes(JSON.parse(JSON.stringify(res.data)));
|
||||
next({ ...to, replace: true });
|
||||
})
|
||||
.catch(() => {});
|
||||
|
||||
@ -13,4 +13,7 @@
|
||||
.el-form-item {
|
||||
display: unset !important;
|
||||
}
|
||||
.login-form .el-form-item {
|
||||
display: block !important;
|
||||
}
|
||||
}
|
||||
|
||||
@ -138,43 +138,46 @@ export default {
|
||||
},
|
||||
// 登录按钮点击
|
||||
submitForm() {
|
||||
let defaultAuthPageList = [];
|
||||
let defaultAuthBtnList = [];
|
||||
// admin 页面权限标识,对应路由 meta.auth
|
||||
let adminAuthPageList = ['admin'];
|
||||
// admin 按钮权限标识
|
||||
let adminAuthBtnList = ['btn.add', 'btn.del', 'btn.edit', 'btn.link'];
|
||||
// test 页面权限标识,对应路由 meta.auth
|
||||
let testAuthPageList = ['test'];
|
||||
// test 按钮权限标识
|
||||
let testAuthBtnList = ['btn.add', 'btn.link'];
|
||||
if (this.ruleForm.userName === 'admin') {
|
||||
defaultAuthPageList = adminAuthPageList;
|
||||
defaultAuthBtnList = adminAuthBtnList;
|
||||
} else {
|
||||
defaultAuthPageList = testAuthPageList;
|
||||
defaultAuthBtnList = testAuthBtnList;
|
||||
}
|
||||
const userInfos = {
|
||||
userName: this.ruleForm.userName === 'admin' ? 'admin' : 'test',
|
||||
photo:
|
||||
this.ruleForm.userName === 'admin'
|
||||
? 'https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=1813762643,1914315241&fm=26&gp=0.jpg'
|
||||
: 'https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=317673774,2961727727&fm=26&gp=0.jpg',
|
||||
time: new Date().getTime(),
|
||||
authPageList: defaultAuthPageList,
|
||||
authBtnList: defaultAuthBtnList,
|
||||
};
|
||||
// 存储 token 到浏览器缓存
|
||||
Session.set('token', Math.random().toString(36).substr(0));
|
||||
// 存储用户信息到浏览器缓存
|
||||
Session.set('userInfo', userInfos);
|
||||
// 存储用户信息到vuex
|
||||
this.$store.dispatch('userInfos/setUserInfos', userInfos);
|
||||
PrevLoading.start();
|
||||
window.location.href = `${window.location.origin}${window.location.pathname}`;
|
||||
this.submit.loading = true;
|
||||
setTimeout(() => {
|
||||
this.$message.success(`${this.currentTime},${this.$t('message.login.signInText')}`);
|
||||
let defaultRoles = [];
|
||||
let defaultAuthBtnList = [];
|
||||
// admin 页面权限标识,对应路由 meta.roles
|
||||
let adminRoles = ['admin'];
|
||||
// admin 按钮权限标识
|
||||
let adminAuthBtnList = ['btn.add', 'btn.del', 'btn.edit', 'btn.link'];
|
||||
// common 页面权限标识,对应路由 meta.roles
|
||||
let testAuthPageList = ['common'];
|
||||
// test 按钮权限标识
|
||||
let testAuthBtnList = ['btn.add', 'btn.link'];
|
||||
if (this.ruleForm.userName === 'admin') {
|
||||
defaultRoles = adminRoles;
|
||||
defaultAuthBtnList = adminAuthBtnList;
|
||||
} else {
|
||||
defaultRoles = testAuthPageList;
|
||||
defaultAuthBtnList = testAuthBtnList;
|
||||
}
|
||||
const userInfos = {
|
||||
userName: this.ruleForm.userName === 'admin' ? 'admin' : 'test',
|
||||
photo:
|
||||
this.ruleForm.userName === 'admin'
|
||||
? 'https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=1813762643,1914315241&fm=26&gp=0.jpg'
|
||||
: 'https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=317673774,2961727727&fm=26&gp=0.jpg',
|
||||
time: new Date().getTime(),
|
||||
roles: defaultRoles,
|
||||
authBtnList: defaultAuthBtnList,
|
||||
};
|
||||
// 存储 token 到浏览器缓存
|
||||
Session.set('token', Math.random().toString(36).substr(0));
|
||||
// 存储用户信息到浏览器缓存
|
||||
Session.set('userInfo', userInfos);
|
||||
// 存储用户信息到vuex
|
||||
this.$store.dispatch('userInfos/setUserInfos', userInfos);
|
||||
PrevLoading.start();
|
||||
window.location.href = `${window.location.origin}${window.location.pathname}`;
|
||||
setTimeout(() => {
|
||||
this.$message.success(`${this.currentTime},${this.$t('message.login.signInText')}`);
|
||||
}, 300);
|
||||
}, 300);
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user