Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas
/
mini-program
/
ai-card
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 d5c96507
authored
Dec 21, 2022
by
chenwq
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
分享埋点
1 parent
f3bd924f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
25 deletions
packagesList/pages/productDetail/productDetail.js
pages/tab/index/constant/senceData.js
packagesList/pages/productDetail/productDetail.js
View file @
d5c9650
...
@@ -82,29 +82,29 @@ Page({
...
@@ -82,29 +82,29 @@ Page({
// console.log(this.data.senceData, 'senceData-----')
// console.log(this.data.senceData, 'senceData-----')
const
senceList
=
productData
[
this
.
data
.
actNum
].
filter
(
item
=>
item
.
name
!=
'全部'
)
const
senceList
=
productData
[
this
.
data
.
actNum
].
filter
(
item
=>
item
.
name
!=
'全部'
)
var
proInfo
=
{}
for
(
let
i
=
0
;
i
<
senceList
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
senceList
.
length
;
i
++
)
{
let
item
=
senceList
[
i
]
let
proIdList
=
senceList
[
i
]?.
productList
.
map
(
k
=>
k
.
id
)
let
proIdList
=
senceList
[
i
]?.
productList
.
map
(
k
=>
k
.
id
)
if
(
proIdList
.
includes
(
activeNavIdx
))
{
if
(
proIdList
.
includes
(
activeNavIdx
))
{
proInfo
=
senceList
[
i
].
productList
.
find
(
k
=>
k
.
id
==
activeNavIdx
)
let
proInfo
=
item
.
productList
.
find
(
k
=>
k
.
id
==
activeNavIdx
)
this
.
setData
({
proInfo
,
sceneCode
:
item
.
sceneCode
})
break
break
}
}
}
}
this
.
setData
({
proInfo
})
// console.log(this.data.proInfo, '---------proInfo')
// console.log(this.data.proInfo, '---------proInfo')
// 设置转发标题
// 设置转发标题
let
userInfoObj
=
wx
.
$storage
.
get
(
"userInfo"
)
let
userInfoObj
=
wx
.
$storage
.
get
(
"userInfo"
)
// #服务商账号#取该分享者商户的联系人字段,无则取商户简称,无则取商户全称
// #服务商账号#取该分享者商户的联系人字段,无则取商户简称,无则取商户全称
let
name
=
userInfoObj
.
merchantName
let
name
=
userInfoObj
.
merchantName
this
.
shareTitle
=
`
${
name
}
给你分享一个活动
${
proInfo
.
productName
}
,戳我参与~`
this
.
shareTitle
=
`
${
name
}
给你分享一个活动
${
this
.
data
.
proInfo
.
productName
}
,戳我参与~`
//分享数据
//分享数据
let
item
=
proInfo
let
item
=
this
.
data
.
proInfo
||
{}
// console.log('title2',item.productName)
// console.log('title2',item.productName)
setTimeout
(()
=>
{
setTimeout
(()
=>
{
utils
.
setNavigationBarTitle
(
item
.
productName
)
utils
.
setNavigationBarTitle
(
item
.
productName
)
...
@@ -114,9 +114,9 @@ Page({
...
@@ -114,9 +114,9 @@ Page({
let
wx_user_info
=
wx
.
$storage
.
get
(
'wx_user_info'
),
let
wx_user_info
=
wx
.
$storage
.
get
(
'wx_user_info'
),
shareOpenId
=
wx_user_info
.
openId
||
''
shareOpenId
=
wx_user_info
.
openId
||
''
this
.
shareQuery
=
`sceneCode=
${
senceData
[
actNum
]
.
sceneCode
}
&productCode=
${
item
?.
productCode
}
&
isShare
=
$
{
true
}
&
productDesc
=
$
{
item
?.
productName
}
&
category
=
$
{
item
?.
category
}
&
actNum
=
$
{
actNum
}
&
activeNavIdx
=
$
{
activeNavIdx
}
&
sharephone
=
$
{
phone
}
`
this
.
shareQuery
=
`sceneCode=
${
this
.
data
.
sceneCode
}
&productCode=
${
item
?.
productCode
}
&
isShare
=
$
{
true
}
&
productDesc
=
$
{
item
?.
productName
}
&
category
=
$
{
item
?.
category
}
&
actNum
=
$
{
actNum
}
&
activeNavIdx
=
$
{
activeNavIdx
}
&
sharephone
=
$
{
phone
}
`
this.shareTrackData = {
this.shareTrackData = {
sceneCode:
senceData[actNum]?
.sceneCode,
sceneCode:
this.data
.sceneCode,
productCode: item?.productCode,
productCode: item?.productCode,
productName: item?.productName,
productName: item?.productName,
category: item?.category,
category: item?.category,
...
@@ -173,7 +173,7 @@ Page({
...
@@ -173,7 +173,7 @@ Page({
// 是否已经查看详情
// 是否已经查看详情
this.isgetAuthphone()
this.isgetAuthphone()
if (!options || utils.isEmptyObj(options)) return
if (!options || utils.isEmptyObj(options)) return
let { actNum
, activeNavIdx, isShare,sharephone
} = options
let { actNum
= 0, activeNavIdx = 0, isShare = true,sharephone = 123
} = options
if(isShare){
if(isShare){
wx.hideHomeButton()
wx.hideHomeButton()
}
}
...
@@ -185,26 +185,35 @@ Page({
...
@@ -185,26 +185,35 @@ Page({
sharephone
sharephone
});
});
//分享数据
let senceItem = senceData[actNum]
let item = senceData[actNum]?.productList[activeNavIdx]
console.log('title',item.productName)
setTimeout(() => {
// wx.setNavigationBarTitle({
// title: " "+item.productName,
// });
utils.setNavigationBarTitle(item.productName)
},100)
let wx_user_info = wx.$storage.get('wx_user_info'),
let wx_user_info = wx.$storage.get('wx_user_info'),
shareOpenId = wx_user_info.openId || ''
shareOpenId = wx_user_info.openId || ''
// console.log('shareOpenId: ', shareOpenId);
// console.log('shareOpenId: ', shareOpenId);
// &shareOpenId=
${
shareOpenId
}
// &shareOpenId=
${
shareOpenId
}
this.shareQuery = `
sceneCode
=
$
{
senceItem
?.
sceneCode
}
&
productCode
=
$
{
item
?.
productCode
}
&
isShare
=
$
{
true
}
&
productDesc
=
$
{
item
?.
productName
}
&
category
=
$
{
item
?.
category
}
&
actNum
=
$
{
actNum
}
&
activeNavIdx
=
$
{
activeNavIdx
}
&
sharephone
=
$
{
sharephone
}
`
const senceList = productData[this.data.actNum].filter(item => item.name != '全部')
for (let i = 0; i < senceList.length; i++) {
let item = senceList[i]
let proIdList = senceList[i]?.productList.map(k => k.id)
if (proIdList.includes(activeNavIdx)) {
let proInfo = item.productList.find(k => k.id == activeNavIdx)
console.log(proInfo)
this.setData({
proInfo,
sceneCode: item.sceneCode
})
break
}
}
//分享数据
let item = this.data.proInfo || {}
setTimeout(() => {
utils.setNavigationBarTitle(item?.productName)
},100)
this.shareQuery = `
sceneCode
=
$
{
this
.
data
.
sceneCode
}
&
productCode
=
$
{
item
?.
productCode
}
&
isShare
=
$
{
true
}
&
productDesc
=
$
{
item
?.
productName
}
&
category
=
$
{
item
?.
category
}
&
actNum
=
$
{
actNum
}
&
activeNavIdx
=
$
{
activeNavIdx
}
&
sharephone
=
$
{
sharephone
}
`
this.shareTrackData = {
this.shareTrackData = {
sceneCode:
senceItem?
.sceneCode,
sceneCode:
this.data
.sceneCode,
productCode: item?.productCode,
productCode: item?.productCode,
productName: item?.productName,
productName: item?.productName,
category: item?.category,
category: item?.category,
...
...
pages/tab/index/constant/senceData.js
View file @
d5c9650
...
@@ -75,6 +75,7 @@ const scenario_0 = [
...
@@ -75,6 +75,7 @@ const scenario_0 = [
sceneImgs
:
sceneImgs0
,
sceneImgs
:
sceneImgs0
,
// 产品详情图片
// 产品详情图片
productImgs
:
productImgs0
,
productImgs
:
productImgs0
,
"sceneCode"
:
"SC001"
,
productList
:
[
productList
:
[
{
{
id
:
0
,
id
:
0
,
...
@@ -134,6 +135,7 @@ const scenario_1 = [
...
@@ -134,6 +135,7 @@ const scenario_1 = [
name
:
'膜类'
,
name
:
'膜类'
,
sceneImgs
:
sceneImgs1
,
sceneImgs
:
sceneImgs1
,
productImgs
:
productImgs1
,
productImgs
:
productImgs1
,
"sceneCode"
:
"SC002"
,
productList
:
[
productList
:
[
{
{
id
:
0
,
id
:
0
,
...
@@ -185,6 +187,7 @@ const scenario_2 = [
...
@@ -185,6 +187,7 @@ const scenario_2 = [
name
:
'膜类'
,
name
:
'膜类'
,
sceneImgs
:
sceneImgs2
,
sceneImgs
:
sceneImgs2
,
productImgs
:
productImgs2
,
productImgs
:
productImgs2
,
"sceneCode"
:
"SC003"
,
productList
:
[
productList
:
[
{
{
id
:
0
,
id
:
0
,
...
@@ -301,6 +304,7 @@ const posterList3 = [
...
@@ -301,6 +304,7 @@ const posterList3 = [
const
scenario_3
=
[
const
scenario_3
=
[
{
{
name
:
'美容类'
,
name
:
'美容类'
,
"sceneCode"
:
"SC004"
,
productList
:
[
productList
:
[
{
{
id
:
0
,
id
:
0
,
...
...
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