why.xingtongworld.com项目
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.
 
 
 
 
 

226 lines
9.8 KiB

{layout name="public/layout" /}
<div class="bbs">
<div class="navs">
{volist name="cates" id="vo" key="key"}
<a href="{:url('index',['pid'=>$vo['id']])}" class="{$key==1?'active':''}" data-id="{$vo.id}">{$vo.name}</a>
{/volist}
</div>
<div class="contentwraper">
<div class="content">
<div class="title">{:isset($list['typename'])?'【'.$list['typename'].'】':''}{$list.name|RemoveXSS}</div>
<div class="user">
<div class="img">
{if condition="empty($list['poster'])"}
<img src="{$yf_theme_path}public/img/user.png" width="100%"/>
{else}
<img src="{$list.poster}" width="100%" οnerrοr="javascript:this.src='{$yf_theme_path}public/img/user.png';"/>
{/if}
</div>
<div class="detail">
<div class="name">{$list.uname}</div>
<div class="date">{$list.create_time|date="Y-m-d H:i",###}</div>
</div>
</div>
<div class="info">{$list.content|htmlspecialchars_decode|RemoveXSS}</div>
</div>
<div class="comwraper">
<div class="title">全部评论</div>
<div class="comments">
<div class="commentswraper">
{volist name="comments" id="vo"}
<div class="comment" data-id="{$vo.id}" data-uid="{$vo.mid}" >
<div class="poster">
{if condition="empty($vo['poster'])"}
<img src="{$yf_theme_path}public/img/user.png" width="100%"/>
{else}
<img src="{$vo.poster}" width="100%" οnerrοr="javascript:this.src='{$yf_theme_path}public/img/user.png';"/>
{/if}
</div>
<div class="showcom">
<div class="uname">{$vo.uname} {if condition="$vo['top']"} <span style="color:red">(精华)</span>{/if}<i class="fa fa-ellipsis-h"></i></div>
<div class="txt">{$vo.content|htmlspecialchars_decode|RemoveXSS}</div>
{if condition="count($vo['parent'])"}
<div class="replay"><span class="red">{$vo.parent.uname}:</span> {$vo.parent.content|htmlspecialchars_decode|RemoveXSS}</div>
{/if}
<div class="tool">
<div class="date">{$vo.create_time|date="Y-m-d H:i",###}</div>
<div class="btns">
{if condition="$list['open'] and $vo['mid'] neq $mid"}<div class="comt"><i class="fa fa-commenting-o"></i></div>{/if}
<div class="love"><i class="fa fa-thumbs-o-up"></i><span> {$vo.love}</span></div>
{if condition="$vo['mid'] neq $mid"}<div class="comt chat"><a href="javascript:void(0);" title="私信">私信</a></div>{/if}
</div>
</div>
</div>
</div>
{/volist}
</div>
</div>
</div>
{if condition="$list['open']"}
<div class="inputwraper">
<div class="replay"><span class="txt"></span><span class="icon"><i class="fa fa-close"></i></span></div>
<input type="hidden" name="id" value="{$list.id}" />
<input type="hidden" name="pid" value="0" />
<div class="input"><i class="fa fa-edit"></i><textarea name="word" rows="1" placeholder="发表您的观点" ></textarea></div>
<div class="btns">
<div class="comt">评论</div>
</div>
</div>
{/if}
</div>
</div>
<script src="__PUBLIC__/layer/layer_home.js" type="text/javascript"></script>
<link rel="stylesheet" href="{$yf_theme_path}public/css/dropload.css">
<script src="{$yf_theme_path}public/js/dropload.js"></script>
<script>
function ajaxContent(pagenum){
// 页数
var page ={$page};
if(typeof pagenum!='undefined')page=pagenum;
// 每页展示5个
var size =10;
// dropload
$('.comments').dropload({
scrollArea : window,
loadDownFn : function(me){
page++;
// 拼接HTML
var result = '';
var pid=$("[name='id']").val();
var url='{:url("ajaxlog")}';
var params={};
params.pid=pid;
params.page=page;
$.post(url,params,function(res){
console.log(res);
var list=res.data;
var mid="{$mid}";
mid=parseInt(mid);
var open={$list.open};
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'){
html+='<div class="comment" data-id="'+item.id+'">';
if(item.poster){
html+="<div class='poster'><img src="+item.poster+" width='100%' οnerrοr=\"javascript:this.src='{$yf_theme_path}public/img/user.png';\"/></div>";
}else{
html+="<div class='poster'><img src='{$yf_theme_path}public/img/user.png' width='100%' /></div>";
}
html+=' <div class="showcom"><div class="uname">'+item.uname;
if(item.top){
html+='<span style="color:red">(精华)</span>';
}
html+='<i class="fa fa-ellipsis-h"></i></div>';
html+='<div class="txt">'+item.content+'</div>';
if(typeof item.parent.uname!='undefined'){
html+='<div class="replay"><span class="red">'+item.parent.uname+':</span> '+item.parent.content+'</div>';
}
html+='<div class="tool"><div class="date">'+item.create_time+'</div>';
html+='<div class="btns">';
if(open&&item.mid!=mid){
html+='<div class="comt"><i class="fa fa-commenting-o"></i></div>';
}
html+='<div class="love "><i class="fa fa-thumbs-o-up"></i><span> '+item.love+'</span></div>';
if(item.mid!=mid){
html+='<div class="comt chat"><a href="javascript:void(0);" title="私信">私信</a></div>';
}
html+='</div></div></div></div>';
}
});
// 如果没有数据
}else{
// 锁定
me.lock();
// 无数据
me.noData();
}
$(".commentswraper").append(html);
me.resetload();
}
});
}
});
}
$(function(){
var pid={$list.parent_id};
ajaxContent(1);
$(".navs a").click(function(){
$(".navs a").removeClass('active');
$(this).addClass('active');
});
$(".navs a").each(function(k,item){
var id=$(item).data('id');
if(id==pid&&k!=0){
$(".navs a").eq(k).trigger('click');
}
});
$("body").on('click','.comment .chat',function(event){
event.stopPropagation();
event.preventDefault();
var parent=$(this).parents(".comment");
var id=parent.data('uid');
var url="{:url('bbs/chatroom')}?uid="+id;
window.location.href=url;
});
$("body").on('click','.comment .love',function(){
var parent=$(this).parents(".comment");
var hasClass=$(this).hasClass("disabled");
if(hasClass)return false;
var id=parent.data('id');
var pid=$("[name='id']").val();
var url="{:url('love')}";
var love=$(this).find("span").html();
var obj=this;
love=parseInt(love);
$.post(url,{id:id,pid:pid},function(res){
console.log(res);
layer.msg(res.msg);
if(res.code){
$(obj).find("span").html(' '+(love+1));
$(obj).addClass("disabled");
}
});
});
{if condition="$list['open']"}
$("body").on('click','.comment .comt',function(){
var parent=$(this).parents(".comment");
var txt=parent.find(".txt").html();
var id=parent.data('id');
console.log(txt);
$("[name='pid']").val(id);
$(".replay .txt").html("回复:"+txt);
$(".inputwraper .replay").show();
});
$(".replay .fa-close").click(function(){
$(".inputwraper .replay").hide();
$(".replay .txt").html("");
});
$(".inputwraper .comt").click(function(){
var id=$("[name='id']").val();
var pid=$("[name='pid']").val();
var url="{:url('comment')}";
var word=$("[name='word']").val();
if(typeof word=='undefined'||word==''){
layer.msg("请输入您的观点");
return false;
}
$.post(url,{id:id,pid:pid,content:word},function(res){
console.log(res);
layer.msg(res.msg);
if(res.code){
$("[name='word']").val("");
}
});
});
{/if}
});
</script>