//首页执行 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 }) } }