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
1f6ee1b1
Commit
1f6ee1b1
authored
Jan 06, 2021
by
张卓
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
文章埋点
parent
e9a09d7a
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
59 additions
and
5 deletions
+59
-5
src/api/index.js
+5
-0
src/pages/index/index.vue
+50
-4
src/pages/login/index.vue
+3
-1
src/utils/request.js
+1
-0
No files found.
src/api/index.js
View file @
1f6ee1b1
...
...
@@ -12,5 +12,9 @@ console.log(process.env,'-----------------config------')
addRecord
(
data
)
{
return
requestPOST
(
`
${
process
.
env
.
OLSHOP_URL
}
/scanCodeCustomerRecord/addRecord`
,
data
);
},
//POST /article/forward 转发分享
forward
(
data
)
{
return
requestPOST
(
`
${
process
.
env
.
OLSHOP_URL
}
/article/forward`
,
data
)
},
}
\ No newline at end of file
src/pages/index/index.vue
View file @
1f6ee1b1
...
...
@@ -9,9 +9,11 @@ import spokesman from "@/api/spokesman.js";
import
shop
from
"@/api/shop.js"
;
import
indexApi
from
"@/api/index.js"
;
import
{
serialize
,
getQueryVariable
,
DFSImg
}
from
"@/utils/index"
;
import
login
from
"@/api/login"
;
export
default
{
data
()
{
return
{
code
:
''
,
shopId
:
this
.
$store
.
state
.
mixid
,
options
:
{},
session_key
:
""
,
...
...
@@ -50,12 +52,13 @@ export default {
},
computed
:
{
pageUrl
()
{
return
this
.
link
+
this
.
page
+
this
.
params
return
this
.
link
+
this
.
page
+
this
.
params
;
}
},
onLoad
(
options
)
{
Object
.
assign
(
this
.
$data
,
this
.
$options
.
data
());
console
.
log
(
wx
.
getStorageSync
(
"sessionid"
),
options
,
"index------"
,
this
.
shopId
,
...
...
@@ -63,6 +66,23 @@ export default {
wx
.
getStorageSync
(
"openid"
),
this
.
shopId
);
//获取openId
wx
.
login
({
success
:
res
=>
{
this
.
code
=
res
.
code
;
login
.
miniLogin
({
code
:
this
.
code
}).
then
(
res1
=>
{
if
(
res1
.
data
.
code
==
200
)
{
wx
.
setStorage
({
key
:
"openid"
,
data
:
res1
.
data
.
data
.
openid
});
}
})
this
.
params
+=
'&open_id='
+
wx
.
getStorageSync
(
"openid"
);
console
.
log
(
this
.
code
,
77777
,
this
.
params
)
},
})
//检测登录态
this
.
checkLogin
();
...
...
@@ -271,7 +291,18 @@ export default {
// var query = options.query.dentistId; // 参数二维码传递过来的场景参数
}
console
.
log
(
"url"
,
this
.
link
+
this
.
page
+
this
.
params
);
//埋点未登录时进入文章
if
(
!
wx
.
getStorageSync
(
"sessionid"
)
&&
this
.
params
.
indexOf
(
'articleId'
)
!=-
1
)
{
wx
.
setStorageSync
(
'articleId'
,
true
)
// var vars = this.params.split("&");
// for (var i = 0; i
<
vars
.
length
;
i
++
)
{
// var pair = vars[i].split("=");
// if (pair[0] == 'articleId') {
// wx.setStorageSync('articleId',pair[1])
// }
// }
}
console
.
log
(
"url"
,
this
.
link
+
this
.
page
+
this
.
params
,
wx
.
getStorageSync
(
"openid"
));
this
.
init
();
},
onShow
()
{
...
...
@@ -360,8 +391,23 @@ export default {
//分享内容中有订单信息为送礼活动
this
.
shareOrderSn
=
res
.
target
.
data
[
len
].
orderSn
;
this
.
shareTid
=
res
.
target
.
data
[
len
].
shareTid
;
this
.
newWindowHref
=
res
.
target
.
data
[
len
].
shareImgUrl
;
console
.
log
(
"分享信息:"
,
this
.
shareLogoUrl
,
this
.
shareShopName
,
this
.
newWindowHref
);
this
.
newWindowHref
=
res
.
target
.
data
[
len
].
shareImgUrl
;
// + '&fromVisitorOpenId=' + wx.getStorageSync("openid")
console
.
log
(
"分享信息:"
,
this
.
shareLogoUrl
,
this
.
shareShopName
,
1111111
,
this
.
newWindowHref
);
//文章详情分享埋点
if
(
this
.
newWindowHref
.
indexOf
(
'articleId'
)
!=-
1
)
{
var
articleId
=
''
var
vars
=
this
.
newWindowHref
.
split
(
"&"
);
for
(
var
i
=
0
;
i
<
vars
.
length
;
i
++
)
{
var
pair
=
vars
[
i
].
split
(
"="
);
console
.
log
(
pair
,
2222
)
if
(
pair
[
0
]
==
'articleId'
)
{
articleId
=
pair
[
1
];
}
}
indexApi
.
forward
({
articleId
:
articleId
,}).
then
(
res
=>
{
})
}
},
//加载成功
handleLoad
(){
...
...
src/pages/login/index.vue
View file @
1f6ee1b1
...
...
@@ -354,7 +354,8 @@ export default {
country
:
this
.
userInfo
.
country
,
province
:
this
.
userInfo
.
province
,
city
:
this
.
userInfo
.
city
,
otherPhone
:
0
otherPhone
:
0
,
customerSourceType
:
wx
.
getStorageSync
(
"articleId"
)?
8
:
''
};
if
(
this
.
$store
.
state
.
spokesmanGroupId
!=
""
)
{
query
.
spokesmanRelId
=
this
.
$store
.
state
.
spokesmanRelId
;
...
...
@@ -368,6 +369,7 @@ export default {
.
then
(
res
=>
{
//绑定成功
if
(
res
.
data
.
code
==
200
)
{
wx
.
setStorageSync
(
'articleId'
,
false
)
this
.
NEED_CERTIFIED
=
res
.
data
.
data
.
NEED_CERTIFIED
;
this
.
backParams
+=
`&sessionid=
${
res
.
data
.
data
.
sessionId
...
...
src/utils/request.js
View file @
1f6ee1b1
...
...
@@ -36,6 +36,7 @@ export async function requestPOST(url, options) {
"Shop-Mixid"
:
shopMixid
,
"Authorization"
:
wx
.
getStorageSync
(
'sessionid'
)
||
""
,
"Offline-Shop-Code"
:
store
.
state
.
offlineShopCode
,
"open_id"
:
wx
.
getStorageSync
(
"openid"
)
||
''
// "dubbo-tag": "ljx"
},
success
:
function
(
res
)
{
...
...
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