/** * Created by webshow on 2019/2/11. */ // $ip="http://test.api.lvdou66.com/"; $ip = 'https://zhibo.lvdou66.com/'; cdn="https://zhibocdn.lvdou66.com/comm"; var bbb = location.href; var UrlData = url_get_params(bbb) function url_get_params(url_path) { var url = url_path; var theRequest = new Object(); if (url.indexOf("?") != -1) { var str = url.substr(url.indexOf("?") + 1); strs = str.split("&"); for (var i = 0; i < strs.length; i++) { theRequest[strs[i].split("=")[0]] = unescape(strs[i].split("=")[1]); } } return theRequest; } if(UrlData.cid!==null){ $.cookie("cid", UrlData.cid, {expires: 1, path: "/"}); $.ajax({ url:'https://zhiboweb.ishuaji.cn/activesys/stat/pc/visit', type:"get", data:{ cid:$.cookie("cid") }, success:function(msg) { var data=JSON.parse(msg) //console.log("埋点",data); } }) } //微信登錄 var fp = new Fingerprint2(); fp.get(function(result, components) { canvasCode=result if(UrlData.code!=undefined&&$.cookie("ukk")==null){ $.ajax({ url:$ip+'weblive/third/login.html', type:"post", data:{ code:UrlData.code, cid:$.cookie("cid"), type:"2", deviceid:canvasCode, }, success: function (msg) { var data=JSON.parse(msg) if(data.code==1){ $.cookie("tbb", data.token, {expires: 1, path: "/"}); $.cookie("ukk", data.uid, {expires: 1, path: "/"}); //然後登陸 window.location.href="https://yabolive.com/index.html" }else{ layer.msg(data.msg); } } }) } }); //QQ登录 //登录后获取信息 sessionStorage.out=false if($.cookie("ukk")!=undefined){ $.ajax({ url:$ip+"weblive/user/myinfo.html", data:{ uid:$.cookie("ukk"), token: $.cookie("tbb") }, type:"post", error: function (msg) { console.log('请求出错'); $.cookie("ukk", null, { path: "/", expires: -1 }); $.cookie("tbb", null, { path: "/", expires: -1 }); layer.msg("登录失效,请重新登录。") }, success: function (msg) { var data=JSON.parse(msg); if(data.code==1){ $(".login-no").hide(); $(".lonin-yes").css("display","inline-block"); $(".header-avatar").attr("src",cdn+data.user.face+'?x-oss-process=image/resize,w_100'); $(".header-name").text(data.user.nickname); $(".level1").attr("src","https://zhibocdn.lvdou66.com/comm/level/"+data.user.richlevel+".png") $(".level2").attr("src","https://zhibocdn.lvdou66.com/comm/level/"+(data.user.richlevel+1)+".png") $(".info-avatar").attr("src",cdn+data.user.face+'?x-oss-process=image/resize,w_100'); $(".info-name").text(data.user.nickname); $(".info-uid").text("Yabo ID:"+data.user.uid); $(".diamond").text(data.diamond); $(".coin").text(data.coin); $(".login-out").on("click", function () { $.ajax({ url:$ip+"/weblive/user/logout.html", data:{ uid:$.cookie("ukk"), token: $.cookie("tbb") }, type:"post", error: function (msg) { console.log('请求出错'); }, success: function (msg) { var data=JSON.parse(msg); if(data.code==1){ $.cookie("__qc__k", null, { path: "/", expires: -1 }); $.cookie("ukk", null, { path: "/", expires: -1 }); $.cookie("tbb", null, { path: "/", expires: -1 }); window.location.reload() } } }) }) //比对富豪等级 $.ajax({ url:$ip+"/weblive/level.html", type:"post", success: function (msg) { var richList=JSON.parse(msg) var richMax=richList.data[data.user.richlevel].score; $(".info-score span").eq(1).text(richMax) $('.info-score span').eq(0).text(data.user.richnum) if(data.user.richlevel==0){ var percentage=Math.floor((data.user.richnum/richMax)*100); if(percentage>96)percentage=96 $(".propress").css("width",percentage+"%") }else{ var percentage=Math.floor(((data.user.richnum-richList.data[data.user.richlevel-1].score)/(richMax-richList.data[data.user.richlevel-1].score))*100); if(percentage>96)percentage=96 $(".propress").css("width",percentage+"%") } } }) }else{ $.cookie("ukk", null, { path: "/", expires: -1 }); $.cookie("tbb", null, { path: "/", expires: -1 }); layer.msg("登录失效,请重新登录。") } } }) }else{ } //layer弹窗 $(".login-btn").on("click", function () { layer.open({ type: 2, title: false, shadeClose: true, skin: "yourclass", area: ["760px", "620px"], content: "pop/login.html?v='2019053002'", }) }) if($.cookie("ukk")!=undefined){ $(".yaboDown").on("click", function () { layer.open({ type: 2, title: false, shadeClose: true, skin: "yourclass", area: ["480px", "820px"], content: "room/activity.html?uid="+ $.cookie("ukk")+"&token="+ $.cookie("tbb"), }) }) }else{ $(".yaboDown").on("click", function () { layer.open({ type: 2, title: false, shadeClose: true, skin: "yourclass", area: ["480px", "820px"], content: "room/activity.html?v='201902140228&uid=7878549", }) }) } $(".register").on("click", function () { layer.open({ type: 2, title: false, shadeClose: true, skin: "yourclass", area: ["760px", "790px"], content: "pop/registered.html?v='2019053001'", }) }) $(".pay").on("click", function () { layer.open({ type: 2, title: false, shadeClose: true, skin: "yourclass", area: ["760px", "600px"], content: "pop/pay.html?v='2019053001'", }) }) $(".home-box-right-content-li1 .home-li-top .home-li-span span").on("click", function () { $(this).siblings("span").removeClass("home-li-act"); $(this).addClass("home-li-act"); if($(this).text()=="今日"){ sexy(0) } if($(this).text()=="昨日"){ sexy(-1) } if($(this).text()=="周榜"){ sexyWeek() } }) $(".home-box-right-content-li2 .home-li-top .home-li-span span").on("click", function () { $(this).siblings("span").removeClass("home-li-act"); $(this).addClass("home-li-act"); if($(this).text()=="今日"){ rich(0) } if($(this).text()=="昨日"){ rich(-1) } if($(this).text()=="周榜"){ richWeek() } }) $(".span4 span").on("click", function () { $(this).siblings("span").removeClass("home-li-act"); $(this).addClass("home-li-act"); if($(this).text()=="上周"){ family(1) } if($(this).text()=="本周"){ family(0) } }) $(".lonin-yes").hover(function () { $(this).find(".info-pop-box").stop(); $(this).find(".info-pop-box").slideDown(100); },function () { $(this).find(".info-pop-box").stop(); $(this).find(".info-pop-box").slideUp(100); }); /*退出登录*/ $(".outlogin").click(function () { $(".pop-outlogin").fadeIn(100); $(".black-bg").fadeIn(100); }); $(".pop-outlogin .close").click(function () { $(".pop-outlogin").fadeOut(100); $(".black-bg").fadeOut(100); }); $(".pop-outlogin .canceloutlogin").click(function () { $(".pop-outlogin").fadeOut(100); $(".black-bg").fadeOut(100); }); //熱門榜 hot() function hot(){ $.ajax({ url:$ip+"weblive/room/hotlist.html", data:{ uid:0, type:2 }, type:"post", error: function (msg) { console.log('请求出错'); }, success: function (msg) { var data=JSON.parse(msg); hotListArr=JSON.parse(msg); var html=[]; for(var i=0;i<data.rooms.length;i++){ html+='<li>'; html+='<img class="play-svg" style="position: absolute;z-index: 100;width: 150px;left: 50%;margin-left: -75px;top: 45%;margin-top: -90px;transition: 0.6s all;opacity: 0" src="images/play.svg">' html+='<i style="display: none">'+data.rooms[i].uid+'</i>' html+='<div class="home-box-left-face-box">'; // if(data.rooms[i].family!=''){ // html+='<div class="home-box-left-family">'; // html+='<div class="text-div">'; // html+=''+data.rooms[i].family+' <img class="text-div-l" src="images/l.png" alt="">'; // html+='<div class="zhao"></div>'; // html+='<img class="text-div-r" src="images/r.png" alt="">'; // html+='</div>'; // html+='</div>'; // } html+='<img class="home-box-left-face" src='+cdn+''+data.rooms[i].face+'?x-oss-process=image/resize,w_500 alt="">'; html+='</div>'; html+='<div class="home-box-left-b">'; html+='<p class="home-box-left-b-name">'+data.rooms[i].nickname+'</p>'; html+='<p><span class="home-box-left-b-city">'+data.rooms[i].city+'</span><span class="home-box-left-b-man">'; html+='<img src="images/man.jpg" alt=""> '+data.rooms[i].viewer+'</span></p>'; html+='</div>'; html+='</li>'; } $(".home-box-left-ul").html(html); //*******************banner图热门播放列表********************** var html2=[]; for(var i=0;i<4;i++){ if(data.rooms[i]!=undefined){ if(i==0) html2+='<div class="banner-mc-click">'; else html2+='<div>'; html2+='<i style="display: none">'+data.rooms[i].uid+'</i>' html2+='<b style="display: none">'+i+'</b>' html2+='<img class="banner-mc-face" src='+cdn+''+data.rooms[i].face+'?x-oss-process=image/resize,w_500 alt="">'; if(data.rooms[i].introduce!='') html+='<p>'+data.rooms[i].introduce+'</p>' else html2+='<p>'+data.rooms[i].nickname+'</p>'; html2+='</div>'; } } $(".banner-r-list").html(html2) $(".home-box-left-ul li").on("click", function () { roomID=$(this).children("i").text(); window.location.href="room/index.html?roomID="+roomID; }) $(".home-box-left-ul li").on({ mouseover : function(){ $(this).children(".home-box-left-face-box").css('filter','blur(2px)') $(this).children(".play-svg").css("opacity",'1'); $(this).children(".play-svg").css("width",'80px'); $(this).children(".play-svg").css("margin-left",'-40px'); $(this).children(".play-svg").css("margin-top",'-55px'); }, mouseout : function(){ $(this).children(".home-box-left-face-box").css('filter','blur(0px)') $(this).children(".play-svg").css("opacity",'0'); $(this).children(".play-svg").css("width",'150px'); $(this).children(".play-svg").css("margin-left",'-75px'); $(this).children(".play-svg").css("margin-top",'-90px'); } }) //************播放第一个**************** playNum=0 join(data.rooms[0].uid,"tempjoin") //****************点击切换首页****************** } }) } // 魅力日榜 sexy(0) function sexy(i){ $.ajax({ url:$ip+"weblive/rank/daycharm.html", data:{ uid:0, day:i }, type:"post", error: function (msg) { console.log('请求出错'); }, success: function (msg) { var data=JSON.parse(msg); $(".ul1").html(""); var html=[]; for(var i= 0;i<data.ranklist.length;i++){ html+='<li>'; if(i<3){ html+='<span class="home-li-wins"><img src=images/m'+(i+1)+'.png alt=""></span>'; }else{ html+='<span class="home-li-wins">'+(i+1)+'</span>'; } html+='<span class="home-li-face"><img src='+cdn+''+data.ranklist[i].face+'?x-oss-process=image/resize,w_100 alt=""></span>'; html+='<span class="home-li-name">'; html+='<p class="home-li-nick">'+data.ranklist[i].nickname+' <img src=https://zhibocdn.lvdou66.com/comm/level/'+data.ranklist[i].level+'.png alt=""></p>'; html+='<p class="home-li-id">'+data.ranklist[i].score+'</p>'; html+='</span>'; html+='</li>'; } $(".ul1").html(html); $(".ul1").scrollBar(); } }) } // sexyWeek() function sexyWeek(){ $.ajax({ url:$ip+"weblive/rank/charmweek.html", data:{ uid:0, lastweek:0 }, type:"post", error: function (msg) { console.log('请求出错'); }, success: function (msg) { var data=JSON.parse(msg); var html=[]; $(".ul1").html(''); for(var i= 0;i<data.ranklist.length;i++){ html+='<li>'; if(i<3){ html+='<span class="home-li-wins"><img src=images/m'+(i+1)+'.png alt=""></span>'; }else{ html+='<span class="home-li-wins">'+(i+1)+'</span>'; } html+='<span class="home-li-face"><img src='+cdn+''+data.ranklist[i].face+'?x-oss-process=image/resize,w_100 alt=""></span>'; html+='<span class="home-li-name">'; html+='<p class="home-li-nick">'+data.ranklist[i].nickname+' <img src=https://zhibocdn.lvdou66.com/comm/level/'+data.ranklist[i].level+'.png alt=""></p>'; html+='<p class="home-li-id">'+data.ranklist[i].score+'</p>'; html+='</span>'; html+='</li>'; } $(".ul1").html(html); $(".ul1").scrollBar(); } }) } // 富豪日榜 rich(0) function rich(i){ $.ajax({ url:$ip+"weblive/rank/dayrich.html", data:{ uid:0, day:i }, type:"post", error: function (msg) { console.log('请求出错'); }, success: function (msg) { var data=JSON.parse(msg); $(".ul2").html(""); var html=[]; for(var i= 0;i<data.ranklist.length;i++){ html+='<li>'; if(i<3){ html+='<span class="home-li-wins"><img src=images/m'+(i+1)+'.png alt=""></span>'; }else{ html+='<span class="home-li-wins">'+(i+1)+'</span>'; } html+='<span class="home-li-face"><img src='+cdn+''+data.ranklist[i].face+'?x-oss-process=image/resize,w_100 alt=""></span>'; html+='<span class="home-li-name">'; html+='<p class="home-li-nick">'+data.ranklist[i].nickname+' <img src=https://zhibocdn.lvdou66.com/comm/level/'+data.ranklist[i].level+'.png alt=""></p>'; html+='<p class="home-li-id">'+data.ranklist[i].score+'</p>'; html+='</span>'; html+='</li>'; } $(".ul2").html(html); $(".ul2").scrollBar(); } }) } function richWeek(){ $.ajax({ url:$ip+"weblive/rank/richweek.html", data:{ uid:0, lastweek:0 }, type:"post", error: function (msg) { console.log('请求出错'); }, success: function (msg) { var data=JSON.parse(msg); var html=[]; for(var i= 0;i<data.ranklist.length;i++){ html+='<li>'; if(i<3){ html+='<span class="home-li-wins"><img src=images/m'+(i+1)+'.png alt=""></span>'; }else{ html+='<span class="home-li-wins">'+(i+1)+'</span>'; } html+='<span class="home-li-face"><img src='+cdn+''+data.ranklist[i].face+'?x-oss-process=image/resize,w_100 alt=""></span>'; html+='<span class="home-li-name">'; html+='<p class="home-li-nick">'+data.ranklist[i].nickname+' <img src=https://zhibocdn.lvdou66.com/comm/level/'+data.ranklist[i].level+'.png alt=""></p>'; html+='<p class="home-li-id">'+data.ranklist[i].score+'</p>'; html+='</span>'; html+='</li>'; } $(".ul2").html(html); $(".ul2").scrollBar(); } }) } //家族版单 family(1) function family(i){ $.ajax({ url:$ip+"weblive/rank/weekrank.html", data:{ week:i, page:1 }, type:"post", success: function (msg) { var data=JSON.parse(msg); var html=[]; for(var i=0;i<data.data.length;i++){ html+='<li>'; if(i<3){ html+='<span class="home-li-wins"><img src=images/m'+(i+1)+'.png alt=""></span>'; }else{ html+='<span class="home-li-wins">'+(i+1)+'</span>'; } html+='<span class="home-li-face"><img src='+cdn+''+data.data[i].face+'?x-oss-process=image/resize,w_100></span>'; html+='<span class="home-li-name">'; html+='<p class="home-li-nick">'+data.data[i].familyname+'</p>'; html+='<p class="home-li-id">族长:'+data.data[i].nickname +'</p>'; html+='</span>'; html+='</li>'; } $(".ul4").html(html); $(".ul4").scrollBar(); } }) } //模擬滾動條 $(".ul1").on({ mouseover : function(){ $(this).children(".zl-scrollBarBox").children(".zl-scrollBar").css('opacity','1'); } , mouseout : function(){ $(this).children(".zl-scrollBarBox").children(".zl-scrollBar").css('opacity','0'); } }); $(".ul2").on({ mouseover : function(){ $(this).children(".zl-scrollBarBox").children(".zl-scrollBar").css('opacity','1'); } , mouseout : function(){ $(this).children(".zl-scrollBarBox").children(".zl-scrollBar").css('opacity','0'); } }); $(".star-ul").on({ mouseover : function(){ $(this).children(".zl-scrollBarBox").children(".zl-scrollBar").css('opacity','1'); } , mouseout : function(){ $(this).children(".zl-scrollBarBox").children(".zl-scrollBar").css('opacity','0'); } }) $(".ul4").on({ mouseover : function(){ $(this).children(".zl-scrollBarBox").children(".zl-scrollBar").css('opacity','1'); } , mouseout : function(){ $(this).children(".zl-scrollBarBox").children(".zl-scrollBar").css('opacity','0'); } }); chromeOk=false; function join(uid,joinType,k){ $.ajax({ url: $ip + "weblive/live/"+joinType+".html", data: { uid: 7878549, roomid: uid, type:1, token:k, }, type: "post", error: function (msg) { console.log('请求出错'); }, success: function (msg) { var data = JSON.parse(msg); if(data.code==-20036){ layer.msg("该直播已结束,已为你切换直播"); // hot() } if(data.code!=1){ playNum++; if(playNum>3){ playNum=4 } if(playNum<4)join(hotListArr.rooms[playNum].uid,"tempjoin") $('.banner-r-list div').eq(playNum).siblings("div").removeClass("banner-mc-click") $('.banner-r-list div').eq(playNum).addClass('banner-mc-click') return; } $(".video-l-name").text(data.room.nickname); $(".coupon").text(data.room.bonds) $(".attention").text(data.room.follow); $(".fans").text(data.room.fans) $(".video-l-top1-face").attr("src",cdn+data.room.face+"?x-oss-process=image/resize,w_100") if(data.room.richlevel==10000){ $(".video-l-top1-level").attr('src',"https://zhibocdn.lvdou66.com/comm/level/gf.png") }else{ $(".video-l-top1-level").attr('src',"https://zhibocdn.lvdou66.com/comm/level/"+data.room.richlevel+".png") } var html=[]; //这有个谷歌66没声音的问题,有空回来解决 var userAgent = navigator.userAgent; if (userAgent.indexOf("Chrome") > -1&&chromeOk==false){ html+='<video style="display: inline;" id="videoElement" muted class="video-play"></video>'; }else{ html+='<video style="display: inline;" id="videoElement" class="video-play"></video>'; } html+='<div class="banner-video-btn">进入直播间</div>'; html+='<i style="display: none">'+data.room.roomid+'</i>'; $('.banner-video-c').html(html); $(".banner-video-r span").text(data.room.roomid) //尼莫的杰作 var nimoUrl=data.url.split(':',2)[1] // setTimeout(function () { if (flvjs.isSupported()) { var videoElement = document.getElementById('videoElement'); var flvPlayer = flvjs.createPlayer({ type: 'flv', url: 'https:'+nimoUrl }); flvPlayer.attachMediaElement(videoElement); flvPlayer.load() setTimeout(function() { flvPlayer.play(); }, 500); flvPlayer.on("error", function (err) { // window.location.reload(); //********************播放失败切换*********************** playNum++; if(playNum>3){ playNum=4 } if(playNum<4)join(hotListArr.rooms[playNum].uid,"tempjoin") $('.banner-r-list div').eq(playNum).siblings("div").removeClass("banner-mc-click") $('.banner-r-list div').eq(playNum).addClass('banner-mc-click') }) var t1=setInterval(function () { if(sessionStorage.out=="true"){ // flvPause() clearInterval(t1) playNum++; sessionStorage.out="false"; $(".banner-r-list div").removeClass("banner-mc-click"); $(".banner-r-list div").eq(playNum).addClass("banner-mc-click"); if(playNum<4)join($(".banner-r-list").children("div").eq(playNum).children("i").text(),"tempjoin") return; } },3000) } // },100) //断掉上一个流 $(".banner-r-list >div").unbind("click") $(".banner-r-list div").on("click", function () { chromeOk=true; join($(this).children("i").text(),"tempjoin") playNum=$(this).children("b").text(); $(this).siblings("div").removeClass("banner-mc-click") $(this).addClass("banner-mc-click") flvPlayer.pause(); flvPlayer.unload(); flvPlayer.detachMediaElement(); flvPlayer.destroy(); flvPlayer = null; }) $(".banner-video-btn").on("click", function () { window.location.href="room/index.html?roomID="+data.room.roomid }) document.addEventListener('DOMContentLoaded', function () { flv_load(); }); } }) } function flv_pause() { flvPlayer.pause(); }