@netang/quasar 0.1.72 → 0.1.74

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": "@netang/quasar",
3
- "version": "0.1.72",
3
+ "version": "0.1.74",
4
4
  "description": "netang-quasar",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
package/utils/$power.js CHANGED
@@ -10,6 +10,7 @@ import $n_isNumber from 'lodash/isNumber'
10
10
  import $n_cloneDeep from 'lodash/cloneDeep'
11
11
  import $n_isFunction from 'lodash/isFunction'
12
12
  import $n_pick from 'lodash/pick'
13
+ import $n_omit from 'lodash/omit'
13
14
 
14
15
  import $n_router from '@netang/utils/vue/router'
15
16
 
@@ -50,6 +51,21 @@ const {
50
51
  dicts,
51
52
  } = configs
52
53
 
54
+ /**
55
+ * 获取来源页面完整地址
56
+ */
57
+ function getFromPageFullUrl({ path, query }) {
58
+
59
+ const {
60
+ fullPath
61
+ } = $n_router.resolve({
62
+ path,
63
+ query: $n_omit(query, ['n_page_title', 'n_from_page']),
64
+ })
65
+
66
+ return encodeURIComponent(fullPath)
67
+ }
68
+
53
69
  /**
54
70
  * 创建权限实例
55
71
  */
@@ -129,6 +145,9 @@ function create(options) {
129
145
  // 权限路由
130
146
  let $route
131
147
 
148
+ // 自定义参数
149
+ const optionsQuery = $n_isValidObject(o.query) ? o.query : {}
150
+
132
151
  // 如果没有路由
133
152
  if (o.path === false) {
134
153
 
@@ -136,7 +155,7 @@ function create(options) {
136
155
  $route = {
137
156
  fullPath: '',
138
157
  path: '',
139
- query: $n_isValidObject(o.query) ? o.query : {},
158
+ query: optionsQuery,
140
159
  }
141
160
 
142
161
  // 如果有自定义路径
@@ -145,19 +164,18 @@ function create(options) {
145
164
  // 获取自定义路由
146
165
  $route = $n_router.resolve({
147
166
  path: o.path,
148
- query: $n_isValidObject(o.query) ? o.query : {},
167
+ query: optionsQuery,
149
168
  })
150
169
 
151
- // 如果在渲染组件内 && 该渲染组件有自定义路由
152
- } else if (hasRender && $n_has($render, 'getRoute')) {
153
-
154
- // 设为渲染组件的路由
155
- $route = $render.getRoute()
156
-
157
- // 否则获取当前路由
158
170
  } else {
159
171
 
160
- $route = $currentRoute
172
+ // 如果在渲染组件内 && 该渲染组件有自定义路由
173
+ $route = hasRender && $n_has($render, 'getRoute')
174
+ // 设为渲染组件的路由
175
+ ? $render.getRoute()
176
+ // 否则获取当前路由
177
+ : $currentRoute
178
+ Object.assign($route.query, optionsQuery)
161
179
  }
162
180
 
163
181
  // quasar 对象
@@ -1030,8 +1048,9 @@ async function request(options) {
1030
1048
 
1031
1049
  // 如果不是禁止添加来源页面参数
1032
1050
  if ($n_get(o.powerBtn.data, 'noFromPageQuery') !== true) {
1051
+
1033
1052
  // 来源页面是当前路由的完整路径
1034
- query.n_from_page = encodeURIComponent($currentRoute.fullPath)
1053
+ query.n_from_page = getFromPageFullUrl($currentRoute)
1035
1054
  }
1036
1055
 
1037
1056
  // 请求前执行
@@ -1376,10 +1395,10 @@ function routerPush({ path, query, pageTitle, fromPage }) {
1376
1395
  // 来源页面
1377
1396
  if (fromPage) {
1378
1397
  if (fromPage === true) {
1379
- fromPage = $n_router.getRoute().fullPath
1398
+ fromPage = $n_router.getRoute()
1380
1399
  }
1381
1400
  // 来源页面是指定路由的完整路径
1382
- query.n_from_page = encodeURIComponent(fromPage)
1401
+ query.n_from_page = getFromPageFullUrl(fromPage)
1383
1402
  }
1384
1403
 
1385
1404
  $n_router.push({
package/utils/$table.js CHANGED
@@ -231,15 +231,22 @@ function create(options) {
231
231
  }
232
232
  }
233
233
 
234
- // 获取权限路由
235
- $route = $n_isValidString(o.path) ?
236
- // 如果为自定义路由
237
- $n_router.resolve({
234
+ // 自定义参数
235
+ const optionsQuery = $n_isValidObject(o.query) ? o.query : {}
236
+
237
+ // 如果为自定义路由
238
+ if ($n_isValidString(o.path)) {
239
+ // 获取权限路由
240
+ $route = $n_router.resolve({
238
241
  path: o.path,
239
- query: $n_isValidObject(o.query) ? o.query : {},
242
+ query: optionsQuery,
240
243
  })
241
244
  // 否则获取当前路由
242
- : (hasPowr ? $power.getRoute() : $n_router.getRoute())
245
+ } else {
246
+ // 获取权限路由
247
+ $route = hasPowr ? $power.getRoute() : $n_router.getRoute()
248
+ Object.assign($route.query, optionsQuery)
249
+ }
243
250
 
244
251
  // 是否有权限按钮
245
252
  const _hasPowerBtns = hasPowr ? $power.powerBtns.value.length : false