vue2-client 1.8.0-1 → 1.8.0-3

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue2-client",
3
- "version": "1.8.0-1",
3
+ "version": "1.8.0-3",
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,17 +58,12 @@
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
- "eslint-plugin-import": "^2.28.1",
69
- "eslint-plugin-node": "^11.1.0",
70
- "eslint-plugin-promise": "^6.1.1",
71
67
  "eslint-plugin-vue": "^9.17.0",
72
68
  "fast-deep-equal": "^3.1.3",
73
69
  "jest": "^26.6.3",
@@ -77,13 +73,11 @@
77
73
  "script-loader": "^0.7.2",
78
74
  "style-resources-loader": "^1.5.0",
79
75
  "vue-cli-plugin-style-resources-loader": "^0.1.5",
80
- "vue-custom-element": "^3.3.0",
81
76
  "vue-jest": "^4.0.1",
82
77
  "vue-template-compiler": "^2.7.14",
83
- "vuepress": "^1.9.9",
84
78
  "webpack": "^5.88.2",
85
79
  "webpack-theme-color-replacer": "^1.4.7",
86
- "whatwg-fetch": "^3.6.2"
80
+ "whatwg-fetch": "^3.6.19"
87
81
  },
88
82
  "browserslist": [
89
83
  "> 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 === 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': '#fff',
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': '#fff'
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': '#fff',
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': '#fff'
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': '#141414',
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': '#141414'
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)))
@@ -135,9 +135,10 @@ export default {
135
135
  this.loading = false
136
136
  return
137
137
  }
138
- this.loadding = true
138
+ if (this.show) return
139
+ this.loading = true
139
140
  setTimeout(() => {
140
- this.loadding = false
141
+ this.loading = false
141
142
  }, 1000)
142
143
  }
143
144
  }
@@ -97,8 +97,7 @@
97
97
  this.$emit('contextmenu', pageKey, e)
98
98
  },
99
99
  pageName (page) {
100
- const pagePath = page.fullPath.split('?')[0]
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.path" />
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.path) === -1) {
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.path
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.path
103
- const page = this.pageList.find(item => item.path === newRoute.path)
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.path,
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}\\d+$`))
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 && permissions.findIndex(item => item === required || item.id === required) !== -1)
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 === '*' || hasAnyRole(required, roles)
29
+ return authority === '*' || hasAnyItem(required, roles, (r, t) => !!(r === t || r === t.id))
28
30
  }
29
31
 
30
32
  /**
31
- * 判断是否有需要的任意一个角色
32
- * @param required {String | Array[String]} 需要的角色,可以是单个角色或者一个角色数组
33
- * @param roles 拥有的角色
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 hasAnyRole (required, roles) {
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
  /**
@@ -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
package/vue.config.js CHANGED
@@ -49,6 +49,14 @@ module.exports = {
49
49
  }
50
50
  },
51
51
  configureWebpack: config => {
52
+ config.context = path.resolve(__dirname, './')
53
+ config.resolve = {
54
+ extensions: ['.js', '.vue', '.json'],
55
+ alias: {
56
+ '@': path.resolve('src'),
57
+ '@vue2-client': path.resolve('src')
58
+ }
59
+ }
52
60
  config.entry.app = ['core-js/stable', 'regenerator-runtime/runtime', 'whatwg-fetch', './src/main.js']
53
61
  config.performance = {
54
62
  hints: false
package/webpack.config.js DELETED
@@ -1,12 +0,0 @@
1
- 'use strict'
2
- const path = require('path')
3
-
4
- module.exports = {
5
- context: path.resolve(__dirname, './'),
6
- resolve: {
7
- extensions: ['.js', '.vue', '.json'],
8
- alias: {
9
- '@vue2-client': path.resolve('src')
10
- }
11
- }
12
- }