Commit c6432ef6 by Sweet Zhang

添加统计代码,解决冲突

parent f244c8fd
<script> <script>
import initApp from "@/util/router.js"; import initApp from "@/util/router.js";
import {interceptor} from "@/util/interceptor"; import { interceptor } from "@/util/interceptor";
import {baseURL,apiURL,cffpURL,companyInfo} from "@/environments/environment"; import { baseURL, apiURL, cffpURL, companyInfo } from "@/environments/environment";
import api from './api/api'; import api from './api/api';
import {hshare} from '@/util/fiveshare'; import { hshare } from '@/util/fiveshare';
import dataHandling from "@/util/dataHandling"; import dataHandling from "@/util/dataHandling";
import { useH5IdleExit } from '@/util/useH5IdleExit' import { useH5IdleExit } from '@/util/useH5IdleExit'
import tracker from '@/util/tracker/tracker.js'
const idleExit = useH5IdleExit() const idleExit = useH5IdleExit()
let isAllInOneEnv = false let isAllInOneEnv = false
...@@ -18,14 +18,18 @@ ...@@ -18,14 +18,18 @@
const m = q.match(/[?&]bagType=([^&]+)/) const m = q.match(/[?&]bagType=([^&]+)/)
return m ? decodeURIComponent(m[1]) === 'allinone' : false return m ? decodeURIComponent(m[1]) === 'allinone' : false
} }
export default { export default {
data() { data() {
return { return {
invitationHandled: false ,// 在data中明确定义, invitationHandled: false,
dataToken:'', dataToken: '',
loginType:'' loginType: '',
// ✅ 新增 debug 属性
debug: process.env.NODE_ENV === 'development'
} }
}, },
onLaunch: function(options) { onLaunch: function(options) {
console.log('App Launch'); console.log('App Launch');
//----嵌入一体机开启超时自动退出----- //----嵌入一体机开启超时自动退出-----
...@@ -35,37 +39,37 @@ ...@@ -35,37 +39,37 @@
window.addEventListener('beforeunload', () => idleExit.stop()) window.addEventListener('beforeunload', () => idleExit.stop())
//----嵌入一体机开启超时自动退出----- //----嵌入一体机开启超时自动退出-----
if (uni.getStorageSync('loginType')) {
if(uni.getStorageSync('loginType')){
this.loginType = uni.getStorageSync('loginType') this.loginType = uni.getStorageSync('loginType')
} }
if(uni.getStorageSync('dataToken')){ if (uni.getStorageSync('dataToken')) {
uni.removeStorageSync('dataToken') uni.removeStorageSync('dataToken')
} }
if(!uni.getStorageSync('loginType')){ if (!uni.getStorageSync('loginType')) {
uni.setStorageSync('loginType','visitor'); uni.setStorageSync('loginType', 'visitor');
} }
if(!uni.getStorageSync('visitorUuid')){ if (!uni.getStorageSync('visitorUuid')) {
uni.setStorageSync('visitorUuid',dataHandling.uuid()); uni.setStorageSync('visitorUuid', dataHandling.uuid());
} }
// 处理外部链接参数 // 处理外部链接参数
this.handleExternalUrlParams(); this.handleExternalUrlParams();
// #ifdef APP-PLUS // #ifdef APP-PLUS
plus.runtime.getProperty(plus.runtime.appid, (wgtinfo) => { plus.runtime.getProperty(plus.runtime.appid, (wgtinfo) => {
uni.getSystemInfo({ uni.getSystemInfo({
success:(systemInfo)=> { success: (systemInfo) => {
uni.request({ uni.request({
url: `${apiURL}/appVersion/checkIsUpdate`, url: `${apiURL}/appVersion/checkIsUpdate`,
method:'POST', method: 'POST',
data: { data: {
appType: 1, appType: 1,
version: wgtinfo.version, version: wgtinfo.version,
systemType:systemInfo.osName.toLowerCase() === 'ios' ? 2 : 1 systemType: systemInfo.osName.toLowerCase() === 'ios' ? 2 : 1
}, },
success: (result) => { success: (result) => {
const data = result.data.data['appVersionInfo']; const data = result.data.data['appVersionInfo'];
if (data.status==1 && data.isForceUpdate && data.wgtUrl) { if (data.status == 1 && data.isForceUpdate && data.wgtUrl) {
uni.downloadFile({ uni.downloadFile({
url: `${baseURL}${data.wgtUrl}`, url: `${baseURL}${data.wgtUrl}`,
success: (downloadResult) => { success: (downloadResult) => {
...@@ -86,8 +90,8 @@ ...@@ -86,8 +90,8 @@
} }
}) })
}) })
// #endif // #endif
interceptor(); interceptor();
initApp(); initApp();
}, },
...@@ -101,43 +105,103 @@ ...@@ -101,43 +105,103 @@
} }
//----嵌入一体机开启超时自动退出----- //----嵌入一体机开启超时自动退出-----
console.log('App Show', options);
// ============================================================
// ✅ 修复:延迟执行,等待页面渲染完成 + tracker 初始化完成
// ============================================================
setTimeout(() => {
this._handlePageShow()
}, 300)
console.log('App Show', options);
// 每次进应用显示时检查用户状态 // 每次进应用显示时检查用户状态
this.checkUserStatus(); this.checkUserStatus();
// App平台从options获取参数 // App平台从options获取参数
// #ifdef APP-PLUS // #ifdef APP-PLUS
if(options && options.query) { if (options && options.query) {
this.saveUrlParams(options.query); this.saveUrlParams(options.query);
} }
// #endif // #endif
}, },
onHide: function() { onHide: function() {
// 切后台/息屏/H5 被隐藏:停掉,避免后台跑定时器 // 切后台/息屏/H5 被隐藏:停掉,避免后台跑定时器
idleExit.stop() idleExit.stop()
// ✅ 应用切到后台时通知 tracker
tracker.onAppHide && tracker.onAppHide();
console.log('App Hide') console.log('App Hide')
}, },
onUnload() { onUnload() {
idleExit.stop() idleExit.stop()
}, },
methods: { methods: {
_handlePageShow() {
try {
const pages = getCurrentPages();
console.log('🔍 [App] pages:', pages) // ✅ 看 pages 是否有值
if (!pages || pages.length === 0) return;
const currentPage = pages[pages.length - 1];
const route = currentPage.route || '';
const options = currentPage.$page?.options || currentPage.options || {};
// 获取页面标题
let title = currentPage.$page?.title ||
currentPage._pageTitle ||
(currentPage.data && currentPage.data.pageTitle) ||
route.split('/').pop() ||
'未知页面';
// 构建完整路径
let fullPath = '/' + route;
const queryString = Object.keys(options)
.filter(k => k !== 'path' && k !== 'webviewId')
.map(k => k + '=' + encodeURIComponent(options[k]))
.join('&');
if (queryString) {
fullPath += '?' + queryString;
}
// 构建完整 URL
let url = fullPath;
// #ifdef H5
url = window.location.origin + fullPath;
// #endif
// ✅ 调用 tracker.trackPageView
tracker.trackPageView({
path: fullPath,
url: url,
title: title,
query: options
});
if (this.debug) {
console.log('[App] 页面切换:', route, '→', title);
console.log('[App] URL:', url);
}
} catch (e) {
console.warn('[App] 页面切换追踪异常:', e);
}
},
// 检查用户状态的方法 防止多端操作导致此用户不存在 // 检查用户状态的方法 防止多端操作导致此用户不存在
async checkUserStatus() { async checkUserStatus() {
// 只有已登录用户才需要检查 // 只有已登录用户才需要检查
if(uni.getStorageSync('loginType') == 'codelogin' && uni.getStorageSync('cffp_userId')) { if (uni.getStorageSync('loginType') == 'codelogin' && uni.getStorageSync('cffp_userId')) {
try { try {
const res = await api.queryInfo({}); const res = await api.queryInfo({ userId: uni.getStorageSync('cffp_userId') });
if(!res['success']) { if (!res['success']) {
// 用户已注销,清除缓存 // 用户已注销,清除缓存
this.clearLoginState(); this.clearLoginState();
// 如果不是在白名单页面,跳转到登录页 // 如果不是在白名单页面,跳转到登录页
const pages = getCurrentPages(); const pages = getCurrentPages();
if(pages.length > 0) { if (pages.length > 0) {
const currentRoute = pages[pages.length - 1].route; const currentRoute = pages[pages.length - 1].route;
console.log('currentRoute',currentRoute); console.log('currentRoute', currentRoute);
const whiteList = [ const whiteList = [
'/myPackageA/login/login', '/myPackageA/login/login',
'/myPackageA/businessCard/businessCard', '/myPackageA/businessCard/businessCard',
...@@ -152,8 +216,8 @@ ...@@ -152,8 +216,8 @@
'/pages/index/index', '/pages/index/index',
'pages/lanch/index', 'pages/lanch/index',
'/myPackageA/poster/poster', '/myPackageA/poster/poster',
] // 根据需要调整 ]
if(!whiteList.includes(currentRoute)) { if (!whiteList.includes(currentRoute)) {
uni.navigateTo({ uni.navigateTo({
url: '/myPackageA/login/login' url: '/myPackageA/login/login'
}); });
...@@ -166,45 +230,43 @@ ...@@ -166,45 +230,43 @@
...res.data ...res.data
} }
// 账号禁用用户 // 账号禁用用户
if(res.data.userIsActive&&res.data.userIsActive==2){ if (res.data.userIsActive && res.data.userIsActive == 2) {
uni.setStorageSync('userIsActive', String(res.data.userIsActive))
uni.setStorageSync('userIsActive',String(res.data.userIsActive))
return return
} }
if(res.data.userIsActive&&res.data.userIsActive!=2){ if (res.data.userIsActive && res.data.userIsActive != 2) {
uni.removeStorageSync('userIsActive') uni.removeStorageSync('userIsActive')
} }
uni.setStorageSync('cffp_userInfo', JSON.stringify(cffp_userInfo)) uni.setStorageSync('cffp_userInfo', JSON.stringify(cffp_userInfo))
} }
} catch (err) { } catch (err) {
console.error('检查用户状态失败:', err); console.error('检查用户状态失败:', err);
} }
return return
}else { } else {
this.checkToken() this.checkToken()
} }
}, },
// 清除登录状态 // 清除登录状态
clearLoginState() { clearLoginState() {
// uni.clearStorageSync();
uni.setStorageSync('loginType', 'visitor'); uni.setStorageSync('loginType', 'visitor');
this.checkToken() this.checkToken()
// 可以在这里添加其他需要清除的状态
}, },
// 未登录状态下需要重新获取token
checkToken(){
api.checkToken().then(res=>{
if(res['success']){}else{
api.obtainToken().then(res=>{
if(res.success){
uni.setStorageSync('uni-token',res.data['token']); // 未登录状态下需要重新获取token
checkToken() {
api.checkToken().then(res => {
if (res['success']) {} else {
api.obtainToken().then(res => {
if (res.success) {
uni.setStorageSync('uni-token', res.data['token']);
} }
}) })
} }
}) })
}, },
// 处理外部链接参数 // 处理外部链接参数
handleExternalUrlParams() { handleExternalUrlParams() {
// #ifdef H5 // #ifdef H5
...@@ -219,16 +281,15 @@ ...@@ -219,16 +281,15 @@
// 处理H5平台的URL参数 // 处理H5平台的URL参数
handleH5UrlParams() { handleH5UrlParams() {
const url = window.location.href; const url = window.location.href;
if(uni.getStorageSync('mpCffp')){ if (uni.getStorageSync('mpCffp')) {
uni.removeStorageSync('mpCffp') uni.removeStorageSync('mpCffp')
} }
if(url.indexOf('?') > -1) { if (url.indexOf('?') > -1) {
const queryString = url.split('?')[1]; const queryString = url.split('?')[1];
const params = this.parseQueryString(queryString); const params = this.parseQueryString(queryString);
this.saveUrlParams(params); this.saveUrlParams(params);
} }
}, },
// 处理App平台的URL参数 // 处理App平台的URL参数
...@@ -236,7 +297,7 @@ ...@@ -236,7 +297,7 @@
// 处理冷启动参数 // 处理冷启动参数
plus.runtime.getProperty(plus.runtime.appid, (widgetInfo) => { plus.runtime.getProperty(plus.runtime.appid, (widgetInfo) => {
const args = plus.runtime.arguments; const args = plus.runtime.arguments;
if(args) { if (args) {
const params = this.parseAppLaunchArgs(args); const params = this.parseAppLaunchArgs(args);
this.saveUrlParams(params); this.saveUrlParams(params);
} }
...@@ -245,7 +306,7 @@ ...@@ -245,7 +306,7 @@
// 监听热启动事件 // 监听热启动事件
plus.runtime.addEventListener('newintent', (e) => { plus.runtime.addEventListener('newintent', (e) => {
const args = e.arguments; const args = e.arguments;
if(args) { if (args) {
const params = this.parseAppLaunchArgs(args); const params = this.parseAppLaunchArgs(args);
this.saveUrlParams(params); this.saveUrlParams(params);
} }
...@@ -256,9 +317,9 @@ ...@@ -256,9 +317,9 @@
parseQueryString(queryString) { parseQueryString(queryString) {
const params = {}; const params = {};
const pairs = queryString.split('&'); const pairs = queryString.split('&');
for(let i = 0; i < pairs.length; i++) { for (let i = 0; i < pairs.length; i++) {
const pair = pairs[i].split('='); const pair = pairs[i].split('=');
if(pair.length === 2) { if (pair.length === 2) {
params[decodeURIComponent(pair[0])] = decodeURIComponent(pair[1] || ''); params[decodeURIComponent(pair[0])] = decodeURIComponent(pair[1] || '');
} }
} }
...@@ -268,7 +329,7 @@ ...@@ -268,7 +329,7 @@
// 解析App启动参数 // 解析App启动参数
parseAppLaunchArgs(args) { parseAppLaunchArgs(args) {
// 处理 scheme://path?key=value 格式 // 处理 scheme://path?key=value 格式
if(args.indexOf('?') > -1) { if (args.indexOf('?') > -1) {
const queryString = args.split('?')[1]; const queryString = args.split('?')[1];
return this.parseQueryString(queryString); return this.parseQueryString(queryString);
} }
...@@ -277,32 +338,28 @@ ...@@ -277,32 +338,28 @@
// 保存URL参数到本地存储 // 保存URL参数到本地存储
saveUrlParams(params) { saveUrlParams(params) {
if(Object.keys(params).length > 0) { if (Object.keys(params).length > 0) {
console.log('获取到外部链接参数:', params); console.log('获取到外部链接参数:', params);
// 使用uni.setStorageSync存储到本地
try { try {
//家办商城跳转登录状态下 //家办商城跳转登录状态下
if(params.dataToken){ if (params.dataToken) {
// this.dataToken = params.dataToken uni.setStorageSync('dataToken', decodeURIComponent(params.dataToken));
uni.setStorageSync('dataToken',decodeURIComponent(params.dataToken));
} }
//家办商城跳转未登录状态下 //家办商城跳转未登录状态下
if(params.mpCffp&&(params.noLogin ||!params.dataToken)){ if (params.mpCffp && (params.noLogin || !params.dataToken)) {
uni.removeStorageSync('userIsActive') uni.removeStorageSync('userIsActive')
uni.removeStorageSync('dataToken') uni.removeStorageSync('dataToken')
uni.setStorageSync('loginType','visitor'); uni.setStorageSync('loginType', 'visitor');
} }
if (params.addSystemType) {
if(params.addSystemType){
uni.setStorageSync('addSystemType', params.addSystemType); uni.setStorageSync('addSystemType', params.addSystemType);
} }
// 家办商城跳转,分享带参 // 家办商城跳转,分享带参
if(params.mpCffp){ if (params.mpCffp) {
uni.setStorageSync('mpCffp',params.mpCffp) uni.setStorageSync('mpCffp', params.mpCffp)
} }
} catch(e) { } catch (e) {
console.error('存储外部链接参数失败:', e); console.error('存储外部链接参数失败:', e);
} }
} }
......
...@@ -15,12 +15,12 @@ ...@@ -15,12 +15,12 @@
const queryString = hash.substring(queryIndex + 1); const queryString = hash.substring(queryIndex + 1);
const reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)'); const reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)');
const r = queryString.match(reg); const r = queryString.match(reg);
console.log('匹配结果', r); // console.log('匹配结果', r);
if (r != null) return decodeURIComponent(r[2]); if (r != null) return decodeURIComponent(r[2]);
return null; return null;
} }
const statusBarHeight = getQueryParam('statusBarHeight'); const statusBarHeight = getQueryParam('statusBarHeight');
console.log('状态栏高度', statusBarHeight); // console.log('状态栏高度', statusBarHeight);
if (statusBarHeight) { if (statusBarHeight) {
const height = parseInt(statusBarHeight, 10); const height = parseInt(statusBarHeight, 10);
if (!isNaN(height) && height > 0) { if (!isNaN(height) && height > 0) {
...@@ -56,9 +56,9 @@ ...@@ -56,9 +56,9 @@
var script = document.createElement('script'); var script = document.createElement('script');
script.src = 'https://res2.wx.qq.com/open/js/jweixin-1.6.0.js'; script.src = 'https://res2.wx.qq.com/open/js/jweixin-1.6.0.js';
document.head.appendChild(script); document.head.appendChild(script);
console.log('加载微信JS-SDK'); // console.log('加载微信JS-SDK');
} else { } else {
console.log('小程序Webview环境,不加载微信JS-SDK'); // console.log('小程序Webview环境,不加载微信JS-SDK');
} }
}); });
</script> </script>
......
// main.js
import App from './App'; import App from './App';
import { scrmUrl } from "./environments/environment";
import tracker from '@/util/tracker/tracker.js'
// // #ifndef VUE3 // 从 track-events.js 导入映射
// import Vue from 'vue' import {
// App.mpType = 'app' FUNCTION_EVENT_MAP,
// const app = new Vue({ FUNCTION_MODULE_MAP,
// ...App FUNCTION_NAMES,
// }) MODULE_NAMES
} from '@/util/tracker/track-events.js'
// ====== 导入 pages.json 自动生成模块映射 ======
import pagesJson from '@/pages.json'
// app.$mount() function buildModuleMap() {
// // #endif 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 // #ifdef VUE3
import { createSSRApp } from 'vue' import { createSSRApp } from 'vue';
export function createApp() { export function createApp() {
const app = createSSRApp(App) const app = createSSRApp(App);
// 挂载到全局
app.config.globalProperties.$tracker = tracker;
return { return {
app app
} };
} }
// #endif // #endif
//#ifdef H5 // #ifndef VUE3
window.sessionStorage.setItem('firstEntryUrl',window.location.href.split('#')[0]) import Vue from 'vue';
App.mpType = 'app';
const app = new Vue({
...App
});
app.$mount();
// #endif // #endif
// #ifdef H5
if (typeof window !== 'undefined' && window.sessionStorage) {
window.sessionStorage.setItem('firstEntryUrl', window.location.href.split('#')[0]);
}
// #endif
...@@ -4,7 +4,8 @@ ...@@ -4,7 +4,8 @@
"path": "pages/index/index", "path": "pages/index/index",
"style": { "style": {
"topWindow": false, "topWindow": false,
"navigationBarTitleText": "银盾家办" "navigationBarTitleText": "银盾家办",
"meta": { "moduleCode": "home", "moduleName": "首页" }
}, },
"lazyLoad": true "lazyLoad": true
}, },
...@@ -12,7 +13,8 @@ ...@@ -12,7 +13,8 @@
"path": "components/login/login", "path": "components/login/login",
"style": { "style": {
"topWindow": false, "topWindow": false,
"navigationBarTitleText": "银盾家办" "navigationBarTitleText": "银盾家办",
"meta": { "moduleCode": "login", "moduleName": "登录" }
}, },
"lazyLoad": true "lazyLoad": true
}, },
...@@ -20,7 +22,8 @@ ...@@ -20,7 +22,8 @@
"path": "pages/courselist/courselist", "path": "pages/courselist/courselist",
"style": { "style": {
"topWindow": false, "topWindow": false,
"navigationBarTitleText": "银盾家办" "navigationBarTitleText": "银盾家办",
"meta": { "moduleCode": "product", "moduleName": "产品中心" }
}, },
"lazyLoad": true "lazyLoad": true
}, },
...@@ -29,9 +32,8 @@ ...@@ -29,9 +32,8 @@
"style": { "style": {
"navigationBarTitleText": "产品详情", "navigationBarTitleText": "产品详情",
"enablePullDownRefresh": false, "enablePullDownRefresh": false,
"app-plus": { "app-plus": { "softinputMode": "adjustResize" },
"softinputMode": "adjustResize" "meta": { "moduleCode": "product", "moduleName": "产品详情" }
}
}, },
"lazyLoad": true "lazyLoad": true
}, },
...@@ -39,7 +41,8 @@ ...@@ -39,7 +41,8 @@
"path": "pages/product/product", "path": "pages/product/product",
"style": { "style": {
"navigationBarTitleText": "SFP", "navigationBarTitleText": "SFP",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"meta": { "moduleCode": "tools", "moduleName": "金融工具" }
}, },
"lazyLoad": true "lazyLoad": true
}, },
...@@ -47,7 +50,8 @@ ...@@ -47,7 +50,8 @@
"path": "pages/shareFriend/shareFriend", "path": "pages/shareFriend/shareFriend",
"style": { "style": {
"navigationBarTitleText": "分享好友", "navigationBarTitleText": "分享好友",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"meta": { "moduleCode": "share", "moduleName": "分享好友" }
}, },
"lazyLoad": true "lazyLoad": true
}, },
...@@ -55,7 +59,8 @@ ...@@ -55,7 +59,8 @@
"path": "pages/personalCenter/personalCenter", "path": "pages/personalCenter/personalCenter",
"style": { "style": {
"navigationBarTitleText": "我的", "navigationBarTitleText": "我的",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"meta": { "moduleCode": "user", "moduleName": "个人中心" }
}, },
"lazyLoad": true "lazyLoad": true
}, },
...@@ -63,7 +68,8 @@ ...@@ -63,7 +68,8 @@
"path": "pages/announcement/announcement", "path": "pages/announcement/announcement",
"style": { "style": {
"navigationBarTitleText": "公告列表", "navigationBarTitleText": "公告列表",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"meta": { "moduleCode": "announcement", "moduleName": "公告列表" }
}, },
"lazyLoad": true "lazyLoad": true
}, },
...@@ -71,7 +77,8 @@ ...@@ -71,7 +77,8 @@
"path": "pages/announcement/announcement_detail", "path": "pages/announcement/announcement_detail",
"style": { "style": {
"navigationBarTitleText": "公告详情", "navigationBarTitleText": "公告详情",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"meta": { "moduleCode": "announcement", "moduleName": "公告详情" }
}, },
"lazyLoad": true "lazyLoad": true
}, },
...@@ -79,7 +86,8 @@ ...@@ -79,7 +86,8 @@
"path": "pages/systemMsg/system_msg", "path": "pages/systemMsg/system_msg",
"style": { "style": {
"navigationBarTitleText": "消息列表", "navigationBarTitleText": "消息列表",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"meta": { "moduleCode": "message", "moduleName": "消息列表" }
}, },
"lazyLoad": true "lazyLoad": true
}, },
...@@ -87,7 +95,8 @@ ...@@ -87,7 +95,8 @@
"path": "pages/systemMsg/system_msg_detail", "path": "pages/systemMsg/system_msg_detail",
"style": { "style": {
"navigationBarTitleText": "消息详情", "navigationBarTitleText": "消息详情",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"meta": { "moduleCode": "message", "moduleName": "消息详情" }
}, },
"lazyLoad": true "lazyLoad": true
}, },
...@@ -96,9 +105,8 @@ ...@@ -96,9 +105,8 @@
"style": { "style": {
"navigationBarTitleText": "申请加盟-基本资料", "navigationBarTitleText": "申请加盟-基本资料",
"enablePullDownRefresh": false, "enablePullDownRefresh": false,
"app-plus": { "app-plus": { "softinputMode": "adjustPan" },
"softinputMode": "adjustPan" "meta": { "moduleCode": "apply", "moduleName": "申请加盟-基本资料" }
}
}, },
"lazyLoad": true "lazyLoad": true
}, },
...@@ -106,7 +114,8 @@ ...@@ -106,7 +114,8 @@
"path": "pages/application-process/work-experience", "path": "pages/application-process/work-experience",
"style": { "style": {
"navigationBarTitleText": "从业经历", "navigationBarTitleText": "从业经历",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"meta": { "moduleCode": "apply", "moduleName": "从业经历" }
}, },
"lazyLoad": true "lazyLoad": true
}, },
...@@ -114,7 +123,8 @@ ...@@ -114,7 +123,8 @@
"path": "pages/myCertify/myCertify", "path": "pages/myCertify/myCertify",
"style": { "style": {
"navigationBarTitleText": "我的认证", "navigationBarTitleText": "我的认证",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"meta": { "moduleCode": "certify", "moduleName": "我的认证" }
}, },
"lazyLoad": true "lazyLoad": true
}, },
...@@ -122,7 +132,8 @@ ...@@ -122,7 +132,8 @@
"path": "pages/inviteJoin/inviteJoin", "path": "pages/inviteJoin/inviteJoin",
"style": { "style": {
"navigationBarTitleText": "邀请加盟", "navigationBarTitleText": "邀请加盟",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"meta": { "moduleCode": "invite", "moduleName": "邀请加盟" }
}, },
"lazyLoad": true "lazyLoad": true
}, },
...@@ -130,7 +141,8 @@ ...@@ -130,7 +141,8 @@
"path": "pages/orderConfirm/orderConfirm", "path": "pages/orderConfirm/orderConfirm",
"style": { "style": {
"navigationBarTitleText": "订单确认", "navigationBarTitleText": "订单确认",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"meta": { "moduleCode": "order", "moduleName": "订单确认" }
}, },
"lazyLoad": true "lazyLoad": true
}, },
...@@ -138,7 +150,8 @@ ...@@ -138,7 +150,8 @@
"path": "pages/learnCertify/learnCertify", "path": "pages/learnCertify/learnCertify",
"style": { "style": {
"navigationBarTitleText": "学习认证", "navigationBarTitleText": "学习认证",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"meta": { "moduleCode": "certify", "moduleName": "学习认证" }
}, },
"lazyLoad": true "lazyLoad": true
}, },
...@@ -146,7 +159,8 @@ ...@@ -146,7 +159,8 @@
"path": "pages/authentication-query/authentication-query", "path": "pages/authentication-query/authentication-query",
"style": { "style": {
"navigationBarTitleText": "认证查询", "navigationBarTitleText": "认证查询",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"meta": { "moduleCode": "certify", "moduleName": "认证查询" }
}, },
"lazyLoad": true "lazyLoad": true
}, },
...@@ -154,7 +168,8 @@ ...@@ -154,7 +168,8 @@
"path": "pages/authentication-query/authentication-result", "path": "pages/authentication-query/authentication-result",
"style": { "style": {
"navigationBarTitleText": "查询结果", "navigationBarTitleText": "查询结果",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"meta": { "moduleCode": "certify", "moduleName": "查询结果" }
}, },
"lazyLoad": true "lazyLoad": true
}, },
...@@ -162,22 +177,17 @@ ...@@ -162,22 +177,17 @@
"path": "pages/certifyDetail/certifyDetail", "path": "pages/certifyDetail/certifyDetail",
"style": { "style": {
"navigationBarTitleText": "认证详情", "navigationBarTitleText": "认证详情",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"meta": { "moduleCode": "certify", "moduleName": "认证详情" }
}, },
"lazyLoad": true "lazyLoad": true
}, },
// {
// "path": "pages/myLearning/myLearning",
// "style": {
// "navigationBarTitleText": "我的学习",
// "enablePullDownRefresh": false
// }
// },
{ {
"path": "pages/personalCenter/myTeam", "path": "pages/personalCenter/myTeam",
"style": { "style": {
"navigationBarTitleText": "我的团队", "navigationBarTitleText": "我的团队",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"meta": { "moduleCode": "team", "moduleName": "我的团队" }
}, },
"lazyLoad": true "lazyLoad": true
}, },
...@@ -185,7 +195,8 @@ ...@@ -185,7 +195,8 @@
"path": "pages/personalCenter/myTeamIncubate", "path": "pages/personalCenter/myTeamIncubate",
"style": { "style": {
"navigationBarTitleText": "育成团队", "navigationBarTitleText": "育成团队",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"meta": { "moduleCode": "team", "moduleName": "育成团队" }
}, },
"lazyLoad": true "lazyLoad": true
}, },
...@@ -193,7 +204,8 @@ ...@@ -193,7 +204,8 @@
"path": "pages/personalCenter/helpCenter", "path": "pages/personalCenter/helpCenter",
"style": { "style": {
"navigationBarTitleText": "帮助中心", "navigationBarTitleText": "帮助中心",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"meta": { "moduleCode": "help", "moduleName": "帮助中心" }
}, },
"lazyLoad": true "lazyLoad": true
}, },
...@@ -201,7 +213,8 @@ ...@@ -201,7 +213,8 @@
"path": "pages/myShare/myShare", "path": "pages/myShare/myShare",
"style": { "style": {
"navigationBarTitleText": "分享数据", "navigationBarTitleText": "分享数据",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"meta": { "moduleCode": "share", "moduleName": "分享数据" }
}, },
"lazyLoad": true "lazyLoad": true
}, },
...@@ -209,7 +222,8 @@ ...@@ -209,7 +222,8 @@
"path": "pages/myPoints/myPoints", "path": "pages/myPoints/myPoints",
"style": { "style": {
"navigationBarTitleText": "我的积分", "navigationBarTitleText": "我的积分",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"meta": { "moduleCode": "points", "moduleName": "我的积分" }
}, },
"lazyLoad": true "lazyLoad": true
}, },
...@@ -217,7 +231,8 @@ ...@@ -217,7 +231,8 @@
"path": "pages/commonDetail/commonDetail", "path": "pages/commonDetail/commonDetail",
"style": { "style": {
"navigationBarTitleText": "明细", "navigationBarTitleText": "明细",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"meta": { "moduleCode": "points", "moduleName": "明细" }
}, },
"lazyLoad": true "lazyLoad": true
}, },
...@@ -225,7 +240,8 @@ ...@@ -225,7 +240,8 @@
"path": "pages/orderDetail/orderDetail", "path": "pages/orderDetail/orderDetail",
"style": { "style": {
"navigationBarTitleText": "订单详情", "navigationBarTitleText": "订单详情",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"meta": { "moduleCode": "order", "moduleName": "订单详情" }
}, },
"lazyLoad": true "lazyLoad": true
}, },
...@@ -233,7 +249,8 @@ ...@@ -233,7 +249,8 @@
"path": "pages/afterSales/afterSales", "path": "pages/afterSales/afterSales",
"style": { "style": {
"navigationBarTitleText": "我的售后", "navigationBarTitleText": "我的售后",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"meta": { "moduleCode": "after_sales", "moduleName": "我的售后" }
}, },
"lazyLoad": true "lazyLoad": true
}, },
...@@ -241,7 +258,8 @@ ...@@ -241,7 +258,8 @@
"path": "pages/afterSaleDetail/afterSaleDetail", "path": "pages/afterSaleDetail/afterSaleDetail",
"style": { "style": {
"navigationBarTitleText": "我的售后", "navigationBarTitleText": "我的售后",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"meta": { "moduleCode": "after_sales", "moduleName": "售后详情" }
}, },
"lazyLoad": true "lazyLoad": true
}, },
...@@ -249,7 +267,8 @@ ...@@ -249,7 +267,8 @@
"path": "pages/saleCourseLists/saleCourseLists", "path": "pages/saleCourseLists/saleCourseLists",
"style": { "style": {
"navigationBarTitleText": "成交订单", "navigationBarTitleText": "成交订单",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"meta": { "moduleCode": "order", "moduleName": "成交订单" }
}, },
"lazyLoad": true "lazyLoad": true
}, },
...@@ -257,7 +276,8 @@ ...@@ -257,7 +276,8 @@
"path": "pages/myPoints/pointsDetail", "path": "pages/myPoints/pointsDetail",
"style": { "style": {
"navigationBarTitleText": "积分明细", "navigationBarTitleText": "积分明细",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"meta": { "moduleCode": "points", "moduleName": "积分明细" }
}, },
"lazyLoad": true "lazyLoad": true
}, },
...@@ -265,7 +285,8 @@ ...@@ -265,7 +285,8 @@
"path": "pages/pointsExchange/pointsStatus", "path": "pages/pointsExchange/pointsStatus",
"style": { "style": {
"navigationBarTitleText": "佣金", "navigationBarTitleText": "佣金",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"meta": { "moduleCode": "commission", "moduleName": "佣金状态" }
}, },
"lazyLoad": true "lazyLoad": true
}, },
...@@ -273,7 +294,8 @@ ...@@ -273,7 +294,8 @@
"path": "pages/pointsExchange/pointsExchange", "path": "pages/pointsExchange/pointsExchange",
"style": { "style": {
"navigationBarTitleText": "佣金", "navigationBarTitleText": "佣金",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"meta": { "moduleCode": "commission", "moduleName": "佣金" }
}, },
"lazyLoad": true "lazyLoad": true
}, },
...@@ -281,7 +303,8 @@ ...@@ -281,7 +303,8 @@
"path": "pages/withdrawal/withdrawal", "path": "pages/withdrawal/withdrawal",
"style": { "style": {
"navigationBarTitleText": "兑换提现", "navigationBarTitleText": "兑换提现",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"meta": { "moduleCode": "withdrawal", "moduleName": "兑换提现" }
}, },
"lazyLoad": true "lazyLoad": true
}, },
...@@ -289,7 +312,8 @@ ...@@ -289,7 +312,8 @@
"path": "pages/exchangeRecord/exchangeRecord", "path": "pages/exchangeRecord/exchangeRecord",
"style": { "style": {
"navigationBarTitleText": "兑换记录", "navigationBarTitleText": "兑换记录",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"meta": { "moduleCode": "withdrawal", "moduleName": "兑换记录" }
}, },
"lazyLoad": true "lazyLoad": true
}, },
...@@ -297,7 +321,8 @@ ...@@ -297,7 +321,8 @@
"path": "pages/withdrawal/withdrawalDetail", "path": "pages/withdrawal/withdrawalDetail",
"style": { "style": {
"navigationBarTitleText": "提现详情", "navigationBarTitleText": "提现详情",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"meta": { "moduleCode": "withdrawal", "moduleName": "提现详情" }
}, },
"lazyLoad": true "lazyLoad": true
}, },
...@@ -305,7 +330,8 @@ ...@@ -305,7 +330,8 @@
"path": "pages/taxRules/taxRules", "path": "pages/taxRules/taxRules",
"style": { "style": {
"navigationBarTitleText": "纳税规则", "navigationBarTitleText": "纳税规则",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"meta": { "moduleCode": "tax", "moduleName": "纳税规则" }
}, },
"lazyLoad": true "lazyLoad": true
}, },
...@@ -313,7 +339,8 @@ ...@@ -313,7 +339,8 @@
"path": "pages/applyDropClass/applyDropClass", "path": "pages/applyDropClass/applyDropClass",
"style": { "style": {
"navigationBarTitleText": "申请退款", "navigationBarTitleText": "申请退款",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"meta": { "moduleCode": "refund", "moduleName": "申请退款" }
}, },
"lazyLoad": true "lazyLoad": true
}, },
...@@ -321,7 +348,8 @@ ...@@ -321,7 +348,8 @@
"path": "pages/application-process/id-card", "path": "pages/application-process/id-card",
"style": { "style": {
"navigationBarTitleText": "申请加盟-个人证件", "navigationBarTitleText": "申请加盟-个人证件",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"meta": { "moduleCode": "apply", "moduleName": "申请加盟-个人证件" }
}, },
"lazyLoad": true "lazyLoad": true
}, },
...@@ -329,7 +357,8 @@ ...@@ -329,7 +357,8 @@
"path": "pages/application-process/education", "path": "pages/application-process/education",
"style": { "style": {
"navigationBarTitleText": "申请加盟-学历信息", "navigationBarTitleText": "申请加盟-学历信息",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"meta": { "moduleCode": "apply", "moduleName": "申请加盟-学历信息" }
}, },
"lazyLoad": true "lazyLoad": true
}, },
...@@ -337,7 +366,8 @@ ...@@ -337,7 +366,8 @@
"path": "pages/application-process/bank-card", "path": "pages/application-process/bank-card",
"style": { "style": {
"navigationBarTitleText": "申请加盟-银行卡号", "navigationBarTitleText": "申请加盟-银行卡号",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"meta": { "moduleCode": "apply", "moduleName": "申请加盟-银行卡号" }
}, },
"lazyLoad": true "lazyLoad": true
}, },
...@@ -345,7 +375,8 @@ ...@@ -345,7 +375,8 @@
"path": "pages/application-process/personal-statement", "path": "pages/application-process/personal-statement",
"style": { "style": {
"navigationBarTitleText": "申请加盟-个人声明", "navigationBarTitleText": "申请加盟-个人声明",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"meta": { "moduleCode": "apply", "moduleName": "申请加盟-个人声明" }
}, },
"lazyLoad": true "lazyLoad": true
}, },
...@@ -353,7 +384,8 @@ ...@@ -353,7 +384,8 @@
"path": "pages/application-process/contract", "path": "pages/application-process/contract",
"style": { "style": {
"navigationBarTitleText": "申请加盟-合同文档", "navigationBarTitleText": "申请加盟-合同文档",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"meta": { "moduleCode": "apply", "moduleName": "申请加盟-合同文档" }
}, },
"lazyLoad": true "lazyLoad": true
}, },
...@@ -362,9 +394,8 @@ ...@@ -362,9 +394,8 @@
"style": { "style": {
"navigationBarTitleText": "申请加盟-电子签名", "navigationBarTitleText": "申请加盟-电子签名",
"enablePullDownRefresh": false, "enablePullDownRefresh": false,
"app-plus": { "app-plus": { "bounce": "none" },
"bounce": "none" "meta": { "moduleCode": "apply", "moduleName": "申请加盟-电子签名" }
}
}, },
"lazyLoad": true "lazyLoad": true
}, },
...@@ -372,7 +403,8 @@ ...@@ -372,7 +403,8 @@
"path": "pages/personalCenter/teamMembers/teamMembers", "path": "pages/personalCenter/teamMembers/teamMembers",
"style": { "style": {
"navigationBarTitleText": "团队成员", "navigationBarTitleText": "团队成员",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"meta": { "moduleCode": "team", "moduleName": "团队成员" }
}, },
"lazyLoad": true "lazyLoad": true
}, },
...@@ -380,7 +412,8 @@ ...@@ -380,7 +412,8 @@
"path": "pages/personalCenter/teamPerformance/teamPerformance", "path": "pages/personalCenter/teamPerformance/teamPerformance",
"style": { "style": {
"navigationBarTitleText": "团队业绩", "navigationBarTitleText": "团队业绩",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"meta": { "moduleCode": "team", "moduleName": "团队业绩" }
}, },
"lazyLoad": true "lazyLoad": true
}, },
...@@ -388,7 +421,8 @@ ...@@ -388,7 +421,8 @@
"path": "pages/personalCenter/user-information", "path": "pages/personalCenter/user-information",
"style": { "style": {
"navigationBarTitleText": "个人资料", "navigationBarTitleText": "个人资料",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"meta": { "moduleCode": "user", "moduleName": "个人资料" }
}, },
"lazyLoad": true "lazyLoad": true
}, },
...@@ -396,7 +430,8 @@ ...@@ -396,7 +430,8 @@
"path": "pages/personalCenter/system/settings", "path": "pages/personalCenter/system/settings",
"style": { "style": {
"navigationBarTitleText": "设置", "navigationBarTitleText": "设置",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"meta": { "moduleCode": "settings", "moduleName": "设置" }
}, },
"lazyLoad": true "lazyLoad": true
}, },
...@@ -404,7 +439,8 @@ ...@@ -404,7 +439,8 @@
"path": "pages/orderStatus/orderStatus", "path": "pages/orderStatus/orderStatus",
"style": { "style": {
"navigationBarTitleText": "订单支付", "navigationBarTitleText": "订单支付",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"meta": { "moduleCode": "order", "moduleName": "订单支付" }
}, },
"lazyLoad": true "lazyLoad": true
}, },
...@@ -412,22 +448,17 @@ ...@@ -412,22 +448,17 @@
"path": "pages/dropLists/dropLists", "path": "pages/dropLists/dropLists",
"style": { "style": {
"navigationBarTitleText": "已退课", "navigationBarTitleText": "已退课",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"meta": { "moduleCode": "refund", "moduleName": "已退课" }
}, },
"lazyLoad": true "lazyLoad": true
}, },
// {
// "path": "pages/learningStatistics/learningStatistics",
// "style": {
// "navigationBarTitleText": "学习统计",
// "enablePullDownRefresh": false
// }
// },
{ {
"path": "pages/personalCenter/system/accontsetting", "path": "pages/personalCenter/system/accontsetting",
"style": { "style": {
"navigationBarTitleText": "账号绑定设置", "navigationBarTitleText": "账号绑定设置",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"meta": { "moduleCode": "settings", "moduleName": "账号绑定设置" }
}, },
"lazyLoad": true "lazyLoad": true
}, },
...@@ -435,7 +466,8 @@ ...@@ -435,7 +466,8 @@
"path": "pages/personalCenter/accountoperation/phonebinding", "path": "pages/personalCenter/accountoperation/phonebinding",
"style": { "style": {
"navigationBarTitleText": "手机号绑定", "navigationBarTitleText": "手机号绑定",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"meta": { "moduleCode": "settings", "moduleName": "手机号绑定" }
}, },
"lazyLoad": true "lazyLoad": true
}, },
...@@ -443,7 +475,8 @@ ...@@ -443,7 +475,8 @@
"path": "pages/personalCenter/accountoperation/resetpassword", "path": "pages/personalCenter/accountoperation/resetpassword",
"style": { "style": {
"navigationBarTitleText": "重置密码", "navigationBarTitleText": "重置密码",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"meta": { "moduleCode": "settings", "moduleName": "重置密码" }
}, },
"lazyLoad": true "lazyLoad": true
}, },
...@@ -451,7 +484,8 @@ ...@@ -451,7 +484,8 @@
"path": "pages/personalCenter/accountoperation/confirmResetpassword", "path": "pages/personalCenter/accountoperation/confirmResetpassword",
"style": { "style": {
"navigationBarTitleText": "重置密码", "navigationBarTitleText": "重置密码",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"meta": { "moduleCode": "settings", "moduleName": "确认重置密码" }
}, },
"lazyLoad": true "lazyLoad": true
}, },
...@@ -459,7 +493,8 @@ ...@@ -459,7 +493,8 @@
"path": "pages/personalCenter/accountoperation/aboutcffp", "path": "pages/personalCenter/accountoperation/aboutcffp",
"style": { "style": {
"navigationBarTitleText": "关于我", "navigationBarTitleText": "关于我",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"meta": { "moduleCode": "about", "moduleName": "关于我" }
}, },
"lazyLoad": true "lazyLoad": true
}, },
...@@ -467,7 +502,8 @@ ...@@ -467,7 +502,8 @@
"path": "pages/certifyDetail/uploadinformation", "path": "pages/certifyDetail/uploadinformation",
"style": { "style": {
"navigationBarTitleText": "上传信息", "navigationBarTitleText": "上传信息",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"meta": { "moduleCode": "certify", "moduleName": "上传信息" }
}, },
"lazyLoad": true "lazyLoad": true
}, },
...@@ -475,7 +511,8 @@ ...@@ -475,7 +511,8 @@
"path": "pages/receiptCycleDesc/receiptCycleDesc", "path": "pages/receiptCycleDesc/receiptCycleDesc",
"style": { "style": {
"navigationBarTitleText": "到账周期说明", "navigationBarTitleText": "到账周期说明",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"meta": { "moduleCode": "withdrawal", "moduleName": "到账周期说明" }
}, },
"lazyLoad": true "lazyLoad": true
}, },
...@@ -483,7 +520,8 @@ ...@@ -483,7 +520,8 @@
"path": "pages/invitationRegister/invitationRegister", "path": "pages/invitationRegister/invitationRegister",
"style": { "style": {
"navigationBarTitleText": "邀请注册", "navigationBarTitleText": "邀请注册",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"meta": { "moduleCode": "invite", "moduleName": "邀请注册" }
}, },
"lazyLoad": true "lazyLoad": true
}, },
...@@ -491,7 +529,8 @@ ...@@ -491,7 +529,8 @@
"path": "pages/invitationRegister/invitationlogin", "path": "pages/invitationRegister/invitationlogin",
"style": { "style": {
"navigationBarTitleText": "邀请登录", "navigationBarTitleText": "邀请登录",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"meta": { "moduleCode": "invite", "moduleName": "邀请登录" }
}, },
"lazyLoad": true "lazyLoad": true
}, },
...@@ -499,7 +538,8 @@ ...@@ -499,7 +538,8 @@
"path": "pages/application-process/application-result", "path": "pages/application-process/application-result",
"style": { "style": {
"navigationBarTitleText": "申请加盟-结果", "navigationBarTitleText": "申请加盟-结果",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"meta": { "moduleCode": "apply", "moduleName": "申请加盟-结果" }
}, },
"lazyLoad": true "lazyLoad": true
}, },
...@@ -507,7 +547,8 @@ ...@@ -507,7 +547,8 @@
"path": "pages/downloadApp/index", "path": "pages/downloadApp/index",
"style": { "style": {
"navigationBarTitleText": "下载", "navigationBarTitleText": "下载",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"meta": { "moduleCode": "download", "moduleName": "下载" }
}, },
"lazyLoad": true "lazyLoad": true
}, },
...@@ -515,33 +556,40 @@ ...@@ -515,33 +556,40 @@
"path": "pages/product/finance-calculator", "path": "pages/product/finance-calculator",
"style": { "style": {
"navigationBarTitleText": "pages/product/finance-calculator", "navigationBarTitleText": "pages/product/finance-calculator",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"meta": { "moduleCode": "tools", "moduleName": "理财计算器" }
}, },
"lazyLoad": true "lazyLoad": true
}, },
{ {
"path": "components/webview", "path": "components/webview",
"style": {}, "style": {
"meta": { "moduleCode": "webview", "moduleName": "WebView" }
},
"lazyLoad": true "lazyLoad": true
}, },
{ {
"path": "pages/personalCenter/system/cancellation", "path": "pages/personalCenter/system/cancellation",
"style": { "style": {
"navigationBarTitleText": "", "navigationBarTitleText": "",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"meta": { "moduleCode": "settings", "moduleName": "注销" }
}, },
"lazyLoad": true "lazyLoad": true
}, },
{ {
"path": "components/clause/clauseIOS", "path": "components/clause/clauseIOS",
"style": {}, "style": {
"meta": { "moduleCode": "clause", "moduleName": "协议" }
},
"lazyLoad": true "lazyLoad": true
}, },
{ {
"path": "sfp/index/index", "path": "sfp/index/index",
"style": { "style": {
"navigationBarTitleText": "", "navigationBarTitleText": "",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"meta": { "moduleCode": "sfp", "moduleName": "SFP首页" }
}, },
"lazyLoad": true "lazyLoad": true
}, },
...@@ -549,7 +597,8 @@ ...@@ -549,7 +597,8 @@
"path": "sfp/housePurchase/housePurchase", "path": "sfp/housePurchase/housePurchase",
"style": { "style": {
"navigationBarTitleText": "", "navigationBarTitleText": "",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"meta": { "moduleCode": "sfp", "moduleName": "购房计算器" }
}, },
"lazyLoad": true "lazyLoad": true
}, },
...@@ -557,7 +606,8 @@ ...@@ -557,7 +606,8 @@
"path": "sfp/childEdu/childEdu", "path": "sfp/childEdu/childEdu",
"style": { "style": {
"navigationBarTitleText": "", "navigationBarTitleText": "",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"meta": { "moduleCode": "sfp", "moduleName": "子女教育计算器" }
}, },
"lazyLoad": true "lazyLoad": true
}, },
...@@ -565,7 +615,8 @@ ...@@ -565,7 +615,8 @@
"path": "sfp/dataImport/data-import", "path": "sfp/dataImport/data-import",
"style": { "style": {
"topWindow": false, "topWindow": false,
"navigationBarTitleText": "批量数据计算" "navigationBarTitleText": "批量数据计算",
"meta": { "moduleCode": "sfp", "moduleName": "批量数据计算" }
}, },
"lazyLoad": true "lazyLoad": true
}, },
...@@ -581,7 +632,8 @@ ...@@ -581,7 +632,8 @@
"disableWebSecurity": true, "disableWebSecurity": true,
"allowNavigateToExternalPages": true, "allowNavigateToExternalPages": true,
"webviewDebug": true "webviewDebug": true
} },
"meta": { "moduleCode": "user", "moduleName": "个人详情" }
}, },
"lazyLoad": true "lazyLoad": true
}, },
...@@ -589,7 +641,8 @@ ...@@ -589,7 +641,8 @@
"path": "pages/lanch/index", "path": "pages/lanch/index",
"style": { "style": {
"topWindow": false, "topWindow": false,
"navigationBarTitleText": "启动页" "navigationBarTitleText": "启动页",
"meta": { "moduleCode": "launch", "moduleName": "启动页" }
}, },
"lazyLoad": true "lazyLoad": true
} }
...@@ -601,158 +654,179 @@ ...@@ -601,158 +654,179 @@
{ {
"path": "lawManual/lawManual", "path": "lawManual/lawManual",
"style": { "style": {
"navigationBarTitleText": "CFFP法条摘要" "navigationBarTitleText": "CFFP法条摘要",
"meta": { "moduleCode": "law", "moduleName": "法条摘要" }
}, },
"lazyLoad": true "lazyLoad": true
}, },
{ {
"path": "videoProject/login", "path": "videoProject/login",
"style": { "style": {
"navigationBarTitleText": "登录" "navigationBarTitleText": "登录",
"meta": { "moduleCode": "video", "moduleName": "视频登录" }
}, },
"lazyLoad": true "lazyLoad": true
}, },
{ {
"path": "videoProject/videoDetail", "path": "videoProject/videoDetail",
"style": { "style": {
"navigationBarTitleText": "视频播放" "navigationBarTitleText": "视频播放",
"meta": { "moduleCode": "video", "moduleName": "视频播放" }
}, },
"lazyLoad": true "lazyLoad": true
}, },
{ {
"path": "videoProject/wxLogin", "path": "videoProject/wxLogin",
"style": { "style": {
"navigationBarTitleText": "微信登录" "navigationBarTitleText": "微信登录",
"meta": { "moduleCode": "login", "moduleName": "微信登录" }
}, },
"lazyLoad": true "lazyLoad": true
}, },
{ {
"path": "applyFranchise/applyFranchise", "path": "applyFranchise/applyFranchise",
"style": { "style": {
"navigationBarTitleText": "申请加盟" "navigationBarTitleText": "申请加盟",
"meta": { "moduleCode": "apply", "moduleName": "申请加盟" }
}, },
"lazyLoad": true "lazyLoad": true
}, },
{ {
"path": "integralExchange/exchange", "path": "integralExchange/exchange",
"style": { "style": {
"navigationBarTitleText": "积分提现" "navigationBarTitleText": "积分提现",
"meta": { "moduleCode": "points", "moduleName": "积分提现" }
}, },
"lazyLoad": true "lazyLoad": true
}, },
{ {
"path": "ruleAndContract/taxRules", "path": "ruleAndContract/taxRules",
"style": { "style": {
"navigationBarTitleText": "纳税规则" "navigationBarTitleText": "纳税规则",
"meta": { "moduleCode": "tax", "moduleName": "纳税规则" }
}, },
"lazyLoad": true "lazyLoad": true
}, },
{ {
"path": "integralExchange/authenticaInfo", "path": "integralExchange/authenticaInfo",
"style": { "style": {
"navigationBarTitleText": "实名认证" "navigationBarTitleText": "实名认证",
"meta": { "moduleCode": "certify", "moduleName": "实名认证" }
}, },
"lazyLoad": true "lazyLoad": true
}, },
{ {
"path": "setting/logOff", "path": "setting/logOff",
"style": { "style": {
"navigationBarTitleText": "合伙人解约" "navigationBarTitleText": "合伙人解约",
"meta": { "moduleCode": "settings", "moduleName": "合伙人解约" }
}, },
"lazyLoad": true "lazyLoad": true
}, },
{ {
"path": "ruleAndContract/cancelProtocol", "path": "ruleAndContract/cancelProtocol",
"style": { "style": {
"navigationBarTitleText": "合伙人解约协议" "navigationBarTitleText": "合伙人解约协议",
"meta": { "moduleCode": "contract", "moduleName": "解约协议" }
}, },
"lazyLoad": true "lazyLoad": true
}, },
{ {
"path": "login/login", "path": "login/login",
"style": { "style": {
"navigationBarTitleText": "银盾家办" "navigationBarTitleText": "银盾家办",
"meta": { "moduleCode": "login", "moduleName": "登录" }
}, },
"lazyLoad": true "lazyLoad": true
}, },
{ {
"path": "ruleAndContract/clause", "path": "ruleAndContract/clause",
"style": { "style": {
"navigationBarTitleText": "协议" "navigationBarTitleText": "协议",
"meta": { "moduleCode": "contract", "moduleName": "协议" }
}, },
"lazyLoad": true "lazyLoad": true
}, },
{ {
"path": "poster/poster", "path": "poster/poster",
"style": { "style": {
"navigationBarTitleText": "分销海报" "navigationBarTitleText": "分销海报",
"meta": { "moduleCode": "share", "moduleName": "分销海报" }
}, },
"lazyLoad": true "lazyLoad": true
}, },
{ {
"path": "myTeam/myTeam", "path": "myTeam/myTeam",
"style": { "style": {
"navigationBarTitleText": "我的团队" "navigationBarTitleText": "我的团队",
"meta": { "moduleCode": "team", "moduleName": "我的团队" }
}, },
"lazyLoad": true "lazyLoad": true
}, },
{ {
"path": "commission/withdrawalRecord", "path": "commission/withdrawalRecord",
"style": { "style": {
"navigationBarTitleText": "提现记录" "navigationBarTitleText": "提现记录",
"meta": { "moduleCode": "withdrawal", "moduleName": "提现记录" }
}, },
"lazyLoad": true "lazyLoad": true
}, },
{ {
"path": "compare-result/compare-result", "path": "compare-result/compare-result",
"style": { "style": {
"navigationBarTitleText": "对比结果" "navigationBarTitleText": "对比结果",
"meta": { "moduleCode": "compare", "moduleName": "对比结果" }
}, },
"lazyLoad": true "lazyLoad": true
}, },
{ {
"path": "product-list/product-list", "path": "product-list/product-list",
"style": { "style": {
"navigationBarTitleText": "产品对比" "navigationBarTitleText": "产品对比",
"meta": { "moduleCode": "product", "moduleName": "产品对比" }
}, },
"lazyLoad": true "lazyLoad": true
}, },
{ {
"path": "product-list/product-commission", "path": "product-list/product-commission",
"style": { "style": {
"navigationBarTitleText": "产品佣率查询" "navigationBarTitleText": "产品佣率查询",
"meta": { "moduleCode": "commission", "moduleName": "产品佣率查询" }
}, },
"lazyLoad": true "lazyLoad": true
}, },
{ {
"path": "product-list/commission-detail", "path": "product-list/commission-detail",
"style": { "style": {
"navigationBarTitleText": "佣金详情" "navigationBarTitleText": "佣金详情",
"meta": { "moduleCode": "commission", "moduleName": "佣金详情" }
}, },
"lazyLoad": true "lazyLoad": true
}, },
{ {
"path": "businessCard/businessCard", "path": "businessCard/businessCard",
"style": { "style": {
"navigationBarTitleText": "我的名片" "navigationBarTitleText": "我的名片",
"meta": { "moduleCode": "card", "moduleName": "我的名片" }
}, },
"lazyLoad": true "lazyLoad": true
}, },
{ {
"path": "noBusinessCard/noBusinessCard", "path": "noBusinessCard/noBusinessCard",
"style": { "style": {
"navigationBarTitleText": "我的名片" "navigationBarTitleText": "我的名片",
"meta": { "moduleCode": "card", "moduleName": "我的名片" }
}, },
"lazyLoad": true "lazyLoad": true
}, },
{ {
"path": "salary/salaryList", "path": "salary/salaryList",
"style": { "style": {
"navigationBarTitleText": "积分明细" "navigationBarTitleText": "积分明细",
"meta": { "moduleCode": "points", "moduleName": "积分明细" }
}, },
"lazyLoad": true "lazyLoad": true
} }
] ]
}, },
{ {
...@@ -762,7 +836,8 @@ ...@@ -762,7 +836,8 @@
"path": "memberQuery", "path": "memberQuery",
"style": { "style": {
"navigationBarTitleText": "", "navigationBarTitleText": "",
"enablePullDownRefresh": false "enablePullDownRefresh": false,
"meta": { "moduleCode": "member", "moduleName": "会员查询" }
}, },
"lazyLoad": true "lazyLoad": true
} }
......
...@@ -834,7 +834,6 @@ ...@@ -834,7 +834,6 @@
} }
if(this.courseInfo.fileIntroduce){ if(this.courseInfo.fileIntroduce){
this.imagesList = this.extractImageUrls(this.courseInfo.fileIntroduce) this.imagesList = this.extractImageUrls(this.courseInfo.fileIntroduce)
console.log(' this.imagesList', this.imagesList);
} }
//this.courseInfo.serviceContent = res['data']['data']['filePathOss']; //this.courseInfo.serviceContent = res['data']['data']['filePathOss'];
this.lecturerId = res['data']['data']['fileLecturerId']; this.lecturerId = res['data']['data']['fileLecturerId'];
...@@ -1099,7 +1098,6 @@ ...@@ -1099,7 +1098,6 @@
// imgUrl: this.courseInfo.displayImage, //图片 // imgUrl: this.courseInfo.displayImage, //图片
imgUrl: this.courseInfo.shareImg, //图片 imgUrl: this.courseInfo.shareImg, //图片
} }
console.log('data', data);
//安卓机型获取当前页面路径 //安卓机型获取当前页面路径
let url = window.location.href.split('#')[0]; let url = window.location.href.split('#')[0];
...@@ -1220,7 +1218,7 @@ ...@@ -1220,7 +1218,7 @@
return return
} }
if(res.data.userIsActive&&res.data.userIsActive!=2){ if(res.data.userIsActive&&res.data.userIsActive!=2){
this.$refs.restrictedTip.close() this.$refs.restrictedTip?.close()
uni.removeStorageSync('userIsActive') uni.removeStorageSync('userIsActive')
} }
uni.setStorageSync('cffp_userInfo', JSON.stringify(cffp_userInfo)) uni.setStorageSync('cffp_userInfo', JSON.stringify(cffp_userInfo))
......
...@@ -542,7 +542,6 @@ ...@@ -542,7 +542,6 @@
}); });
}, },
courseList() { courseList() {
console.log('执行了');
const param = { const param = {
queryName: this.queryName, queryName: this.queryName,
courseClassify: this.courseClassify courseClassify: this.courseClassify
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
<view class="featureContent"> <view class="featureContent">
<!-- 顶部快捷菜单 --> <!-- 顶部快捷菜单 -->
<view class="nav_wrapper"> <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)"> @click="featureSelect(featureItem)">
<view class="imgbox"> <view class="imgbox">
<view class="iconfont iconSize" :class="`${featureItem.icon}`"></view> <view class="iconfont iconSize" :class="`${featureItem.icon}`"></view>
...@@ -222,7 +222,8 @@ ...@@ -222,7 +222,8 @@
icon: 'icon-hezuo', icon: 'icon-hezuo',
link: '/myPackageA/applyFranchise/applyFranchise', link: '/myPackageA/applyFranchise/applyFranchise',
isOpen: true, isOpen: true,
isApply:true isApply:true,
trackCode:"apply_join"
}, },
{ {
key: '07', key: '07',
...@@ -230,6 +231,7 @@ ...@@ -230,6 +231,7 @@
icon: 'icon-zhuanfa', icon: 'icon-zhuanfa',
link: '/pages/courselist/courselist', link: '/pages/courselist/courselist',
isOpen: true, isOpen: true,
trackCode:"share_product"
}, },
{ {
...@@ -238,7 +240,8 @@ ...@@ -238,7 +240,8 @@
icon: 'icon-yaoqing', icon: 'icon-yaoqing',
link: '/pages/inviteJoin/inviteJoin', link: '/pages/inviteJoin/inviteJoin',
isOpen: true, isOpen: true,
isJoin: true isJoin: true,
trackCode:"invite_join"
}, },
], ],
...@@ -314,7 +317,7 @@ ...@@ -314,7 +317,7 @@
}, },
onHide() { onHide() {
this.$nextTick(()=>{ this.$nextTick(()=>{
this.$refs.courselist.$refs.sharePosterPop.closeDropdown() this.$refs.courselist?.$refs?.sharePosterPop?.closeDropdown?.()
}) })
}, },
onLoad(options) { onLoad(options) {
...@@ -393,10 +396,11 @@ ...@@ -393,10 +396,11 @@
uni.setStorageSync('cffp_userInfo', JSON.stringify(cffp_userInfo)); uni.setStorageSync('cffp_userInfo', JSON.stringify(cffp_userInfo));
uni.setStorageSync('user_mobile', res.data.mobile) uni.setStorageSync('user_mobile', res.data.mobile)
if(cffp_userInfo.partnerType){ if(cffp_userInfo.partnerType){
this.featureLists = [{key: '00',name: '成交订单',icon:'icon-dingdan',link: '/pages/saleCourseLists/saleCourseLists',isOpen: true,enName:'order'}, this.featureLists =
{key: '01',name: '佣金',icon: 'icon-yongjin',link: '/pages/pointsExchange/pointsExchange',isOpen: true,isJoin: true}, [{key: '00',name: '成交订单',icon:'icon-dingdan',link: '/pages/saleCourseLists/saleCourseLists',isOpen: true,enName:'order',trackCode:"view_order_list" },
{key: '07',name: '分享产品',icon: 'icon-zhuanfa',link: '/pages/courselist/courselist',isOpen: true}, {key: '01',name: '佣金',icon: 'icon-yongjin',link: '/pages/pointsExchange/pointsExchange',isOpen: true,isJoin: true,trackCode:"view_commission" },
{key: '04',name: '邀请加盟',icon: 'icon-yaoqing',link: '/pages/inviteJoin/inviteJoin',isOpen: true,isJoin: true}]; {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 { }else {
this.featureLists =[ this.featureLists =[
{ {
...@@ -405,7 +409,8 @@ ...@@ -405,7 +409,8 @@
icon: 'icon-hezuo', icon: 'icon-hezuo',
link: '/myPackageA/applyFranchise/applyFranchise', link: '/myPackageA/applyFranchise/applyFranchise',
isOpen: true, isOpen: true,
isApply:true isApply:true,
trackCode:"apply_join"
}, },
{ {
key: '07', key: '07',
...@@ -413,6 +418,7 @@ ...@@ -413,6 +418,7 @@
icon: 'icon-zhuanfa', icon: 'icon-zhuanfa',
link: '/pages/courselist/courselist', link: '/pages/courselist/courselist',
isOpen: true, isOpen: true,
trackCode:"share_product"
}, },
{ {
...@@ -421,7 +427,8 @@ ...@@ -421,7 +427,8 @@
icon: 'icon-yaoqing', icon: 'icon-yaoqing',
link: '/pages/inviteJoin/inviteJoin', link: '/pages/inviteJoin/inviteJoin',
isOpen: true, isOpen: true,
isJoin: true isJoin: true,
trackCode:"invite_join"
}, },
] ]
......
...@@ -279,7 +279,6 @@ ...@@ -279,7 +279,6 @@
isShow: true, isShow: true,
identity: true identity: true
}, },
// {title:'育成团队',icon:'icon-yuchengguanxi',link:'/pages/personalCenter/myTeamIncubate',isOpen:true,isShow:true,identity: true},
], ],
}, { }, {
id: '03', id: '03',
...@@ -371,7 +370,6 @@ ...@@ -371,7 +370,6 @@
minorMenuLists: [ minorMenuLists: [
// {title:'我的邀请码',icon:'shareEcode',link:'',isOpen:true,isShow:true}, // {title:'我的邀请码',icon:'shareEcode',link:'',isOpen:true,isShow:true},
{ title: '我的卡包', icon: 'card', link: '', isOpen: true, isShow: false }, { 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: '申请修改公司周边', icon: 'setting', link: '', isOpen: true, isShow: false },
{ {
title: '我的消息', title: '我的消息',
......
...@@ -344,11 +344,6 @@ ...@@ -344,11 +344,6 @@
}) })
} }
}, },
// toRecord(){
// uni.navigateTo({
// url:'/pages/exchangeRecord/exchangeRecord'
// })
// },
viewDropLists() { viewDropLists() {
uni.navigateTo({ uni.navigateTo({
url: '/pages/dropLists/dropLists' url: '/pages/dropLists/dropLists'
......
...@@ -14,6 +14,7 @@ function isWechatBrowser(): boolean { ...@@ -14,6 +14,7 @@ function isWechatBrowser(): boolean {
function isMiniProgramWebView(): boolean { function isMiniProgramWebView(): boolean {
// 检查微信环境变量 // 检查微信环境变量
// @ts-ignore
if (typeof window.__wxjs_environment !== 'undefined' && window.__wxjs_environment === 'miniprogram') { if (typeof window.__wxjs_environment !== 'undefined' && window.__wxjs_environment === 'miniprogram') {
return true; return true;
} }
......
...@@ -4,6 +4,7 @@ import { initJssdkShare, setWechatShare } from '@/util/fiveshare'; ...@@ -4,6 +4,7 @@ import { initJssdkShare, setWechatShare } from '@/util/fiveshare';
import { shareURL } from "@/environments/environment"; import { shareURL } from "@/environments/environment";
import wx from 'weixin-js-sdk' import wx from 'weixin-js-sdk'
import { nanoid } from 'nanoid'; import { nanoid } from 'nanoid';
//只要是未登录状态,想要跳转到名单内的路径时,直接跳到登录页 //只要是未登录状态,想要跳转到名单内的路径时,直接跳到登录页
// 页面白名单,不受拦截 // 页面白名单,不受拦截
const whiteList = [ const whiteList = [
...@@ -26,6 +27,7 @@ let shareCustomPageList = [ ...@@ -26,6 +27,7 @@ let shareCustomPageList = [
'/pages/courselist/courselist', '/pages/courselist/courselist',
'/myPackageA/businessCard/businessCard', '/myPackageA/businessCard/businessCard',
] ]
export default function initApp() { export default function initApp() {
let date = Date.now() let date = Date.now()
...@@ -69,6 +71,7 @@ export default function initApp() { ...@@ -69,6 +71,7 @@ export default function initApp() {
url: '/myPackageA/login/login' url: '/myPackageA/login/login'
}) })
} }
if (uni.getStorageSync('loginType') == 'codelogin') { if (uni.getStorageSync('loginType') == 'codelogin') {
api.queryInfo({}).then(res => { api.queryInfo({}).then(res => {
if (!res['success']) { if (!res['success']) {
...@@ -97,7 +100,6 @@ export default function initApp() { ...@@ -97,7 +100,6 @@ export default function initApp() {
uni.setStorageSync('cffp_userInfo', JSON.stringify(cffp_userInfo)) uni.setStorageSync('cffp_userInfo', JSON.stringify(cffp_userInfo))
} }
}) })
} }
if (userInfo.userIsActive == 2 && uni.getStorageSync('loginType') == 'codelogin') { if (userInfo.userIsActive == 2 && uni.getStorageSync('loginType') == 'codelogin') {
...@@ -150,7 +152,8 @@ export default function initApp() { ...@@ -150,7 +152,8 @@ export default function initApp() {
} }
return true return true
}, },
success(e) {} success(e) {
}
}) })
uni.addInterceptor('switchTab', { uni.addInterceptor('switchTab', {
// tabbar页面跳转前进行拦截 // tabbar页面跳转前进行拦截
...@@ -194,7 +197,8 @@ export default function initApp() { ...@@ -194,7 +197,8 @@ export default function initApp() {
date = Date.now() date = Date.now()
return true return true
}, },
success(e) {} success(e) {
}
}) })
uni.addInterceptor('reLaunch', { uni.addInterceptor('reLaunch', {
//页面跳转前拦截 //页面跳转前拦截
...@@ -238,7 +242,9 @@ export default function initApp() { ...@@ -238,7 +242,9 @@ export default function initApp() {
return true return true
}, },
//页面跳转后缓存当前页路由 //页面跳转后缓存当前页路由
success(e) {} success(e) {
}
}) })
} }
......
/**
* ============================================================
* 业务事件定义
* 与数据字典保持一致,统一管理事件编码
* 基于:事件表、模块表、功能表
* ============================================================
*/
// ============================================================
// 一、事件编码常量(对应事件表 event_code)
// ============================================================
export const EVENTS = {
// ====== 页面级(自动采集) ======
PAGE_VIEW: 'page_view',
PAGE_LEAVE: 'page_leave',
// ====== 交互级(自动采集) ======
CLICK: 'click',
TAB_SWITCH: 'tab_switch',
INPUT: 'input',
// ====== 业务级 ======
VIEW_DETAIL: 'view_detail',
SUBMIT: 'submit',
APPLY: 'apply',
INVITE: 'invite',
SHARE: 'share',
SEARCH: 'search',
EDIT: 'edit',
CLEAR: 'clear',
LOGOUT: 'logout',
PURCHASE: 'purchase',
LOGIN: 'login',
REGISTER: 'register',
// ====== 风控级 ======
FRAUD_DETECT: 'fraud_detect',
ACCOUNT_LOCK: 'account_lock'
}
// ============================================================
// 二、事件分类映射(operCategory)
// ============================================================
export const EVENT_CATEGORIES = {
[EVENTS.PAGE_VIEW]: '页面级事件',
[EVENTS.PAGE_LEAVE]: '页面级事件',
[EVENTS.CLICK]: '交互级事件',
[EVENTS.TAB_SWITCH]: '交互级事件',
[EVENTS.INPUT]: '交互级事件',
[EVENTS.VIEW_DETAIL]: '业务级事件',
[EVENTS.SUBMIT]: '业务级事件',
[EVENTS.APPLY]: '业务级事件',
[EVENTS.INVITE]: '业务级事件',
[EVENTS.SHARE]: '业务级事件',
[EVENTS.SEARCH]: '业务级事件',
[EVENTS.EDIT]: '业务级事件',
[EVENTS.CLEAR]: '业务级事件',
[EVENTS.LOGOUT]: '业务级事件',
[EVENTS.PURCHASE]: '业务级事件',
[EVENTS.LOGIN]: '业务级事件',
[EVENTS.REGISTER]: '业务级事件',
[EVENTS.FRAUD_DETECT]: '风控级事件',
[EVENTS.ACCOUNT_LOCK]: '风控级事件'
}
// ============================================================
// 三、事件名称映射(eventTypeName)
// ============================================================
export const EVENT_NAMES = {
[EVENTS.PAGE_VIEW]: '页面浏览',
[EVENTS.PAGE_LEAVE]: '页面离开',
[EVENTS.CLICK]: '点击',
[EVENTS.TAB_SWITCH]: 'Tab切换',
[EVENTS.INPUT]: '输入',
[EVENTS.VIEW_DETAIL]: '查看详情',
[EVENTS.SUBMIT]: '提交',
[EVENTS.APPLY]: '申请',
[EVENTS.INVITE]: '邀请',
[EVENTS.SHARE]: '分享',
[EVENTS.SEARCH]: '搜索',
[EVENTS.EDIT]: '编辑',
[EVENTS.CLEAR]: '清除',
[EVENTS.LOGOUT]: '退出登录',
[EVENTS.PURCHASE]: '购买',
[EVENTS.LOGIN]: '登录',
[EVENTS.REGISTER]: '注册',
[EVENTS.FRAUD_DETECT]: '欺诈检测',
[EVENTS.ACCOUNT_LOCK]: '账号锁定'
}
// ============================================================
// 四、模块编码常量(对应模块表 module_code)
// ============================================================
export const MODULES = {
HOME: 'home',
PRODUCT: 'product',
ORDER: 'order',
USER: 'user',
PARTNER: 'partner',
TOOLS: 'tools',
HELP: 'help',
SEARCH: 'search'
}
// ============================================================
// 五、模块名称映射(moduleTypeName)
// ============================================================
export const MODULE_NAMES = {
[MODULES.HOME]: '首页',
[MODULES.PRODUCT]: '商品',
[MODULES.ORDER]: '订单',
[MODULES.USER]: '个人中心',
[MODULES.PARTNER]: '合伙人',
[MODULES.TOOLS]: '工具箱',
[MODULES.HELP]: '帮助',
[MODULES.SEARCH]: '搜索'
}
// ============================================================
// 六、功能编码常量(对应功能表 function_code)
// ============================================================
export const FUNCTIONS = {
// ====== 合伙人模块 ======
APPLY_JOIN: 'apply_join',
INVITE_JOIN: 'invite_join',
VIEW_TEAM: 'view_team',
VIEW_TEAM_PERFORMANCE: 'view_team_performance',
VIEW_COMMISSION: 'view_commission',
VIEW_POINTS: 'view_points',
SHARE_DATA: 'share_data',
AGENT_COMMISSION: 'agent_commission',
AGENT_POINTS: 'agent_points',
EXCHANGE_POINTS: 'exchange_points',
// ====== 商品模块 ======
VIEW_PRODUCT: 'view_product',
SHARE_PRODUCT: 'share_product',
CONSULT_PRODUCT: 'consult_product',
PLAN_PRODUCT: 'plan_product',
PRODUCT_ANALYSIS: 'product_analasy',
// ====== 用户模块 ======
EDIT_PROFILE: 'edit_profile',
EDIT_ACCOUNT: 'edit_account',
REALNAME_VERIFY: 'realname_verify',
CLEAR_CACHE: 'clear_cache',
LOGOUT: 'logout',
RESIGN_PARTNER: 'resign_partner',
// ====== 搜索模块 ======
SEARCH: 'search',
// ====== 帮助模块 ======
HELP_CENTER: 'help_center',
CUSTOMER_SERVICE: 'customer_service',
SHARE_APP: 'share_app',
COMPANY_INTRO: 'company_intro',
VIEW_COMPANY_POLICY: 'view_company_policy',
VIEW_CASE_SHARE: 'view_case_share',
CHANNEL_INTRO: 'channel_intro',
// ====== 工具箱模块 ======
TOOLS_HOUSING: 'tools_housing',
TOOLS_EDUCATION: 'tools_education',
TOOLS_INSURANCE: 'tools_insurance',
// ====== 订单模块 ======
VIEW_ORDER_LIST: 'view_order_list',
SWITCH_ORDER_TAB: 'switch_order_tab',
VIEW_ORDER: 'view_order'
}
// ============================================================
// 七、功能 → 事件类型 映射
// ============================================================
export const FUNCTION_EVENT_MAP = {
[FUNCTIONS.APPLY_JOIN]: EVENTS.APPLY,
[FUNCTIONS.INVITE_JOIN]: EVENTS.INVITE,
[FUNCTIONS.VIEW_TEAM]: EVENTS.CLICK,
[FUNCTIONS.VIEW_TEAM_PERFORMANCE]: EVENTS.CLICK,
[FUNCTIONS.VIEW_COMMISSION]: EVENTS.CLICK,
[FUNCTIONS.VIEW_POINTS]: EVENTS.CLICK,
[FUNCTIONS.SHARE_DATA]: EVENTS.SHARE,
[FUNCTIONS.AGENT_COMMISSION]: EVENTS.CLICK,
[FUNCTIONS.AGENT_POINTS]: EVENTS.CLICK,
[FUNCTIONS.EXCHANGE_POINTS]: EVENTS.SUBMIT,
[FUNCTIONS.VIEW_PRODUCT]: EVENTS.VIEW_DETAIL,
[FUNCTIONS.SHARE_PRODUCT]: EVENTS.SHARE,
[FUNCTIONS.CONSULT_PRODUCT]: EVENTS.CLICK,
[FUNCTIONS.PLAN_PRODUCT]: EVENTS.CLICK,
[FUNCTIONS.PRODUCT_ANALYSIS]: EVENTS.CLICK,
[FUNCTIONS.EDIT_PROFILE]: EVENTS.EDIT,
[FUNCTIONS.EDIT_ACCOUNT]: EVENTS.EDIT,
[FUNCTIONS.REALNAME_VERIFY]: EVENTS.SUBMIT,
[FUNCTIONS.CLEAR_CACHE]: EVENTS.CLEAR,
[FUNCTIONS.LOGOUT]: EVENTS.LOGOUT,
[FUNCTIONS.RESIGN_PARTNER]: EVENTS.SUBMIT,
[FUNCTIONS.SEARCH]: EVENTS.SEARCH,
[FUNCTIONS.HELP_CENTER]: EVENTS.CLICK,
[FUNCTIONS.CUSTOMER_SERVICE]: EVENTS.CLICK,
[FUNCTIONS.SHARE_APP]: EVENTS.SHARE,
[FUNCTIONS.COMPANY_INTRO]: EVENTS.CLICK,
[FUNCTIONS.VIEW_COMPANY_POLICY]: EVENTS.CLICK,
[FUNCTIONS.VIEW_CASE_SHARE]: EVENTS.CLICK,
[FUNCTIONS.CHANNEL_INTRO]: EVENTS.CLICK,
[FUNCTIONS.TOOLS_HOUSING]: EVENTS.SUBMIT,
[FUNCTIONS.TOOLS_EDUCATION]: EVENTS.SUBMIT,
[FUNCTIONS.TOOLS_INSURANCE]: EVENTS.SUBMIT,
[FUNCTIONS.VIEW_ORDER_LIST]: EVENTS.CLICK,
[FUNCTIONS.SWITCH_ORDER_TAB]: EVENTS.TAB_SWITCH,
[FUNCTIONS.VIEW_ORDER]: EVENTS.VIEW_DETAIL
}
// ============================================================
// 八、功能 → 模块 映射
// ============================================================
export const FUNCTION_MODULE_MAP = {
[FUNCTIONS.APPLY_JOIN]: MODULES.PARTNER,
[FUNCTIONS.INVITE_JOIN]: MODULES.PARTNER,
[FUNCTIONS.VIEW_TEAM]: MODULES.PARTNER,
[FUNCTIONS.VIEW_TEAM_PERFORMANCE]: MODULES.PARTNER,
[FUNCTIONS.VIEW_COMMISSION]: MODULES.PARTNER,
[FUNCTIONS.VIEW_POINTS]: MODULES.PARTNER,
[FUNCTIONS.SHARE_DATA]: MODULES.PARTNER,
[FUNCTIONS.AGENT_COMMISSION]: MODULES.PARTNER,
[FUNCTIONS.AGENT_POINTS]: MODULES.PARTNER,
[FUNCTIONS.EXCHANGE_POINTS]: MODULES.PARTNER,
[FUNCTIONS.VIEW_PRODUCT]: MODULES.PRODUCT,
[FUNCTIONS.SHARE_PRODUCT]: MODULES.PRODUCT,
[FUNCTIONS.CONSULT_PRODUCT]: MODULES.PRODUCT,
[FUNCTIONS.PLAN_PRODUCT]: MODULES.PRODUCT,
[FUNCTIONS.PRODUCT_ANALYSIS]: MODULES.PRODUCT,
[FUNCTIONS.EDIT_PROFILE]: MODULES.USER,
[FUNCTIONS.EDIT_ACCOUNT]: MODULES.USER,
[FUNCTIONS.REALNAME_VERIFY]: MODULES.USER,
[FUNCTIONS.CLEAR_CACHE]: MODULES.USER,
[FUNCTIONS.LOGOUT]: MODULES.USER,
[FUNCTIONS.RESIGN_PARTNER]: MODULES.USER,
[FUNCTIONS.SEARCH]: MODULES.SEARCH,
[FUNCTIONS.HELP_CENTER]: MODULES.HELP,
[FUNCTIONS.CUSTOMER_SERVICE]: MODULES.HELP,
[FUNCTIONS.SHARE_APP]: MODULES.HELP,
[FUNCTIONS.COMPANY_INTRO]: MODULES.HELP,
[FUNCTIONS.VIEW_COMPANY_POLICY]: MODULES.HELP,
[FUNCTIONS.VIEW_CASE_SHARE]: MODULES.HELP,
[FUNCTIONS.CHANNEL_INTRO]: MODULES.HELP,
[FUNCTIONS.TOOLS_HOUSING]: MODULES.TOOLS,
[FUNCTIONS.TOOLS_EDUCATION]: MODULES.TOOLS,
[FUNCTIONS.TOOLS_INSURANCE]: MODULES.TOOLS,
[FUNCTIONS.VIEW_ORDER_LIST]: MODULES.ORDER,
[FUNCTIONS.SWITCH_ORDER_TAB]: MODULES.ORDER,
[FUNCTIONS.VIEW_ORDER]: MODULES.ORDER
}
// ============================================================
// 九、功能名称映射(functionName)
// ============================================================
export const FUNCTION_NAMES = {
[FUNCTIONS.APPLY_JOIN]: '申请加盟',
[FUNCTIONS.INVITE_JOIN]: '邀请加盟',
[FUNCTIONS.VIEW_TEAM]: '查看团队',
[FUNCTIONS.VIEW_TEAM_PERFORMANCE]: '查看团队业绩',
[FUNCTIONS.VIEW_COMMISSION]: '查看佣金',
[FUNCTIONS.VIEW_POINTS]: '查看积分',
[FUNCTIONS.SHARE_DATA]: '分享数据',
[FUNCTIONS.AGENT_COMMISSION]: '持牌人佣金',
[FUNCTIONS.AGENT_POINTS]: '持牌人积分明细',
[FUNCTIONS.EXCHANGE_POINTS]: '积分兑换',
[FUNCTIONS.VIEW_PRODUCT]: '查看商品',
[FUNCTIONS.SHARE_PRODUCT]: '分享产品',
[FUNCTIONS.CONSULT_PRODUCT]: '咨询产品',
[FUNCTIONS.PLAN_PRODUCT]: '规划产品',
[FUNCTIONS.PRODUCT_ANALYSIS]: '产品分析',
[FUNCTIONS.EDIT_PROFILE]: '修改资料',
[FUNCTIONS.EDIT_ACCOUNT]: '绑定账号',
[FUNCTIONS.REALNAME_VERIFY]: '实名认证',
[FUNCTIONS.CLEAR_CACHE]: '清除缓存',
[FUNCTIONS.LOGOUT]: '退出登录',
[FUNCTIONS.RESIGN_PARTNER]: '合伙人解约',
[FUNCTIONS.SEARCH]: '搜索',
[FUNCTIONS.HELP_CENTER]: '帮助中心',
[FUNCTIONS.CUSTOMER_SERVICE]: '咨询客服',
[FUNCTIONS.SHARE_APP]: '分享应用',
[FUNCTIONS.COMPANY_INTRO]: '公司介绍',
[FUNCTIONS.VIEW_COMPANY_POLICY]: '公司制度',
[FUNCTIONS.VIEW_CASE_SHARE]: '案例分享',
[FUNCTIONS.CHANNEL_INTRO]: '渠道介绍',
[FUNCTIONS.TOOLS_HOUSING]: '购房能力',
[FUNCTIONS.TOOLS_EDUCATION]: '子女教育',
[FUNCTIONS.TOOLS_INSURANCE]: '保单复利',
[FUNCTIONS.VIEW_ORDER_LIST]: '查看订单列表',
[FUNCTIONS.SWITCH_ORDER_TAB]: '切换订单Tab',
[FUNCTIONS.VIEW_ORDER]: '查看订单'
}
// ============================================================
// 十、辅助函数
// ============================================================
/**
* 获取事件分类
*/
export function getEventCategory(eventCode) {
return EVENT_CATEGORIES[eventCode] || '业务级事件'
}
/**
* 获取事件名称
*/
export function getEventName(eventCode) {
return EVENT_NAMES[eventCode] || eventCode
}
/**
* 获取功能对应的事件类型
*/
export function getEventByFunction(functionCode) {
return FUNCTION_EVENT_MAP[functionCode] || EVENTS.CLICK
}
/**
* 获取功能对应的模块
*/
export function getModuleByFunction(functionCode) {
return FUNCTION_MODULE_MAP[functionCode] || MODULES.HOME
}
/**
* 获取模块名称
*/
export function getModuleName(moduleCode) {
return MODULE_NAMES[moduleCode] || moduleCode
}
/**
* 获取功能名称
*/
export function getFunctionName(functionCode) {
return FUNCTION_NAMES[functionCode] || functionCode
}
/**
* 构建标准埋点参数(适配后端入参格式)
*/
export function buildTrackParams(functionCode, extra = {}) {
const eventCode = getEventByFunction(functionCode)
const moduleCode = getModuleByFunction(functionCode)
return {
eventCode: eventCode,
eventName: getEventName(eventCode),
eventCategory: getEventCategory(eventCode),
moduleType: moduleCode,
moduleTypeName: getModuleName(moduleCode),
functionCode: functionCode,
functionName: getFunctionName(functionCode),
extra: extra
}
}
\ No newline at end of file
// utils/tracker.js
/**
* ============================================================
* 前端埋点核心 SDK
* 适配后端入参格式:
* {
* projectType, clientType, sessionId, visitorCode,
* screenResolution, source,
* saveRequestList: [ { operCategory, moduleType, moduleTypeName,
* eventType, eventTypeName, pageUrl, pageTitle,
* actionTarget, actionTargetType, actionTargetName,
* functionCode, functionName, extraParams, eventTime, remark } ]
* }
* ============================================================
*/
import {
EVENTS,
EVENT_CATEGORIES,
EVENT_NAMES,
MODULES,
MODULE_NAMES,
FUNCTION_EVENT_MAP,
FUNCTION_MODULE_MAP,
FUNCTION_NAMES,
getEventCategory,
getEventName,
getModuleByFunction,
getModuleName,
getFunctionName
} from './track-events.js'
class Tracker {
constructor() {
// ====== 外层公共参数 ======
this.fixedHeaders = {
projectType: 'CFFP',
clientType: this._detectClientType(),
sessionId: '',
visitorCode: '',
screenResolution: '',
source: ''
}
// ====== 运行时状态 ======
this.sessionId = ''
this.visitorCode = ''
this.currentPage = null
this.lastPage = null
this.pageEnterTime = 0
this.deviceInfo = {}
this._initialized = false
this._eventIdCounter = 0
// ====== 上报配置 ======
this.reportUrl = ''
this.queue = []
this.batchSize = 10
this.intervalTime = 3000
this.timer = null
// ====== 调试配置 ======
this.debug = false
this.dryRun = false // ✅ 新增:true=只打印不上报,false=正常上报
// ====== 重试配置 ======
this.maxRetries = 3
this.retryDelay = 1000
this.maxRetryDelay = 30000
// ====== 点击去重 ======
this.lastClickTime = 0
this.lastClickTarget = ''
// ====== 模块映射 ======
this.moduleMap = {}
this.keywordMap = []
// ====== 事件缓存(去重) ======
this._eventCache = new Map()
this._cacheTimeout = 5000
// ====== 映射缓存 ======
this._functionEventMap = {}
this._functionModuleMap = {}
this._functionNameMap = {}
}
// ============================================================
// 初始化
// ============================================================
init(config) {
if (this._initialized) {
console.warn('[Tracker] 已初始化,跳过')
return
}
this.reportUrl = config.reportUrl || ''
this.debug = config.debug || false
this.dryRun = config.dryRun || false
if (config.projectType) this.fixedHeaders.projectType = config.projectType
if (config.clientType) this.fixedHeaders.clientType = config.clientType
if (config.source) this.fixedHeaders.source = config.source
// 注册功能映射(从 track-events.js 注入)
if (config.functionEventMap) {
this._functionEventMap = config.functionEventMap
}
if (config.functionModuleMap) {
this._functionModuleMap = config.functionModuleMap
}
if (config.functionNameMap) {
this._functionNameMap = config.functionNameMap
}
// 检测客户端类型
this.fixedHeaders.clientType = this._detectClientType()
// 获取设备信息
this.deviceInfo = this._getDeviceInfo()
this.fixedHeaders.screenResolution =
(this.deviceInfo.screenWidth || 0) + 'x' + (this.deviceInfo.screenHeight || 0)
// 生成访客ID和会话ID
this.visitorCode = this._getVisitorCode()
this.sessionId = this._generateSessionId()
this.fixedHeaders.sessionId = this.sessionId
this.fixedHeaders.visitorCode = this.visitorCode
// 模块映射
if (config.moduleMap) {
this.moduleMap = config.moduleMap
}
if (config.keywordMap) {
this.keywordMap = config.keywordMap
}
console.log('[Tracker] 准备绑定 _bindUnload') // ✅ 确认执行到这一步
// 绑定页面关闭/刷新事件
this._bindUnload()
console.log('[Tracker] _bindUnload 绑定完成') // ✅ 确认执行完成
// 启动定时上报
this._startTimer()
// 绑定自动点击采集
this._bindAutoClick()
// 上报应用启动
this._report({
eventType: EVENTS.PAGE_VIEW,
pageUrl: '',
pageTitle: '应用启动',
actionTarget: 'app_launch',
actionTargetType: 'launch',
actionTargetName: '应用启动',
functionCode: null,
functionName: null,
moduleType: MODULES.HOME,
moduleTypeName: MODULE_NAMES[MODULES.HOME],
extraParams: {
sessionId: this.sessionId,
visitorCode: this.visitorCode,
source: this.fixedHeaders.source || 'direct'
}
})
this._initialized = true
if (this.debug) {
console.log('[Tracker] ✅ 初始化完成', {
projectType: this.fixedHeaders.projectType,
clientType: this.fixedHeaders.clientType,
visitorCode: this.visitorCode,
sessionId: this.sessionId,
screenResolution: this.fixedHeaders.screenResolution,
dryRun: this.dryRun
})
}
}
// ============================================================
// ====== 🔥 核心埋点方法 ======
// ============================================================
/**
* 基于功能编码埋点(推荐)
* 自动从数据字典获取事件类型、模块信息
*
* @param {string} functionCode - 功能编码(对应功能表 function_code)
* @param {object} params - 埋点参数
* @param {string} params.target - 操作目标(可选)
* @param {string} params.targetType - 操作目标类型(button/link/image等)
* @param {string} params.actionTargetName - 操作目标名称
* @param {string} params.moduleType - 覆盖模块类型(可选)
* @param {string} params.moduleTypeName - 覆盖模块名称(可选)
* @param {object} params.extra - 扩展数据(可选)
*/
trackFunction(functionCode, params = {}) {
if (!functionCode) {
console.warn('[Tracker] 功能编码不能为空')
return
}
// 获取事件类型
const eventType = this._functionEventMap[functionCode] || EVENTS.CLICK
// 获取模块信息
let moduleType = params.moduleType || this._functionModuleMap[functionCode] || MODULES.HOME
let moduleTypeName = params.moduleTypeName || MODULE_NAMES[moduleType] || moduleType
// 获取功能名称
const functionName = this._functionNameMap[functionCode] || functionCode
// 构建目标名称
const actionTargetName = params.actionTargetName || functionName
const actionTarget = params.target || functionCode
this.trackEvent(eventType, {
target: actionTarget,
targetType: params.targetType || 'click',
actionTargetName: actionTargetName,
moduleType: moduleType,
moduleTypeName: moduleTypeName,
functionCode: functionCode,
functionName: functionName,
extra: {
...(params.extra || {}),
functionCode: functionCode,
functionName: functionName
}
})
if (this.debug) {
console.log('[Tracker] 🎯 功能埋点:', functionCode, '→', eventType, params)
}
}
/**
* 通用事件埋点
*
* @param {string} eventType - 事件编码(对应事件表 event_code)
* @param {object} params - 埋点参数
* @param {string} params.target - 操作目标
* @param {string} params.targetType - 操作目标类型(button/link/image等)
* @param {string} params.actionTargetName - 操作目标名称
* @param {string} params.moduleType - 模块类型
* @param {string} params.moduleTypeName - 模块名称
* @param {string} params.functionCode - 功能编码(可选)
* @param {string} params.functionName - 功能名称(可选)
* @param {object} params.extra - 扩展数据
*/
trackEvent(eventType, params = {}) {
if (!eventType) {
console.warn('[Tracker] 事件编码不能为空')
return
}
// 获取当前页面模块信息
const pageModule = this._getModuleByPage(this.currentPage ? this.currentPage.path : '')
// 确定模块信息(优先使用传入的,否则用页面识别)
const moduleType = params.moduleType || pageModule.moduleType || MODULES.HOME
const moduleTypeName = params.moduleTypeName || pageModule.moduleName || MODULE_NAMES[moduleType] || moduleType
let pageUrl = (params.extra && params.extra.pageUrl) ||
(this.currentPage ? this.currentPage.url : '') ||
''
let pageTitle = (params.extra && params.extra.pageTitle) ||
(this.currentPage ? this.currentPage.title : '') ||
''
// 如果 currentPage 有值但 pageUrl 为空,打印警告
if (this.currentPage && !pageUrl) {
console.warn('[Tracker] currentPage 有值但 pageUrl 为空:', this.currentPage)
}
// H5 兜底
// #ifdef H5
if (!pageUrl && typeof window !== 'undefined' && window.location) {
pageUrl = window.location.href || ''
}
if (!pageTitle && typeof document !== 'undefined' && document.title) {
pageTitle = document.title || ''
}
// #endif
// 生成事件ID用于去重
const eventId = this._generateEventId(eventType, params)
// 防重复提交(同一事件5秒内不重复上报)
if (this._eventCache.has(eventId)) {
if (this.debug) {
console.log('[Tracker] ⏳ 事件去重:', eventType)
}
return
}
this._eventCache.set(eventId, Date.now())
setTimeout(() => {
this._eventCache.delete(eventId)
}, this._cacheTimeout)
// 构建上报数据(适配后端入参格式)
const reportData = {
// saveRequestList 中的字段
operCategory: getEventCategory(eventType),
moduleType: moduleType,
moduleTypeName: moduleTypeName,
eventType: eventType,
eventTypeName: getEventName(eventType),
pageUrl: pageUrl,
pageTitle: pageTitle,
actionTarget: params.target || eventType,
actionTargetType: params.targetType || eventType,
actionTargetName: params.actionTargetName || params.target || eventType,
functionCode: params.functionCode || null,
functionName: params.functionName || null,
extraParams: {
...(params.extra || {})
},
eventTime: params.eventTime || this._formatTime(new Date()),
remark: params.remark || ''
}
// 如果 extra 中有 module 信息,合并到 extraParams
if (params.extra) {
reportData.extraParams = {
...params.extra
}
}
// ✅ 打印调试信息
console.log('[Tracker] 📤 准备上报:', {
eventType: eventType,
pageUrl: pageUrl,
pageTitle: pageTitle,
currentPage: this.currentPage
})
this._report(reportData)
if (this.debug) {
console.log('[Tracker] 📤 事件埋点:', eventType, params)
}
}
// ============================================================
// 页面浏览(PV)- 由 App.vue 自动调用
// ============================================================
trackPageView(pageInfo) {
const now = Date.now()
// 1. 上报上一页面离开
if (this.currentPage && this.pageEnterTime > 0) {
const duration = Math.floor((now - this.pageEnterTime) / 1000)
if (duration >= 1) {
const leaveData = {
operCategory: '页面级事件',
moduleType: this.currentPage.moduleType || 'home',
moduleTypeName: this.currentPage.moduleName || '首页',
eventType: 'page_leave',
eventTypeName: '页面离开',
pageUrl: this.currentPage.url || '',
pageTitle: this.currentPage.title || '',
actionTarget: 'page_leave',
actionTargetType: 'page_leave',
actionTargetName: '页面离开',
functionCode: null,
functionName: null,
extraParams: {
duration: duration,
pageUrl: this.currentPage.url || '',
pageTitle: this.currentPage.title || '',
referrer: this.currentPage.referrer || ''
},
eventTime: this._formatTime(new Date()),
remark: ''
}
// ✅ 立即上报!不走队列
this._reportImmediate(leaveData)
}
}
// 2. 获取模块信息
const moduleInfo = this._getModuleByPage(pageInfo.path || '')
// 3. 上报当前页面浏览
this.trackEvent(EVENTS.PAGE_VIEW, {
target: 'page_view',
targetType: 'page_view',
actionTargetName: '页面浏览',
moduleType: moduleInfo.moduleType || MODULES.HOME,
moduleTypeName: moduleInfo.moduleName || MODULE_NAMES[MODULES.HOME],
extra: {
referrer: this.currentPage ? this.currentPage.url : '',
query: pageInfo.query || {}
}
})
// 4. 更新状态
this.lastPage = this.currentPage
this.currentPage = {
url: pageInfo.url || '',
title: pageInfo.title || '未知页面',
path: pageInfo.path || '',
moduleType: moduleInfo.moduleType || MODULES.HOME,
moduleName: moduleInfo.moduleName || MODULE_NAMES[MODULES.HOME],
referrer: this.currentPage ? this.currentPage.url : ''
}
this.pageEnterTime = now
if (this.debug) {
console.log('[Tracker] 📄 页面切换:', pageInfo.path, '→', this.currentPage.moduleName)
}
}
// ============================================================
// 快捷埋点方法(基于事件类型)
// ============================================================
/** 点击 */
click(target, extra = {}) {
this.trackEvent(EVENTS.CLICK, {
target: target,
targetType: 'click',
actionTargetName: target,
extra: extra
})
}
/** 查看详情 */
viewDetail(target, extra = {}) {
this.trackEvent(EVENTS.VIEW_DETAIL, {
target: target,
targetType: 'view_detail',
actionTargetName: target,
extra: extra
})
}
/** 提交 */
submit(target, extra = {}) {
this.trackEvent(EVENTS.SUBMIT, {
target: target,
targetType: 'submit',
actionTargetName: target,
extra: extra
})
}
/** 申请 */
apply(target, extra = {}) {
this.trackEvent(EVENTS.APPLY, {
target: target,
targetType: 'apply',
actionTargetName: target,
extra: extra
})
}
/** 邀请 */
invite(target, extra = {}) {
this.trackEvent(EVENTS.INVITE, {
target: target,
targetType: 'invite',
actionTargetName: target,
extra: extra
})
}
/** 分享 */
share(target, extra = {}) {
this.trackEvent(EVENTS.SHARE, {
target: target,
targetType: 'share',
actionTargetName: target,
extra: extra
})
}
/** 搜索 */
search(keyword, extra = {}) {
this.trackEvent(EVENTS.SEARCH, {
target: 'search',
targetType: 'search',
actionTargetName: '搜索',
extra: {
keyword: keyword,
...extra
}
})
}
/** 编辑 */
edit(target, extra = {}) {
this.trackEvent(EVENTS.EDIT, {
target: target,
targetType: 'edit',
actionTargetName: target,
extra: extra
})
}
/** 清除 */
clear(target, extra = {}) {
this.trackEvent(EVENTS.CLEAR, {
target: target,
targetType: 'clear',
actionTargetName: target,
extra: extra
})
}
/** 退出登录 */
logout(extra = {}) {
this.trackEvent(EVENTS.LOGOUT, {
target: 'logout',
targetType: 'logout',
actionTargetName: '退出登录',
extra: extra
})
}
/** 购买 */
purchase(params = {}) {
this.trackEvent(EVENTS.PURCHASE, {
target: 'purchase',
targetType: 'purchase',
actionTargetName: '购买',
extra: params
})
}
/** 登录 */
login(params = {}) {
this.trackEvent(EVENTS.LOGIN, {
target: 'login',
targetType: 'login',
actionTargetName: '登录',
extra: params
})
}
/** 注册 */
register(params = {}) {
this.trackEvent(EVENTS.REGISTER, {
target: 'register',
targetType: 'register',
actionTargetName: '注册',
extra: params
})
}
/** Tab切换 */
tabSwitch(tabName, extra = {}) {
this.trackEvent(EVENTS.TAB_SWITCH, {
target: tabName,
targetType: 'tab_switch',
actionTargetName: '切换Tab',
extra: {
tabName: tabName,
...extra
}
})
}
/** 输入 */
input(fieldName, extra = {}) {
this.trackEvent(EVENTS.INPUT, {
target: fieldName,
targetType: 'input',
actionTargetName: '输入',
extra: {
fieldName: fieldName,
...extra
}
})
}
// ============================================================
// 内部方法
// ============================================================
_generateEventId(eventType, params) {
this._eventIdCounter++
const key = eventType + '_' + (params.target || '') + '_' + (this.currentPage ? this.currentPage.path : '')
return key + '_' + this._eventIdCounter
}
_report(eventData) {
// 构建 saveRequestList 中的单条事件
const eventItem = {
operCategory: eventData.operCategory || getEventCategory(eventData.eventType),
moduleType: eventData.moduleType || MODULES.HOME,
moduleTypeName: eventData.moduleTypeName || MODULE_NAMES[eventData.moduleType] || eventData.moduleType,
eventType: eventData.eventType || 'custom',
eventTypeName: eventData.eventTypeName || getEventName(eventData.eventType),
pageUrl: eventData.pageUrl || (this.currentPage ? this.currentPage.url : ''),
pageTitle: eventData.pageTitle || (this.currentPage ? this.currentPage.title : ''),
actionTarget: eventData.actionTarget || '',
actionTargetType: eventData.actionTargetType || '',
actionTargetName: eventData.actionTargetName || '',
functionCode: eventData.functionCode || null,
functionName: eventData.functionName || null,
extraParams: eventData.extraParams || {},
eventTime: eventData.eventTime || this._formatTime(new Date()),
remark: eventData.remark || ''
}
this.queue.push(eventItem)
if (this.debug) {
console.log('[Tracker] 📦 入队:', eventItem.eventType, '队列:', this.queue.length)
}
if (this.queue.length >= this.batchSize) {
this._flush()
}
}
_flush() {
if (this.isReporting || this.queue.length === 0) return
this.isReporting = true
const batch = this.queue.splice(0, this.batchSize)
const batchWithRetry = batch.map((item) => ({
...item,
_retryCount: item._retryCount || 0
}))
this._doReport(batchWithRetry, 0)
}
_doReport(batch, retryCount) {
// 构建完整请求体(适配后端入参)
const requestBody = {
projectType: this.fixedHeaders.projectType,
clientType: this.fixedHeaders.clientType,
sessionId: this.fixedHeaders.sessionId,
visitorCode: this.fixedHeaders.visitorCode,
screenResolution: this.fixedHeaders.screenResolution,
source: this.fixedHeaders.source || '',
saveRequestList: batch.map(item => {
// 移除内部字段 _retryCount
const { _retryCount, ...rest } = item
return rest
})
}
// ============================================================
// ✅ dryRun 模式:只打印日志,不上报
// ============================================================
if (this.dryRun) {
console.log('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━')
console.log('📋 [Tracker DRY-RUN] 模拟上报(未实际发送)')
console.log('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━')
console.log('📦 上报数量:', batch.length, '条')
console.log('📤 请求体:', JSON.stringify(requestBody, null, 2))
console.log('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━')
this.isReporting = false
if (this.queue.length > 0) {
setTimeout(() => this._flush(), 500)
}
return
}
if (this.debug) {
console.log('[Tracker] 📤 上报:', batch.length, '条, 重试:', retryCount)
}
uni.request({
url: this.reportUrl,
method: 'POST',
header: { 'Content-Type': 'application/json' },
data: requestBody,
timeout: 10000,
success: (res) => {
const isSuccess = res.statusCode === 200 && res.data && res.data.code === 0
if (isSuccess) {
if (this.debug) {
console.log('[Tracker] ✅ 上报成功:', batch.length, '条')
}
} else {
console.warn('[Tracker] ⚠️ 业务失败:', res.data)
this._handleReportFail(batch, retryCount)
}
this.isReporting = false
if (this.queue.length > 0) {
setTimeout(() => this._flush(), 500)
}
},
fail: (err) => {
console.error('[Tracker] ❌ 上报失败:', err)
this._handleReportFail(batch, retryCount)
this.isReporting = false
if (this.queue.length > 0) {
setTimeout(() => this._flush(), 500)
}
}
})
}
/**
* 立即上报(不经过队列,直接发送)
* 专门用于 page_leave 等离场事件
*/
_reportImmediate(eventData) {
// 构建请求体
const requestBody = {
projectType: this.fixedHeaders.projectType,
clientType: this.fixedHeaders.clientType,
sessionId: this.fixedHeaders.sessionId,
visitorCode: this.fixedHeaders.visitorCode,
screenResolution: this.fixedHeaders.screenResolution,
source: this.fixedHeaders.source || '',
saveRequestList: [eventData] // 单条立即上报
}
if (this.dryRun) {
console.log('📋 [Tracker DRY-RUN] 立即上报(停留时长):', requestBody)
return
}
if (this.debug) {
console.log('[Tracker] 🔥 立即上报 page_leave:', requestBody)
}
uni.request({
url: this.reportUrl,
method: 'POST',
header: { 'Content-Type': 'application/json' },
data: requestBody,
timeout: 5000,
success: (res) => {
if (this.debug) {
console.log('[Tracker] ✅ 停留时长上报成功')
}
},
fail: (err) => {
console.error('[Tracker] ❌ 停留时长上报失败:', err)
// 失败时放入队列重试(兜底)
this.queue.push(eventData)
}
})
}
// ============================================================
// 新增:切换 dryRun 模式的方法
// ============================================================
/**
* 切换模拟模式
* @param {boolean} enabled - true=只打印不上报,false=正常上报
*/
setDryRun(enabled) {
this.dryRun = enabled
if (this.debug) {
console.log('[Tracker] 🔄 切换 dryRun 模式:', enabled ? '✅ 模拟模式(不上报)' : '❌ 正常模式(会上报)')
}
}
// ============================================================
// 新增:手动触发上报(用于测试)
// ============================================================
/**
* 立即上报队列中的数据
*/
flushNow() {
if (this.debug) {
console.log('[Tracker] 🔄 手动触发上报,队列长度:', this.queue.length)
}
this._flush()
}
// ============================================================
// 新增:清空队列(用于测试)
// ============================================================
/**
* 清空队列(不上报)
*/
clearQueue() {
const count = this.queue.length
this.queue = []
if (this.debug) {
console.log('[Tracker] 🗑️ 清空队列,已清除', count, '条数据')
}
}
_handleReportFail(batch, retryCount) {
const nextRetry = retryCount + 1
if (nextRetry >= this.maxRetries) {
console.warn('[Tracker] ❌ 上报失败,已超过最大重试次数(' + this.maxRetries + '),丢弃数据')
return
}
let delay = this.retryDelay * Math.pow(2, retryCount)
delay = Math.min(delay, this.maxRetryDelay)
console.log('[Tracker] 🔄 将在 ' + delay + 'ms 后重试 (第 ' + nextRetry + ' 次)')
setTimeout(() => {
if (this.debug) {
console.log('[Tracker] 🔄 重试上报:', batch.length, '条')
}
this._doReport(batch, nextRetry)
}, delay)
}
_startTimer() {
if (this.timer) return
this.timer = setInterval(() => {
if (this.queue.length > 0) {
this._flush()
}
}, this.intervalTime)
}
_stopTimer() {
if (this.timer) {
clearInterval(this.timer)
this.timer = null
}
}
_getModuleByPage(path) {
if (!path) {
return { moduleType: MODULES.HOME, moduleName: MODULE_NAMES[MODULES.HOME] }
}
if (this.moduleMap[path]) {
return this.moduleMap[path]
}
const keys = Object.keys(this.moduleMap).sort((a, b) => b.length - a.length)
for (const key of keys) {
if (path.startsWith(key) || path.includes(key)) {
return this.moduleMap[key]
}
}
if (this.keywordMap && this.keywordMap.length > 0) {
for (const item of this.keywordMap) {
if (path.includes(item.keyword)) {
return {
moduleType: item.moduleType,
moduleName: item.moduleName || item.moduleType
}
}
}
}
return { moduleType: MODULES.HOME, moduleName: MODULE_NAMES[MODULES.HOME] }
}
_detectClientType() {
// #ifdef APP-PLUS
return 'APP_' + (plus.os.name === 'iOS' ? 'IOS' : 'ANDROID')
// #endif
// #ifdef MP-WEIXIN
return 'MP'
// #endif
// #ifdef H5
const ua = navigator.userAgent.toLowerCase()
if (ua.includes('micromessenger')) {
return 'MP'
}
const isMobile = /android|iphone|ipad|ipod|blackberry|windows phone/i.test(ua)
return isMobile ? 'H5' : 'PC'
// #endif
return 'UNKNOWN'
}
_getDeviceInfo() {
const info = {
platform: '',
osVersion: '',
brand: '',
model: '',
screenWidth: 0,
screenHeight: 0
}
try {
const systemInfo = uni.getSystemInfoSync()
info.platform = systemInfo.platform || ''
info.osVersion = systemInfo.osVersion || ''
info.brand = systemInfo.brand || ''
info.model = systemInfo.model || ''
info.screenWidth = systemInfo.screenWidth || 0
info.screenHeight = systemInfo.screenHeight || 0
} catch (e) {
console.warn('[Tracker] 获取设备信息失败:', e)
}
return info
}
_getVisitorCode() {
let code = uni.getStorageSync('tracker_visitor_code')
if (!code) {
code = 'vis_' + Date.now() + '_' + Math.random().toString(36).slice(2, 8)
uni.setStorageSync('tracker_visitor_code', code)
}
return code
}
_generateSessionId() {
return 'sess_' + Date.now() + '_' + Math.random().toString(36).slice(2, 6)
}
_formatTime(date) {
const pad = (n) => String(n).padStart(2, '0')
return date.getFullYear() + '-' +
pad(date.getMonth() + 1) + '-' +
pad(date.getDate()) + ' ' +
pad(date.getHours()) + ':' +
pad(date.getMinutes()) + ':' +
pad(date.getSeconds())
}
_bindAutoClick() {
if (typeof document === 'undefined') return
document.addEventListener('click', this._handleClick.bind(this), true)
if (this.debug) {
console.log('[Tracker] 🖱️ 自动点击采集已启动')
}
}
_handleClick(event) {
const target = event.target
if (!target) return
// 防重复
const now = Date.now()
const targetKey = target.id || (target.innerText || '').slice(0, 20) || target.tagName
if (now - this.lastClickTime < 200 && this.lastClickTarget === targetKey) {
return
}
this.lastClickTime = now
this.lastClickTarget = targetKey
// ============================================================
// ✅ 新增:查找 data-track 属性
// ============================================================
let functionCode = null
let functionName = null
let elWithTrack = target
let depth = 0
const maxDepth = 10
while (elWithTrack && depth < maxDepth && elWithTrack !== document && elWithTrack !== document.body) {
// 使用 getAttribute 获取 data-track(兼容 H5 + 小程序)
const track = elWithTrack.getAttribute ? elWithTrack.getAttribute('data-track') : null
if (track) {
functionCode = track
const trackName = elWithTrack.getAttribute ? elWithTrack.getAttribute('data-track-name') : null
functionName = trackName || functionCode
if (this.debug) {
console.log('[Tracker] ✅ 找到 data-track:', functionCode)
}
break
}
elWithTrack = elWithTrack.parentElement
depth++
}
// ============================================================
// 提取点击信息
// ============================================================
let el = target
let text = (el.innerText || el.textContent || '').trim().slice(0, 50)
let id = el.id || ''
let tag = (el.tagName || '').toLowerCase()
while (el && el !== document) {
if (!text) {
text = (el.innerText || el.textContent || '').trim().slice(0, 50)
}
if (!id && el.id) {
id = el.id
}
const tagName = (el.tagName || '').toLowerCase()
if (['button', 'a', 'input', 'select', 'textarea'].includes(tagName)) {
tag = tagName
break
}
el = el.parentElement
}
const targetName = text || id || tag || '未知元素'
const moduleInfo = this._getModuleByPage(this.currentPage ? this.currentPage.path : '')
// ============================================================
// ✅ 上报点击(带上 functionCode)
// ============================================================
this.trackEvent(EVENTS.CLICK, {
target: targetName,
targetType: tag || 'click',
actionTargetName: functionName || targetName,
functionCode: functionCode,
functionName: functionName,
moduleType: moduleInfo.moduleType || MODULES.HOME,
moduleTypeName: moduleInfo.moduleName || MODULE_NAMES[MODULES.HOME],
extra: {
text: text,
id: id,
tagName: tag,
selector: this._getSelector(target),
x: event.clientX || 0,
y: event.clientY || 0,
hasTrack: !!functionCode,
trackValue: functionCode
}
})
}
_getSelector(target) {
if (target.id) return '#' + target.id
if (target.className && typeof target.className === 'string') {
const cls = target.className.split(' ').filter(c => c).join('.')
if (cls) return target.tagName.toLowerCase() + '.' + cls
}
return target.tagName.toLowerCase()
}
onAppShow() {
this._startTimer()
}
onAppHide() {
// ✅ APP 切到后台时,立即上报当前页面停留时长
if (this.currentPage && this.pageEnterTime > 0) {
const duration = Math.floor((Date.now() - this.pageEnterTime) / 1000)
if (duration >= 1) {
const leaveData = {
operCategory: '页面级事件',
moduleType: this.currentPage.moduleType || 'home',
moduleTypeName: this.currentPage.moduleName || '首页',
eventType: 'page_leave',
eventTypeName: '页面离开',
pageUrl: this.currentPage.url || '',
pageTitle: this.currentPage.title || '',
actionTarget: 'page_leave',
actionTargetType: 'page_leave',
actionTargetName: '页面离开',
functionCode: null,
functionName: null,
extraParams: {
duration: duration,
pageUrl: this.currentPage.url || '',
pageTitle: this.currentPage.title || '',
referrer: this.currentPage.referrer || ''
},
eventTime: this._formatTime(new Date()),
remark: ''
}
// ✅ 立即上报!
this._reportImmediate(leaveData)
}
}
this._flush()
this._stopTimer()
}
destroy() {
this._flush()
this._stopTimer()
if (typeof document !== 'undefined') {
document.removeEventListener('click', this._handleClick, true)
}
this._initialized = false
}
_bindUnload() {
if (typeof window === 'undefined') return
// ✅ 页面关闭/刷新时,立即上报停留时长
window.addEventListener('beforeunload', () => {
console.log('🔴🔴🔴 beforeunload 触发了!!!') // ✅ 确认事件触发
console.log('🔴 currentPage:', this.currentPage) // ✅ 看是否有值
console.log('🔴 pageEnterTime:', this.pageEnterTime) // ✅ 看是否有值
if (this.currentPage && this.pageEnterTime > 0) {
const duration = Math.floor((Date.now() - this.pageEnterTime) / 1000)
if (duration >= 1) {
const leaveData = {
operCategory: '页面级事件',
moduleType: this.currentPage.moduleType || 'home',
moduleTypeName: this.currentPage.moduleName || '首页',
eventType: 'page_leave',
eventTypeName: '页面离开',
pageUrl: this.currentPage.url || '',
pageTitle: this.currentPage.title || '',
actionTarget: 'page_leave',
actionTargetType: 'page_leave',
actionTargetName: '页面离开',
functionCode: null,
functionName: null,
extraParams: {
duration: duration,
pageUrl: this.currentPage.url || '',
pageTitle: this.currentPage.title || '',
referrer: this.currentPage.referrer || ''
},
eventTime: this._formatTime(new Date()),
remark: ''
}
// ✅ 使用 sendBeacon(保证页面关闭时请求能发出)
this._reportBeacon(leaveData)
}
}
})
}
/**
* 使用 sendBeacon 上报(页面关闭时也能发出)
*/
_reportBeacon(eventData) {
// ✅ dryRun 时打印完整日志,方便调试
if (this.dryRun) {
console.log('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━')
console.log('📋 [Tracker DRY-RUN] sendBeacon(停留时长)')
console.log('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━')
console.log('📦 上报数据:', JSON.stringify(eventData, null, 2))
console.log('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━')
return
}
if (typeof navigator === 'undefined' || !navigator.sendBeacon) {
// 降级:用同步请求
this._reportImmediate(eventData)
return
}
const requestBody = {
projectType: this.fixedHeaders.projectType,
clientType: this.fixedHeaders.clientType,
sessionId: this.fixedHeaders.sessionId,
visitorCode: this.fixedHeaders.visitorCode,
screenResolution: this.fixedHeaders.screenResolution,
source: this.fixedHeaders.source || '',
saveRequestList: [eventData]
}
try {
const blob = new Blob([JSON.stringify(requestBody)], {
type: 'application/json'
})
navigator.sendBeacon(this.reportUrl, blob)
if (this.debug) {
console.log('[Tracker] 📤 sendBeacon 上报 page_leave')
}
} catch (e) {
// 降级到普通上报
this._reportImmediate(eventData)
}
}
// ============================================================
// 设置访问来源
// ============================================================
setSource(source) {
this.fixedHeaders.source = source
}
// ============================================================
// 获取外层公共参数(调试用)
// ============================================================
getHeaders() {
return { ...this.fixedHeaders }
}
}
export default new Tracker()
\ No newline at end of file
// 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