// 统计数据 // 统计类型 1:首页banner;2:直播模块;3:最新活动;4:热门文章;5:新品橱窗;6:活动列表 var cmSysVitaMixins = function () { return { data() { return { cmSysParams:{ accessClient: 0,// 来源 0网站 1小程序 pagePath:'',//页面路径 accessDuration:0,//停留时间 pageType:'',//页面类型 pageLabel:'',//页面标签 userId:0,//用户Id productId:0,//商品Id behaviorType:1 // 用户行为类型 }, handleProsId:0, handleShopId:0, handlearticleId:0, handleProsKey:"", handleShopKey:"", productIds:[7247,7248],//Ross 商品ID集合 shopIds:[1378],// Ross 供应商Id articleIds:[7184,7199,7531,7497,7471,7458,7440,7424,7398,7370,7356,7344,7300,7298,7232,6674],//Ross 相关文章ID 集合 keyWords:['Binary Premium','智能体疗管理系统','448k','肌肉重塑疗法','西班牙ROSS','ROSS','智能体疗','西班牙Ross','Ross','西班牙ross','ross',],// Ross 搜索商品关键词 集合 shopKeyWords:['深圳艾斯佰丽生物科技有限公司','艾斯佰丽'], showRossHtml:false, consultParams:{ ip:'', createTime:'', consultMobile: '', consultName: '', isClick:1 }, isDisabled:true, isRossShow:false } }, methods: { // 校验返回页面类型 checkedIsIncludeType(url){ if (!url) return false return includeList.find(item => url === item.url) }, // 校验是否为配置的路径 checkedIsInclude(url) { if (!url) return false return includeList.some(item => url === item.url) }, handleCmSysNetInfo() { //设置定时器 const globalUserData = JSON.parse(localStorage.getItem('userInfo')); if(globalUserData){ this.cmSysParams.userId = globalUserData.userId * 1; } if( this.productIds.includes(this.handleProsId*1) || this.shopIds.includes(this.handleShopId*1) || this.articleIds.includes(this.handlearticleId*1) || this.keyWords.includes(this.handleProsKey) || this.shopKeyWords.includes(this.handleShopKey) ){ this.cmSysParams.behaviorType = 2; if (!GLOBAL_USER_ID>0) { this.userInformationIsClick() } } const pageUrls = window.location.pathname; const pagePath = window.location.href; if(this.checkedIsInclude(pageUrls)){ const pageData = this.checkedIsIncludeType(pageUrls); this.cmSysParams.pageType = pageData ? pageData.pageType : ''; this.cmSysParams.pageLabel = pageData ? pageData.pageLabel : ''; } this.cmSysParams.pagePath = pagePath; setTimeout(()=>{ this.handleSetNetworks(this.cmSysParams); },2000) }, handleSetNetworks(params){// 进入页面执行统计 console.log(`页面路径:${params.pagePath}`,`标签:${params.pageLabel}`) PublicApi.userRecordStatisticsApp(params,function(response){ if(response.code === 0){ console.log('上送浏览记录统计成功~') }else{ console.log('上送浏览记录统计失败~') } }); }, handleInputName(e){ this.consultParams.consultName = e.target.value; this.handldeCheckInput(); }, handleInputPhone(e){ this.consultParams.consultMobile = e.target.value; this.handldeCheckInput(); }, handldeCheckInput(){ this.isDisabled = !(this.consultParams.consultName !== "" && this.consultParams.consultMobile !== ""); }, handleSubmit(){ // 提交联系人信息 if(this.isDisabled){ return } let reg = RegExp(/^1\d{10}$/); if(!reg.test(this.consultParams.consultMobile)){ CAIMEI.dialog('请输入正确的手机号'); return } this.userInformationInsertRoos(this.consultParams); }, handleClose(){ // 关闭Ross 广告弹窗 this.userInformationInsertRoos(this.consultParams); }, userInformationIsClick(){ //查询是否需要弹Ross广告 let _self = this; PublicApi.userInformationIsClick({}, function (response) { if(response.code === 0){ if(response.data){ setTimeout(()=>{ _self.showRossHtml = true },5000) } }else{ console.log('error',response.msg); } }) }, userInformationInsertRoos(params){ //提交记录咨询人&&关闭弹窗 let _self = this; PublicApi.userInformationInsertRoos(params, function (response) { if(response.code === 0){ _self.showRossHtml = false }else{ console.log('error',response.msg); } }) }, userInformationVisitRoos(params){ //查看访问者是否浏览过roos相关页面 let _self = this; PublicApi.userInformationVisitRoos(params, function (response) { if(response.code === 0){ _self.isRossShow = response.data }else{ console.log('error',response.msg); } }) }, userRecordStatistics() {// navigator.sendBeacon 方式 暂时废弃 const NODE_ENV_BASE_URL = $("#coreServer").val(); const url = `${NODE_ENV_BASE_URL}/user/record/StatisticsPc`; const blob = new Blob([JSON.stringify(this.cmSysParams)], { type: 'application/json; charset=UTF-8', }); navigator.sendBeacon(url, blob); }, handleWindow(type){ // 暂时废弃 const isBrowser = isPC ? 1 : 0; const map = { 0: 'pagehide', 1: 'beforeunload', }; const FunMap = { 0:window.addEventListener(map[isBrowser], e => this.beforeunloadHandler(e)), // 绑定 1:window.removeEventListener(map[isBrowser], e => this.beforeunloadHandler(e)) // 接触绑定 } return FunMap[type]; }, }, mounted() { // 页面加载完成后[监听]执行事件 this.handleCmSysNetInfo() // 查看访问者是否浏览过roos相关页面 this.userInformationVisitRoos({ userId: this.cmSysParams.userId }) }, destroyed() { } } }();