var smsflag=false; var smsshowfun=null; var hasscroll=false; var isweixin = function(){ var ua = navigator.useragent.tolowercase(); return ua.match(/micromessenger/i) == "micromessenger" } $(function(){ //棣栭〉鎵ц锛岀伆鑹蹭富棰? if(window.pageobj && window.pageobj.ishomepage==1){ gray() } if(tenant.unittype!='portal-saas-mall'){ //鑺傛棩鎸備欢 festival() //鏅烘収瀹㈡湇 smartserviceinit() } //闃查挀楸? if(tenant.tenantid!=268516 && tenant.unittype!='portal-saas-mall'){ preventfish() } if(isweixin() && tenant.unittype!='portal-saas-mall'){ wxshare() } //寰俊灏忕▼搴? if(window.__wxjs_environment === 'miniprogram'){ $require(['/npublic/commonjs/jweixin/jweixin.js','pl_util'],function(){ wx.miniprogram.postmessage({ data: { sharetitle:encodeuricomponent(document.title), sharedesc:getmeta("description"), shareurl:encodeuricomponent(location.href) } }) }) } }) //閫氳繃name鑾峰彇瀵瑰簲meta鐨刢ontent鍊?function getmeta(name) { var _metas = document.getelementsbytagname("meta") for (var i = 0, _item; (_item = _metas[i++]); ) { if (_item.getattribute("name") && _item.getattribute("name").tolowercase() === name) { return encodeuricomponent(_item.content) } } } //鐏拌壊涓婚 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) }) } } }) }) } //鏅烘収瀹㈡湇 function smartserviceinit(){ if(!isfrontenv()){ return } $(window).on('mousemove scroll touchmove tap click keydown',function(){ if(!hasscroll){ hasscroll = true getsmsvs(function(resp){ $require([`css!/npublic/commonjs/smartservice/t.css`,'/npublic/commonjs/smartservice.js'],function(r,smartservice){ let set = {} try{ set = json.parse(resp.setting.colorlayout) }catch(e){} if(set.entrancelocation==1){ let dom = ` ` $("body").append(dom) $(".smarticon").hover(function(){ $(this).css({ "background-color": set.windowcolor, "color": "#fff" }) },function(){ $(this).css({ "background-color": "#fff", "color": set.windowcolor }) }) } $(document).on("click","[smartservice]",showandinit) //涓诲姩鍏抽棴鏍囪瘑 let smartserviceclose = sessionstorage.getitem('smartserviceclose') if(set.showflag==1 && resp && smartserviceclose!='true'){ showandinit() } function showandinit(){ if(smsshowfun){ if($(".smartservice.show").length>0){ smsshowfun.closedialog() return } if(smsflag){ smsshowfun.showfun() }else{ smsshowfun() } return } smsflag = true smsshowfun = new smartservice(resp) if(window.zqsensorsobj){ let obj = { tenantid: tenant.tenantid, ibusinesscode : "01", ibusinessname : "鏅烘収瀹㈡湇涓氬姟绾?, ibusinesscustid : localstorage.getitem(`account_${tenant.tenantid}`) } zqsensorsobj.track('smartservicewakeup',obj); } } }) }) } }) //璇锋眰鎺ュ彛鏁版嵁 function getsmsvs(callback){ $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){ localstorage.setitem(`account_${tenant.tenantid}`,res.data.account) callback(res.data) } }) }) } } //闃查挀楸?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 }) } } //鑷畾涔夊井淇″垎浜?function wxshare(){ $require(['cmsajax','/npublic/commonjs/jweixin/jweixin.js','pl_util'],function(c){ let url = "/fwebapi/cms/api/tdk/getwxshareinfo" let data = { pageurl:location.href, appcode:pageobj.appid, tid:pageobj.contenttype, pagetype:pageobj.pagetype, ishomepage:pageobj.ishomepage, pageid:pageobj.pageid, contentid:pageobj._detailid, pagename:pageobj.name } function imgxaf(src,v){ var imgparam = src.indexof('?')>-1 ? src.split('?')[1] : ""; var imgsrc = src.split('?')[0] var paramstr = imgparam ? "?" + imgparam : ""; return imgsrc + "_" + v + "xaf" + imgsrc.substr(imgsrc.lastindexof('.')) + paramstr } c.cmsajax.postjson(url,data).then(function(resp){ let data = resp.data if(data.data){ data = data.data } if(data.wxjsconfig){ let obj = data.wxjsconfig let content = data.wxsharecontent let sharobj = { title: content.title, // 鍒嗕韩鏍囬 desc: content.desc, // 鍒嗕韩鎻忚堪 link: location.href, // 鍒嗕韩閾炬帴锛岃閾炬帴鍩熷悕鎴栬矾寰勫繀椤讳笌褰撳墠椤甸潰瀵瑰簲鐨勫叕浼楀彿js瀹夊叏鍩熷悕涓€鑷? imgurl: imgxaf($.handledataimg(content.imgurl),104) } console.log("鍒嗕韩鏁版嵁锛?,sharobj) wx.config({ debug: false, // 寮€鍚皟璇曟ā寮?璋冪敤鐨勬墍鏈塧pi鐨勮繑鍥炲€间細鍦ㄥ鎴风alert鍑烘潵锛岃嫢瑕佹煡鐪嬩紶鍏ョ殑鍙傛暟锛屽彲浠ュ湪pc绔墦寮€锛屽弬鏁颁俊鎭細閫氳繃log鎵撳嚭锛屼粎鍦╬c绔椂鎵嶄細鎵撳嵃銆? appid: obj.appid, // 蹇呭~锛屽叕浼楀彿鐨勫敮涓€鏍囪瘑 timestamp: obj.timestamp, // 蹇呭~锛岀敓鎴愮鍚嶇殑鏃堕棿鎴? noncestr: obj.noncestr, // 蹇呭~锛岀敓鎴愮鍚嶇殑闅忔満涓? signature: obj.signature,// 蹇呭~锛岀鍚? jsapilist: ['updateappmessagesharedata','updatetimelinesharedata'] // 蹇呭~锛岄渶瑕佷娇鐢ㄧ殑js鎺ュ彛鍒楄〃 }); wx.ready(function () { //闇€鍦ㄧ敤鎴峰彲鑳界偣鍑诲垎浜寜閽墠灏卞厛璋冪敤 wx.updateappmessagesharedata(sharobj) wx.updatetimelinesharedata(sharobj) }); } }) }) }