159 lines
7.9 KiB
PHTML
Executable File
159 lines
7.9 KiB
PHTML
Executable File
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
{include file="include/head" /}
|
|
<script type="text/javascript">
|
|
var navID = "1";
|
|
</script>
|
|
</head>
|
|
<body>
|
|
<!--top-->
|
|
{include file="include/top-product" /}
|
|
<!--top End-->
|
|
|
|
<!-- 新闻详情页 s -->
|
|
<div class="xq">
|
|
<div class="w1200">
|
|
<!-- 发表评论 -->
|
|
<?php if (!empty($list)): ?>
|
|
<div class="fb">
|
|
<div class="love1 img-responsive">
|
|
<p>已有<span id="ccount"><?php echo $total; ?></span>位网友发表评论</p>
|
|
<p><img src="__PUBLIC__/web/images/1line.png"></p>
|
|
</div>
|
|
|
|
<ul class="fbul" id="listul">
|
|
<?php foreach ($list as $k => $comment): ?>
|
|
<li>
|
|
<div class="fbimg">
|
|
<div><img src="__PUBLIC__/web/uploadfiles/image/ns<?php echo $comment['tx']; ?>.jpg"></div>
|
|
<div class="peo3"><?php echo $comment['cname']; ?></div>
|
|
<div class="peo4"><?php echo $comment['createtime']; ?></div>
|
|
</div>
|
|
<div class="fbcon" id="c<?php echo $comment['id']; ?>">
|
|
<?php
|
|
$content = '';
|
|
if ($comment['pid']) {
|
|
$child = db('Pinglun')->where(['stat' => 0, 'id' => $comment['pid']])->find();
|
|
if ($child) {
|
|
$content = '<div><div class="ccontent"><label class="clabel"><span class="ctimestamp">' . $child['createtime'] . '</span> <span class="cname">' . $child['cname'] . '</span>发表</label><br />' . $content . $child['content'] . '</div></div>';
|
|
}
|
|
echo '<div class="cli">' . $content . '</div>', $comment['content'];
|
|
} else {
|
|
echo $comment['content'];
|
|
}
|
|
?>
|
|
</div>
|
|
<div class="fbnum">
|
|
<p class="no1">NO.<?php echo $k + 1; ?></p>
|
|
<p class="no2"><a href="javascript:void(0);" onclick="answer('<?php echo $comment['id']; ?>')">回复</a></p>
|
|
</div>
|
|
<div class="clear"></div>
|
|
</li>
|
|
<?php endforeach; ?>
|
|
</ul>
|
|
<!-- 分页 s -->
|
|
<?php
|
|
if ($page) {
|
|
echo $page;
|
|
}
|
|
?>
|
|
<!-- 分页 e -->
|
|
</div>
|
|
<?php endif; ?>
|
|
<!-- 回复 -->
|
|
<div class="huifu">
|
|
<div class="love1 img-responsive">
|
|
<p>回复</p>
|
|
<p><img src="__PUBLIC__/web/images/1line.png"></p>
|
|
</div>
|
|
<div class="login">(请<a href="<?php echo url('/login'); ?>" target="_blank">登录</a>后发表评论,若无帐号可<a href="<?php echo url('/register'); ?>" target="_blank">快速注册</a>,也可使用<a href="#">QQ</a>帐号登录。)</div>
|
|
<textarea id="ccont"></textarea>
|
|
<a href="javascript:void(0);" class="replay" onclick="submit_pl(0);">发布</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!-- 新闻详情页 e -->
|
|
<script>
|
|
var type = "<?php echo empty($type) ? 'Article' : $type; ?>"
|
|
var cid = "<?php echo $cid ? $cid : 1; ?>";
|
|
//点击回复创建回复块
|
|
function answer(id) {
|
|
if ($('#c' + id).find('.answer_block' + id).html()) {
|
|
$('.answer_block' + id).remove()
|
|
} else {
|
|
var cname = '.answer_block' + id;
|
|
var fhHtml = '<div class="answer_block' + id + '"> \n\
|
|
<textarea class="hf_input" placeholder="输入回复内容"></textarea> \
|
|
<div class="csunbmit"><button class="submitBtn" onclick=submit_pl("' + cname + '")>确定回复</button></div>\n\
|
|
</div>';
|
|
$('#c' + id).append(fhHtml);
|
|
$(cname).find('.hf_input').css('width', '99%')
|
|
$(cname).find('.hf_input').css('height', '90px')
|
|
$(cname).find('.hf_input').css('resize', 'none')
|
|
$(cname).find('.hf_input').css('background', '#f6f9fb')
|
|
$(cname).find('.hf_input').css('border', '1px solid #ccc')
|
|
$(cname).children('.hf_input').focus().val("回复:");
|
|
}
|
|
}
|
|
function submit_pl(cname) {
|
|
var pid;
|
|
var content;
|
|
var data = {};
|
|
if (cname == 0) {
|
|
pid = 0;
|
|
content = $('#ccont').val()
|
|
if (!content.replace(/^ +| +$/g, '')) {
|
|
return false;
|
|
}
|
|
$('#ccont').val('');
|
|
}
|
|
else {
|
|
pid = cname.split('block')[1];
|
|
content = $(cname).children('.hf_input').val();
|
|
if (!content.replace('回复:', '').replace(/^ +| +$/g, '')) {
|
|
return false;
|
|
}
|
|
$(cname).children('.hf_input').val('');
|
|
$(cname).remove();
|
|
}
|
|
data.pid = pid;
|
|
data.content = content;
|
|
data.typeid = type;
|
|
data.cid = cid;
|
|
var options = {
|
|
url: "<?php echo url('index/pinglun/add'); ?>",
|
|
type: "post",
|
|
dataType: "json",
|
|
data: data,
|
|
success: function(data) {
|
|
if (data.code) {
|
|
alert(data.msg);
|
|
} else {
|
|
alert(data.msg);
|
|
}
|
|
},
|
|
error: function(xhr, ajaxOptions, thrownError) {
|
|
alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
|
|
}
|
|
};
|
|
$.ajax(options);
|
|
return false;
|
|
}
|
|
</script>
|
|
<style>
|
|
.csunbmit{height: 35px;margin-top: 10px;margin-bottom: 5px;}
|
|
.submitBtn{width: 75px;height: 30px;line-height: 26px;background-color: #339b53;text-align: center;display: block;
|
|
color: #FFFFFF;font-size: 12px;border-radius: 6px;float: left;}
|
|
.cli{border-bottom: 1px dashed #ccc;text-align: left;font-size: 12px;/*margin-left: -40px;margin-top:10px;*/ }
|
|
.ctimestamp{color: red;}
|
|
.ccontent{width: 98%;padding: 10px; background: #f6f9fb;border:1px solid #ccc;margin-bottom: 10px}
|
|
/*回复*/
|
|
</style>
|
|
<!-- bottom s -->
|
|
{include file="include/bottom" /}
|
|
<!-- bottom e -->
|
|
</body>
|
|
</html>
|