Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas_plus
/
business-assistant
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 9b72c022
authored
Oct 18, 2022
by
李伟康
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
修改分享埋点
1 parent
1286910d
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
12 deletions
pages/tab/index/index.js
utils/share.js
pages/tab/index/index.js
View file @
9b72c02
...
@@ -7,6 +7,7 @@ import pageData from "./constant/data";
...
@@ -7,6 +7,7 @@ import pageData from "./constant/data";
let
IMG_URLLocal
=
"../../../images/"
;
let
IMG_URLLocal
=
"../../../images/"
;
Page
({
Page
({
shareQuery
:
'a=b'
,
// behaviors: [kfMixin],
// behaviors: [kfMixin],
/**
/**
* 页面的初始数据
* 页面的初始数据
...
@@ -534,5 +535,5 @@ Page({
...
@@ -534,5 +535,5 @@ Page({
* 用户点击右上角分享
* 用户点击右上角分享
*/
*/
onShareAppMessage
:
function
()
{},
onShareAppMessage
:
function
()
{},
onShareTimeline
:
function
()
{}
onShareTimeline
:
function
()
{}
,
});
});
utils/share.js
View file @
9b72c02
...
@@ -31,8 +31,9 @@ class Share {
...
@@ -31,8 +31,9 @@ class Share {
}
}
/**设置全局分享 */
/**设置全局分享 */
pageLeaveProxy
(
page
)
{
pageLeaveProxy
(
page
)
{
const
that
=
this
if
(
page
.
onShareAppMessage
)
{
if
(
page
.
onShareAppMessage
)
{
page
.
onShareAppMessage
=
()
=>
{
page
.
onShareAppMessage
=
function
()
{
let
{
let
{
shareTitle
,
shareTitle
,
sharePath
,
sharePath
,
...
@@ -41,13 +42,14 @@ class Share {
...
@@ -41,13 +42,14 @@ class Share {
noPageAuth
,
noPageAuth
,
shareFun
,
shareFun
,
shareTrackData
shareTrackData
}
=
page
,
}
=
this
,
path
=
`/
${
page
.
route
}
`
path
=
`/
${
this
.
route
}
`
if
(
sharePath
)
path
=
`/
${
sharePath
}
`
if
(
sharePath
)
path
=
`/
${
sharePath
}
`
if
(
shareQuery
)
path
+=
`?
${
shareQuery
}
`
path
+=
that
.
setCommonShareQuery
()
if
(
shareQuery
)
path
+=
`&
${
shareQuery
}
`
if
(
!
noPageAuth
)
path
=
`/login/loading/loading?url=
${
encodeURIComponent
(
path
)}
`
if
(
!
noPageAuth
)
path
=
`/login/loading/loading?url=
${
encodeURIComponent
(
path
)}
`
if
(
shareFun
)
shareFun
()
if
(
shareFun
)
shareFun
()
if
(
shareTrackData
)
th
is
.
reportShareData
(
shareTrackData
)
if
(
shareTrackData
)
th
at
.
reportShareData
(
shareTrackData
)
return
{
return
{
path
,
path
,
title
:
shareTitle
,
title
:
shareTitle
,
...
@@ -56,16 +58,18 @@ class Share {
...
@@ -56,16 +58,18 @@ class Share {
}
}
}
}
if
(
page
.
onShareTimeline
)
{
if
(
page
.
onShareTimeline
)
{
page
.
onShareTimeline
=
()
=>
{
page
.
onShareTimeline
=
function
()
{
let
{
let
{
shareTitle
,
shareTitle
,
shareImage
,
shareImage
,
shareQuery
,
shareQuery
,
shareFun
,
shareFun
,
shareTrackData
shareTrackData
}
=
page
}
=
this
if
(
shareFun
)
shareFun
()
if
(
shareFun
)
shareFun
()
if
(
shareTrackData
)
this
.
reportShareData
(
shareTrackData
)
if
(
shareTrackData
)
that
.
reportShareData
(
shareTrackData
)
shareQuery
=
that
.
setCommonShareQuery
(
shareQuery
)
console
.
log
(
shareQuery
)
return
{
return
{
query
:
shareQuery
,
query
:
shareQuery
,
title
:
shareTitle
,
title
:
shareTitle
,
...
@@ -73,12 +77,29 @@ class Share {
...
@@ -73,12 +77,29 @@ class Share {
}
}
}
}
}
}
}
}
reportShareData
(
shareTrackData
)
{
getCommonData
(
)
{
const
WXUSERINFO
=
wx
.
$storage
.
get
(
'wx_user_info'
),
const
WXUSERINFO
=
wx
.
$storage
.
get
(
'wx_user_info'
),
USERINFO
=
wx
.
$storage
.
get
(
'userInfo'
)
USERINFO
=
wx
.
$storage
.
get
(
'userInfo'
)
console
.
log
(
shareTrackData
,
'============'
)
return
{
WXUSERINFO
,
USERINFO
}
}
setCommonShareQuery
(
query
)
{
const
{
WXUSERINFO
,
USERINFO
}
=
this
.
getCommonData
()
query
=
`
${
query
?
`?
${
query
}
&`
:
'?'
}
merchantId=
${
USERINFO
.
merchantId
}
&shareOpenId=
${
WXUSERINFO
.
openId
}
`
if
(
USERINFO
.
phone
)
query
+=
`&sharePhone=
${
USERINFO
.
phone
}
`
return
query
}
reportShareData
(
shareTrackData
)
{
const
{
WXUSERINFO
,
USERINFO
}
=
this
.
getCommonData
()
reportData
({
reportData
({
openId
:
WXUSERINFO
.
openId
||
''
,
openId
:
WXUSERINFO
.
openId
||
''
,
unionId
:
WXUSERINFO
.
unionId
||
''
,
unionId
:
WXUSERINFO
.
unionId
||
''
,
...
...
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