Commit 1bb1fa15 by 李伟康

修改浏览埋点

1 parent b698e735
...@@ -134,14 +134,6 @@ class UsersApi { ...@@ -134,14 +134,6 @@ class UsersApi {
...data ...data
}) })
} }
<<<<<<< HEAD
/** 退出登录 */
logout(data) {
return api.post({
method: 'scrm.api.sso.wechat.applets.logout',
...CODE,
...data
=======
/** 手机号授权解析(单纯解析内容返回前端) /** 手机号授权解析(单纯解析内容返回前端)
* 只传loginToken就返回unionId和openid * 只传loginToken就返回unionId和openid
* 传加密信息就解析手机号 * 传加密信息就解析手机号
...@@ -167,7 +159,6 @@ class UsersApi { ...@@ -167,7 +159,6 @@ class UsersApi {
method: 'scrm.api.sso.wechat.applets.phone.grant.analysis', method: 'scrm.api.sso.wechat.applets.phone.grant.analysis',
...detail, ...detail,
platformEntrance: 'BUSINESS_ASSISTANT' platformEntrance: 'BUSINESS_ASSISTANT'
>>>>>>> 453f605c17f20f69b383822ce6981abe179f022b
}) })
} }
} }
......
...@@ -59,31 +59,32 @@ Page({ ...@@ -59,31 +59,32 @@ Page({
actNum, actNum,
activeNavIdx activeNavIdx
}) })
}, if (this.options?.shareOpenId) {
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
console.log(options)
if (options.shareOpenId) {
const WXUSERINFO = wx.$storage.get('wx_user_info'), const WXUSERINFO = wx.$storage.get('wx_user_info'),
USERINFO = wx.$storage.get('userInfo') USERINFO = wx.$storage.get('userInfo'),
shareInfo = this.options
reportData({ reportData({
openId: WXUSERINFO.openId || '', openId: WXUSERINFO.openId || '',
unionId: WXUSERINFO.unionId || '', unionId: WXUSERINFO.unionId || '',
nickName: WXUSERINFO.nickName || '', nickName: WXUSERINFO.nickName || '',
avatar: WXUSERINFO.avatarUrl || '', avatar: WXUSERINFO.avatarUrl || '',
phone: USERINFO.phone || '', phone: USERINFO.phone || '',
merchantId: options.merchantId || '', merchantId: shareInfo.merchantId || '',
shareOpenId: options.shareOpenId || '', shareOpenId: shareInfo.shareOpenId || '',
sharePhone: options.sharePhone || '', sharePhone: shareInfo.sharePhone || '',
productCode: options.productCode || '', productCode: shareInfo.productCode || '',
productDesc: options.productDesc || '' productDesc: shareInfo.productDesc || ''
}, 1) }, 1)
// 禁用分享功能 // 禁用分享功能
wx.hideShareMenu() wx.hideShareMenu()
} }
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
// actNum,activeNavIdx isShare // actNum,activeNavIdx isShare
}, },
......
...@@ -5,6 +5,7 @@ import { IMG_URL } from '~/utils/constantData' ...@@ -5,6 +5,7 @@ import { IMG_URL } from '~/utils/constantData'
import { generateRoutList } from './wxOnAppRoute.js' import { generateRoutList } from './wxOnAppRoute.js'
import { getNavigationBarTitleText } from '~/utils/cache/storageApi' import { getNavigationBarTitleText } from '~/utils/cache/storageApi'
import { getUserInfo } from '~/utils/cache/userInfo' import { getUserInfo } from '~/utils/cache/userInfo'
import USERAPI from '~/api/usersApi/index'
class Router { class Router {
[_query] = {}; [_query] = {};
[_routeHooks] = []; [_routeHooks] = [];
...@@ -12,11 +13,12 @@ class Router { ...@@ -12,11 +13,12 @@ class Router {
constructor(router) { constructor(router) {
this[_routerList] = generateRoutList(router) this[_routerList] = generateRoutList(router)
wx.onAppRoute && wx.onAppRoute &&
wx.onAppRoute(e => { wx.onAppRoute(async e => {
let thisPage = this.getPageInstance() let thisPage = this.getPageInstance()
if (thisPage) { if (thisPage) {
await USERAPI.getWXUserInfo()
thisPage.setData({ IMG_URL }) thisPage.setData({ IMG_URL })
thisPage.options = this[_query] if(Object.keys(this[_query]).length) thisPage.options = this[_query]
this.setNavigationBarTitleText(thisPage) this.setNavigationBarTitleText(thisPage)
let onRoute = thisPage.onRoute let onRoute = thisPage.onRoute
typeof onRoute === 'function' && onRoute(this[_query]) typeof onRoute === 'function' && onRoute(this[_query])
......
...@@ -5,16 +5,13 @@ ...@@ -5,16 +5,13 @@
* @param {*} shareQuery 分享页面参数 * @param {*} shareQuery 分享页面参数
* @param {*} noPageAuth 分享页面是否需要登录拦截 * @param {*} noPageAuth 分享页面是否需要登录拦截
* @param {*} shareFun 分享页面 * @param {*} shareFun 分享页面
* @param {*} isShareTrack 是否分享埋点 * @param {*} shareTrackData 分享埋点数据
* @returns * @returns
*/ */
import { import {
reportData reportData
} from '~/api/index.js' } from '~/api/index.js'
import USERAPI from '~/api/usersApi/index'
const _WXUSERINFO_ = Symbol('_WXUSERINFO_')
class Share { class Share {
[_WXUSERINFO_] = null
constructor() { constructor() {
console.log('---------------- 分享初始化 ----------------') console.log('---------------- 分享初始化 ----------------')
this.initPageProxy() this.initPageProxy()
...@@ -31,17 +28,11 @@ class Share { ...@@ -31,17 +28,11 @@ class Share {
} }
} }
} }
async checkWxUserInfo() {
if (!this[_WXUSERINFO_]) {
const data = await USERAPI.getWXUserInfo()
this[_WXUSERINFO_] = data
}
}
/**设置全局分享 */ /**设置全局分享 */
pageLeaveProxy(page) { pageLeaveProxy(page) {
if (page.onShareAppMessage) { if (page.onShareAppMessage) {
const that = this const that = this
this.checkWxUserInfo()
page.onShareAppMessage = function () { page.onShareAppMessage = function () {
let { let {
shareTitle, shareTitle,
...@@ -89,7 +80,7 @@ class Share { ...@@ -89,7 +80,7 @@ class Share {
} }
} }
getCommonData() { getCommonData() {
const WXUSERINFO = this[_WXUSERINFO_], const WXUSERINFO = wx.$storage.get('wx_user_info'),
USERINFO = wx.$storage.get('userInfo') USERINFO = wx.$storage.get('userInfo')
return { return {
WXUSERINFO, WXUSERINFO,
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!