Commit 65e8a616 by 张卓

小程序授权绑定手机号文章埋点

parent ad5a138b
......@@ -55,7 +55,27 @@ export default {
return this.link+this.page+this.params;
}
},
watch: {
pageUrl() {
//埋点未登录时进入文章
// this.params+='&articleId=111'
console.log(wx.getStorageSync("sessionid"),3333333,this.pageUrl)
if(!wx.getStorageSync("sessionid")&&this.pageUrl.indexOf('articleId')!=-1) {
// wx.setStorageSync('articleId',true)
var vars = this.pageUrl.split("&");
console.log(vars,2222)
for (var i = 0; i < vars.length; i++) {
var pair = vars[i].split("=");
console.log(pair,1111)
if (pair[0] == 'articleId') {
wx.setStorageSync(this.$store.state.mixid+'articleId',pair[1])
}
}
}
}
},
onLoad(options) {
this.options = options;
Object.assign(this.$data, this.$options.data());
console.log(
wx.getStorageSync("sessionid"),
......@@ -71,21 +91,22 @@ export default {
success: res => {
this.code = res.code;
login.miniLogin({ code: this.code}).then(res1 => {
console.log(res1,555555)
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();
console.log(this.params,6666666)
this.options = options;
console.log('-------1',options.scene)
console.log(this.options)
......@@ -291,18 +312,6 @@ export default {
// var query = options.query.dentistId; // 参数二维码传递过来的场景参数
}
//埋点未登录时进入文章
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(this.$store.state.mixid+'articleId',pair[1])
}
}
}
console.log("url", this.link + this.page + this.params, wx.getStorageSync("openid"));
this.init();
},
onShow() {
......
......@@ -370,7 +370,7 @@ export default {
.then(res => {
//绑定成功
if (res.data.code == 200) {
wx.setStorageSync('articleId',false)
wx.setStorageSync(this.$store.state.mixid+'articleId',false)
this.NEED_CERTIFIED = res.data.data.NEED_CERTIFIED;
this.backParams += `&sessionid=${
res.data.data.sessionId
......
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