Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
glsx
/
gl_tape
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
3
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 07466c8f
authored
Apr 16, 2025
by
胡悦
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
修复系统消息埋点,定时器未清除问题
1 parent
4b8de0db
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
7 deletions
mixin/systemTrack.js
mixin/systemTrack.js
View file @
07466c8
let
timer
=
null
import
dayjs
from
'dayjs'
import
dayjs
from
'dayjs'
export
default
{
export
default
{
data
()
{
data
()
{
return
{
return
{
systemInfo
:
{}
systemInfo
:
{},
timer
:
null
,
id
:
null
}
}
},
},
onLoad
(
options
)
{
onLoad
(
options
)
{
if
(
this
.
timer
)
{
clearInterval
(
this
.
timer
);
this
.
timer
=
null
;
}
const
{
row
}
=
options
const
{
row
}
=
options
const
_row
=
JSON
.
parse
(
row
)
const
_row
=
JSON
.
parse
(
row
)
this
.
systemInfo
=
_row
this
.
systemInfo
=
_row
this
.
systemInfo
.
time
=
dayjs
(
new
Date
(
_row
.
actualSendTime
)).
format
(
"YYYY-MM-DD HH:mm:ss"
)
this
.
systemInfo
.
time
=
dayjs
(
new
Date
(
_row
.
actualSendTime
)).
format
(
"YYYY-MM-DD HH:mm:ss"
)
this
.
addTrack
(
_row
)
this
.
addTrack
(
_row
)
this
.
timer
=
setInterval
(()
=>
{
this
.
leaveTrack
(
this
.
id
)
},
3000
)
},
},
methods
:
{
methods
:
{
// 进入埋点事件
// 进入埋点事件
...
@@ -25,9 +33,7 @@ export default {
...
@@ -25,9 +33,7 @@ export default {
uni
.
$api
.
commonApi
.
addSystemInfo
(
entryData
).
then
(
res
=>
{
uni
.
$api
.
commonApi
.
addSystemInfo
(
entryData
).
then
(
res
=>
{
if
(
res
)
{
if
(
res
)
{
this
.
leaveTrack
(
res
)
this
.
leaveTrack
(
res
)
timer
=
setInterval
(()
=>
{
this
.
id
=
res
this
.
leaveTrack
(
res
)
},
3000
)
}
}
})
})
}
catch
(
error
)
{
}
catch
(
error
)
{
...
@@ -36,12 +42,14 @@ export default {
...
@@ -36,12 +42,14 @@ export default {
},
},
// 离开埋点事件
// 离开埋点事件
async
leaveTrack
(
id
)
{
async
leaveTrack
(
id
)
{
if
(
!
id
)
return
await
uni
.
$api
.
commonApi
.
leaveSystemInfo
({
id
})
await
uni
.
$api
.
commonApi
.
leaveSystemInfo
({
id
})
}
}
},
},
onUnload
()
{
onUnload
()
{
if
(
timer
)
{
if
(
this
.
timer
)
{
clearInterval
(
timer
);
clearInterval
(
this
.
timer
);
this
.
timer
=
null
;
}
}
}
}
}
}
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