@yysports/tools 2.2.3 → 2.2.5

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.
@@ -1,5 +1,6 @@
1
1
  export default class Log {
2
2
  private static _module;
3
+ static get module(): string;
3
4
  private static _commonProps;
4
5
  static visitLog(module: string): void;
5
6
  static eventLog(content: string): void;
package/dist/Track/Log.js CHANGED
@@ -14,10 +14,17 @@ var Log = /*#__PURE__*/function () {
14
14
  _classCallCheck(this, Log);
15
15
  }
16
16
  _createClass(Log, null, [{
17
- key: "_commonProps",
18
- value:
17
+ key: "module",
18
+ get:
19
+ // 获取当前模块名称
20
+ function get() {
21
+ return this._module;
22
+ }
23
+
19
24
  // 上报日志的公共属性
20
- function _commonProps() {
25
+ }, {
26
+ key: "_commonProps",
27
+ value: function _commonProps() {
21
28
  return _objectSpread(_objectSpread(_objectSpread({}, User.profile), System.profile), {}, {
22
29
  appId: Config.data.appId,
23
30
  module: this._module
@@ -8,6 +8,7 @@ export default class Track {
8
8
  static get userProfile(): UserProfile | null;
9
9
  static get systemProfile(): import("../interfaces/track.interface").SystemProfile;
10
10
  static run(): void;
11
+ static get module(): string;
11
12
  static visitLog: typeof Log.visitLog;
12
13
  static eventLog: typeof Log.eventLog;
13
14
  static errorLog: typeof Log.errorLog;
@@ -47,6 +47,13 @@ var Track = /*#__PURE__*/function () {
47
47
  Replay.run();
48
48
  Beacon.updateVersion();
49
49
  }
50
+
51
+ // 获取当前页面模块名称
52
+ }, {
53
+ key: "module",
54
+ get: function get() {
55
+ return Log.module;
56
+ }
50
57
  }]);
51
58
  return Track;
52
59
  }();
@@ -7,6 +7,7 @@
7
7
  export declare const getModuleNameByUmi: (onRouteChangeArgs: {
8
8
  location: any;
9
9
  routes: any;
10
+ basename: string;
10
11
  }, menuNameMap?: {
11
12
  [key: string]: string;
12
13
  } | undefined) => string | undefined;
@@ -6,10 +6,15 @@
6
6
  */
7
7
  export var getModuleNameByUmi = function getModuleNameByUmi(onRouteChangeArgs, menuNameMap) {
8
8
  var location = onRouteChangeArgs.location,
9
- routes = onRouteChangeArgs.routes;
9
+ routes = onRouteChangeArgs.routes,
10
+ basename = onRouteChangeArgs.basename;
10
11
  var pathname = location.pathname;
12
+ var routePath = pathname;
13
+ if (basename !== '/') {
14
+ routePath = pathname.replace(basename, '');
15
+ }
11
16
  var currentRouteKey = Object.keys(routes).find(function (v) {
12
- return routes[v].path === pathname;
17
+ return routes[v].path === routePath;
13
18
  });
14
19
 
15
20
  // 如果路由不存在或是重定向路由,直接返回
@@ -1,5 +1,6 @@
1
1
  export default class Log {
2
2
  private static _module;
3
+ static get module(): string;
3
4
  private static _commonProps;
4
5
  static visitLog(module: string): void;
5
6
  static eventLog(content: string): void;
package/lib/Track/Log.js CHANGED
@@ -38,6 +38,10 @@ var import_Replay = __toESM(require("./Replay"));
38
38
  var import_System = __toESM(require("./System"));
39
39
  var import_User = __toESM(require("./User"));
40
40
  var Log = class {
41
+ // 获取当前模块名称
42
+ static get module() {
43
+ return this._module;
44
+ }
41
45
  // 上报日志的公共属性
42
46
  static _commonProps() {
43
47
  return {
@@ -8,6 +8,7 @@ export default class Track {
8
8
  static get userProfile(): UserProfile | null;
9
9
  static get systemProfile(): import("../interfaces/track.interface").SystemProfile;
10
10
  static run(): void;
11
+ static get module(): string;
11
12
  static visitLog: typeof Log.visitLog;
12
13
  static eventLog: typeof Log.eventLog;
13
14
  static errorLog: typeof Log.errorLog;
@@ -62,6 +62,10 @@ var Track = class {
62
62
  import_Replay.default.run();
63
63
  import_Beacon.default.updateVersion();
64
64
  }
65
+ // 获取当前页面模块名称
66
+ static get module() {
67
+ return import_Log.default.module;
68
+ }
65
69
  };
66
70
  Track.visitLog = import_Log.default.visitLog.bind(import_Log.default);
67
71
  Track.eventLog = import_Log.default.eventLog.bind(import_Log.default);
@@ -7,6 +7,7 @@
7
7
  export declare const getModuleNameByUmi: (onRouteChangeArgs: {
8
8
  location: any;
9
9
  routes: any;
10
+ basename: string;
10
11
  }, menuNameMap?: {
11
12
  [key: string]: string;
12
13
  } | undefined) => string | undefined;
@@ -23,10 +23,14 @@ __export(route_exports, {
23
23
  });
24
24
  module.exports = __toCommonJS(route_exports);
25
25
  var getModuleNameByUmi = (onRouteChangeArgs, menuNameMap) => {
26
- const { location, routes } = onRouteChangeArgs;
26
+ const { location, routes, basename } = onRouteChangeArgs;
27
27
  const { pathname } = location;
28
+ let routePath = pathname;
29
+ if (basename !== "/") {
30
+ routePath = pathname.replace(basename, "");
31
+ }
28
32
  const currentRouteKey = Object.keys(routes).find(
29
- (v) => routes[v].path === pathname
33
+ (v) => routes[v].path === routePath
30
34
  );
31
35
  if (!currentRouteKey || routes[currentRouteKey].redirect) {
32
36
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yysports/tools",
3
- "version": "2.2.3",
3
+ "version": "2.2.5",
4
4
  "description": "常用工具函数库",
5
5
  "homepage": "https://git.pousheng.com/sport-service-department/pousheng-guard/yysports_tools#readme",
6
6
  "bugs": {