You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
298 lines
13 KiB
298 lines
13 KiB
{layout name="layout" /}
|
|
<input type="hidden" name="parent_id" value="{$pid}" />
|
|
<input type="hidden" name="child_id" value="{$cid}" />
|
|
<input type="hidden" name="type" value="subject" />
|
|
<div class="boxwraper">
|
|
<div class="leftwraper">
|
|
<div class="navs">
|
|
{volist name="cates" id="vo" key="key"}
|
|
<a href="javascript:void(0);" class="{$key==1?'active':''}" data-id="{$vo.id}">{$vo.name}</a>
|
|
{/volist}
|
|
<div class="searchbox"><i class="fa fa-search"></i><input name="search" placeholder="帖子标题或内容"></div>
|
|
</div>
|
|
<div class="topwraper">
|
|
{volist name="cates" id="vo" key="key"}
|
|
{if condition="count($vo['tops'])"}
|
|
<div class="toplist {$key==1?'active':''}">
|
|
{volist name="vo.tops" id="vo"}
|
|
<div class="titem">
|
|
<a {if condition="$vo['link'] neq '' and $vo['link'] neq 'null'"}href="{$vo.link}" target="__blank"{else}href="{:url('detail',['id'=>$vo['id']])}"{/if} ><span class="icon">顶</span><span class="txt">{$vo.name|RemoveXSS}</span></a>
|
|
</div>
|
|
{/volist}
|
|
</div>
|
|
{/if}
|
|
{/volist}
|
|
</div>
|
|
<div class="showwraper">
|
|
<div class="subjects">
|
|
<div class="subject active" data-type="subject"><a href="javascript:void(0);">按主题</a></div>
|
|
<div class="subject" data-type="comment"><a href="javascript:void(0);">按回复</a></div>
|
|
<div class="subject" data-type="hot"><a href="javascript:void(0);">最热</a></div>
|
|
<div class="subject" data-type="marrow"><a href="javascript:void(0);">精华</a></div>
|
|
<div class="all desc"><a href="javascript:void(0);"><span>全部</span><span class="icon"><i class="fa fa-sort-down"></i></span></a></div>
|
|
</div>
|
|
<div class="childswraper">
|
|
{volist name="cates" id="vo" key="key"}
|
|
{if condition="count($vo['childs'])"}
|
|
<div class="childsrow">
|
|
<a href="javascript:void(0);" class="active" data-id="{$vo.id}">全部</a>
|
|
{volist name="vo.childs" id="jo"}
|
|
<a href="javascript:void(0);" data-id="{$jo.id}">{$jo.name}</a>
|
|
{/volist}
|
|
</div>
|
|
{/if}
|
|
{/volist}
|
|
</div>
|
|
<div class="showlists">
|
|
{volist name="cates" id="jo" key="jey"}
|
|
{if condition="count($jo['data'])"}
|
|
<div class="showlist {$jey==1?'active':''}">
|
|
<input type="hidden" name="page" value="1" />
|
|
<div class="showlistwraper">
|
|
{volist name="jo.data" id="vo"}
|
|
<div class="sitem" data-uid="{$vo.mid}" {if condition="$vo['link'] neq '' and $vo['link'] neq 'null'"}onclick="window.open('{$vo.link}')"{else}onclick="window.location.href='{:url('detail',['id'=>$vo['id']])}'"{/if}>
|
|
<div class="user">
|
|
<div class="img">
|
|
{if condition="empty($vo['poster'])"}
|
|
<img src="{$yf_home_path}public/images/user.png" width="100%"/>
|
|
{else}
|
|
<img src="{$vo.poster}" width="100%" οnerrοr="javascript:this.src='{$yf_home_path}public/images/user.png';"/>
|
|
{/if}
|
|
</div>
|
|
<div class="detail">
|
|
<div class="name">{$vo.uname}</div>
|
|
<div class="date">{$vo.create_time|date="Y-m-d H:i",###}</div>
|
|
</div>
|
|
</div>
|
|
<div class="title">{:isset($showcates[$vo['child_id']])?'【'.$showcates[$vo['child_id']].'】':''}{$vo.name|RemoveXSS}</div>
|
|
<div class="info">{$vo.content|htmlspecialchars_decode|RemoveXSS|strip_tags|sub_str=100}</div>
|
|
<div class="tool">
|
|
<div class="comment"><i class="fa fa-commenting-o"></i> {$vo.comment}</div>
|
|
{if condition="$user['member_list_id'] neq $vo['mid']"}
|
|
<div class="comment chat"><a href="javascript:void(0);" title="私信"> <i class="fa fa-comments-o" ></i></a></div>
|
|
{/if}
|
|
<div class="time">{$vo.created}</div>
|
|
</div>
|
|
</div>
|
|
{/volist}
|
|
</div>
|
|
<div class="col-xs-12 text-center list-page" align="center">
|
|
<ul id="propage{$jey-1}" class="pagination"></ul>
|
|
</div>
|
|
</div>
|
|
{/if}
|
|
{/volist}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="rightwraper">
|
|
<div class="hots">
|
|
<div class="title">讨论最热帖子</div>
|
|
<div class="wraper">
|
|
{volist name="hots" id="vo"}
|
|
<div class="ritem">
|
|
<a href="{:url('detail',['id'=>$vo['id']])}" >{$vo.name|RemoveXSS}</a>
|
|
</div>
|
|
{/volist}
|
|
</div>
|
|
</div>
|
|
<div class="interested">
|
|
<div class="title">你可能最感兴趣的帖子</div>
|
|
<div class="wraper">
|
|
{volist name="marrows" id="vo"}
|
|
<div class="ritem">
|
|
<a href="{:url('detail',['id'=>$vo['id']])}" >{$vo.name|RemoveXSS}</a>
|
|
</div>
|
|
{/volist}
|
|
</div>
|
|
</div>
|
|
<div class="postbtn">
|
|
<a href="{:url('article')}" target="__blank"><img src="{$yf_home_path}public/images/postbtn.png" class="wid100"></a>
|
|
<a href="{:url('home/center/mybbs')}" target="__blank"><img src="{$yf_home_path}public/images/userbtn.png" class="wid100"></a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<script src="{$yf_home_path}public/js/jquery.page.js"></script>
|
|
<script>
|
|
|
|
var mid={$user['member_list_id']};
|
|
function propage(meta,index){
|
|
var per_page=meta['per_page'];
|
|
var total=parseInt(meta['total']);
|
|
var current_page=parseInt(meta['current_page']);
|
|
var pages=Math.ceil(total/per_page);
|
|
var total=parseInt(meta['total']);
|
|
console.log(index,meta);
|
|
$("。showlist:eq("+index+") .list-page").append('<ul id="propage'+index+'" class="pagination"></ul>');
|
|
$("#propage"+index).createPage({
|
|
pageCount:pages,
|
|
current:current_page,
|
|
backFn:function(p){
|
|
getMore(p);
|
|
}
|
|
});
|
|
}
|
|
|
|
function getMore(curpage,change){
|
|
$('.showlists .active [name="page"]').val(curpage);
|
|
// 拼接HTML
|
|
var result = '';
|
|
var pid=$("[name='parent_id']").val();
|
|
var cid=$("[name='child_id']").val();
|
|
var keyword=$("[name='search']").val();
|
|
var type=$(".subjects .active").data("type");
|
|
var url='{:url("ajaxlist")}';
|
|
var index=$(".navs .active").index();
|
|
var params={};
|
|
params.pid=pid;
|
|
params.cid=cid;
|
|
params.type=type;
|
|
params.page=curpage;
|
|
if(typeof keyword!='undefined'&&keyword)params.keyword=keyword;
|
|
$.post(url,params,function(res){
|
|
var list=res.data;
|
|
if(typeof list.data!='undefined'){
|
|
// 锁定
|
|
var data=list.data;
|
|
var arrLen = data.length;
|
|
var html='';
|
|
if(arrLen>0){
|
|
$.each(data,function(key,item){
|
|
if(typeof item.id!='undefined'){
|
|
if(item.link!=''&&item.link!='null'&&item.link!=null){
|
|
html+="<div class='sitem' data-uid='"+item.mid+"' onclick=\"window.open('"+item.link+"')\">";
|
|
}else{
|
|
html+="<div class='sitem' data-uid='"+item.mid+"' onclick=\"window.location.href='detail/id/"+item.id+".html'\">";
|
|
}
|
|
if(item.poster){
|
|
html+="<div class='user'><div class='img'> <img src="+item.poster+" width='100%' οnerrοr=\"javascript:this.src='{$yf_home_path}public/images/user.png';\"/></div>";
|
|
}else{
|
|
html+="<div class='user'><div class='img'> <img src='{$yf_home_path}public/images/user.png' width='100%' /></div>";
|
|
}
|
|
|
|
html+='<div class="detail"><div class="name">'+item.uname+'</div>';
|
|
html+='<div class="date">'+item.create_time+'</div></div></div>';
|
|
html+='<div class="title">'+item.name+'</div>';
|
|
html+='<div class="info">'+item.content+'</div>';
|
|
html+='<div class="tool"><div class="comment"><i class="fa fa-commenting-o"></i> '+item.comment+'</div>';
|
|
if(mid!=item.mid){
|
|
html+='<div class="comment chat"><a href="javascript:void(0);" title="私信"> <i class="fa fa-comments-o" ></i></a></div>';
|
|
}
|
|
html+='<div class="time">'+item.created+'</div></div></div>';
|
|
}
|
|
});
|
|
}
|
|
$(".showlist").eq(index).find(".showlistwraper").empty().append(html);
|
|
if(typeof change!='undefined'&&change){
|
|
var meta={'current_page':list.current_page,"per_page":list.per_page,"total":list.total};
|
|
propage(meta,index);
|
|
}
|
|
}
|
|
});
|
|
}
|
|
function search(){
|
|
$("html,body").scrollTop(0);
|
|
$(".showlists .active .showlistwraper").html("");
|
|
getMore(1,1);
|
|
}
|
|
|
|
$(function(){
|
|
var pid={$pid};
|
|
$(".searchbox i").click(function(){
|
|
search();
|
|
});
|
|
{volist name="cates" id="jo" key="key"}
|
|
{if condition="count($jo['data'])"}
|
|
propage({$jo.pages|json_encode},{$key}-1);
|
|
{/if}
|
|
{/volist}
|
|
$(document).keyup(function(event){
|
|
if(event.keyCode ==13){
|
|
search();
|
|
}
|
|
});
|
|
|
|
$("body").on('click','.showlist .chat',function(event){
|
|
event.stopPropagation();
|
|
event.preventDefault();
|
|
var parent=$(this).parents(".sitem");
|
|
var id=parent.data('uid');
|
|
var url="{:url('chatroom')}?uid="+id;
|
|
window.location.href=url;
|
|
});
|
|
$(".navs a").click(function(){
|
|
$(".navs a").removeClass('active');
|
|
$(this).addClass('active');
|
|
var index=$(".navs .active").index();
|
|
$(".toplist").removeClass('active');
|
|
$(".toplist").eq(index).addClass('active');
|
|
$(".showlist").removeClass('active');
|
|
$(".showlist").eq(index).addClass('active');
|
|
|
|
$("html,body").scrollTop(0);
|
|
|
|
var pid=$(this).data('id');
|
|
$("[name='parent_id']").val(pid);
|
|
$("[name='child_id']").val(pid);
|
|
|
|
$(".childsrow").slideUp();
|
|
$(".subjects .all").removeClass("asc").addClass("desc");
|
|
$(".subjects .all").find("i").attr('class','fa fa-sort-down');
|
|
$(".subjects .subject").removeClass("active");
|
|
$(".subjects .subject").eq(0).addClass("active");
|
|
|
|
$(".showlists .active .showlistwraper").html("");
|
|
$(".showlists .active [name='page']").val(0);
|
|
//changeState(1);
|
|
getMore(1,1);
|
|
});
|
|
$(".subject").click(function(){
|
|
var index=$(".navs a.active").index();
|
|
$(".subject").removeClass('active');
|
|
$(this).addClass('active');
|
|
var type=$(this).data("type");
|
|
|
|
$("html,body").scrollTop(0);
|
|
$(".showlists .active .showlistwraper").html("");
|
|
$(".showlists .active [name='page']").val(0);
|
|
$("[name='type']").val(type);
|
|
//changeState(1);
|
|
getMore(1,1);
|
|
});
|
|
$(".navs a").each(function(k,item){
|
|
var id=$(item).data('id');
|
|
if(id==pid&&k!=0){
|
|
$(".navs a").eq(k).trigger('click');
|
|
}
|
|
});
|
|
$(".childsrow a").click(function(){
|
|
$(".childsrow a").removeClass('active');
|
|
$(this).addClass('active');
|
|
var index=$(".navs a.active").index();
|
|
var id=$(this).data("id");
|
|
|
|
$("html,body").scrollTop(0);
|
|
$(".showlists .active .showlistwraper").html("");
|
|
$(".showlists .active [name='page']").val(0);
|
|
$("[name='child_id']").val(id);
|
|
//changeState(1);
|
|
getMore(1,1);
|
|
});
|
|
$(".subjects .all").click(function(){
|
|
var has=$(this).hasClass("desc");
|
|
var index=$(".navs a.active").index();
|
|
$(".childsrow").hide();
|
|
if(has){
|
|
$(this).removeClass("desc");
|
|
$(this).addClass("asc");
|
|
$(this).find("i").attr('class','fa fa-sort-up');
|
|
$(".childsrow").eq(index).slideDown();
|
|
}else{
|
|
$(this).removeClass("asc");
|
|
$(this).addClass("desc");
|
|
$(this).find("i").attr('class','fa fa-sort-down');
|
|
$(".childsrow").eq(index).slideUp();
|
|
}
|
|
});
|
|
});
|
|
</script>
|