Commit c6432ef6 by Sweet Zhang

添加统计代码,解决冲突

parent f244c8fd
......@@ -15,12 +15,12 @@
const queryString = hash.substring(queryIndex + 1);
const reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)');
const r = queryString.match(reg);
console.log('匹配结果', r);
// console.log('匹配结果', r);
if (r != null) return decodeURIComponent(r[2]);
return null;
}
const statusBarHeight = getQueryParam('statusBarHeight');
console.log('状态栏高度', statusBarHeight);
// console.log('状态栏高度', statusBarHeight);
if (statusBarHeight) {
const height = parseInt(statusBarHeight, 10);
if (!isNaN(height) && height > 0) {
......@@ -56,9 +56,9 @@
var script = document.createElement('script');
script.src = 'https://res2.wx.qq.com/open/js/jweixin-1.6.0.js';
document.head.appendChild(script);
console.log('加载微信JS-SDK');
// console.log('加载微信JS-SDK');
} else {
console.log('小程序Webview环境,不加载微信JS-SDK');
// console.log('小程序Webview环境,不加载微信JS-SDK');
}
});
</script>
......
// main.js
import App from './App';
import { scrmUrl } from "./environments/environment";
import tracker from '@/util/tracker/tracker.js'
// // #ifndef VUE3
// import Vue from 'vue'
// App.mpType = 'app'
// const app = new Vue({
// ...App
// })
// 从 track-events.js 导入映射
import {
FUNCTION_EVENT_MAP,
FUNCTION_MODULE_MAP,
FUNCTION_NAMES,
MODULE_NAMES
} from '@/util/tracker/track-events.js'
// ====== 导入 pages.json 自动生成模块映射 ======
import pagesJson from '@/pages.json'
// app.$mount()
// // #endif
function buildModuleMap() {
const map = {}
const keywordList = []
function processPages(pages, root = '') {
(pages || []).forEach((page) => {
const meta = (page.style && page.style.meta) || {}
if (meta.moduleCode) {
const fullPath = '/' + root + page.path
map[fullPath] = {
moduleType: meta.moduleCode,
moduleName: meta.moduleName || meta.moduleCode
}
keywordList.push({
keyword: meta.moduleCode,
moduleType: meta.moduleCode,
moduleName: meta.moduleName || meta.moduleCode
})
if (meta.moduleName && meta.moduleName !== meta.moduleCode) {
keywordList.push({
keyword: meta.moduleName,
moduleType: meta.moduleCode,
moduleName: meta.moduleName
})
}
}
})
}
processPages(pagesJson.pages)
;(pagesJson.subPackages || []).forEach((sub) => {
const root = sub.root || ''
processPages(sub.pages, root + '/')
})
return { exact: map, keyword: keywordList }
}
const moduleMapData = buildModuleMap()
// ====== 初始化 tracker ======
tracker.init({
reportUrl: `${scrmUrl}/scrm-api/log/client/batch/save`,
projectType: 'CFFP',
clientType: 'H5',
source: 'direct', // 访问来源,可从 URL 参数获取
// 注入功能映射
functionEventMap: FUNCTION_EVENT_MAP,
functionModuleMap: FUNCTION_MODULE_MAP,
functionNameMap: FUNCTION_NAMES,
// 模块映射
moduleMap: moduleMapData.exact,
keywordMap: moduleMapData.keyword,
debug: process.env.NODE_ENV === 'development',
dryRun: true // ✅ 开启模拟模式(只打印不上报)
})
// #ifdef VUE3
import { createSSRApp } from 'vue'
import { createSSRApp } from 'vue';
export function createApp() {
const app = createSSRApp(App)
const app = createSSRApp(App);
// 挂载到全局
app.config.globalProperties.$tracker = tracker;
return {
app
}
};
}
// #endif
//#ifdef H5
window.sessionStorage.setItem('firstEntryUrl',window.location.href.split('#')[0])
// #ifndef VUE3
import Vue from 'vue';
App.mpType = 'app';
const app = new Vue({
...App
});
app.$mount();
// #endif
// #ifdef H5
if (typeof window !== 'undefined' && window.sessionStorage) {
window.sessionStorage.setItem('firstEntryUrl', window.location.href.split('#')[0]);
}
// #endif
......@@ -834,7 +834,6 @@
}
if(this.courseInfo.fileIntroduce){
this.imagesList = this.extractImageUrls(this.courseInfo.fileIntroduce)
console.log(' this.imagesList', this.imagesList);
}
//this.courseInfo.serviceContent = res['data']['data']['filePathOss'];
this.lecturerId = res['data']['data']['fileLecturerId'];
......@@ -1099,7 +1098,6 @@
// imgUrl: this.courseInfo.displayImage, //图片
imgUrl: this.courseInfo.shareImg, //图片
}
console.log('data', data);
//安卓机型获取当前页面路径
let url = window.location.href.split('#')[0];
......@@ -1220,7 +1218,7 @@
return
}
if(res.data.userIsActive&&res.data.userIsActive!=2){
this.$refs.restrictedTip.close()
this.$refs.restrictedTip?.close()
uni.removeStorageSync('userIsActive')
}
uni.setStorageSync('cffp_userInfo', JSON.stringify(cffp_userInfo))
......
......@@ -542,7 +542,6 @@
});
},
courseList() {
console.log('执行了');
const param = {
queryName: this.queryName,
courseClassify: this.courseClassify
......
......@@ -23,7 +23,7 @@
<view class="featureContent">
<!-- 顶部快捷菜单 -->
<view class="nav_wrapper">
<view class="nav_content" v-for="featureItem in featureLists" :key="featureItem.key"
<view class="nav_content" v-for="featureItem in featureLists" :key="featureItem.key" :data-track="featureItem.trackCode"
@click="featureSelect(featureItem)">
<view class="imgbox">
<view class="iconfont iconSize" :class="`${featureItem.icon}`"></view>
......@@ -222,7 +222,8 @@
icon: 'icon-hezuo',
link: '/myPackageA/applyFranchise/applyFranchise',
isOpen: true,
isApply:true
isApply:true,
trackCode:"apply_join"
},
{
key: '07',
......@@ -230,6 +231,7 @@
icon: 'icon-zhuanfa',
link: '/pages/courselist/courselist',
isOpen: true,
trackCode:"share_product"
},
{
......@@ -238,7 +240,8 @@
icon: 'icon-yaoqing',
link: '/pages/inviteJoin/inviteJoin',
isOpen: true,
isJoin: true
isJoin: true,
trackCode:"invite_join"
},
],
......@@ -314,7 +317,7 @@
},
onHide() {
this.$nextTick(()=>{
this.$refs.courselist.$refs.sharePosterPop.closeDropdown()
this.$refs.courselist?.$refs?.sharePosterPop?.closeDropdown?.()
})
},
onLoad(options) {
......@@ -393,10 +396,11 @@
uni.setStorageSync('cffp_userInfo', JSON.stringify(cffp_userInfo));
uni.setStorageSync('user_mobile', res.data.mobile)
if(cffp_userInfo.partnerType){
this.featureLists = [{key: '00',name: '成交订单',icon:'icon-dingdan',link: '/pages/saleCourseLists/saleCourseLists',isOpen: true,enName:'order'},
{key: '01',name: '佣金',icon: 'icon-yongjin',link: '/pages/pointsExchange/pointsExchange',isOpen: true,isJoin: true},
{key: '07',name: '分享产品',icon: 'icon-zhuanfa',link: '/pages/courselist/courselist',isOpen: true},
{key: '04',name: '邀请加盟',icon: 'icon-yaoqing',link: '/pages/inviteJoin/inviteJoin',isOpen: true,isJoin: true}];
this.featureLists =
[{key: '00',name: '成交订单',icon:'icon-dingdan',link: '/pages/saleCourseLists/saleCourseLists',isOpen: true,enName:'order',trackCode:"view_order_list" },
{key: '01',name: '佣金',icon: 'icon-yongjin',link: '/pages/pointsExchange/pointsExchange',isOpen: true,isJoin: true,trackCode:"view_commission" },
{key: '07',name: '分享产品',icon: 'icon-zhuanfa',link: '/pages/courselist/courselist',isOpen: true,trackCode:"share_product" },
{key: '04',name: '邀请加盟',icon: 'icon-yaoqing',link: '/pages/inviteJoin/inviteJoin',isOpen: true,isJoin: true,trackCode:"invite_join" }];
}else {
this.featureLists =[
{
......@@ -405,7 +409,8 @@
icon: 'icon-hezuo',
link: '/myPackageA/applyFranchise/applyFranchise',
isOpen: true,
isApply:true
isApply:true,
trackCode:"apply_join"
},
{
key: '07',
......@@ -413,6 +418,7 @@
icon: 'icon-zhuanfa',
link: '/pages/courselist/courselist',
isOpen: true,
trackCode:"share_product"
},
{
......@@ -421,7 +427,8 @@
icon: 'icon-yaoqing',
link: '/pages/inviteJoin/inviteJoin',
isOpen: true,
isJoin: true
isJoin: true,
trackCode:"invite_join"
},
]
......
......@@ -279,7 +279,6 @@
isShow: true,
identity: true
},
// {title:'育成团队',icon:'icon-yuchengguanxi',link:'/pages/personalCenter/myTeamIncubate',isOpen:true,isShow:true,identity: true},
],
}, {
id: '03',
......@@ -371,7 +370,6 @@
minorMenuLists: [
// {title:'我的邀请码',icon:'shareEcode',link:'',isOpen:true,isShow:true},
{ title: '我的卡包', icon: 'card', link: '', isOpen: true, isShow: false },
// {title:'我的认证',icon:'myCertify',link:'/pages/myCertify/myCertify',isOpen:true,isShow:true},
{ title: '申请修改公司周边', icon: 'setting', link: '', isOpen: true, isShow: false },
{
title: '我的消息',
......
......@@ -344,11 +344,6 @@
})
}
},
// toRecord(){
// uni.navigateTo({
// url:'/pages/exchangeRecord/exchangeRecord'
// })
// },
viewDropLists() {
uni.navigateTo({
url: '/pages/dropLists/dropLists'
......
......@@ -14,6 +14,7 @@ function isWechatBrowser(): boolean {
function isMiniProgramWebView(): boolean {
// 检查微信环境变量
// @ts-ignore
if (typeof window.__wxjs_environment !== 'undefined' && window.__wxjs_environment === 'miniprogram') {
return true;
}
......
......@@ -4,6 +4,7 @@ import { initJssdkShare, setWechatShare } from '@/util/fiveshare';
import { shareURL } from "@/environments/environment";
import wx from 'weixin-js-sdk'
import { nanoid } from 'nanoid';
//只要是未登录状态,想要跳转到名单内的路径时,直接跳到登录页
// 页面白名单,不受拦截
const whiteList = [
......@@ -26,6 +27,7 @@ let shareCustomPageList = [
'/pages/courselist/courselist',
'/myPackageA/businessCard/businessCard',
]
export default function initApp() {
let date = Date.now()
......@@ -69,6 +71,7 @@ export default function initApp() {
url: '/myPackageA/login/login'
})
}
if (uni.getStorageSync('loginType') == 'codelogin') {
api.queryInfo({}).then(res => {
if (!res['success']) {
......@@ -97,7 +100,6 @@ export default function initApp() {
uni.setStorageSync('cffp_userInfo', JSON.stringify(cffp_userInfo))
}
})
}
if (userInfo.userIsActive == 2 && uni.getStorageSync('loginType') == 'codelogin') {
......@@ -150,7 +152,8 @@ export default function initApp() {
}
return true
},
success(e) {}
success(e) {
}
})
uni.addInterceptor('switchTab', {
// tabbar页面跳转前进行拦截
......@@ -194,7 +197,8 @@ export default function initApp() {
date = Date.now()
return true
},
success(e) {}
success(e) {
}
})
uni.addInterceptor('reLaunch', {
//页面跳转前拦截
......@@ -238,7 +242,9 @@ export default function initApp() {
return true
},
//页面跳转后缓存当前页路由
success(e) {}
success(e) {
}
})
}
......
// utils/tracker/types.js
/**
* 项目类型
*/
export const PROJECT_TYPES = {
SFP: 'SFP',
CFFP: 'CFFP',
}
/**
* 模块类型
*/
export const MODULE_TYPES = {
REPORT: 'report',
ORDER: 'order',
HOME: 'home',
PRODUCT: 'product',
USER: 'user',
SEARCH: 'search',
CART: 'cart',
PAYMENT: 'payment',
ACTIVITY: 'activity',
OTHER: 'other',
}
/**
* 客户端类型
*/
export const CLIENT_TYPES = {
MINI_PROGRAM: 'mini_program',
H5: 'H5',
APP: 'app',
}
/**
* 操作分类
*/
export const OPER_CATEGORY = {
GENERAL: '1', // 通用操作(系统自动采集)
PERSONALIZED: '2', // 个性化操作(定制化采集)
}
/**
* 事件类型(对应后端 eventType)
*/
export const EVENT_TYPES = {
PAGE_VIEW: 'page_view',
PAGE_LEAVE: 'page_leave',
CLICK: 'click',
LOGIN: 'login',
PURCHASE: 'purchase',
SHARE: 'share',
SEARCH: 'search',
DOWNLOAD: 'download',
SUBMIT: 'submit',
SCROLL: 'scroll',
CUSTOM: 'custom',
}
/**
* 目标类型
*/
export const TARGET_TYPES = {
BUTTON: 'button',
PRODUCT: 'product',
MODULE: 'module',
INPUT: 'input',
LINK: 'link',
IMAGE: 'image',
VIDEO: 'video',
REPORT: 'report',
OTHER: 'other',
}
\ No newline at end of file
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