items_news.php 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <?php
  2. /**
  3. * 桌面首页项(新闻资讯)
  4. */
  5. defined('HOST') or die ('not access');
  6. ?>
  7. <script>
  8. morenewss=function(){
  9. addtabs({num:'news',url:'flow,page,news,atype=my',icons:'volume-up',name:'新闻资讯'});
  10. }
  11. homeobject.show_news_list=function(a){
  12. var s='',a1,i,typa = a.typearr,act,c1;
  13. typa.unshift({'name':'新闻'});
  14. for(i=0;i<typa.length;i++){
  15. act='';
  16. c1 = (i==0)?'0':'1';
  17. if(i==0)act='active';
  18. s+='<li tab="'+i+'" onclick="homeobject.clicknewstabs('+i+',\''+typa[i].name+'\')" class="'+act+'"><a style="TEXT-DECORATION:none; border-top:0; border-left-width:'+c1+'px;border-radius:0">'+typa[i].name+'</a></li>';
  19. }
  20. $('#newstabs_{rand}').html(s);
  21. this.newsrows = [];
  22. this.newsrows[0] = a.rows;
  23. this.shownewsss(a.rows);
  24. }
  25. homeobject.clicknewstabs=function(oi,na){
  26. if(get('losnew{rand}'))return;
  27. var o1 = $('#newstabs_{rand}');
  28. o1.find('li').removeClass('active');
  29. o1.find('li[tab="'+oi+'"]').addClass('active');
  30. var das = this.newsrows[oi];
  31. if(typeof(das)=='undefined'){
  32. $('#newstabs_{rand}').after('<div id="losnew{rand}" style="margin:10px" align="center">'+js.ling(30)+'</div>');
  33. js.ajax(publicmodeurl('news','getnews'),{typename:na},function(ret){
  34. homeobject.newsrows[oi]=ret;
  35. homeobject.shownewsss(ret);
  36. },'get,json');
  37. }else{
  38. this.shownewsss(das);
  39. }
  40. }
  41. homeobject.shownewsss=function(das){
  42. var i,s='',len=das.length,a1,c1,c2;
  43. $('#homenewslist{rand} a[temp]').remove();
  44. $('#losnew{rand}').remove();
  45. for(i=0;i<len;i++){
  46. a1 = das[i];
  47. c1 = (i>0) ? '1' : '0';
  48. c2 = (i==len-1) ? '0' : '1';
  49. if(!isempt(a1.fengmian)){
  50. s+='<a onclick="openxiangs(\''+a1.typename+'\',\'news\',\''+a1.id+'\');" style="TEXT-DECORATION:none;border-top-width:'+c1+'px;border-bottom-width:'+c2+'px;border-right:0;border-left:0" temp="list" class="list-group-item">';
  51. s+='<table style="background:none"><tr>';
  52. s+='<td style="padding-right:10px"><div style="height:80px;display:table-cell;overflow:hidden;vertical-align:middle"><img src="'+a1.fengmian+'" width="100"></div></td>';
  53. s+='<td><h5 class="text-left">'+a1.title+'</h5><div><small>'+a1.smallcont+'</small></div></td>';
  54. s+='</tr></table>';
  55. s+='</a>';
  56. }else{
  57. s+='<a onclick="openxiangs(\''+a1.typename+'\',\'news\',\''+a1.id+'\');" style="TEXT-DECORATION:none;border-right:0;border-left:0;border-bottom-width:'+c2+'px;border-top-width:'+c1+'px" temp="list" class="list-group-item">◇【'+a1.typename+'】'+a1.title+'</a>';
  58. }
  59. }
  60. $('#homenewslist{rand}').append(s);
  61. }
  62. </script>
  63. <div class="panel panel-danger">
  64. <div class="panel-heading">
  65. <h3 class="panel-title"><i class="icon-globe"></i> <?=$itemnowname?>
  66. <a style="float:right;TEXT-DECORATION:none" href="javascript:;" onclick="morenewss()">更多&gt;&gt;</a>
  67. </h3>
  68. </div>
  69. <div class="panel-body" id="homenewslist{rand}" style="padding:0px">
  70. <ul class="nav nav-tabs" id="newstabs_{rand}"></ul>
  71. </div>
  72. </div>
粤ICP备19079148号