vue2-client 1.8.0-1 → 1.8.0-2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -5
- package/src/base-client/plugins/tabs-page-plugin.js +5 -4
- package/src/config/default/antd.config.js +11 -6
- package/src/layouts/PageLayout.vue +1 -1
- package/src/layouts/header/HeaderNotice.vue +3 -2
- package/src/layouts/tabs/TabsHead.vue +1 -2
- package/src/layouts/tabs/TabsView.vue +7 -7
- package/src/utils/authority-utils.js +12 -12
- package/src/utils/routerUtil.js +4 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vue2-client",
|
|
3
|
-
"version": "1.8.0-
|
|
3
|
+
"version": "1.8.0-2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"scripts": {
|
|
6
6
|
"serve": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve",
|
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
"js-base64": "^3.7.5",
|
|
33
33
|
"js-cookie": "^2.2.1",
|
|
34
34
|
"jsencrypt": "^3.3.2",
|
|
35
|
+
"lodash.clonedeep": "^4.5.0",
|
|
35
36
|
"lodash.get": "^4.4.2",
|
|
36
37
|
"mockjs": "^1.1.0",
|
|
37
38
|
"nprogress": "^0.2.0",
|
|
@@ -57,13 +58,11 @@
|
|
|
57
58
|
"@vue/cli-service": "^5.0.8",
|
|
58
59
|
"@vue/eslint-config-standard": "^8.0.1",
|
|
59
60
|
"@vue/test-utils": "^1.3.6",
|
|
60
|
-
"@vuepress/plugin-back-to-top": "^1.9.9",
|
|
61
61
|
"babel-jest": "^26.6.3",
|
|
62
62
|
"babel-plugin-transform-remove-console": "^6.9.4",
|
|
63
63
|
"compression-webpack-plugin": "^10.0.0",
|
|
64
64
|
"css-minimizer-webpack-plugin": "^5.0.1",
|
|
65
65
|
"deepmerge": "^4.3.1",
|
|
66
|
-
"document-register-element": "^1.14.10",
|
|
67
66
|
"eslint": "^8.51.0",
|
|
68
67
|
"eslint-plugin-import": "^2.28.1",
|
|
69
68
|
"eslint-plugin-node": "^11.1.0",
|
|
@@ -80,10 +79,9 @@
|
|
|
80
79
|
"vue-custom-element": "^3.3.0",
|
|
81
80
|
"vue-jest": "^4.0.1",
|
|
82
81
|
"vue-template-compiler": "^2.7.14",
|
|
83
|
-
"vuepress": "^1.9.9",
|
|
84
82
|
"webpack": "^5.88.2",
|
|
85
83
|
"webpack-theme-color-replacer": "^1.4.7",
|
|
86
|
-
"whatwg-fetch": "^3.6.
|
|
84
|
+
"whatwg-fetch": "^3.6.19"
|
|
87
85
|
},
|
|
88
86
|
"browserslist": [
|
|
89
87
|
"> 1%",
|
|
@@ -17,8 +17,9 @@ const TabsPagePlugin = {
|
|
|
17
17
|
},
|
|
18
18
|
$setPageTitle (route, title) {
|
|
19
19
|
if (title) {
|
|
20
|
-
let path = typeof route === 'object' ? route.path : route
|
|
21
|
-
path = path && path.split('?')[0]
|
|
20
|
+
// let path = typeof route === 'object' ? route.path : route
|
|
21
|
+
// path = path && path.split('?')[0]
|
|
22
|
+
const path = typeof route === 'object' ? this.$router.resolve(route).route.fullPath : route
|
|
22
23
|
this.$store.commit('setting/setCustomTitle', { path, title })
|
|
23
24
|
}
|
|
24
25
|
}
|
|
@@ -26,8 +27,8 @@ const TabsPagePlugin = {
|
|
|
26
27
|
computed: {
|
|
27
28
|
customTitle () {
|
|
28
29
|
const customTitles = this.$store.state.setting.customTitles
|
|
29
|
-
const path = this.$route.path.split('?')[0]
|
|
30
|
-
const custom = customTitles.find(item => item.path ===
|
|
30
|
+
// const path = this.$route.path.split('?')[0]
|
|
31
|
+
const custom = customTitles.find(item => item.path === this.$route.fullPath)
|
|
31
32
|
return custom && custom.title
|
|
32
33
|
}
|
|
33
34
|
}
|
|
@@ -22,10 +22,11 @@ const ANTD = {
|
|
|
22
22
|
'component-background': '#fff',
|
|
23
23
|
'heading-color': 'rgba(0, 0, 0, 0.85)',
|
|
24
24
|
'text-color': 'rgba(0, 0, 0, 0.65)',
|
|
25
|
-
'text-color-inverse': '#
|
|
25
|
+
'text-color-inverse': '#fefefe',
|
|
26
26
|
'text-color-secondary': 'rgba(0, 0, 0, 0.45)',
|
|
27
27
|
'shadow-color': 'rgba(0, 0, 0, 0.15)',
|
|
28
28
|
'border-color-split': '#f0f0f0',
|
|
29
|
+
'border-color-base': '#d9d9d9',
|
|
29
30
|
'background-color-light': '#fafafa',
|
|
30
31
|
'background-color-base': '#f5f5f5',
|
|
31
32
|
'table-selected-row-bg': '#fafafa',
|
|
@@ -34,8 +35,9 @@ const ANTD = {
|
|
|
34
35
|
'disabled-color': 'rgba(0, 0, 0, 0.25)',
|
|
35
36
|
'menu-dark-color': 'rgba(254, 254, 254, 0.65)',
|
|
36
37
|
'menu-dark-highlight-color': '#fefefe',
|
|
38
|
+
'menu-dark-selected-item-icon-color': '#fefefe',
|
|
37
39
|
'menu-dark-arrow-color': '#fefefe',
|
|
38
|
-
'btn-primary-color': '#
|
|
40
|
+
'btn-primary-color': '#fefefe'
|
|
39
41
|
},
|
|
40
42
|
light: {
|
|
41
43
|
'layout-body-background': '#f0f2f5',
|
|
@@ -43,10 +45,11 @@ const ANTD = {
|
|
|
43
45
|
'component-background': '#fff',
|
|
44
46
|
'heading-color': 'rgba(0, 0, 0, 0.85)',
|
|
45
47
|
'text-color': 'rgba(0, 0, 0, 0.65)',
|
|
46
|
-
'text-color-inverse': '#
|
|
48
|
+
'text-color-inverse': '#fefefe',
|
|
47
49
|
'text-color-secondary': 'rgba(0, 0, 0, 0.45)',
|
|
48
50
|
'shadow-color': 'rgba(0, 0, 0, 0.15)',
|
|
49
51
|
'border-color-split': '#f0f0f0',
|
|
52
|
+
'border-color-base': '#d9d9d9',
|
|
50
53
|
'background-color-light': '#fafafa',
|
|
51
54
|
'background-color-base': '#f5f5f5',
|
|
52
55
|
'table-selected-row-bg': '#fafafa',
|
|
@@ -56,7 +59,7 @@ const ANTD = {
|
|
|
56
59
|
'menu-dark-color': 'rgba(1, 1, 1, 0.65)',
|
|
57
60
|
'menu-dark-highlight-color': '#fefefe',
|
|
58
61
|
'menu-dark-arrow-color': '#fefefe',
|
|
59
|
-
'btn-primary-color': '#
|
|
62
|
+
'btn-primary-color': '#fefefe'
|
|
60
63
|
},
|
|
61
64
|
night: {
|
|
62
65
|
'layout-body-background': '#000',
|
|
@@ -64,10 +67,11 @@ const ANTD = {
|
|
|
64
67
|
'component-background': '#141414',
|
|
65
68
|
'heading-color': 'rgba(255, 255, 255, 0.85)',
|
|
66
69
|
'text-color': 'rgba(255, 255, 255, 0.85)',
|
|
67
|
-
'text-color-inverse': '#
|
|
70
|
+
'text-color-inverse': '#fefefe',
|
|
68
71
|
'text-color-secondary': 'rgba(255, 255, 255, 0.45)',
|
|
69
72
|
'shadow-color': 'rgba(255, 255, 255, 0.15)',
|
|
70
73
|
'border-color-split': '#303030',
|
|
74
|
+
'border-color-base': '#282828',
|
|
71
75
|
'background-color-light': '#ffffff0a',
|
|
72
76
|
'background-color-base': '#2a2a2a',
|
|
73
77
|
'table-selected-row-bg': '#ffffff0a',
|
|
@@ -76,8 +80,9 @@ const ANTD = {
|
|
|
76
80
|
'disabled-color': 'rgba(255, 255, 255, 0.25)',
|
|
77
81
|
'menu-dark-color': 'rgba(254, 254, 254, 0.65)',
|
|
78
82
|
'menu-dark-highlight-color': '#fefefe',
|
|
83
|
+
'menu-dark-selected-item-icon-color': '#fefefe',
|
|
79
84
|
'menu-dark-arrow-color': '#fefefe',
|
|
80
|
-
'btn-primary-color': '#
|
|
85
|
+
'btn-primary-color': '#fefefe'
|
|
81
86
|
}
|
|
82
87
|
}
|
|
83
88
|
}
|
|
@@ -99,7 +99,7 @@ export default {
|
|
|
99
99
|
const routes = this.$route.matched
|
|
100
100
|
const path = this.$route.path
|
|
101
101
|
const breadcrumb = []
|
|
102
|
-
routes.filter(item => path.includes(item.path))
|
|
102
|
+
routes.filter(item => path.includes(item.path) || item.regex.test(path))
|
|
103
103
|
.forEach(route => {
|
|
104
104
|
const path = route.path.length === 0 ? '/home' : route.path
|
|
105
105
|
breadcrumb.push(this.$t(getI18nKey(path)))
|
|
@@ -97,8 +97,7 @@
|
|
|
97
97
|
this.$emit('contextmenu', pageKey, e)
|
|
98
98
|
},
|
|
99
99
|
pageName (page) {
|
|
100
|
-
const
|
|
101
|
-
const custom = this.customTitles.find(item => item.path === pagePath)
|
|
100
|
+
const custom = this.customTitles.find(item => item.path === page.path)
|
|
102
101
|
return (custom && custom.title) || page.title || this.$t(getI18nKey(page.keyPath))
|
|
103
102
|
}
|
|
104
103
|
}
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
<div :class="['tabs-view-content', layout, pageWidth]" :style="`margin-top: ${multiPage ? -24 : 0}px`">
|
|
15
15
|
<page-toggle-transition v-show="!$route.meta.singlePage" :disabled="animate.disabled" :animate="animate.name" :direction="animate.direction">
|
|
16
16
|
<a-keep-alive :exclude-keys="excludeKeys" v-if="multiPage && cachePage" v-model="clearCaches">
|
|
17
|
-
<router-view v-if="!refreshing" ref="tabContent" :key="$route.
|
|
17
|
+
<router-view v-if="!refreshing" ref="tabContent" :key="$route.fullPath" />
|
|
18
18
|
</a-keep-alive>
|
|
19
19
|
<router-view ref="tabContent" v-else-if="!refreshing" />
|
|
20
20
|
</page-toggle-transition>
|
|
@@ -75,10 +75,10 @@ export default {
|
|
|
75
75
|
this.loadCacheConfig(this.$router?.options?.routes)
|
|
76
76
|
this.loadCachedTabs()
|
|
77
77
|
const route = this.$route
|
|
78
|
-
if (this.pageList.findIndex(item => item.path === route.
|
|
78
|
+
if (this.pageList.findIndex(item => item.path === route.fullPath) === -1) {
|
|
79
79
|
this.pageList.push(this.createPage(route))
|
|
80
80
|
}
|
|
81
|
-
this.activePage = route.
|
|
81
|
+
this.activePage = route.fullPath
|
|
82
82
|
if (this.multiPage) {
|
|
83
83
|
this.$nextTick(() => {
|
|
84
84
|
this.setCachedKey(route)
|
|
@@ -99,8 +99,8 @@ export default {
|
|
|
99
99
|
this.loadCacheConfig(val)
|
|
100
100
|
},
|
|
101
101
|
$route: function (newRoute) {
|
|
102
|
-
this.activePage = newRoute.
|
|
103
|
-
const page = this.pageList.find(item => item.path === newRoute.
|
|
102
|
+
this.activePage = newRoute.fullPath
|
|
103
|
+
const page = this.pageList.find(item => item.path === newRoute.fullPath)
|
|
104
104
|
if (!this.multiPage) {
|
|
105
105
|
this.pageList = [this.createPage(newRoute)]
|
|
106
106
|
} else if (page) {
|
|
@@ -288,7 +288,7 @@ export default {
|
|
|
288
288
|
keyPath: route.matched[route.matched.length - 1].path,
|
|
289
289
|
fullPath: route.fullPath,
|
|
290
290
|
loading: false,
|
|
291
|
-
path: route.
|
|
291
|
+
path: route.fullPath,
|
|
292
292
|
title: route.meta && route.meta.page && route.meta.page.title,
|
|
293
293
|
unclose: route.meta && route.meta.page && (route.meta.page.closable === false)
|
|
294
294
|
}
|
|
@@ -340,7 +340,7 @@ export default {
|
|
|
340
340
|
this.allSinglePages.push(item)
|
|
341
341
|
}
|
|
342
342
|
if (!cacheAble) {
|
|
343
|
-
this.excludeKeys.push(new RegExp(`${item.path}
|
|
343
|
+
this.excludeKeys.push(new RegExp(`${item.path.replace(/:[^/]*/g, '[^/]*')}(\\?.*)?\\d*$`))
|
|
344
344
|
}
|
|
345
345
|
if (item.children) {
|
|
346
346
|
this.loadCacheConfig(item.children, cacheAble)
|
|
@@ -8,10 +8,12 @@ function hasPermission (authority, permissions) {
|
|
|
8
8
|
let required = '*'
|
|
9
9
|
if (typeof authority === 'string') {
|
|
10
10
|
required = authority
|
|
11
|
+
} else if (Array.isArray(authority)) {
|
|
12
|
+
required = authority
|
|
11
13
|
} else if (typeof authority === 'object') {
|
|
12
14
|
required = authority.permission
|
|
13
15
|
}
|
|
14
|
-
return required === '*' || (permissions
|
|
16
|
+
return required === '*' || hasAnyItem(required, permissions, (r, t) => !!(r === t || r === t.id))
|
|
15
17
|
}
|
|
16
18
|
|
|
17
19
|
/**
|
|
@@ -24,25 +26,23 @@ function hasRole (authority, roles) {
|
|
|
24
26
|
if (typeof authority === 'object') {
|
|
25
27
|
required = authority.role
|
|
26
28
|
}
|
|
27
|
-
return authority === '*' ||
|
|
29
|
+
return authority === '*' || hasAnyItem(required, roles, (r, t) => !!(r === t || r === t.id))
|
|
28
30
|
}
|
|
29
31
|
|
|
30
32
|
/**
|
|
31
|
-
*
|
|
32
|
-
* @param
|
|
33
|
-
* @param
|
|
33
|
+
* 判断目标数组是否有所需元素
|
|
34
|
+
* @param {String | String[]}required 所需元素,数组或单个元素
|
|
35
|
+
* @param {String[]|Object[]} source 目标数组
|
|
36
|
+
* @param {Function} filter 匹配条件
|
|
37
|
+
* (r: String, s: String|Object) => boolean
|
|
34
38
|
* @returns {boolean}
|
|
35
39
|
*/
|
|
36
|
-
function
|
|
40
|
+
function hasAnyItem (required, source, filter) {
|
|
37
41
|
if (!required) {
|
|
38
42
|
return false
|
|
39
|
-
} else if (Array.isArray(required)) {
|
|
40
|
-
return roles.findIndex(role => {
|
|
41
|
-
return required.findIndex(item => item === role || item === role.id) !== -1
|
|
42
|
-
}) !== -1
|
|
43
|
-
} else {
|
|
44
|
-
return roles.findIndex(role => role === required || role.id === required) !== -1
|
|
45
43
|
}
|
|
44
|
+
const checkedList = Array.isArray(required) ? required : [required]
|
|
45
|
+
return !!source.find(s => checkedList.find(r => filter(r, s)))
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
/**
|
package/src/utils/routerUtil.js
CHANGED
|
@@ -117,6 +117,9 @@ function parseRoutes (routesConfig, routerMap) {
|
|
|
117
117
|
redirect: routeCfg.redirect || router.redirect,
|
|
118
118
|
meta: { ...meta, authority: meta.authority || '*' }
|
|
119
119
|
}
|
|
120
|
+
if (router.beforeEnter) {
|
|
121
|
+
route.beforeEnter = router.beforeEnter
|
|
122
|
+
}
|
|
120
123
|
if (routeCfg.invisible || router.invisible) {
|
|
121
124
|
route.meta.invisible = true
|
|
122
125
|
}
|
|
@@ -265,7 +268,7 @@ function formatAuthority (routes, pAuthorities = []) {
|
|
|
265
268
|
let authority = {}
|
|
266
269
|
if (!meta.authority) {
|
|
267
270
|
authority = defaultAuthority
|
|
268
|
-
} else if (typeof meta.authority === 'string') {
|
|
271
|
+
} else if (typeof meta.authority === 'string' || Array.isArray(meta.authority)) {
|
|
269
272
|
authority.permission = meta.authority
|
|
270
273
|
} else if (typeof meta.authority === 'object') {
|
|
271
274
|
authority = meta.authority
|