From 60325225ec1cf7aa604680d3eb415335770abf26 Mon Sep 17 00:00:00 2001
From: toesbieya <1647775459@qq.com>
Date: Sat, 8 Aug 2020 22:24:46 +0800
Subject: [PATCH] =?UTF-8?q?=E8=B7=AF=E7=94=B1=E7=AE=80=E5=8C=96=20?=
=?UTF-8?q?=E7=A7=BB=E9=99=A4=E6=8E=A5=E5=8F=A3=E8=AE=BE=E7=BD=AE=E9=A1=B5?=
=?UTF-8?q?=E9=9D=A2?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
vue/src/api/system/resource.js | 4 -
vue/src/layout/component/Navbar/index.vue | 9 +-
vue/src/router/authority/module/purchase.js | 2 -
vue/src/router/authority/module/sell.js | 2 -
vue/src/router/authority/module/system.js | 6 --
vue/src/router/constant/module/app.js | 15 +++-
vue/src/router/constant/module/example.js | 18 +---
vue/src/router/index.js | 2 +-
vue/src/router/util.js | 31 ++++---
vue/src/view/app/redirect.vue | 8 +-
vue/src/view/system/resource/EditDialog.vue | 96 ---------------------
vue/src/view/system/resource/index.vue | 73 ----------------
12 files changed, 38 insertions(+), 228 deletions(-)
delete mode 100644 vue/src/view/system/resource/EditDialog.vue
delete mode 100644 vue/src/view/system/resource/index.vue
diff --git a/vue/src/api/system/resource.js b/vue/src/api/system/resource.js
index d97db4c..733d179 100644
--- a/vue/src/api/system/resource.js
+++ b/vue/src/api/system/resource.js
@@ -6,7 +6,3 @@ export const baseUrl = `${BASE}/resource`
export function getAllResources() {
return request.get(`${baseUrl}/getAll`).then(({data}) => data.data)
}
-
-export function updateResource(data) {
- return request.post(`${baseUrl}/update`, data).then(({data}) => data)
-}
diff --git a/vue/src/layout/component/Navbar/index.vue b/vue/src/layout/component/Navbar/index.vue
index 92d4f58..30b2215 100644
--- a/vue/src/layout/component/Navbar/index.vue
+++ b/vue/src/layout/component/Navbar/index.vue
@@ -33,9 +33,6 @@
$guide(0,guideSteps)">
新手指引
-
- 接口设置
-
退出登录
@@ -73,11 +70,7 @@ export default {
computed: {
...mapState('user', ['avatar', 'name', 'prepareLogout']),
- ...mapState('setting', ['sidebarCollapse', 'showBreadcrumb']),
-
- showSystemResource() {
- return auth('/system/resource')
- }
+ ...mapState('setting', ['sidebarCollapse', 'showBreadcrumb'])
},
methods: {
diff --git a/vue/src/router/authority/module/purchase.js b/vue/src/router/authority/module/purchase.js
index 85e5316..72aa096 100644
--- a/vue/src/router/authority/module/purchase.js
+++ b/vue/src/router/authority/module/purchase.js
@@ -15,7 +15,6 @@ const router = {
},
{
path: 'order/detail/:type(see|add|edit)/:id?',
- name: 'purchaseOrderDetail',
props: true,
component: lazyLoadView(import('@/view/purchase/order/detail')),
meta: {
@@ -43,7 +42,6 @@ const router = {
},
{
path: 'inbound/detail/:type(see|add|edit)/:id?',
- name: 'purchaseInboundDetail',
props: true,
component: lazyLoadView(import('@/view/purchase/inbound/detail')),
meta: {
diff --git a/vue/src/router/authority/module/sell.js b/vue/src/router/authority/module/sell.js
index a5ebc1d..157034c 100644
--- a/vue/src/router/authority/module/sell.js
+++ b/vue/src/router/authority/module/sell.js
@@ -15,7 +15,6 @@ const router = {
},
{
path: 'order/detail/:type(see|add|edit)/:id?',
- name: 'sellOrderDetail',
props: true,
component: lazyLoadView(import('@/view/sell/order/detail')),
meta: {
@@ -43,7 +42,6 @@ const router = {
},
{
path: 'outbound/detail/:type(see|add|edit)/:id?',
- name: 'purchaseOutboundDetail',
props: true,
component: lazyLoadView(import('@/view/sell/outbound/detail')),
meta: {
diff --git a/vue/src/router/authority/module/system.js b/vue/src/router/authority/module/system.js
index d908ff9..3a109f7 100644
--- a/vue/src/router/authority/module/system.js
+++ b/vue/src/router/authority/module/system.js
@@ -42,12 +42,6 @@ const router = {
name: 'supplierManagement',
component: lazyLoadView(import('@/view/system/supplier')),
meta: {title: '供应商管理'}
- },
- {
- path: 'resource',
- name: 'resourceManagement',
- component: lazyLoadView(import('@/view/system/resource')),
- meta: {title: '接口设置', hidden: true}
}
]
}
diff --git a/vue/src/router/constant/module/app.js b/vue/src/router/constant/module/app.js
index 0057213..deab45a 100644
--- a/vue/src/router/constant/module/app.js
+++ b/vue/src/router/constant/module/app.js
@@ -23,10 +23,6 @@ const router = [
name: 'userCenter',
component: lazyLoadView(import('@/view/userCenter')),
meta: {title: '个人中心', noCache: true, icon: 'user', hidden: true},
- },
- {
- path: 'redirect/:path(.*)',
- component: Redirect
}
]
},
@@ -34,6 +30,17 @@ const router = [
path: 'https://doc.toesbieya.cn',
meta: {title: '文档', icon: 'documentation', sort: 1}
},
+ {
+ path: '/redirect',
+ component: Layout,
+ children: [
+ {
+ path: ':path(.*)',
+ props: true,
+ component: Redirect
+ }
+ ]
+ },
{
path: '/login',
alias: '/register',
diff --git a/vue/src/router/constant/module/example.js b/vue/src/router/constant/module/example.js
index a3ed90d..b23c306 100644
--- a/vue/src/router/constant/module/example.js
+++ b/vue/src/router/constant/module/example.js
@@ -9,19 +9,16 @@ const router = {
children: [
{
path: 'stylePage',
- name: 'stylePage',
component: lazyLoadView(import('@/view/example/stylePage')),
meta: {title: '样 式'}
},
{
- path: 'icons',
- name: 'icons',
+ path: 'icon',
component: lazyLoadView(import('@/view/example/icon')),
meta: {title: '图 标'}
},
{
path: 'taobao',
- name: 'taobao',
meta: {title: '淘宝iframe', iframe: 'https://www.taobao.com'}
},
{
@@ -31,13 +28,11 @@ const router = {
children: [
{
path: 'fluid',
- name: 'fluid',
component: lazyLoadView(import('@/view/example/cool/fluid')),
meta: {title: '流体动画'}
},
{
path: 'l2d',
- name: 'l2d',
component: lazyLoadView(import('@/view/example/cool/l2d')),
meta: {title: '看板娘'}
},
@@ -50,37 +45,31 @@ const router = {
children: [
{
path: 'uploadExample',
- name: 'uploadExample',
component: lazyLoadView(import('@/view/example/component/uploadExample')),
meta: {title: '上传文件'}
},
{
path: 'skeletonExample',
- name: 'skeletonExample',
component: lazyLoadView(import('@/view/example/component/skeletonExample')),
meta: {title: '骨架屏'}
},
{
path: 'rippleExample',
- name: 'rippleExample',
component: lazyLoadView(import('@/view/example/component/rippleExample')),
meta: {title: '波纹'}
},
{
path: 'signatureExample',
- name: 'signatureExample',
component: lazyLoadView(import('@/view/example/component/signatureExample')),
meta: {title: '手写签名'}
},
{
path: 'regionSelectorExample',
- name: 'regionSelectorExample',
component: lazyLoadView(import('@/view/example/component/regionSelectorExample')),
meta: {title: '行政区划选择'}
},
{
path: 'treeSelectExample',
- name: 'treeSelectExample',
component: lazyLoadView(import('@/view/example/component/treeSelectExample')),
meta: {title: '树选择'}
}
@@ -88,28 +77,23 @@ const router = {
},
{
path: 'developingTest',
- name: 'developingTest',
component: lazyLoadView(import('@/view/example/developingTest')),
meta: {title: '开发测试'}
},
{
path: 'detailPage1',
- name: 'detailPage1',
component: lazyLoadView(import('@/view/example/detailPage')),
meta: {
title: '详情页缓存1',
- noCache: false,
usePathKey: true,
commonModule: '@/view/example/detailPage'
}
},
{
path: 'detailPage2',
- name: 'detailPage2',
component: lazyLoadView(import('@/view/example/detailPage')),
meta: {
title: '详情页缓存2',
- noCache: false,
usePathKey: true,
commonModule: '@/view/example/detailPage'
}
diff --git a/vue/src/router/index.js b/vue/src/router/index.js
index 422caf0..9d402f9 100644
--- a/vue/src/router/index.js
+++ b/vue/src/router/index.js
@@ -36,7 +36,7 @@ NProgress.configure({showSpinner: false})
metaExtend(constantRoutes)
metaExtend(authorityRoutes)
-const endRoute = [{path: '*', redirect: '/404', meta: {hidden: true}}]
+const endRoute = [{path: '*', redirect: '/404'}]
const whiteList = transformWhiteList(['/login', '/register', '/404', '/403'])
diff --git a/vue/src/router/util.js b/vue/src/router/util.js
index 434b38e..571985f 100644
--- a/vue/src/router/util.js
+++ b/vue/src/router/util.js
@@ -12,30 +12,35 @@ export function setPageTitle(route) {
//确定路由的标题
export function specifyRouteTitle(to, from) {
- if (typeof to.meta.dynamicTitle === 'function') {
- to.meta.title = to.meta.dynamicTitle(to, from)
+ const {meta} = to
+ if (typeof meta.dynamicTitle === 'function') {
+ meta.title = meta.dynamicTitle(to, from)
}
}
//将给定的白名单url转换为正则
export function transformWhiteList(list) {
- return list.map(url => pathToRegexp(url))
+ return list.map(pathToRegexp)
}
-//子路由继承父路由meta上的{affix,noAuth,noCache},优先使用子路由的值
-export function metaExtend(routes, meta) {
+//子路由继承父路由meta上的{noAuth,noCache},优先使用子路由的值
+export function metaExtend(routes, parentMeta) {
+ const keys = ['noAuth', 'noCache']
routes.forEach(route => {
- if (meta) {
- const keys = ['affix', 'noAuth', 'noCache']
- Object.keys(meta).forEach(key => {
- if (keys.includes(key) && !isEmpty(meta[key]) && isEmpty(route.meta[key])) {
- route.meta[key] = meta[key]
+ if (parentMeta) {
+ Object.keys(parentMeta).forEach(key => {
+ const value = parentMeta[key]
+ if (keys.includes(key) && !isEmpty(value)) {
+ if (!route.meta) {
+ route.meta = {[key]: value}
+ }
+ else if (isEmpty(route.meta[key])) {
+ route.meta[key] = value
+ }
}
})
}
- if (route.children) {
- metaExtend(route.children, route.meta)
- }
+ route.children && metaExtend(route.children, route.meta)
})
}
diff --git a/vue/src/view/app/redirect.vue b/vue/src/view/app/redirect.vue
index b04f669..3240ad1 100644
--- a/vue/src/view/app/redirect.vue
+++ b/vue/src/view/app/redirect.vue
@@ -1,13 +1,17 @@
diff --git a/vue/src/view/system/resource/index.vue b/vue/src/view/system/resource/index.vue
deleted file mode 100644
index cf2e195..0000000
--- a/vue/src/view/system/resource/index.vue
+++ /dev/null
@@ -1,73 +0,0 @@
-
-
-
- 查 询
- 编 辑
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-