Commit 1f6ee1b1 by 张卓

文章埋点

parent e9a09d7a
......@@ -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
......@@ -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(){
......
......@@ -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
......
......@@ -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) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment