@yysports/tools 0.1.4 → 0.1.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.
package/dist/Track/index.js
CHANGED
|
@@ -267,6 +267,9 @@ var Track = /*#__PURE__*/function () {
|
|
|
267
267
|
key: "getPageModuleName",
|
|
268
268
|
value: function getPageModuleName() {
|
|
269
269
|
var routeInfo = this.routesMap.get(this.getFormatBasePath());
|
|
270
|
+
if (routeInfo !== null && routeInfo !== void 0 && routeInfo.redirect) {
|
|
271
|
+
throw new Error('重定向路径不记录埋点');
|
|
272
|
+
}
|
|
270
273
|
return (routeInfo === null || routeInfo === void 0 ? void 0 : routeInfo.module) || [];
|
|
271
274
|
}
|
|
272
275
|
|
|
@@ -312,21 +315,23 @@ var Track = /*#__PURE__*/function () {
|
|
|
312
315
|
}, {
|
|
313
316
|
key: "visitLog",
|
|
314
317
|
value: function visitLog(_visitLog) {
|
|
315
|
-
|
|
316
|
-
_visitLog
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
318
|
+
try {
|
|
319
|
+
if (_visitLog === undefined) {
|
|
320
|
+
_visitLog = {
|
|
321
|
+
module: '',
|
|
322
|
+
content: ''
|
|
323
|
+
};
|
|
324
|
+
var routeNames = this.getPageModuleName();
|
|
325
|
+
Object.assign(_visitLog, {
|
|
326
|
+
module: routeNames.join('-'),
|
|
327
|
+
content: "\u8BBF\u95EE\u9875\u9762: ".concat(_toConsumableArray(routeNames).pop())
|
|
328
|
+
});
|
|
329
|
+
}
|
|
330
|
+
this.pushQueue({
|
|
331
|
+
log: _visitLog,
|
|
332
|
+
type: 'visit'
|
|
324
333
|
});
|
|
325
|
-
}
|
|
326
|
-
this.pushQueue({
|
|
327
|
-
log: _visitLog,
|
|
328
|
-
type: 'visit'
|
|
329
|
-
});
|
|
334
|
+
} catch (e) {}
|
|
330
335
|
}
|
|
331
336
|
|
|
332
337
|
// 推送接口访问日志
|
package/dist/Utils/route.js
CHANGED
package/lib/Track/index.js
CHANGED
|
@@ -205,6 +205,9 @@ var Track = class {
|
|
|
205
205
|
// 获取模块名称
|
|
206
206
|
static getPageModuleName() {
|
|
207
207
|
const routeInfo = this.routesMap.get(this.getFormatBasePath());
|
|
208
|
+
if (routeInfo == null ? void 0 : routeInfo.redirect) {
|
|
209
|
+
throw new Error("重定向路径不记录埋点");
|
|
210
|
+
}
|
|
208
211
|
return (routeInfo == null ? void 0 : routeInfo.module) || [];
|
|
209
212
|
}
|
|
210
213
|
// 推送错误日志
|
|
@@ -241,18 +244,21 @@ var Track = class {
|
|
|
241
244
|
}
|
|
242
245
|
// 推送页面访问日志
|
|
243
246
|
static visitLog(visitLog) {
|
|
244
|
-
|
|
245
|
-
visitLog
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
247
|
+
try {
|
|
248
|
+
if (visitLog === void 0) {
|
|
249
|
+
visitLog = { module: "", content: "" };
|
|
250
|
+
const routeNames = this.getPageModuleName();
|
|
251
|
+
Object.assign(visitLog, {
|
|
252
|
+
module: routeNames.join("-"),
|
|
253
|
+
content: `访问页面: ${[...routeNames].pop()}`
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
this.pushQueue({
|
|
257
|
+
log: visitLog,
|
|
258
|
+
type: "visit"
|
|
250
259
|
});
|
|
260
|
+
} catch (e) {
|
|
251
261
|
}
|
|
252
|
-
this.pushQueue({
|
|
253
|
-
log: visitLog,
|
|
254
|
-
type: "visit"
|
|
255
|
-
});
|
|
256
262
|
}
|
|
257
263
|
// 推送接口访问日志
|
|
258
264
|
static apiLog(apiLog) {
|
package/lib/Utils/route.js
CHANGED