Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mayi-mp-shop
Overview
Overview
Details
Activity
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
程默
mayi-mp-shop
Commits
68ea55f1
Commit
68ea55f1
authored
Sep 15, 2020
by
张卓
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
客流渠道埋点
parent
bb856523
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
46 additions
and
0 deletions
+46
-0
src/api/index.js
+7
-0
src/pages/index/index.vue
+16
-0
src/pages/login/index.vue
+23
-0
No files found.
src/api/index.js
View file @
68ea55f1
...
@@ -9,4 +9,10 @@ console.log(process.env,'-----------------config------')
...
@@ -9,4 +9,10 @@ console.log(process.env,'-----------------config------')
return
requestPOST
(
`
${
process
.
env
.
OLSHOP_URL
}
/shareSceneRecord/getShareSceneRecord/
${
options
}
`
,
{});
return
requestPOST
(
`
${
process
.
env
.
OLSHOP_URL
}
/shareSceneRecord/getShareSceneRecord/
${
options
}
`
,
{});
},
},
}
}
export
default
{
//POST /shareSceneRecord/getShareSceneRecord/{sceneCode} 获取分享场景参数记录
addRecord
(
data
)
{
return
requestPOST
(
`
${
process
.
env
.
OLSHOP_URL
}
/scanCodeCustomerRecord/addRecord`
,
{
data
});
},
}
\ No newline at end of file
src/pages/index/index.vue
View file @
68ea55f1
...
@@ -48,6 +48,8 @@ export default {
...
@@ -48,6 +48,8 @@ export default {
};
};
},
},
onLoad
(
options
)
{
onLoad
(
options
)
{
//清空引客渠道id
wx
.
setStorageSync
(
'attractingCustomerChannelId'
,
''
)
Object
.
assign
(
this
.
$data
,
this
.
$options
.
data
());
Object
.
assign
(
this
.
$data
,
this
.
$options
.
data
());
console
.
log
(
console
.
log
(
options
,
options
,
...
@@ -140,6 +142,20 @@ export default {
...
@@ -140,6 +142,20 @@ export default {
if
(
res
.
data
.
code
==
'200'
){
if
(
res
.
data
.
code
==
'200'
){
this
.
page
=
res
.
data
.
data
.
pageUri
;
this
.
page
=
res
.
data
.
data
.
pageUri
;
let
paramsObj
=
JSON
.
parse
(
res
.
data
.
data
.
scene
);
let
paramsObj
=
JSON
.
parse
(
res
.
data
.
data
.
scene
);
wx
.
setStorageSync
(
'attractingCustomerChannelId'
,
paramsObj
.
attractingCustomerChannelId
)
console
.
log
(
flag
,
99999999
,
wx
.
getStorageSync
(
'attractingCustomerChannelId'
),
wx
.
getStorageSync
(
"openid"
))
if
(
wx
.
getStorageSync
(
"openid"
))
{
indexApi
.
addRecord
(
{
attractingCustomersChannelId
:
paramsObj
.
attractingCustomerChannelId
,
miniOpenId
:
wx
.
getStorageSync
(
"openid"
),
registerFlag
:
1
,
newRegisterFlag
:
0
,
}
).
then
(
ele
=>
{
alert
(
ele
,
9999
)
})
}
let
params
=
''
;
let
params
=
''
;
for
(
let
i
in
paramsObj
){
for
(
let
i
in
paramsObj
){
params
+=
"&"
+
i
+
'='
+
paramsObj
[
i
]
params
+=
"&"
+
i
+
'='
+
paramsObj
[
i
]
...
...
src/pages/login/index.vue
View file @
68ea55f1
...
@@ -30,6 +30,7 @@ import { serialize } from "@/utils/index";
...
@@ -30,6 +30,7 @@ import { serialize } from "@/utils/index";
import
{
wx_decode
}
from
"@/utils/wxIndex.js"
;
import
{
wx_decode
}
from
"@/utils/wxIndex.js"
;
import
login
from
"@/api/login"
;
import
login
from
"@/api/login"
;
import
shop
from
"@/api/shop"
;
import
shop
from
"@/api/shop"
;
import
indexApi
from
"@/api/index.js"
;
var
WXBizDataCrypt
=
require
(
"@/utils/WXBizDataCrypt"
);
var
WXBizDataCrypt
=
require
(
"@/utils/WXBizDataCrypt"
);
export
default
{
export
default
{
components
:
{
components
:
{
...
@@ -148,6 +149,23 @@ export default {
...
@@ -148,6 +149,23 @@ export default {
});
});
});
});
},
},
addRecord
(
flag
)
{
console
.
log
(
flag
,
99999999
,
wx
.
getStorageSync
(
'attractingCustomerChannelId'
),
this
.
openid
)
//埋点引客渠道
if
(
wx
.
getStorageSync
(
'attractingCustomerChannelId'
))
{
indexApi
.
addRecord
(
{
attractingCustomersChannelId
:
wx
.
getStorageSync
(
'attractingCustomerChannelId'
),
miniOpenId
:
this
.
openid
,
registerFlag
:
1
,
newRegisterFlag
:
flag
?
1
:
0
,
//1是新注册用户
}
).
then
(
ele
=>
{
wx
.
setStorageSync
(
'attractingCustomerChannelId'
,
''
)
})
}
},
getUserInfo
:
function
(
e
)
{
getUserInfo
:
function
(
e
)
{
this
.
backParams
=
this
.
defalutBackParams
this
.
backParams
=
this
.
defalutBackParams
wx
.
showLoading
({
wx
.
showLoading
({
...
@@ -230,6 +248,7 @@ export default {
...
@@ -230,6 +248,7 @@ export default {
this
.
userInfo
=
JSON
.
parse
(
e
.
target
.
rawData
);
this
.
userInfo
=
JSON
.
parse
(
e
.
target
.
rawData
);
this
.
$store
.
commit
(
'setUserInfo'
,
this
.
userInfo
)
this
.
$store
.
commit
(
'setUserInfo'
,
this
.
userInfo
)
this
.
addRecord
(
false
);
this
.
pushPageType
();
this
.
pushPageType
();
}
else
{
}
else
{
var
data
=
wx_decode
(
var
data
=
wx_decode
(
...
@@ -258,6 +277,7 @@ export default {
...
@@ -258,6 +277,7 @@ export default {
key
:
"sessionid"
,
key
:
"sessionid"
,
data
:
res
.
data
.
data
.
sessionId
data
:
res
.
data
.
data
.
sessionId
});
});
this
.
addRecord
(
false
)
// 跳转回小程序页面
// 跳转回小程序页面
this
.
pushPageType
();
this
.
pushPageType
();
// wx.reLaunch({
// wx.reLaunch({
...
@@ -268,6 +288,7 @@ export default {
...
@@ -268,6 +288,7 @@ export default {
}
else
{
}
else
{
//不是会员需要绑定手机号
//不是会员需要绑定手机号
this
.
isShowPhone
=
true
;
this
.
isShowPhone
=
true
;
this
.
addRecord
(
true
)
}
}
}
}
})
})
...
@@ -279,7 +300,9 @@ export default {
...
@@ -279,7 +300,9 @@ export default {
wx
.
hideLoading
();
wx
.
hideLoading
();
//不是会员需要绑定手机号
//不是会员需要绑定手机号
this
.
isShowPhone
=
true
;
this
.
isShowPhone
=
true
;
this
.
addRecord
(
true
)
}
}
}
}
},
},
// 是否跳转h5或小程序
// 是否跳转h5或小程序
...
...
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