Files
orico-official-website-old/app/usmobile/view/article/online.2019.4.22/lists.phtml
2024-10-29 14:04:59 +08:00

138 lines
4.7 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>
<!-- 轮播 s -->
<div id="content">
<!--头部-->
{include file="include/top" /}
<!--banner-->
<div class="banner img-responsive">
<img src="__PUBLIC__/m_web/images/news/news-banner.jpg">
</div>
<!--新闻列表-->
<div class="m_Container news">
<div class="title text_center title_margin-top">新闻资讯</div>
<?php if (!empty($list)): ?>
<?php foreach ($list as $key => $value): ?>
<div class="news_list newfl">
<a href="/mobile/article/detail/id/<?php echo $value['id']; ?>">
<div class="left img-responsive"><img src="<?php echo getImage($value['picture']); ?>"></div>
<div class="right">
<div class="news_list_title nowrap_ellipsis"><?php echo $value['name']; ?></div>
<div class="news_list_des_text"><?php echo date("Y-m-d", $value['createtime']); ?></div>
<div class="news_list_des_text">
<?php
if (utf8_strlen($value['description']) > 35) {
$value['description'] = msubstr($value['description'], 0, 35);
}
echo $value['description'];
?>
</div>
</a>
<div class="news_list_share">
<span><img src="__PUBLIC__/m_web/images/news/news-share.png">分享</span>
<span><a href="javascript:void(0);" class="addzan text_gray" data-id="<?php echo $value['id']; ?>"><img src="__PUBLIC__/m_web/images/news/news-Collection.png">点赞 <span class="zan_count<?php echo $value['id']; ?>">(<?php echo $value['zancount']; ?>)</span></a></span>
<a href="/mobile/article/detail/id/<?php echo $value['id']; ?>#ccont" class="text_gray">
<span><img src="__PUBLIC__/m_web/images/news/news-comment.png">评论(<?php echo $value['commentcount']; ?>)</span>
</a>
</div>
</div>
</div>
<?php endforeach; ?>
<?php endif; ?>
<div class="Pages">
<span class="p_page">
<?php if ($page) echo $page; ?>
</span>
</div>
</div>
<!--精彩评论-->
<div class="m_Container">
<div class="news-comments">
<div class="title text_center title_margin-top">精彩评论</div>
<?php if (!empty($hot_comment)): ?>
<?php foreach ($hot_comment as $key => $value): ?>
<div class="news-comment">
<div class="Customer-information">
<div class="left"><img src="<?php echo getImage($value['headimg']); ?>"></div>
<div class="right">
<span class="news_list_des_text"><?php echo $value['customer_name']; ?></span>
<span class="news_list_share"><?php echo $value['createtime'] ?></span>
</div>
</div>
<p><?php echo $value['content']; ?></p>
</div>
<?php endforeach; ?>
<?php endif; ?>
</div>
</div>
<br class="bottom-margin">
<!--底部文件-->
{include file="include/bottom" /}
</div>
</body>
</html>
<script>
$(function() {
$(".newfl .addzan").click(function(event) {
event.preventDefault();
var love = $(this);
var id = love.data("id"); //对应id
if (!love.data("zan")) {
$.ajax({
type: "POST",
dataType: "json",
url: "<?php echo url('/index/article/zan'); ?>",
data: {id: id},
cache: false, //不缓存此页面
success: function(data) {
//console.log(data);
if (data.code) {
love.data("zan", true);
love.html('<img src="__PUBLIC__/m_web/images/news/news-Collection.png">点赞(' + data.data + ')');
}
}
});
} else {
alert('您已点过赞了!');
}
return false;
});
});
</script>
<script type="text/javascript">
/*function zan(id) {
var article_id = id;
$.ajax({
url: '/mobile/article/zan',
type: 'post',
data: {id: article_id},
dataType: 'json',
success: function(res) {
if (res) {
alert(res.msg);
if (res.code == 1) {
// 点赞成功
}
}
}
});
}*/
</script>