@haluo/util 2.0.7 → 2.0.9
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/index.js +34 -20
- package/dist/modules/cookie/index.js +4 -3
- package/dist/modules/date/index.js +12 -12
- package/dist/modules/dom/index.js +2 -2
- package/dist/modules/filter/index.js +11 -20
- package/dist/modules/format/index.js +2 -1
- package/dist/modules/match/index.js +1 -1
- package/dist/modules/monitor/index.js +2 -2
- package/dist/modules/monitor/lib/jsError.js +5 -13
- package/dist/modules/monitor/lib/timing.js +1 -1
- package/dist/modules/monitor/lib/xhr.js +2 -4
- package/dist/modules/monitor/utils/tracker.js +2 -23
- package/dist/modules/number/index.js +5 -4
- package/dist/modules/sentry/index.js +9 -6
- package/dist/modules/tools/index.js +5 -5
- package/dist/tsconfig.tsbuildinfo +1 -2915
- package/dist/types/index.d.ts +24 -3
- package/dist/types/modules/cookie/index.d.ts +2 -0
- package/dist/types/modules/date/index.d.ts +52 -1
- package/dist/types/modules/dom/index.d.ts +28 -1
- package/dist/types/modules/filter/index.d.ts +4 -6
- package/dist/types/modules/format/index.d.ts +2 -0
- package/dist/types/modules/match/index.d.ts +12 -1
- package/dist/types/modules/monitor/utils/tracker.d.ts +0 -1
- package/dist/types/modules/number/index.d.ts +3 -1
- package/dist/types/modules/tools/index.d.ts +166 -1
- package/package.json +6 -2
- package/dist/index.cjs.js +0 -89
- package/dist/index.d.ts +0 -12
- package/dist/index.esm.js +0 -87
- package/dist/lib-list.d.ts +0 -2
- package/dist/modules/cookie/index.d.ts +0 -27
- package/dist/modules/date/index.d.ts +0 -1
- package/dist/modules/dom/index.d.ts +0 -1
- package/dist/modules/filter/index.d.ts +0 -26
- package/dist/modules/format/index.d.ts +0 -13
- package/dist/modules/match/index.d.ts +0 -1
- package/dist/modules/number/index.d.ts +0 -39
- package/dist/modules/sentry/index.d.ts +0 -15
- package/dist/modules/tools/index.d.ts +0 -1
package/dist/index.js
CHANGED
|
@@ -1,17 +1,34 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.tools = exports.number = exports.match = exports.format = exports.filter = exports.dom = exports.date = exports.cookie = void 0;
|
|
7
|
+
var cookie_1 = __importDefault(require("./modules/cookie"));
|
|
8
|
+
exports.cookie = cookie_1.default;
|
|
9
|
+
var date_1 = __importDefault(require("./modules/date"));
|
|
10
|
+
exports.date = date_1.default;
|
|
11
|
+
var dom_1 = __importDefault(require("./modules/dom"));
|
|
12
|
+
exports.dom = dom_1.default;
|
|
13
|
+
var filter_1 = __importDefault(require("./modules/filter"));
|
|
14
|
+
exports.filter = filter_1.default;
|
|
15
|
+
var format_1 = __importDefault(require("./modules/format"));
|
|
16
|
+
exports.format = format_1.default;
|
|
17
|
+
var match_1 = __importDefault(require("./modules/match"));
|
|
18
|
+
exports.match = match_1.default;
|
|
19
|
+
var number_1 = __importDefault(require("./modules/number"));
|
|
20
|
+
exports.number = number_1.default;
|
|
21
|
+
var tools_1 = __importDefault(require("./modules/tools"));
|
|
22
|
+
exports.tools = tools_1.default;
|
|
6
23
|
var modules = {
|
|
7
|
-
cookie:
|
|
8
|
-
date:
|
|
9
|
-
dom:
|
|
10
|
-
filter:
|
|
11
|
-
format:
|
|
12
|
-
match:
|
|
13
|
-
number:
|
|
14
|
-
tools:
|
|
24
|
+
cookie: cookie_1.default,
|
|
25
|
+
date: date_1.default,
|
|
26
|
+
dom: dom_1.default,
|
|
27
|
+
filter: filter_1.default,
|
|
28
|
+
format: format_1.default,
|
|
29
|
+
match: match_1.default,
|
|
30
|
+
number: number_1.default,
|
|
31
|
+
tools: tools_1.default,
|
|
15
32
|
};
|
|
16
33
|
var Utils = /** @class */ (function () {
|
|
17
34
|
function Utils() {
|
|
@@ -22,15 +39,12 @@ var Utils = /** @class */ (function () {
|
|
|
22
39
|
* 示例:this.$cookie、this.$date、this.$match、this.$number、this.$tools
|
|
23
40
|
* @param {Object} Vue 需要挂载的目标对象
|
|
24
41
|
*/
|
|
25
|
-
Utils.prototype.install = function (
|
|
42
|
+
Utils.prototype.install = function (app) {
|
|
26
43
|
Object.keys(modules).forEach(function (key) {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
Vue.prototype['$' + key] = modules[key];
|
|
31
|
-
Vue['$' + key] = modules[key];
|
|
44
|
+
var globalProperties = app.config.globalProperties;
|
|
45
|
+
globalProperties['$' + key] = modules[key];
|
|
32
46
|
});
|
|
33
47
|
};
|
|
34
48
|
return Utils;
|
|
35
49
|
}());
|
|
36
|
-
|
|
50
|
+
exports.default = new Utils();
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* @createBy: @2021.01.21
|
|
5
5
|
*/
|
|
6
6
|
'use strict';
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
8
|
var CookieClass = /** @class */ (function () {
|
|
8
9
|
function CookieClass() {
|
|
9
10
|
}
|
|
@@ -32,8 +33,8 @@ var CookieClass = /** @class */ (function () {
|
|
|
32
33
|
var _b = _a.name, name = _b === void 0 ? '' : _b, _c = _a.value, value = _c === void 0 ? '' : _c, _d = _a.exdays, exdays = _d === void 0 ? -1 : _d, _e = _a.path, path = _e === void 0 ? '/' : _e, _f = _a.domain, domain = _f === void 0 ? '.jddmoto.com' : _f;
|
|
33
34
|
var d = new Date();
|
|
34
35
|
d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000));
|
|
35
|
-
var expires = "expires="
|
|
36
|
-
document.cookie = name
|
|
36
|
+
var expires = "expires=".concat(d.toUTCString());
|
|
37
|
+
document.cookie = "".concat(name, "=").concat(value, ";").concat(expires, ";path=").concat(path, ";domain=").concat(domain, ";");
|
|
37
38
|
};
|
|
38
39
|
/**
|
|
39
40
|
* 清除Cookie
|
|
@@ -51,4 +52,4 @@ var CookieClass = /** @class */ (function () {
|
|
|
51
52
|
};
|
|
52
53
|
return CookieClass;
|
|
53
54
|
}());
|
|
54
|
-
|
|
55
|
+
exports.default = new CookieClass();
|
|
@@ -14,7 +14,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
14
14
|
function replacementDate(data, fmt) {
|
|
15
15
|
for (var k in data) {
|
|
16
16
|
if (new RegExp('(' + k + ')').test(fmt)) {
|
|
17
|
-
fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1) ? (data[k]) : (("00"
|
|
17
|
+
fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1) ? (data[k]) : (("00".concat(data[k])).substr(('' + data[k]).length)));
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
return fmt;
|
|
@@ -70,7 +70,7 @@ var DateClass = /** @class */ (function () {
|
|
|
70
70
|
};
|
|
71
71
|
fmt = replacementYear(timeData, fmt);
|
|
72
72
|
if (/(E+)/.test(fmt)) {
|
|
73
|
-
fmt = fmt.replace(RegExp.$1, ((RegExp.$1.length > 1) ? (RegExp.$1.length > 2 ? '\u661f\u671f' : '\u5468') : '') + week[timeData.getDay()
|
|
73
|
+
fmt = fmt.replace(RegExp.$1, ((RegExp.$1.length > 1) ? (RegExp.$1.length > 2 ? '\u661f\u671f' : '\u5468') : '') + week["".concat(timeData.getDay(), " ")]);
|
|
74
74
|
}
|
|
75
75
|
return replacementDate(o, fmt);
|
|
76
76
|
};
|
|
@@ -105,10 +105,10 @@ var DateClass = /** @class */ (function () {
|
|
|
105
105
|
if (ts <= 0)
|
|
106
106
|
return false;
|
|
107
107
|
return {
|
|
108
|
-
dd: (dd < 10 ? "0"
|
|
109
|
-
hh: (hh < 10 ? "0"
|
|
110
|
-
mm: (mm < 10 ? "0"
|
|
111
|
-
ss: (ss < 10 ? "0"
|
|
108
|
+
dd: (dd < 10 ? "0".concat(dd) : dd),
|
|
109
|
+
hh: (hh < 10 ? "0".concat(hh) : hh),
|
|
110
|
+
mm: (mm < 10 ? "0".concat(mm) : mm),
|
|
111
|
+
ss: (ss < 10 ? "0".concat(ss) : ss)
|
|
112
112
|
};
|
|
113
113
|
};
|
|
114
114
|
/**
|
|
@@ -121,19 +121,19 @@ var DateClass = /** @class */ (function () {
|
|
|
121
121
|
var time = currentTime - startTime;
|
|
122
122
|
var year = Math.floor(time / (1000 * 60 * 60 * 24) / 30 / 12);
|
|
123
123
|
if (year)
|
|
124
|
-
return year
|
|
124
|
+
return "".concat(year, "\u5E74\u524D");
|
|
125
125
|
var month = Math.floor(time / (1000 * 60 * 60 * 24) / 30);
|
|
126
126
|
if (month)
|
|
127
|
-
return month
|
|
127
|
+
return "".concat(month, "\u4E2A\u6708\u524D");
|
|
128
128
|
var day = Math.floor(time / (1000 * 60 * 60 * 24));
|
|
129
129
|
if (day)
|
|
130
|
-
return day
|
|
130
|
+
return "".concat(day, "\u5929\u524D");
|
|
131
131
|
var hour = Math.floor(time / (1000 * 60 * 60));
|
|
132
132
|
if (hour)
|
|
133
|
-
return hour
|
|
133
|
+
return "".concat(hour, "\u5C0F\u65F6\u524D");
|
|
134
134
|
var min = Math.floor(time / (1000 * 60));
|
|
135
135
|
if (min)
|
|
136
|
-
return min
|
|
136
|
+
return "".concat(min, "\u5206\u949F\u524D");
|
|
137
137
|
else
|
|
138
138
|
return '刚刚';
|
|
139
139
|
};
|
|
@@ -189,4 +189,4 @@ var DateClass = /** @class */ (function () {
|
|
|
189
189
|
};
|
|
190
190
|
return DateClass;
|
|
191
191
|
}());
|
|
192
|
-
|
|
192
|
+
exports.default = new DateClass();
|
|
@@ -48,7 +48,7 @@ var DomClass = /** @class */ (function () {
|
|
|
48
48
|
var value = object[key];
|
|
49
49
|
if (Array.isArray(value)) {
|
|
50
50
|
value.forEach(function (subValue, i) {
|
|
51
|
-
return formData.append(key +
|
|
51
|
+
return formData.append(key + "[".concat(i, "]"), subValue);
|
|
52
52
|
});
|
|
53
53
|
}
|
|
54
54
|
else {
|
|
@@ -59,4 +59,4 @@ var DomClass = /** @class */ (function () {
|
|
|
59
59
|
};
|
|
60
60
|
return DomClass;
|
|
61
61
|
}());
|
|
62
|
-
|
|
62
|
+
exports.default = new DomClass();
|
|
@@ -3,17 +3,14 @@
|
|
|
3
3
|
* @Author: wanghui
|
|
4
4
|
* @createBy: @2020.05.28
|
|
5
5
|
*/
|
|
6
|
-
/**
|
|
7
|
-
* 示例:注入所有过滤器
|
|
8
|
-
* import { filter as filters } from '@haluo/util'
|
|
9
|
-
* Object.keys(filters).forEach(key => {
|
|
10
|
-
* Vue.filter(key, filters[key])
|
|
11
|
-
* })
|
|
12
|
-
*/
|
|
13
6
|
'use strict';
|
|
14
|
-
var
|
|
15
|
-
|
|
16
|
-
|
|
7
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
8
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
9
|
+
};
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
var date_1 = __importDefault(require("../date"));
|
|
12
|
+
var number_1 = __importDefault(require("../number"));
|
|
13
|
+
var tools_1 = __importDefault(require("../tools"));
|
|
17
14
|
var FilterClass = /** @class */ (function () {
|
|
18
15
|
function FilterClass() {
|
|
19
16
|
}
|
|
@@ -25,7 +22,7 @@ var FilterClass = /** @class */ (function () {
|
|
|
25
22
|
*/
|
|
26
23
|
FilterClass.prototype.format = function (date, fmt) {
|
|
27
24
|
if (fmt === void 0) { fmt = 'YYYY-MM-DD HH:mm:ss'; }
|
|
28
|
-
return
|
|
25
|
+
return date_1.default.format(date, fmt);
|
|
29
26
|
};
|
|
30
27
|
/**
|
|
31
28
|
* 格式化金额,示例:123456 | formatMoney
|
|
@@ -33,7 +30,7 @@ var FilterClass = /** @class */ (function () {
|
|
|
33
30
|
* @return {String} 123,456
|
|
34
31
|
*/
|
|
35
32
|
FilterClass.prototype.formatMoney = function (money) {
|
|
36
|
-
return
|
|
33
|
+
return number_1.default.formatMoney(money);
|
|
37
34
|
};
|
|
38
35
|
/**
|
|
39
36
|
* 截取数组或字符串,示例:'1234' | slice(3)
|
|
@@ -44,14 +41,8 @@ var FilterClass = /** @class */ (function () {
|
|
|
44
41
|
FilterClass.prototype.slice = function (target, length) {
|
|
45
42
|
if (target === void 0) { target = ''; }
|
|
46
43
|
if (length === void 0) { length = 0; }
|
|
47
|
-
return
|
|
48
|
-
};
|
|
49
|
-
FilterClass.prototype.install = function (Vue) {
|
|
50
|
-
var _this = this;
|
|
51
|
-
Vue.filter('format', _this.format);
|
|
52
|
-
Vue.filter('formatMoney', _this.formatMoney);
|
|
53
|
-
Vue.filter('slice', _this.slice);
|
|
44
|
+
return tools_1.default.slice(target, length);
|
|
54
45
|
};
|
|
55
46
|
return FilterClass;
|
|
56
47
|
}());
|
|
57
|
-
|
|
48
|
+
exports.default = new FilterClass();
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
3
|
var Format = /** @class */ (function () {
|
|
3
4
|
function Format() {
|
|
4
5
|
}
|
|
@@ -18,4 +19,4 @@ var Format = /** @class */ (function () {
|
|
|
18
19
|
};
|
|
19
20
|
return Format;
|
|
20
21
|
}());
|
|
21
|
-
|
|
22
|
+
exports.default = new Format();
|
|
@@ -10,8 +10,8 @@ var tracker_1 = __importDefault(require("./utils/tracker"));
|
|
|
10
10
|
exports.Tracker = tracker_1.default;
|
|
11
11
|
// import timing from './lib/timing'
|
|
12
12
|
function setup(data) {
|
|
13
|
-
jsError_1.injectJsError(data);
|
|
14
|
-
xhr_1.default(data);
|
|
13
|
+
(0, jsError_1.injectJsError)(data);
|
|
14
|
+
(0, xhr_1.default)(data);
|
|
15
15
|
}
|
|
16
16
|
exports.default = setup;
|
|
17
17
|
// timing()
|
|
@@ -20,19 +20,12 @@ function injectJsError(data) {
|
|
|
20
20
|
if (data === void 0) { data = {}; }
|
|
21
21
|
window.addEventListener('error', function (e) {
|
|
22
22
|
if (e.target && (e.target.src || e.target.href)) {
|
|
23
|
-
|
|
24
|
-
//
|
|
25
|
-
|
|
26
|
-
// title: 'resourceError',
|
|
27
|
-
// filename: e.target.src || e.target.href,
|
|
28
|
-
// tagName: e.target.tagName,
|
|
29
|
-
// reason: e.target.src || e.target.href,
|
|
30
|
-
// ...data
|
|
31
|
-
// // selector: lastEvent ? get
|
|
32
|
-
// })
|
|
23
|
+
tracker_1.default.send(__assign({ kind: 'stability', type: 'error', title: 'resourceError', filename: e.target.src || e.target.href, tagName: e.target.tagName, reason: e.target.src || e.target.href }, data
|
|
24
|
+
// selector: lastEvent ? get
|
|
25
|
+
));
|
|
33
26
|
return;
|
|
34
27
|
}
|
|
35
|
-
tracker_1.default.send(__assign({ kind: 'stability', type: 'error', title: 'jsError', message: e.message, filename: e.filename, position: e.lineno
|
|
28
|
+
tracker_1.default.send(__assign({ kind: 'stability', type: 'error', title: 'jsError', message: e.message, filename: e.filename, position: "".concat(e.lineno, ":").concat(e.colno), reason: e.error.stack }, data
|
|
36
29
|
// selector: lastEvent ? get
|
|
37
30
|
));
|
|
38
31
|
}, true);
|
|
@@ -52,8 +45,7 @@ function injectJsError(data) {
|
|
|
52
45
|
message = reason.message;
|
|
53
46
|
stack = reason.stack;
|
|
54
47
|
}
|
|
55
|
-
tracker_1.default.send(__assign({ kind: 'stability', type: 'error', title: 'promiseError', message: message,
|
|
56
|
-
filename: filename, position: line + ":" + column, reason: stack }, data
|
|
48
|
+
tracker_1.default.send(__assign({ kind: 'stability', type: 'error', title: 'promiseError', message: message, filename: filename, position: "".concat(line, ":").concat(column), reason: stack }, data
|
|
57
49
|
// selector: lastEvent ? get
|
|
58
50
|
));
|
|
59
51
|
});
|
|
@@ -35,7 +35,7 @@ function timing() {
|
|
|
35
35
|
}
|
|
36
36
|
observer.disconnect(); // 不再观察
|
|
37
37
|
}).observe({ type: 'first-input', buffered: true }); // 观察页面中最大的元素
|
|
38
|
-
onload_1.default(function () {
|
|
38
|
+
(0, onload_1.default)(function () {
|
|
39
39
|
setTimeout(function () {
|
|
40
40
|
console.dir(window.performance);
|
|
41
41
|
var _a = performance.getEntriesByType('navigation')[0], fetchStart = _a.fetchStart, connectStart = _a.connectStart, connectEnd = _a.connectEnd, requestStart = _a.requestStart, responseStart = _a.responseStart, responseEnd = _a.responseEnd, domInteractive = _a.domInteractive, domContentLoadedEventStart = _a.domContentLoadedEventStart, domContentLoadedEventEnd = _a.domContentLoadedEventEnd, loadEventStart = _a.loadEventStart;
|
|
@@ -31,14 +31,12 @@ function injectXHR(data) {
|
|
|
31
31
|
var handler = function (type) { return function (event) {
|
|
32
32
|
if (_this.logData.url.indexOf('app/collect/original/info/report/v2') > -1)
|
|
33
33
|
return;
|
|
34
|
-
|
|
35
|
-
// 当前都是在readyState为4(请求已完成)的情况下,进行处理
|
|
36
|
-
if (type !== 'error' || _this.status === 0)
|
|
34
|
+
if (type !== 'error')
|
|
37
35
|
return;
|
|
38
36
|
var duration = Date.now() - startTime_1;
|
|
39
37
|
var status = _this.status;
|
|
40
38
|
var statusText = _this.statusText;
|
|
41
|
-
tracker_1.default.send(__assign({ kind: 'stability', type: 'xhr', eventType: event.type, pathname: _this.logData.url, status: status + '-' + statusText, duration: duration, response: _this.response ? JSON.stringify(_this.response) : '', params: body || '', title: 'xhr', reason: status + '-' + statusText +
|
|
39
|
+
tracker_1.default.send(__assign({ kind: 'stability', type: 'xhr', eventType: event.type, pathname: _this.logData.url, status: status + '-' + statusText, duration: duration, response: _this.response ? JSON.stringify(_this.response) : '', params: body || '', title: 'xhr', reason: status + '-' + statusText + " ".concat(_this.logData.url, " ").concat(_this.response ? JSON.stringify(_this.response) : '') }, data));
|
|
42
40
|
}; };
|
|
43
41
|
this.addEventListener('load', handler('load'), false);
|
|
44
42
|
this.addEventListener('error', handler('error'), false);
|
|
@@ -13,40 +13,18 @@ var __assign = (this && this.__assign) || function () {
|
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
14
|
var uuidv4 = require('uuid').v4;
|
|
15
15
|
// const Parser = require('ua-parser-js');
|
|
16
|
-
var reg = /((2(5[0-5]|[0-4]\d))|[0-1]?\d{1,2})(\.((2(5[0-5]|[0-4]\d))|[0-1]?\d{1,2})){3}/g;
|
|
17
16
|
var SendTracker = /** @class */ (function () {
|
|
18
17
|
function SendTracker() {
|
|
19
18
|
this.url = '';
|
|
20
19
|
}
|
|
21
|
-
SendTracker.prototype.verifyRequest = function (reason) {
|
|
22
|
-
if (!reason)
|
|
23
|
-
return false;
|
|
24
|
-
if (reg.test(reason))
|
|
25
|
-
return false;
|
|
26
|
-
if (reason.startsWith('halomoto'))
|
|
27
|
-
return false;
|
|
28
|
-
if (reason.startsWith('file:'))
|
|
29
|
-
return false;
|
|
30
|
-
if (reason.includes('log-center.58moto.com'))
|
|
31
|
-
return false;
|
|
32
|
-
if (reason.includes('s23.cnzz.com'))
|
|
33
|
-
return false;
|
|
34
|
-
if (reason.includes('g.alicdn.com'))
|
|
35
|
-
return false;
|
|
36
|
-
if (reason.includes('vendors'))
|
|
37
|
-
return false;
|
|
38
|
-
return true;
|
|
39
|
-
};
|
|
40
20
|
SendTracker.prototype.send = function (data) {
|
|
41
21
|
if (data === void 0) { data = {}; }
|
|
42
22
|
var host = window.location.host;
|
|
43
23
|
if (host.indexOf('localhost') > -1)
|
|
44
24
|
return;
|
|
25
|
+
var reg = /((2(5[0-5]|[0-4]\d))|[0-1]?\d{1,2})(\.((2(5[0-5]|[0-4]\d))|[0-1]?\d{1,2})){3}/g;
|
|
45
26
|
if (reg.test(host))
|
|
46
27
|
return;
|
|
47
|
-
if (!this.verifyRequest(data.reason))
|
|
48
|
-
return;
|
|
49
|
-
data.reason = window.location.href + ' ' + data.reason;
|
|
50
28
|
var log = __assign(__assign({}, getExtraData()), data);
|
|
51
29
|
var formBody = [];
|
|
52
30
|
for (var property in log) {
|
|
@@ -79,6 +57,7 @@ function getExtraData() {
|
|
|
79
57
|
title: '',
|
|
80
58
|
frontStatus: 3,
|
|
81
59
|
occurTimeStamp: Date.now(),
|
|
60
|
+
// userAgent: new Parser().getResult()
|
|
82
61
|
};
|
|
83
62
|
}
|
|
84
63
|
exports.default = new SendTracker();
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* @createBy: @2020.05.26
|
|
5
5
|
*/
|
|
6
6
|
'use strict';
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
8
|
var NumberClass = /** @class */ (function () {
|
|
8
9
|
function NumberClass() {
|
|
9
10
|
}
|
|
@@ -91,12 +92,12 @@ var NumberClass = /** @class */ (function () {
|
|
|
91
92
|
var price = money.split('.')[0] + '';
|
|
92
93
|
var pricePoint = money.split('.')[1];
|
|
93
94
|
result = price.length > 6 ?
|
|
94
|
-
""
|
|
95
|
+
"".concat(price.substring(0, price.length - 6)).concat(signal).concat(price.substring(price.length - 6, price.length - 3), ",").concat(price.substring(price.length - 3, price.length))
|
|
95
96
|
:
|
|
96
|
-
""
|
|
97
|
-
result = pricePoint ? ""
|
|
97
|
+
"".concat(price.substring(0, price.length - 3)).concat(signal).concat(price.substring(price.length - 3, price.length));
|
|
98
|
+
result = pricePoint ? "".concat(result).concat(signal).concat(pricePoint) : result;
|
|
98
99
|
return result;
|
|
99
100
|
};
|
|
100
101
|
return NumberClass;
|
|
101
102
|
}());
|
|
102
|
-
|
|
103
|
+
exports.default = new NumberClass();
|
|
@@ -11,7 +11,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
11
11
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
12
12
|
};
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
var
|
|
14
|
+
var raven_js_1 = __importDefault(require("raven-js"));
|
|
15
|
+
// import RavenVue from 'raven-js/plugins/vue';
|
|
15
16
|
var Report = /** @class */ (function () {
|
|
16
17
|
function Report(Vue, options) {
|
|
17
18
|
if (options === void 0) { options = {}; }
|
|
@@ -35,9 +36,9 @@ var Report = /** @class */ (function () {
|
|
|
35
36
|
// }).addPlugin(RavenVue, this.Vue).install();
|
|
36
37
|
// raven内置了vue插件,会通过vue.config.errorHandler来捕获vue组件内错误并上报sentry服务
|
|
37
38
|
// 记录用户信息
|
|
38
|
-
|
|
39
|
+
raven_js_1.default.setUserContext({ user: this.options.user || '' });
|
|
39
40
|
// 设置全局tag标签
|
|
40
|
-
|
|
41
|
+
raven_js_1.default.setTagsContext({ environment: this.options.env || '' });
|
|
41
42
|
}
|
|
42
43
|
};
|
|
43
44
|
/**
|
|
@@ -51,20 +52,22 @@ var Report = /** @class */ (function () {
|
|
|
51
52
|
if (type === void 0) { type = 'error'; }
|
|
52
53
|
if (options === void 0) { options = {}; }
|
|
53
54
|
// 添加面包屑
|
|
54
|
-
|
|
55
|
+
raven_js_1.default.captureBreadcrumb({
|
|
55
56
|
message: data,
|
|
56
57
|
category: 'manual message',
|
|
57
58
|
});
|
|
58
59
|
// 异常上报
|
|
59
60
|
if (data instanceof Error) {
|
|
60
|
-
|
|
61
|
+
raven_js_1.default.captureException(data, {
|
|
61
62
|
level: type,
|
|
63
|
+
logger: 'manual exception',
|
|
62
64
|
tags: { options: options },
|
|
63
65
|
});
|
|
64
66
|
}
|
|
65
67
|
else {
|
|
66
|
-
|
|
68
|
+
raven_js_1.default.captureException('error', {
|
|
67
69
|
level: type,
|
|
70
|
+
logger: 'manual data',
|
|
68
71
|
extra: {
|
|
69
72
|
data: data,
|
|
70
73
|
options: this.options,
|
|
@@ -25,7 +25,7 @@ var ToolsClass = /** @class */ (function () {
|
|
|
25
25
|
body.style.overflow = 'hidden';
|
|
26
26
|
body.style.height = '100%';
|
|
27
27
|
if (className) {
|
|
28
|
-
var dom = document.querySelector("."
|
|
28
|
+
var dom = document.querySelector(".".concat(className));
|
|
29
29
|
dom && dom.addEventListener('touchmove', _this.__setDefault__);
|
|
30
30
|
}
|
|
31
31
|
};
|
|
@@ -45,7 +45,7 @@ var ToolsClass = /** @class */ (function () {
|
|
|
45
45
|
body.style.overflow = 'visible';
|
|
46
46
|
body.style.height = 'auto';
|
|
47
47
|
if (className) {
|
|
48
|
-
var dom = document.querySelector("."
|
|
48
|
+
var dom = document.querySelector(".".concat(className));
|
|
49
49
|
dom && dom.removeEventListener('touchmove', _this.__setDefault__);
|
|
50
50
|
}
|
|
51
51
|
};
|
|
@@ -384,10 +384,10 @@ var ToolsClass = /** @class */ (function () {
|
|
|
384
384
|
}
|
|
385
385
|
// 匹配中文、英文、数字
|
|
386
386
|
var regItem = '[\u4e00-\u9fa5a-zA-Z0-9]';
|
|
387
|
-
var regExp = "("
|
|
387
|
+
var regExp = "(".concat(regItem, "{").concat(before, "})").concat(regItem, "*(").concat(regItem, "{").concat(after, "})");
|
|
388
388
|
var reg = new RegExp(regExp);
|
|
389
|
-
return field.replace(reg, "$1"
|
|
389
|
+
return field.replace(reg, "$1".concat("*".repeat(sensitiveLen), "$2"));
|
|
390
390
|
};
|
|
391
391
|
return ToolsClass;
|
|
392
392
|
}());
|
|
393
|
-
|
|
393
|
+
exports.default = new ToolsClass();
|