n20-common-lib 2.8.25 → 2.8.26
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 +1 -1
- package/src/utils/handleTab.js +4 -0
- package/src/utils/monitor.js +16 -7
package/package.json
CHANGED
package/src/utils/handleTab.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import monitor from './monitor'
|
|
2
|
+
|
|
1
3
|
// 操作切换路由生成的页签
|
|
2
4
|
const dN = process.env.VUE_APP_NAME
|
|
3
5
|
/** 打开页签,push对应路由 */
|
|
@@ -78,6 +80,8 @@ function getName(baseUrl) {
|
|
|
78
80
|
/** 子模块在门户中打开页签 */
|
|
79
81
|
export function setTabs(baseUrl, to, tab = true) {
|
|
80
82
|
let { path, name, meta = {}, query } = to
|
|
83
|
+
monitor.setCurrentRoute(meta?.desc || meta?.title)
|
|
84
|
+
|
|
81
85
|
let { i18n, title } = getI18n(meta, name)
|
|
82
86
|
let route = getPath(baseUrl, path)
|
|
83
87
|
|
package/src/utils/monitor.js
CHANGED
|
@@ -1,22 +1,31 @@
|
|
|
1
1
|
// 监控类 用户点击菜单时记录当前菜单,用于统一请求体的OperationDesc
|
|
2
2
|
class Monitor {
|
|
3
3
|
constructor(opt) {
|
|
4
|
-
this.
|
|
5
|
-
this.
|
|
4
|
+
this.options = opt
|
|
5
|
+
this._init()
|
|
6
6
|
}
|
|
7
|
-
|
|
8
|
-
this.
|
|
7
|
+
_init() {
|
|
8
|
+
this._clickEvent()
|
|
9
9
|
}
|
|
10
10
|
setRouter(router) {
|
|
11
11
|
this.router = router
|
|
12
12
|
}
|
|
13
|
-
|
|
13
|
+
setCurrentRoute(value) {
|
|
14
|
+
this.desc = value
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
getCurrentRoute() {
|
|
18
|
+
return this.router?.currentRoute
|
|
19
|
+
}
|
|
20
|
+
_clickEvent() {
|
|
14
21
|
// 监听点击事件
|
|
15
22
|
document.addEventListener('click', (e) => {
|
|
16
|
-
const currentMenu = this.
|
|
23
|
+
const currentMenu = this.getCurrentRoute()
|
|
17
24
|
if (currentMenu) {
|
|
18
25
|
const { meta } = currentMenu
|
|
19
|
-
|
|
26
|
+
if (this.desc || meta?.desc) {
|
|
27
|
+
window.localStorage.setItem('currentMenu', this.desc || meta?.desc)
|
|
28
|
+
}
|
|
20
29
|
}
|
|
21
30
|
})
|
|
22
31
|
}
|