<script type="text/javascript"> |
|
<!-- |
|
var classId = 1;//类型Id(歌曲、歌手) |
|
var typeId = 1;//榜单详细类型Id(热度榜、搜索榜) |
|
var param = location.search; |
|
var page = 1,pageSize=50, pagepaper=1,pagesizepaper=4,IsGetInfo = false; |
|
if ((param != null) && (typeof (param) != "undefined") && param != '') { |
|
var params = param.substring(1).split('&'); |
|
classId = params[0].split('=')[1]; |
|
typeId = params[1].split('=')[1]; |
|
} |
|
//默认调用 |
|
$(function() { |
|
showListData(classId, typeId); |
|
$('.play_gray').die('click'); |
|
}); |
|
|
|
//动态显示列表数据 |
|
function showListData(cId, tId, event) { |
|
IsGetInfo = false; |
|
//add by lidong 20121129 |
|
var target = event; |
|
if (target) { |
|
$('#left').find('li').removeClass('hover'); |
|
$(target).parent('li').addClass('hover'); |
|
} else { |
|
$('#left').find('li').removeClass('hover'); |
|
$('#left').find('li[type="'+tId+'"]').addClass('hover'); |
|
} |
|
//add end |
|
classId = cId; |
|
typeId = tId; |
|
page = 1; |
|
pagepaper = 1; |
|
window.scroll(0,0); |
|
//获取数据 |
|
getAllRankings(); |
|
} |
|
//获取歌手歌曲top列表数据 |
|
function getAllRankings() { |
|
var url=''; |
|
if(typeId== 13 || typeId== 14 || typeId== 11 || typeId== 5){ |
|
url = config.migu_top_list_act + "?type=" + typeId; |
|
}else{ |
|
url = config.migu_more_list_act + "?type=" + typeId+"&page="+page+"&pageSize="+pageSize; |
|
} |
|
$.ajax( { |
|
type : "GET", |
|
url : url, |
|
timeout : 30000, |
|
dataType : "JSON", |
|
error : function(response) { |
|
alert('request data error'); |
|
}, |
|
beforeSend : function() { |
|
$("#right").html('<img width="32" height="32" src="images/loading.gif" style="vertical-align:middle;" alt="正在加载数据中" title="正在加载数据中"/>'); |
|
}, |
|
success : function(data) { |
|
document.title='咪咕音乐指数-'+getNameByClassId(typeId); |
|
$('.mb5').html('<a href="index.html">指数</a>>'+getNameByClassId(typeId)); |
|
var name = classId == 1 ? "歌曲" : "歌手"; |
|
var styleclas = classId==1?"title_song":"title_singer"; |
|
var songorsinger = classId == 1 ? "soundmsgspan01": "soundmsgspan08"; |
|
var rankingByRanking = ''; |
|
rankingByRanking += '<div class="ind_tit"><ul><li class="+styleclas+"></li></ul></div>' |
|
if (data.contents) { |
|
//歌曲 |
|
if (classId == 1) { |
|
|
|
rankingByRanking +='<ul class="music_list music_list_hide h_music_list h_music_libray_list"><li class="list list_title_color"><span class="fl soundmsgspan08">排名</span><span class="fl soundmsgspan08 mr20">趋势</span><span class="fl soundmsgspan10 mr20">歌曲名</span><span class="fl soundmsgspan01">指数</span></li>'; |
|
}//歌手 |
|
else { |
|
rankingByRanking += '<ul class="music_list music_list_hide h_music_list h_music_libray_list"><li class="list list_title_color"><span class="fl soundmsgspan08">排名</span><span class="fl soundmsgspan08 mr20">趋势</span><span class="fl soundmsgspan09">歌手</span><span class="fr mr10">指数</span></li>'; |
|
} |
|
$.each(data.contents,function(key, items) { |
|
// var rankingindex = key + 1; |
|
var rankingindex = key + 1+((page-1)*pageSize); |
|
if (rankingindex < 10) { |
|
rankingindex = '0' + rankingindex; |
|
} |
|
//歌曲 |
|
if (classId == 1) { |
|
|
|
rankingByRanking +='<li><span class="fl soundmsgspan08 ">'+ |
|
'<span class="num num_yellow_'+rankingindex+' ml10 dis_in">'+ rankingindex+ '</span></span>'+ |
|
'<span class="fl soundmsgspan08 mr20">'+ getUpDown(items.weekUpdown)+ '</span>'+ |
|
'<span class="fl soundmsgspan10 mr20"><a href="detail.html?type=0&class=1&num='+data.rankingId+'&contentId='+ items.contentId + '" title="'+ items.name+ '" target="_blank">'+ subString(items.name, 26, true)+ '</a></span>'+ |
|
'<span class="fl percent soundmsgspan01"><a href="detail.html?type=0&class=1&num='+data.rankingId+'&contentId='+ items.contentId + '" target="_blank" >' + formatNumber(items.amount,',')+'</a></span>'+ |
|
'<span class="icon_tools fr">'+getPlayIconStyle(2,items.businessId)+'</span>'+ |
|
'</li>'; |
|
}//歌手 |
|
else if (classId == 2) { |
|
|
|
rankingByRanking +='<li><span class="fl soundmsgspan08 ">'+ |
|
'<span class="num num_yellow_'+rankingindex+' ml10 dis_in">'+ rankingindex+ '</span></span>'+ |
|
'<span class="fl soundmsgspan08 mr20">'+ getUpDown(items.weekUpdown)+ '</span>'+ |
|
'<span class="fl soundmsgspan10"><a href="detail.html?type=0&class=2&num='+data.rankingId+'&contentId='+ items.contentId + '" target="_blank">'+ subString(items.name, 26, true)+ '</a></span>'+ |
|
'<span class="fr percent"><a href="detail.html?type=0&class=2&num='+data.rankingId+'&contentId='+ items.contentId + '" target="_blank" >' + formatNumber(items.amount,',')+'</a></span>'+ |
|
'</li>'; |
|
} |
|
}); |
|
rankingByRanking += '</ul>'; |
|
$('#right').html(rankingByRanking); |
|
} else { |
|
$('#right').html(rankingByRanking + '<ul><li>暂无数据</li></ul>'); |
|
} |
|
} |
|
}); |
|
} |
|
|
|
$(window).bind( |
|
"scroll", |
|
function() { |
|
if ($(document).height() - $(this).scrollTop() |
|
- $(this).height() <= 100) { |
|
if(!IsGetInfo){ |
|
if(typeId== 13 || typeId== 14 || typeId== 11 || typeId== 5){ |
|
IsGetInfo = true;return false; |
|
}else{ |
|
getPlushList(); |
|
} |
|
} |
|
} |
|
}); |
|
|
|
//下一页 |
|
function nextpage(){ |
|
pagepaper++; |
|
page++; |
|
$('#right').empty(); |
|
scroll(0,0); |
|
IsGetInfo = false; |
|
getAllRankings(); |
|
} |
|
//上一页 |
|
function prepage(){ |
|
pagepaper--; |
|
page = (pagesizepaper*(pagepaper-1)); |
|
if(page<1){ |
|
page=1; |
|
}else{ |
|
page = page+1; |
|
} |
|
$('#right').empty(); |
|
scroll(0,0); |
|
IsGetInfo = false; |
|
getAllRankings(); |
|
} |
|
function getPlushList(){ |
|
IsGetInfo = true; |
|
if((page%pagesizepaper)==0){ |
|
IsGetInfo = true; |
|
//alert(page); |
|
if(page<5){ |
|
$('#right ul.music_list').append('<li id="change_pages" style="text-align:center"><a href="javascript:nextpage();">下一页</a></li>'); |
|
}else{ |
|
$('#right ul.music_list').append('<li id="change_pages" style="text-align:center"><a href="javascript:prepage();">上一页</a><a href="javascript:nextpage();">下一页</a></li>'); |
|
} |
|
return ; |
|
}else{ |
|
page++; |
|
$.ajax({ |
|
type : "GET", |
|
url : config.migu_more_list_act + "?type=" + typeId+"&page="+page+"&pageSize="+pageSize, |
|
timeout : 30000, |
|
dataType : "JSON", |
|
beforeSend : function() { |
|
//$("#right").html('<img width="32" height="32" src="images/loading.gif" style="vertical-align:middle;" alt="正在加载数据中" title="正在加载数据中"/>'); |
|
$('#right ul.music_list').append('<li id="waterfallbefore" style="text-align:center"><img width="32" height="32" src="images/loading.gif" style="vertical-align:middle;" alt="正在加载数据中" title="正在加载数据中"/></li>'); |
|
}, |
|
error : function(response) { |
|
alert('request data error'); |
|
}, |
|
success : function(data) { |
|
$('#waterfallbefore').remove(); |
|
if(!data) |
|
{ |
|
IsGetInfo = true; |
|
if(pagepaper>1){ |
|
$('#right ul.music_list').append('<li id="change_pages" style="text-align:center"><a href="javascript:prepage();">上一页</a></li>'); |
|
}else{ |
|
$('#right ul.music_list').append('<li style="text-align:center">没有更多的数据</li>'); |
|
} |
|
return; |
|
} |
|
//* |
|
if (data.contents) { |
|
$('#waterfallbefore').remove(); |
|
if(data.contents==''){ |
|
IsGetInfo = true; |
|
if(pagepaper>1){ |
|
$('#right ul.music_list').append('<li id="change_pages" style="text-align:center"><a href="javascript:prepage();">上一页</a></li>'); |
|
}else{ |
|
$('#right ul.music_list').append('<li style="text-align:center">没有更多的数据</li>'); |
|
} |
|
return ; |
|
}else{ |
|
var rankingByRanking = ''; |
|
$.each(data.contents,function(key, items) { |
|
var rankingindex = key + 1+((page-1)*pageSize); |
|
if (rankingindex < 10) { |
|
rankingindex = '0' + rankingindex; |
|
} |
|
//歌曲 |
|
if (classId == 1) { |
|
rankingByRanking ='<li><span class="fl soundmsgspan08 ">'+ |
|
'<span class="num ml10 dis_in">'+ rankingindex+ '</span></span>'+ |
|
'<span class="fl soundmsgspan08 mr20">'+ getUpDown(items.weekUpdown)+ '</span>'+ |
|
'<span class="fl soundmsgspan10 mr20"><a href="detail.html?type=0&class=1&num='+data.rankingId+'&contentId='+ items.contentId + '" title="'+ items.name+ '" target="_blank">'+ subString(items.name, 26, true)+ '</a></span>'+ |
|
'<span class="fl percent soundmsgspan01"><a href="detail.html?type=0&class=1&num='+data.rankingId+'&contentId='+ items.contentId + '" target="_blank" >' + formatNumber(items.amount,',')+'</a></span>'+ |
|
'<span class="icon_tools fr">'+getPlayIconStyle(2,items.businessId)+'</span>'+ |
|
'</li>'; |
|
}//歌手 |
|
else if (classId == 2) { |
|
rankingByRanking ='<li><span class="fl soundmsgspan08 ">'+ |
|
'<span class="num num_yellow_'+rankingindex+' ml10 dis_in">'+ rankingindex+ '</span></span>'+ |
|
'<span class="fl soundmsgspan08 mr20">'+ getUpDown(items.weekUpdown)+ '</span>'+ |
|
'<span class="fl soundmsgspan10"><a href="detail.html?type=0&class=2&num='+data.rankingId+'&contentId='+ items.contentId + '" target="_blank">'+ subString(items.name, 26, true)+ '</a></span>'+ |
|
'<span class="fr percent"><a href="detail.html?type=0&class=2&num='+data.rankingId+'&contentId='+ items.contentId + '" target="_blank" >' + formatNumber(items.amount,',')+'</a></span>'+ |
|
'</li>'; |
|
} |
|
$('#right ul.music_list').append(rankingByRanking); |
|
}); |
|
IsGetInfo = false; |
|
} |
|
} else { |
|
IsGetInfo = true; |
|
if(pagepaper>1){ |
|
$('#right ul.music_list').append('<li id="change_pages" style="text-align:center"><a href="javascript:prepage();">上一页</a></li>'); |
|
}else{ |
|
$('#right ul.music_list').append('<li style="text-align:center">没有更多的数据</li>'); |
|
} |
|
return; |
|
} |
|
} |
|
}); |
|
} |
|
} |
|
--> |
|
|