vue2-client 1.8.28 → 1.8.30
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/CHANGELOG.md +1 -1
- package/package.json +1 -1
- package/src/router/guards.js +4 -3
- package/src/utils/routerUtil.js +5 -4
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
package/src/router/guards.js
CHANGED
|
@@ -35,8 +35,9 @@ const progressStart = (to, from, next) => {
|
|
|
35
35
|
* @param options
|
|
36
36
|
*/
|
|
37
37
|
const loginGuard = (to, from, next, options) => {
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
if (window.__MICRO_APP_ENVIRONMENT__) {
|
|
39
|
+
window.microApp.dispatch({ type: '子应用发送给主应用的数据', to: to.path })
|
|
40
|
+
}
|
|
40
41
|
const urlParams = new URLSearchParams(window.location.search)
|
|
41
42
|
const token = urlParams.get('token')
|
|
42
43
|
const V4_LOGIN_DATA_KEY = localStorage.getItem('v4LoginData')
|
|
@@ -89,7 +90,7 @@ const loginGuard = (to, from, next, options) => {
|
|
|
89
90
|
r: v4LoginData.r
|
|
90
91
|
}
|
|
91
92
|
Vue.$store.commit('account/setLogin', login)
|
|
92
|
-
|
|
93
|
+
loadRoutes(funcToRouter(v4LoginData.functions))
|
|
93
94
|
next()
|
|
94
95
|
} else {
|
|
95
96
|
const { store, message } = options
|
package/src/utils/routerUtil.js
CHANGED
|
@@ -346,6 +346,10 @@ function parsefunc (func) {
|
|
|
346
346
|
icon: row.icon,
|
|
347
347
|
name: row.name
|
|
348
348
|
}
|
|
349
|
+
if (row.link.includes('$')) {
|
|
350
|
+
route.router = row.link.split('$')[1]
|
|
351
|
+
route.params = row.link.split('$')[0]
|
|
352
|
+
}
|
|
349
353
|
if (row.children && row.children.length > 0) {
|
|
350
354
|
route.children = parsefunc(row.children)
|
|
351
355
|
}
|
|
@@ -358,10 +362,7 @@ function parsefunc (func) {
|
|
|
358
362
|
* 资源服务路由排序
|
|
359
363
|
*/
|
|
360
364
|
function positionRouter (r) {
|
|
361
|
-
let router =
|
|
362
|
-
for (const row of r) {
|
|
363
|
-
router[row.position] = row
|
|
364
|
-
}
|
|
365
|
+
let router = r.sort((a, b) => a.position - b.position)
|
|
365
366
|
router = arrRemoveEmpty(router)
|
|
366
367
|
return router
|
|
367
368
|
}
|