Commit 1f6ee1b1 by 张卓

文章埋点

parent e9a09d7a
...@@ -12,5 +12,9 @@ console.log(process.env,'-----------------config------') ...@@ -12,5 +12,9 @@ console.log(process.env,'-----------------config------')
addRecord(data) { addRecord(data) {
return requestPOST(`${process.env.OLSHOP_URL}/scanCodeCustomerRecord/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"; ...@@ -9,9 +9,11 @@ import spokesman from "@/api/spokesman.js";
import shop from "@/api/shop.js"; import shop from "@/api/shop.js";
import indexApi from "@/api/index.js"; import indexApi from "@/api/index.js";
import { serialize, getQueryVariable, DFSImg } from "@/utils/index"; import { serialize, getQueryVariable, DFSImg } from "@/utils/index";
import login from "@/api/login";
export default { export default {
data() { data() {
return { return {
code: '',
shopId: this.$store.state.mixid, shopId: this.$store.state.mixid,
options: {}, options: {},
session_key: "", session_key: "",
...@@ -50,12 +52,13 @@ export default { ...@@ -50,12 +52,13 @@ export default {
}, },
computed: { computed: {
pageUrl() { pageUrl() {
return this.link+this.page+this.params return this.link+this.page+this.params;
} }
}, },
onLoad(options) { onLoad(options) {
Object.assign(this.$data, this.$options.data()); Object.assign(this.$data, this.$options.data());
console.log( console.log(
wx.getStorageSync("sessionid"),
options, options,
"index------", "index------",
this.shopId, this.shopId,
...@@ -63,6 +66,23 @@ export default { ...@@ -63,6 +66,23 @@ export default {
wx.getStorageSync("openid"), wx.getStorageSync("openid"),
this.shopId 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(); this.checkLogin();
...@@ -271,7 +291,18 @@ export default { ...@@ -271,7 +291,18 @@ export default {
// var query = options.query.dentistId; // 参数二维码传递过来的场景参数 // 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(); this.init();
}, },
onShow() { onShow() {
...@@ -360,8 +391,23 @@ export default { ...@@ -360,8 +391,23 @@ export default {
//分享内容中有订单信息为送礼活动 //分享内容中有订单信息为送礼活动
this.shareOrderSn = res.target.data[len].orderSn; this.shareOrderSn = res.target.data[len].orderSn;
this.shareTid = res.target.data[len].shareTid; this.shareTid = res.target.data[len].shareTid;
this.newWindowHref = res.target.data[len].shareImgUrl; this.newWindowHref = res.target.data[len].shareImgUrl;// + '&fromVisitorOpenId=' + wx.getStorageSync("openid")
console.log("分享信息:", this.shareLogoUrl, this.shareShopName,this.newWindowHref); 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(){ handleLoad(){
......
...@@ -354,7 +354,8 @@ export default { ...@@ -354,7 +354,8 @@ export default {
country: this.userInfo.country, country: this.userInfo.country,
province: this.userInfo.province, province: this.userInfo.province,
city: this.userInfo.city, city: this.userInfo.city,
otherPhone: 0 otherPhone: 0,
customerSourceType: wx.getStorageSync("articleId")?8:''
}; };
if (this.$store.state.spokesmanGroupId != "") { if (this.$store.state.spokesmanGroupId != "") {
query.spokesmanRelId = this.$store.state.spokesmanRelId; query.spokesmanRelId = this.$store.state.spokesmanRelId;
...@@ -368,6 +369,7 @@ export default { ...@@ -368,6 +369,7 @@ export default {
.then(res => { .then(res => {
//绑定成功 //绑定成功
if (res.data.code == 200) { if (res.data.code == 200) {
wx.setStorageSync('articleId',false)
this.NEED_CERTIFIED = res.data.data.NEED_CERTIFIED; this.NEED_CERTIFIED = res.data.data.NEED_CERTIFIED;
this.backParams += `&sessionid=${ this.backParams += `&sessionid=${
res.data.data.sessionId res.data.data.sessionId
......
...@@ -36,6 +36,7 @@ export async function requestPOST(url, options) { ...@@ -36,6 +36,7 @@ export async function requestPOST(url, options) {
"Shop-Mixid": shopMixid, "Shop-Mixid": shopMixid,
"Authorization": wx.getStorageSync('sessionid') || "", "Authorization": wx.getStorageSync('sessionid') || "",
"Offline-Shop-Code": store.state.offlineShopCode, "Offline-Shop-Code": store.state.offlineShopCode,
"open_id": wx.getStorageSync("openid") || ''
// "dubbo-tag": "ljx" // "dubbo-tag": "ljx"
}, },
success: function (res) { 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