visual-buried-point-platform-uni 1.0.0-alpha.1 → 1.0.0-alpha.2
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/index.js +18 -19
- package/package.json +2 -2
- package/tools.js +5 -17
package/index.js
CHANGED
|
@@ -74,14 +74,14 @@ export function init(config) {
|
|
|
74
74
|
startGlobalTime();
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
//the general custom
|
|
77
|
+
//the general custom reportCustom interval is enabled
|
|
78
78
|
function startGlobalTime() {
|
|
79
79
|
clearInterval(cInterval);
|
|
80
80
|
cInterval = setInterval(() => {
|
|
81
81
|
let cData = getSData();
|
|
82
|
-
console.log("storage data " + cData);
|
|
82
|
+
console.log("storage data " + JSON.stringify(cData));
|
|
83
83
|
if (cData) {
|
|
84
|
-
|
|
84
|
+
reportCustom(cData);
|
|
85
85
|
delSData();
|
|
86
86
|
}
|
|
87
87
|
}, _config.flushInterval * 1000);
|
|
@@ -129,13 +129,14 @@ export function setCustomEvent(data) {
|
|
|
129
129
|
addCache(reportData);
|
|
130
130
|
const data = getCache();
|
|
131
131
|
if (data.length) {
|
|
132
|
+
console.log("customData: ", JSON.stringify(data));
|
|
132
133
|
addSData(data);
|
|
133
134
|
clearCache();
|
|
134
135
|
}
|
|
135
136
|
}
|
|
136
137
|
}
|
|
137
138
|
|
|
138
|
-
function
|
|
139
|
+
function reportCustom(data) {
|
|
139
140
|
if (!reportUrl) {
|
|
140
141
|
//console.error("please set upload data url");
|
|
141
142
|
return;
|
|
@@ -145,21 +146,19 @@ function report(data) {
|
|
|
145
146
|
...comData,
|
|
146
147
|
dataAbstract: MD5(JSON.stringify(comData)),
|
|
147
148
|
};
|
|
148
|
-
uni.
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
},
|
|
162
|
-
});
|
|
149
|
+
uni.request({
|
|
150
|
+
url: reportUrl,
|
|
151
|
+
method: "POST",
|
|
152
|
+
header: {
|
|
153
|
+
"Content-Type": "application/json",
|
|
154
|
+
appKey: _config.token,
|
|
155
|
+
projectId: _config.token,
|
|
156
|
+
},
|
|
157
|
+
data: reportData,
|
|
158
|
+
success: function (res) {},
|
|
159
|
+
fail: function (error) {
|
|
160
|
+
console.error(error);
|
|
161
|
+
},
|
|
163
162
|
});
|
|
164
163
|
}
|
|
165
164
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "visual-buried-point-platform-uni",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
4
|
-
"lsi": "
|
|
3
|
+
"version": "1.0.0-alpha.02",
|
|
4
|
+
"lsi": "f0ca171a9f641657370a83f2f7ed65c7",
|
|
5
5
|
"description": "To make it easy for you to get started with GitLab, here's a list of recommended next steps.",
|
|
6
6
|
"main": "index.js",
|
|
7
7
|
"scripts": {
|
package/tools.js
CHANGED
|
@@ -168,9 +168,9 @@ export function getTrackObj(busObj) {
|
|
|
168
168
|
const pages = getCurrentPages();
|
|
169
169
|
const gcp = pages[pages.length - 1];
|
|
170
170
|
//h5
|
|
171
|
-
let wl = window.location;
|
|
172
|
-
let docTitle = document.title;
|
|
173
|
-
let refurl = document.referrer;
|
|
171
|
+
// let wl = window.location;
|
|
172
|
+
// let docTitle = document.title;
|
|
173
|
+
// let refurl = document.referrer;
|
|
174
174
|
let parsedUrl;
|
|
175
175
|
if (refurl) {
|
|
176
176
|
parsedUrl = new URL(refurl);
|
|
@@ -183,22 +183,10 @@ export function getTrackObj(busObj) {
|
|
|
183
183
|
}
|
|
184
184
|
}
|
|
185
185
|
if (gcp) {
|
|
186
|
-
let domain = "";
|
|
187
|
-
let url = "";
|
|
188
|
-
if (busObj.domain) {
|
|
189
|
-
domain = busObj.domain;
|
|
190
|
-
} else {
|
|
191
|
-
domain = wl.hostname ? wl.hostname : "";
|
|
192
|
-
}
|
|
193
|
-
if (busObj.url) {
|
|
194
|
-
url = busObj.url;
|
|
195
|
-
} else {
|
|
196
|
-
url = wl.href ? wl.href : "";
|
|
197
|
-
}
|
|
198
186
|
return {
|
|
199
187
|
path: gcp.route,
|
|
200
|
-
domain: domain,
|
|
201
|
-
url: url,
|
|
188
|
+
domain: busObj.domain ? busObj.domain : "",
|
|
189
|
+
url: busObj.url ? busObj.url : "",
|
|
202
190
|
circulation: gcp.length > 1 ? 2 : 1,
|
|
203
191
|
visitPage: gcp.length,
|
|
204
192
|
sourceDomain: parsedUrl ? parsedUrl.hostname : "",
|