Commit a8e9746d by 李伟康

修改浏览埋点

1 parent 2e627bbc
......@@ -7,9 +7,6 @@ const navStyle = "background-color: #fff";
import {
senceData
} from "~/pages/tab/index/constant/data";
import {
reportData
} from '~/api/index.js'
Page({
/**
* 页面的初始数据
......@@ -59,33 +56,15 @@ Page({
actNum,
activeNavIdx
})
if (this.options?.shareOpenId) {
const WXUSERINFO = wx.$storage.get('wx_user_info'),
USERINFO = wx.$storage.get('userInfo'),
shareInfo = this.options
reportData({
openId: WXUSERINFO.openId || '',
unionId: WXUSERINFO.unionId || '',
nickName: WXUSERINFO.nickName || '',
avatar: WXUSERINFO.avatarUrl || '',
phone: USERINFO.phone || '',
merchantId: shareInfo.merchantId || '',
shareOpenId: shareInfo.shareOpenId || '',
sharePhone: shareInfo.sharePhone || '',
productCode: shareInfo.productCode || '',
productDesc: shareInfo.productDesc || ''
}, 1)
// 禁用分享功能
wx.hideShareMenu()
}
},
onViewTrack: true, //是否浏览埋点
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
// actNum,activeNavIdx isShare
// 禁用分享功能
wx.hideShareMenu()
},
/**
......
......@@ -5,7 +5,6 @@ import { IMG_URL } from '~/utils/constantData'
import { generateRoutList } from './wxOnAppRoute.js'
import { getNavigationBarTitleText } from '~/utils/cache/storageApi'
import { getUserInfo } from '~/utils/cache/userInfo'
import USERAPI from '~/api/usersApi/index'
class Router {
[_query] = {};
[_routeHooks] = [];
......@@ -13,10 +12,9 @@ class Router {
constructor(router) {
this[_routerList] = generateRoutList(router)
wx.onAppRoute &&
wx.onAppRoute(async e => {
wx.onAppRoute(e => {
let thisPage = this.getPageInstance()
if (thisPage) {
if(!thisPage.route.includes('login')) await USERAPI.getWXUserInfo()
thisPage.setData({ IMG_URL })
if(Object.keys(this[_query]).length) thisPage.options = this[_query]
this.setNavigationBarTitleText(thisPage)
......
......@@ -11,6 +11,8 @@
import {
reportData
} from '~/api/index.js'
import USERAPI from '~/api/usersApi/index'
class Share {
constructor() {
console.log('---------------- 分享初始化 ----------------')
......@@ -31,6 +33,8 @@ class Share {
/**设置全局分享 */
pageLeaveProxy(page) {
const onLoad = page.onLoad,
that = this
if (page.onShareAppMessage) {
const that = this
page.onShareAppMessage = function () {
......@@ -78,6 +82,28 @@ class Share {
}
}
}
page.onLoad = async function () {
onLoad && onLoad.apply(this, arguments)
if (this.onViewTrack) {
const WXUSERINFO = await USERAPI.getWXUserInfo(),
{
USERINFO
} = that.getCommonData(),
shareInfo = this.options
reportData({
openId: WXUSERINFO.openId || '',
unionId: WXUSERINFO.unionId || '',
nickName: WXUSERINFO.nickName || '',
avatar: WXUSERINFO.avatarUrl || '',
phone: USERINFO.phone || '',
merchantId: shareInfo.merchantId || '',
shareOpenId: shareInfo.shareOpenId || '',
sharePhone: shareInfo.sharePhone || '',
productCode: shareInfo.productCode || '',
productDesc: shareInfo.productDesc || ''
}, 1)
}
}
}
getCommonData() {
const WXUSERINFO = wx.$storage.get('wx_user_info'),
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!