Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
rip
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fanxuehui
rip
Commits
dc164ff2
Commit
dc164ff2
authored
Sep 04, 2019
by
aiduck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
version1.1.0
parent
f9056aa0
Pipeline
#155907
passed with stage
in 26 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
7 deletions
+13
-7
package.json
package.json
+1
-1
reporter.js
src/lib/reporter.js
+12
-6
No files found.
package.json
View file @
dc164ff2
{
{
"name"
:
"@tuia/rip"
,
"name"
:
"@tuia/rip"
,
"version"
:
"1.
0.6
"
,
"version"
:
"1.
1.0
"
,
"description"
:
"Tools for user behavior recording and playback based on rrweb"
,
"description"
:
"Tools for user behavior recording and playback based on rrweb"
,
"main"
:
"dist/index.js"
,
"main"
:
"dist/index.js"
,
"scripts"
:
{
"scripts"
:
{
...
...
src/lib/reporter.js
View file @
dc164ff2
...
@@ -39,15 +39,15 @@ class Reporter {
...
@@ -39,15 +39,15 @@ class Reporter {
}
}
// 上传CDN
// 上传CDN
toCDN
(
payload
)
{
toCDN
(
payload
)
{
const
blob
=
new
Blob
([
JSON
.
stringify
(
payload
)],
{
type
:
"application/json"
});
//
const blob = new Blob([JSON.stringify(payload)], { type: "application/json" });
const
formData
=
new
FormData
();
//
const formData = new FormData();
// 保存上下文
// 保存上下文
const
trackId
=
this
.
counter
.
count
;
const
trackId
=
this
.
counter
.
count
;
const
recordKey
=
this
.
recordKey
;
const
recordKey
=
this
.
recordKey
;
log
(
"trackId"
,
trackId
);
log
(
"trackId"
,
trackId
);
log
(
"recordKey"
,
recordKey
);
log
(
"recordKey"
,
recordKey
);
this
.
uploadingPile
.
add
(
trackId
);
this
.
uploadingPile
.
add
(
trackId
);
formData
.
append
(
"file"
,
blob
,
`
${
this
.
recordKey
+
trackId
}
.json`
);
//
formData.append("file", blob, `${this.recordKey + trackId}.json`);
const
extra
=
{
const
extra
=
{
...
this
.
baseInfo
,
...
this
.
baseInfo
,
recordKey
:
this
.
recordKey
,
recordKey
:
this
.
recordKey
,
...
@@ -55,11 +55,17 @@ class Reporter {
...
@@ -55,11 +55,17 @@ class Reporter {
isCDN
:
true
,
isCDN
:
true
,
};
};
try
{
try
{
fetch
(
`
${
this
.
environmentUrl
}
/upload`
,
{
fetch
(
`
${
this
.
environmentUrl
}
/upload
String
`
,
{
// fetch(`http://localhost:3000/upload`, {
// fetch(`http://localhost:3000/upload
String
`, {
method
:
"POST"
,
method
:
"POST"
,
credentials
:
"include"
,
credentials
:
"include"
,
body
:
formData
,
// body: formData
headers
:
new
Headers
({
"content-type"
:
"application/json"
}),
body
:
JSON
.
stringify
({
payload
:
payload
,
recordKey
:
recordKey
,
trackId
:
trackId
}),
})
})
.
then
(
res
=>
{
.
then
(
res
=>
{
return
res
.
json
();
return
res
.
json
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment