Commit 963044f0 by 李嘉林

加log

parent d3783440
......@@ -71,14 +71,14 @@ export default {
pageUrl(n,o) {
//埋点未登录时进入文章
// this.params+='&articleId=111'
log.info(wx.getStorageSync("sessionid"),3333333,this.pageUrl)
log.info('watch-pageUrl-sessionid',wx.getStorageSync("sessionid"))
log.info('watch-pageUrl-pageUrl',this.pageUrl)
if(!wx.getStorageSync("sessionid")&&this.pageUrl.indexOf('articleId')!=-1) {
// wx.setStorageSync('articleId',true)
var vars = this.pageUrl.split("&");
log.info(vars,2222)
log.info('watch-pageUrl.split("&")',vars)
for (var i = 0; i < vars.length; i++) {
var pair = vars[i].split("=");
log.info(pair,1111)
if (pair[0] == 'articleId') {
wx.setStorageSync(this.$store.state.mixid+'articleId',pair[1])
}
......@@ -92,15 +92,15 @@ export default {
if (this.pageUrl.split('unionId=')[1]) {
unionId = this.pageUrl.split('unionId=')[1].split('&')[0]
}
indexApi.addRecord(
{
let addRecordQuery = {
attractingCustomersChannelId: wx.getStorageSync('attractingCustomerChannelId'),
miniOpenId: openId,
unionId: unionId,
registerFlag: 1,
newRegisterFlag: 0,
}
).then(ele=>{
}
indexApi.addRecord(addRecordQuery).then(ele=>{
log.info('watch-pageUrl-addRecord',addRecordQuery,ele)
if (ele.data.data) {
//清空引客渠道id
wx.setStorageSync('attractingCustomerChannelId','');
......@@ -134,6 +134,7 @@ export default {
this.code = res.code;
log.info(this.code,'-----------------------------110---code')
login.get_open_id_by_code({ code: this.code}).then(res1 => {
log.info('onLoad-api:get_open_id_by_code',this.code,res1)
if (res1.data.code == 200) {
wx.setStorage({
key: "openid",
......@@ -156,8 +157,10 @@ export default {
this.checkLogin();
this.options = options;
if (options.share) {
log.info('options.share',options.share)
//来自分享
this.link = decodeURIComponent(options.share);
log.info('options.share-link',this.link)
this.spokesmanGroupId =
getQueryVariable(this.link, "spokesmanGroupId") || "";
this.spokesmanShopId =
......@@ -166,11 +169,13 @@ export default {
this.userId = getQueryVariable(this.link, "userId") || "";
if (this.spokesmanGroupId != "") {
//上级分销员信息
this.$store.commit("setSpokesman", {
let spokesmanInfo = {
spokesmanGroupId: this.spokesmanGroupId,
spokesmanShopId: this.spokesmanShopId,
spokesmanRelId: this.spokesmanRelId
});
}
log.info('options.share-上级分销员信息',spokesmanInfo)
this.$store.commit("setSpokesman", spokesmanInfo);
}
this.page = "";
this.params = "";
......@@ -193,6 +198,7 @@ export default {
}
options.params && (this.params += "&" + serialize(decodeURIComponent(options.params)));
} else if (options.from && options.from == "themeLink") {
log.info('options.from == "themeLink"')
// 多主题link
this.page = decodeURIComponent(options.backpath);
this.params += "&" + decodeURIComponent(options.params);
......@@ -201,10 +207,12 @@ export default {
this.page = decodeURIComponent(options.backpath);
this.params += "&" + serialize(options.params);
} else if (options.from && options.from == "login") {
log.info('options.from == "login"')
//来自小程序登录页面
this.page = decodeURIComponent(options.backpath);
this.params += "&" + decodeURIComponent(options.params);
} else if (options.from && options.from == "logout") {
log.info('options.from == "logout"')
//来自用户登出
wx.removeStorage({
key: "sessionid"
......@@ -213,34 +221,37 @@ export default {
key: "openid"
});
} else if (options.from && options.from == "address") {
log.info('options.from == "address"')
// 来自小程序地址页面
this.link = decodeURIComponent(options.backpath);
log.info("adress", options.backpath, this.link);
this.page = "";
this.params = "";
} else if (options.from == "wxPay") {
log.info('options.from == "wxPay"')
//来自支付页面
this.page = options.backpath;
this.params += "&" + serialize(options.params);
} else if (options.scene) {
log.info(options)
log.info(222222)
log.info('options.scene',options)
if(options.scene.indexOf('_') == -1){
log.info("新版本(scene参数)分享进入")
this.withoutScene = false;
//新二维码扫码进入
wx.nextTick(() => {
indexApi.getShareSceneRecord(options.scene).then(res=>{
this.withoutScene = true;
log.info('getShareSceneRecord',res)
if(res.data.code == '200'){
this.page = res.data.data.pageUri;
let paramsObj = JSON.parse(res.data.data.scene);
wx.setStorageSync('attractingCustomerChannelId',paramsObj.attractingCustomerChannelId);
wx.setStorageSync(this.$store.state.mixid+'storeId',paramsObj.storeId);
wx.setStorageSync(this.$store.state.mixid+'sellerId',paramsObj.sellerId);
log.info(res.data.data)
wx.login({
success: res => {
login.get_open_id_by_code({ code: res.code}).then(res1 => {
log.info('get_open_id_by_code',res1)
if (res1.data.code == 200) {
wx.setStorageSync({
key: "openid",
......@@ -249,14 +260,14 @@ export default {
log.info('判断是否登录过=登陆过直接调用..未登录过需要授权头像昵称信息。')
if (wx.getStorageSync('sessionid')) {
log.info('已登陆了')
indexApi.addRecord(
{
let addRecordQuery = {
attractingCustomersChannelId: paramsObj.attractingCustomerChannelId,
miniOpenId: res1.data.data,
registerFlag: 1,
newRegisterFlag: 0,
}
).then(ele=>{
};
indexApi.addRecord(addRecordQuery).then(ele=>{
log.info('addRecord',addRecordQuery,ele)
if (ele.data.data) {
//清空引客渠道id
wx.setStorageSync('attractingCustomerChannelId','');
......@@ -288,6 +299,7 @@ export default {
});
}else {
log.info('老版本分享(下划线拼接参数)')
//来自扫码
// options 中的scene需要使用decodeURIComponent才能获取到生成二维码时传入的scene
var scene = decodeURIComponent(options.scene); //参数二维码传递过来的参数
......@@ -408,7 +420,7 @@ export default {
let getOpenid = wx.getStorageSync("openid");
let getSessionid = wx.getStorageSync("sessionid");
log.info('244',getOpenid,getSessionid);
log.info('methods-checkLogin',getOpenid,getSessionid);
if (getOpenid == "" || getSessionid == "") {
// this.params += "&logOut=true";
}
......@@ -430,6 +442,7 @@ export default {
},
async getSpokesman() {
await spokesman.getSpokesmanidByShare().then(res => {
log.info('onShareAppMessage-getSpokesmanidByShare',res)
if (res.data.code == 200) {
if (res.data.data.hasInvitationStatus == 1) {
this.hasInvitationStatus = 1;
......@@ -445,7 +458,7 @@ export default {
}else{
this.newHref="";
}
log.info(this.newHref, "this.newHrefthis.newHrefthis.newHref");
log.info('onShareAppMessage-getSpokesmanidByShare',this.newHref);
}
});
},
......@@ -460,7 +473,7 @@ export default {
//右上角分享时触发
getMessage(res) {
let len = res.target.data.length - 1;
log.info(res, "h5消息", res.target.data[len]);
log.info('右上角分享触发',res, res.target.data[len]);
this.shareShopName = res.target.data[len].shareShopName || "";
this.shareLogoUrl = DFSImg(res.target.data[len].shareLogoUrl, 500, 400);
......@@ -468,7 +481,7 @@ export default {
this.shareOrderSn = res.target.data[len].orderSn;
this.shareTid = res.target.data[len].shareTid;
this.newWindowHref = res.target.data[len].shareImgUrl + '&verifyShare=1';// + '&fromVisitorOpenId=' + wx.getStorageSync("openid")
log.info("分享信息:", this.shareLogoUrl, this.shareShopName,1111111,this.newWindowHref);
log.info("getMessage-分享信息:", this.shareLogoUrl, this.shareShopName,1111111,this.newWindowHref);
//文章详情分享埋点
if(this.newWindowHref.indexOf('articleId')!=-1) {
var articleId = ''
......@@ -490,6 +503,7 @@ export default {
log.info('网页加载成功');
},
handleError(data){
log.info('handleError',data)
wx.showLoading({
title: "网页加载失败 请右上角刷新"
});
......@@ -553,6 +567,7 @@ export default {
log.info("卸载----------------", this.options);
},
async onShareAppMessage(res) {
log.info('onShareAppMessage',res)
await this.getSpokesman();
let url = ''
log.info(this.newWindowHref + 'this.newWindowHref')
......@@ -584,7 +599,7 @@ export default {
}
log.info(this.shareUrl, "index12");
log.info('onShareAppMessage-shareUrl',this.shareUrl,);
log.info(`/pages/index/main?share=${encodeURIComponent(this.shareUrl)}`, '测试直播分享相关')
return {
title: this.shareShopName, // 默认是小程序的名称
......
......@@ -117,8 +117,9 @@ export default {
})
},
onLoad(options) {
log.info(options,'----------------------login-options')
log.info(options,'----------------------login-onload-options')
login.getShopUserProtocol().then(res => {
log.info('获取用户协议',res)
if(res.data.code == '200') {
this.content = res.data.data;
}
......@@ -157,6 +158,7 @@ export default {
this.logoUrl = wx.getStorageSync("logoUrl");
if (!(this.shopName && this.logoUrl)) {
shop.getShopInfo().then(res => {
log.info('获取商城信息',res)
if (res.data.code == 200) {
this.shopName = res.data.data.shopName;
this.logoUrl = process.env.IMG_DOMAIN + res.data.data.logoUrl;
......@@ -176,15 +178,18 @@ export default {
init() {
let _this = this;
return new Promise((resolve, reject) => {
login
.miniLogin({ code: this.code,
let query = {
code: this.code,
spokesmanRelId : '',
spokesmanGroupId : '',
spokesmanShopId : '',
nickname: _this.wxUserInfo.nickName,
headImgUrl: _this.wxUserInfo.avatarUrl
})
};
login
.miniLogin(query)
.then(res => {
log.info('/wx/mini_login',query,res)
if (res.data.code == 200) {
resolve(res);
} else {
......@@ -197,9 +202,9 @@ export default {
});
},
addRecord(flag) {
log.info(wx.getStorageSync('attractingCustomerChannelId'))
log.info(this.openid)
log.info(99999)
log.info('attractingCustomerChannelId',wx.getStorageSync('attractingCustomerChannelId'))
log.info('openid',this.openid)
log.info('addRecord',flag)
//埋点引客渠道
if(wx.getStorageSync('attractingCustomerChannelId')) {
indexApi.addRecord(
......@@ -211,6 +216,7 @@ export default {
newRegisterFlag: flag?1:0,//1是新注册用户
}
).then(ele=>{
log.info('addRecord',res)
if (ele.data.data) {
wx.setStorageSync('attractingCustomerChannelId','')
}
......@@ -218,6 +224,7 @@ export default {
}
},
getUserProfile() {
log.info('点击了微信一键登录');
let _this = this;
if(this.content&&!this.checked) {
wx.showToast({
......@@ -236,6 +243,7 @@ export default {
desc: '用于完善会员资料', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
success: (e) => {
_this.wxUserInfo = e.userInfo;
log.info('获取wx.getUserProfile用户信息',_this.wxUserInfo);
this.init()
.then(res => {
//存入openid
......@@ -302,6 +310,7 @@ export default {
});
},
fail: (e) => {
log.info('wx.getUserProfile-fail',e)
wx.hideLoading()
}
})
......@@ -320,6 +329,7 @@ export default {
login
.checkUnionid({ unionId: this.unionId, openId: this.openid })
.then(res => {
log.info('checkUnionid',res)
wx.hideLoading();
if (res.data.code == 200) {
if (res.data.data.isHaveUnion == "true") {
......@@ -469,11 +479,11 @@ export default {
query.spokesmanShopId = this.$store.state.spokesmanShopId;
}
log.info(query, "query");
login
.bindUser(query)
.then(res => {
//绑定成功
log.info('bindUser',query,res)
if (res.data.code == 200) {
wx.setStorageSync(this.$store.state.mixid+'articleId',false)
this.NEED_CERTIFIED = res.data.data.NEED_CERTIFIED;
......@@ -513,6 +523,7 @@ export default {
});
},
handbindHandle() {
log.info('点击手动绑定手机号')
log.info(this.queryOptions,'---------------options')
const query = {
openId: this.openid,
......@@ -526,7 +537,7 @@ export default {
param: this.queryOptions.param,
back: this.queryOptions.back,
};
log.info(query,'-------------------519')
log.info(query,'handbindHandle-query')
log.info( serialize(query),'------------------- serialize(query)')
if(wx.getStorageSync(this.$store.state.mixid+'storeId')) {
query.storeId = wx.getStorageSync(this.$store.state.mixid+'storeId')
......@@ -546,6 +557,7 @@ export default {
// wx.reLaunch({
// url : '/pages/home/main'
// })
log.info('点击暂不登录')
wx.navigateBack({
delta: 1
});
......
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