//首页执行 if(window.pageObj && window.pageObj.isHomePage==1){ gray() } festival() function gray(){ $require(['cmsAjax'],function(c){ let url = window.location.origin + "/ndesigner/api/gray" c.cmsAjax.postJson(url).then(function(res){ if(res.code == 200){ $("html")[0].style="filter:progid:DXImageTransform.Microsoft.Basiclmage\(grayscale=1\);-webkit-filter\:grayscale\(100%\)\;" } }) }) } function festival(){ if(!isFrontEnv()){ return } $require(['cmsAjax'],function(c){ let url = "/fwebapi/cms/lowcode/festivalPendant/getSettings" c.cmsAjax.get(url).then(function(resp){ if(resp.data && resp.data.code == 200 && resp.data.settings){ let res = resp.data.settings if(res.location==1 && window.pageObj && window.pageObj.isHomePage!=1){ return } let canTime = (res.showTime && res.showTime.length==2 && res.nowTime>=res.showTime[0] && res.nowTime<=res.showTime[1]) || !res.showTime || res.showTime.length==0 if(res.isOpen && canTime){ $require(['/npublic/commonjs/restival.js'],function(r){ r.init(res) }) } } }) }) } //点击智慧客服 var smsFlag=false; var smsShowFun=null; $(document).on("click","[smartService]",function(){ if(!isFrontEnv()){ return } if(smsShowFun){ if(smsFlag){ smsShowFun.showFun() }else{ smsShowFun() } }else{ smartServiceInit() } }) function smartServiceInit(){ $require(['cmsAjax'],function(c){ let domain = __ce.smartServiceUrl || 'https://web-visitor.yun300.cn' let url = `${domain}/visitormanager/intelligent/front/checkAndRegister?tenantId=${tenant.tenantId}&instance=${tenant.bossProductInstance}` let data = { account:localStorage.getItem(`account_${tenant.tenantId}`) } c.cmsAjax.postJson(url,data).then(function(res){ if(res.status==200 && res.data){ if(res.data.account){ localStorage.setItem(`account_${tenant.tenantId}`,res.data.account) } $require(['/npublic/commonjs/smartService.js'],function(smartService){ smsFlag = true smsShowFun = new smartService(res.data) }) }else{ smsFail() } },function(){ smsFail() }) }) function smsFail(){ $require(['pl_toast'],function(){ $.pl_toast({msg:i18n.sms_no}) }) smsFlag = false smsShowFun = function(){ $.pl_toast({msg:i18n.sms_no}) } } } //防钓鱼 preventFish() function preventFish(){ var req = location.hostname var rel = getCookie('realhost') || "" if(rel && rel != req){ var url = "/repository/cheat?req="+req+"&rel="+rel $.ajax({ url:url }) } }