diff --git a/public/images/avatar.jpg b/public/images/avatar.jpg
new file mode 100644
index 00000000..b8a3cf3c
Binary files /dev/null and b/public/images/avatar.jpg differ
diff --git a/public/images/avatar2.gif b/public/images/avatar2.gif
new file mode 100644
index 00000000..6fade970
Binary files /dev/null and b/public/images/avatar2.gif differ
diff --git a/public/images/avatar3.gif b/public/images/avatar3.gif
new file mode 100644
index 00000000..495fe433
Binary files /dev/null and b/public/images/avatar3.gif differ
diff --git a/public/json/user.json b/public/json/user.json
index 881cb815..b39acdcb 100644
--- a/public/json/user.json
+++ b/public/json/user.json
@@ -1,34 +1,35 @@
{
"code": 200,
"data": {
- "userInfo" : {
- "userName":"Admin"
+ "userInfo": {
+ "userId": "1",
+ "userName": "Administrator"
},
- "menuList" : [
- {
+ "menuList": [{
"name": "组件",
"path": "/vab",
"meta": {
- "icon":"el-icon-takeaway-box"
+ "icon": "el-icon-takeaway-box"
},
- "children": [
- {
- "path": "/vab/list",
+ "children": []
+ },
+ {
+ "name": "布局",
+ "path": "/layout",
+ "meta": {
+ "icon": "el-icon-files"
+ },
+ "children": [{
+ "path": "/layout/list",
"name": "列表",
"meta": {},
"component": "list"
},
{
- "path": "/vab/show",
+ "path": "/layout/show",
"name": "详情",
"meta": {},
"component": "show"
- },
- {
- "path": "/vab/lala",
- "name": "404",
- "meta": {},
- "component": "lala"
}
]
},
@@ -36,14 +37,54 @@
"name": "其他",
"path": "/other",
"meta": {
- "icon":"el-icon-more"
+ "icon": "el-icon-more"
},
"children": [
{
- "path": "/other/1",
- "name": "other1",
+ "path": "/link",
+ "name": "外部链接",
+ "meta": {
+ "icon": "el-icon-link"
+ },
+ "children": [
+ {
+ "path": "https://baidu.com",
+ "name": "百度",
+ "meta": {
+ "target": "_blank"
+ }
+ },
+ {
+ "path": "https://www.google.cn",
+ "name": "谷歌",
+ "meta": {
+ "target": "_blank"
+ }
+ }
+ ]
+ },
+ {
+ "path": "/iframe",
+ "name": "Iframe",
+ "meta": {
+ "icon": "el-icon-position"
+ },
+ "children": [
+ {
+ "path": "https://vue3js.cn/docs/zh/",
+ "name": "VUE 3"
+ },
+ {
+ "path": "https://element-plus.org?id=1",
+ "name": "Element Plus"
+ }
+ ]
+ },
+ {
+ "path": "/other/lala",
+ "name": "404",
"meta": {},
- "component": "list"
+ "component": "lala"
}
]
},
@@ -51,16 +92,14 @@
"name": "配置",
"path": "/setting",
"meta": {
- "icon":"el-icon-setting"
+ "icon": "el-icon-setting"
},
- "children": [
- {
- "path": "/setting/1",
- "name": "setting1",
- "meta": {},
- "component": "lala"
- }
- ]
+ "children": [{
+ "path": "/setting/1",
+ "name": "setting1",
+ "meta": {},
+ "component": "lala"
+ }]
}
]
},
diff --git a/src/App.vue b/src/App.vue
index 7aa61808..01a43446 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -11,4 +11,4 @@
\ No newline at end of file
+
diff --git a/src/layout/components/NavMenu.vue b/src/layout/components/NavMenu.vue
index 72cb595e..1d92b1ea 100644
--- a/src/layout/components/NavMenu.vue
+++ b/src/layout/components/NavMenu.vue
@@ -1,10 +1,13 @@
-
+
\ No newline at end of file
+
diff --git a/src/layout/components/head.vue b/src/layout/components/head.vue
index d93c5943..4dec61d2 100644
--- a/src/layout/components/head.vue
+++ b/src/layout/components/head.vue
@@ -1,14 +1,77 @@
diff --git a/src/layout/components/side.vue b/src/layout/components/side.vue
index 98c71fa9..afc3daf2 100644
--- a/src/layout/components/side.vue
+++ b/src/layout/components/side.vue
@@ -11,7 +11,7 @@
-
+
@@ -37,7 +37,7 @@
var menu = this.$TOOL.data.get("user").menuList;
var home = this.$router.options.routes[0].children[0];
menu.unshift(home);
- this.menu = menu;
+ this.menu = this.filterUrl(menu);
this.showThis()
},
setup() {
@@ -51,13 +51,9 @@
methods: {
//路由监听高亮
showThis(){
- var menu = this.$TOOL.data.get("user").menuList;
var home = this.$router.options.routes[0].children[0];
- menu.unshift(home);
- var pl = this.$route.path.split("/");
- var p = pl.length<=2?home.path:"/" + pl[1];
- this.pmenu = p==home.path ? home:this.getRoute(p, menu);
- this.nextMenu = this.pmenu.children;
+ this.pmenu = this.$route.matched[1] || home;
+ this.nextMenu = this.filterUrl(this.pmenu.children);
},
//点击显示
showMenu(route) {
@@ -74,6 +70,21 @@
this.getRoute(path, item.children);
}
}
+ },
+ //转换外部链接的路由
+ filterUrl(map){
+ var newMap = []
+ map.forEach(item => {
+ item.meta = item.meta?item.meta:{};
+ if(item.path.startsWith('http') && item.meta.target!='_blank'){
+ item.path = `/${encodeURIComponent(item.path)}`;
+ }
+ if(item.children&&item.children.length > 0){
+ this.filterUrl(item.children);
+ }
+ newMap.push(item)
+ })
+ return newMap;
}
}
}
diff --git a/src/layout/index.vue b/src/layout/index.vue
index f07da65a..36dc61e1 100644
--- a/src/layout/index.vue
+++ b/src/layout/index.vue
@@ -5,7 +5,7 @@
-
+
diff --git a/src/router/index.js b/src/router/index.js
index 31a33240..dc2a77cf 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -60,6 +60,7 @@ router.beforeEach(async (to, from, next) => {
let userInfo = tool.data.get("user");
if(to.path === "/login"){
+ isGetApiRouter = false;
next();
return false;
}
@@ -79,7 +80,7 @@ router.beforeEach(async (to, from, next) => {
})
router.addRoute(routes_404)
if (to.matched.length == 0) {
- router.push(to.path);
+ router.push(to.fullPath);
}
isGetApiRouter = true;
}
@@ -94,7 +95,7 @@ router.onError((error) => {
NProgress.done();
ElNotification.error({
title: '路由错误',
- message: error
+ message: error.message
});
});
@@ -102,14 +103,22 @@ router.onError((error) => {
//转换
function filterAsyncRouter(routerMap) {
const accessedRouters = []
- routerMap.filter(itemRouter => {
- accessedRouters.push({
- path: itemRouter.path,
- name: itemRouter.name,
- meta: itemRouter.meta,
- children: filterAsyncRouter(itemRouter.children || []),
- component: loadComponent(itemRouter.component)
- })
+ routerMap.forEach(item => {
+ item.meta = item.meta?item.meta:{};
+ //处理外部链接特殊路由
+ if(item.path.startsWith('http') && item.meta.target!='_blank'){
+ item.path = `/${encodeURIComponent(item.path)}`;
+ item.component = 'other/iframe';
+ }
+ //MAP转路由对象
+ var route = {
+ path: item.path,
+ name: item.name,
+ meta: item.meta,
+ children: item.children ? filterAsyncRouter(item.children) : null,
+ component: loadComponent(item.component)
+ }
+ accessedRouters.push(route)
})
return accessedRouters
}
diff --git a/src/style/style.less b/src/style/style.less
index c2c46acd..4763fbcd 100644
--- a/src/style/style.less
+++ b/src/style/style.less
@@ -1,4 +1,4 @@
-#app, body, html {width: 100%;height: 100%;background-color: #f8f8f8;font-size: 12px;}
+#app, body, html {width: 100%;height: 100%;background-color: #f6f8f9;font-size: 12px;}
* {margin: 0;padding: 0;box-sizing: border-box;outline: none;}
/* 全局滚动条样式 */
@@ -29,7 +29,23 @@
.aminui-body {position: absolute;z-index: 70;top:0px;left:275px;bottom:0px;right:0px;}
-.adminui-header {height: 50px;border-bottom: 1px solid #ebeef5;background: #fff;box-shadow: 0 1px 4px rgba(0,21,41,.08);}
+.adminui-header {height: 50px;border-bottom: 1px solid #ebeef5;background: #fff;box-shadow: 0 1px 4px rgba(0,21,41,.08);display: flex;justify-content:space-between;}
+
+.adminui-header .left-panel {display: flex;align-items: center;padding-left:20px;}
+.adminui-header .right-panel {display: flex;align-items: center;}
+
+.adminui-header .panel-item {height:50px;line-height: 50px;padding:0 20px;cursor: pointer;}
+.adminui-header .panel-item i {font-size: 16px;}
+.adminui-header .panel-item .badge .el-badge__content {top:15px}
+.adminui-header .panel-item:hover {background: #eee;}
+
+.adminui-header .el-breadcrumb .el-breadcrumb__inner i {margin-right:5px;}
+.adminui-header .user {display: flex;align-items: center;}
+.adminui-header .user label {display: inline-block;margin-left:5px;font-size: 12px;cursor:pointer;}
+
+
+
+
.adminui-tags {height:35px;background: #fff;border-bottom: 1px solid #e6e6e6;box-shadow: 0 1px 4px rgba(0,21,41,.08);}
.adminui-tags li {cursor: pointer;display: inline-block;float: left;height:34px;line-height: 34px;}
.adminui-tags li a {display: inline-block;padding:0 10px;width:100%;height:100%;color: #999;text-decoration:none;}
@@ -40,8 +56,9 @@
.adminui-tags li.active a {color: #fff;}
-.adminui-main {position: absolute;top:85px;left:0px;right:0px;bottom:0px;overflow: auto;}
+.adminui-main {position: absolute;top:85px;left:0px;right:0px;bottom:0px;overflow: auto;padding: 20px;}
.el-menu {border: none!important;}
-.el-menu-item.is-active {background: #ecf5ff;}
\ No newline at end of file
+.el-menu-item.is-active {background: #ecf5ff;}
+.el-menu .el-menu-item a {color: inherit;text-decoration: none;display: block;width:100%;height:100%;position: absolute;top:0px;left:0px;}
diff --git a/src/views/home.vue b/src/views/home.vue
index 3c8cb80b..c4e858d9 100644
--- a/src/views/home.vue
+++ b/src/views/home.vue
@@ -1,9 +1,44 @@
- HOME
+
+
+
+
+
+
+
+
+
嗨~ admin,忙碌了一上午,记得吃午饭哦。
+
最近更新:动态面包屑,外部链接,Iframe链接等
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Participants
+
+
+
+
+
-
diff --git a/src/views/list.vue b/src/views/list.vue
index c9426247..0d65b149 100644
--- a/src/views/list.vue
+++ b/src/views/list.vue
@@ -1,6 +1,7 @@
- LIST
-
+
+
+
+
+
diff --git a/src/views/show.vue b/src/views/show.vue
index 72fd5fd7..28bd4c9c 100644
--- a/src/views/show.vue
+++ b/src/views/show.vue
@@ -1,7 +1,6 @@
- SHOW
-
-
+
+
@@ -15,6 +14,6 @@
}
-
\ No newline at end of file