Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas_plus
/
dj-car-life-system
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit b2072824
authored
Jul 09, 2026
by
Jaxon
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
修复(埋点上报混入): 完善埋点发送错误处理并统一代码格式
为所有单行if语句补充块级大括号,统一代码书写规范 为埋点数据发送请求添加错误捕获,打印错误日志
1 parent
a798793f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
8 deletions
src/mixins/reportTrackFunMixin.js
src/mixins/reportTrackFunMixin.js
View file @
b207282
...
@@ -59,15 +59,19 @@ export default {
...
@@ -59,15 +59,19 @@ export default {
eventType
,
eventType
,
pagePath
:
route
.
path
,
pagePath
:
route
.
path
,
};
};
if
(
!
prePagePath
)
if
(
!
prePagePath
)
{
prePagePath
=
this
.
getPrePagePath
(
this
);
prePagePath
=
this
.
getPrePagePath
(
this
);
}
item
.
prePagePath
=
prePagePath
||
"/index"
;
item
.
prePagePath
=
prePagePath
||
"/index"
;
if
(
batchId
)
if
(
batchId
)
{
item
.
batchId
=
batchId
;
item
.
batchId
=
batchId
;
if
(
eventCode
)
}
if
(
eventCode
)
{
item
.
eventCode
=
eventCode
;
item
.
eventCode
=
eventCode
;
if
(
businessParam
)
}
if
(
businessParam
)
{
item
.
businessParam
=
JSON
.
stringify
(
businessParam
);
item
.
businessParam
=
JSON
.
stringify
(
businessParam
);
}
if
(
!
recordList
)
{
if
(
!
recordList
)
{
recordList
=
[
item
];
recordList
=
[
item
];
}
else
{
}
else
{
...
@@ -79,8 +83,9 @@ export default {
...
@@ -79,8 +83,9 @@ export default {
console
.
log
(
"---------------- 重新打开定时埋点 ----------------"
);
console
.
log
(
"---------------- 重新打开定时埋点 ----------------"
);
this
.
sendTrack
();
// 开启定时埋点
this
.
sendTrack
();
// 开启定时埋点
}
}
if
(
recordList
.
length
>
9
)
if
(
recordList
.
length
>
9
)
{
this
.
sendTrackData
();
this
.
sendTrackData
();
}
},
},
getRandomString
(
length
=
30
)
{
getRandomString
(
length
=
30
)
{
const
characters
const
characters
...
@@ -94,8 +99,9 @@ export default {
...
@@ -94,8 +99,9 @@ export default {
return
result
;
return
result
;
},
},
onPageShow
()
{
onPageShow
()
{
if
(
this
.
track_page_view_flag
)
if
(
this
.
track_page_view_flag
)
{
return
;
return
;
}
if
(
!
this
.
track_batchId
)
{
if
(
!
this
.
track_batchId
)
{
this
.
track_batchId
=
`DJ_
${
this
.
getRandomString
()}
_
${
Date
.
now
()}
`
;
this
.
track_batchId
=
`DJ_
${
this
.
getRandomString
()}
_
${
Date
.
now
()}
`
;
}
}
...
@@ -127,8 +133,9 @@ export default {
...
@@ -127,8 +133,9 @@ export default {
},
10
e3
);
},
10
e3
);
}
}
let
trackParams
=
{};
let
trackParams
=
{};
if
(
this
.
track_businessParam_key
)
if
(
this
.
track_businessParam_key
)
{
trackParams
=
this
[
this
.
track_businessParam_key
]
||
{};
trackParams
=
this
[
this
.
track_businessParam_key
]
||
{};
}
this
.
setReportTrackData
(
this
.
setReportTrackData
(
2
,
2
,
this
.
track_event_code
,
this
.
track_event_code
,
...
@@ -166,8 +173,11 @@ export default {
...
@@ -166,8 +173,11 @@ export default {
reportTrack
({
reportTrack
({
recordList
:
JSON
.
parse
(
recordList
),
recordList
:
JSON
.
parse
(
recordList
),
}).
then
((
res
)
=>
{
}).
then
((
res
)
=>
{
if
(
res
)
if
(
res
)
{
localStorage
.
removeItem
(
"recordList"
);
localStorage
.
removeItem
(
"recordList"
);
}
}).
catch
((
e
)
=>
{
console
.
log
(
"发送出错"
,
e
);
});
});
}
else
{
}
else
{
clearInterval
(
window
.
TRACK_TIMER
);
clearInterval
(
window
.
TRACK_TIMER
);
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment