From fe1688c7a36812b5790ffdec380f0d4526716aca Mon Sep 17 00:00:00 2001 From: sc Date: Fri, 23 Apr 2021 15:46:10 +0800 Subject: [PATCH] UP --- public/json/user.json | 13 +++-- src/layout/components/side.vue | 19 +++---- src/layout/components/tags.vue | 35 +++++------- src/layout/index.vue | 1 - src/router/index.js | 1 - src/store/index.js | 15 +++-- src/store/modules/viewTags.js | 31 ++++++++++ src/style/style.less | 8 ++- src/views/home.vue | 83 +++++++++++++-------------- src/views/list.vue | 100 +++++++++++++++++++++++++++++++-- src/views/login.vue | 9 ++- src/views/show.vue | 12 +++- 12 files changed, 229 insertions(+), 98 deletions(-) create mode 100644 src/store/modules/viewTags.js diff --git a/public/json/user.json b/public/json/user.json index 0af42750..a3b01355 100644 --- a/public/json/user.json +++ b/public/json/user.json @@ -15,14 +15,14 @@ "children": [] }, { - "name": "layout2", - "path": "/layout", + "name": "template", + "path": "/template", "meta": { - "title": "组件", + "title": "模板", "icon": "el-icon-files" }, "children": [{ - "path": "/layout/list", + "path": "/template/list", "name": "list", "meta": { "title": "列表" @@ -30,10 +30,11 @@ "component": "list" }, { - "path": "/layout/show", + "path": "/template/show/:id", "name": "show", "meta": { - "title": "详情" + "title": "详情", + "hidden": true }, "component": "show" } diff --git a/src/layout/components/side.vue b/src/layout/components/side.vue index 1421612e..bbb2783b 100644 --- a/src/layout/components/side.vue +++ b/src/layout/components/side.vue @@ -58,27 +58,22 @@ //点击显示 showMenu(route) { this.pmenu = route; - this.nextMenu = route.children; - }, - //根据path获取 - getRoute(path, menu){ - for (var item of menu) { - if (item.path == path) { - return item; - } - if (item.children) { - this.getRoute(path, item.children); - } - } + this.nextMenu = this.filterUrl(route.children); }, //转换外部链接的路由 filterUrl(map){ var newMap = [] map.forEach(item => { item.meta = item.meta?item.meta:{}; + //处理隐藏 + if(item.meta.hidden){ + return false + } + //处理http 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); } diff --git a/src/layout/components/tags.vue b/src/layout/components/tags.vue index 442b8db0..bd9f3f25 100644 --- a/src/layout/components/tags.vue +++ b/src/layout/components/tags.vue @@ -9,14 +9,15 @@ - - - + + + + diff --git a/src/views/login.vue b/src/views/login.vue index 31dd1900..ea454600 100644 --- a/src/views/login.vue +++ b/src/views/login.vue @@ -17,12 +17,11 @@ login: async function() { var userInfo = await this.$API.user.info(); this.$TOOL.data.set("user", userInfo.data); - this.$router.replace({path: '/'}); + this.$router.replace({ + path: '/' + }); //开启欢迎词 - this.$notify.success({ - title: '登录成功', - message: '欢迎登录' - }) + this.$message.success("Login Success 登录成功") } } } diff --git a/src/views/show.vue b/src/views/show.vue index 108ad6d7..e5916476 100644 --- a/src/views/show.vue +++ b/src/views/show.vue @@ -10,12 +10,22 @@ name: 'show', data() { return { + id: this.$route.params.id, input: "" } + }, + mounted: function() { + //修改tags title + this.$store.commit("updateViewTags", { + path: this.$route.path, + meta: { + title:"详情ID="+this.id + } + }) } } \ No newline at end of file +