This commit is contained in:
2018-03-27 13:52:36 +08:00
parent e699ead679
commit 8c3c7b4db9
7 changed files with 320 additions and 2 deletions
+37
View File
@@ -327,11 +327,21 @@ i.loginIcon03{width:14px;height:24px;background:url(../images/loginIcon03.png) n
.popup-about02 .list-block.historyList{margin-top:-1px;}
.popup-about02 .list-block.historyList .searchHistory{padding-top:0;}
.popup-about02 .list-block.newCss ul{padding:0.75rem;padding-top:0;padding-left:0.25rem;overflow:hidden;}
.popup-about02 .list-block.newCss ul li{background:#F4F4F4;border-radius:0.16rem;float:left;margin-left:0.5rem;margin-bottom:0.5rem;padding:0 0.5rem;line-height:1.5rem;}
.popup-about02 .list-block.newCss ul li a{font-size:0.65rem;color:#333;}
.popup-about02 .list-block.newCss ul:before,.popup-about02 .list-block.newCss ul:after{height:0;}
.newCss ul{padding:0.75rem;padding-top:0;padding-left:0.25rem;overflow:hidden;}
.newCss ul li{background:#F4F4F4;border-radius:0.16rem;display:inline-block;margin-left:0.5rem;margin-bottom:0.5rem;padding:0 0.5rem;line-height:1.5rem;}
.newCss ul li span{font-size:0.65rem;color:#333;}
.newCss ul:before,.popup-about02 .list-block.newCss ul:after{height:0;}
.content-padded + .newCss ul{padding-bottom:0;}
.list-block .item-content label.label-checkbox{float:left;padding-left:0;}
.list-block .item-content label.label-checkbox .item-media{width:auto;height:auto;padding:0;margin:0;}
label.label-checkbox i.icon-form-checkbox{margin-right:0.5rem;}
@@ -506,6 +516,32 @@ input::-webkit-input-placeholder{
.content-padded img{width:100%;}
.icon-eye{width:0.89rem;height:0.57rem;background:url(../images/icon-eye.png) no-repeat center center;background-size:100%;margin-right:0.3rem;vertical-align:baseline;}
.adBoxApp{width:80%;margin:0 auto;margin-top:1rem;margin-bottom:1.5rem;overflow:hidden;}
.adBoxApp img{float:left;width:5.6rem;height:4.7rem;margin-right:1rem;}
.adBoxApp p{float:left;}
.adBoxApp p label{font-size:0.8rem;}
.adBoxApp p small{font-size:0.65rem;}
.list-block.commentList{margin-bottom:76px;}
.list-block.commentList ul:after{height:0;}
.list-block.commentList .item-media{padding-top:0;margin-top:-1rem;}
.list-block.commentList .item-media img{width:2.3rem;height:2.3rem;}
.list-block.commentList .item-text{height:auto;min-height:1.5rem;}
.commentInput{height:66px;background:#fff;position:absolute;right:0;left:0;bottom:0;z-index:10;}
.commentInput .searchbar{padding:0.75rem 0.5rem;padding-left:0;margin:0;height:66px;background:#fff;border-top:solid 1px #dcdcdc;position:absolute;right:0;left:0;bottom:0;z-index:10;}
.commentInput .searchbar .search-input{line-height:36px;}
.commentInput .searchbar .search-input input{height:36px;background:#EFEFEF;padding-left:1.8rem;}
.commentInput .searchbar span{text-align:center;}
.commentInput .searchbar span a{font-size:0.65rem;color:#666;line-height:36px;}
.commentInput .searchbar span .collection{margin-left:0.75rem;position:static;}
.icon-comments{width:17px;height:16px;background:url(../images/icon-comments.png) no-repeat center center;background-size:100%;margin-left:0.3rem;vertical-align:baseline;}
.icon-praise-grey01{width:14px;height:14px;background:url(../images/icon-praise-grey01.png) no-repeat center center;background-size:100%;margin-right:0.3rem;vertical-align:baseline;}
.icon-praise-grey02{width:16px;height:16px;background:url(../images/icon-praise-grey02.png) no-repeat center center;background-size:100%;margin-right:0.3rem;vertical-align:text-bottom;}
.commentInput .icon-collection01{display:inline-block;vertical-align:text-bottom;margin:0;}
.commentInput .icon-collection02{display:inline-block;vertical-align:text-bottom;margin:0;}
/* 顶部 */
.top{width:100%;padding:0.75rem 0.5rem;border-bottom:solid 1px #dcdcdc;overflow:hidden;position:absolute;top:0;z-index:10;}
.top.bar{height:auto;}
@@ -1146,6 +1182,7 @@ input[type=range]::-webkit-slider-thumb {
.cardInfo01a .card-footer span:nth-child(1){width:50%;}
.cardInfo02 img{width:5rem;height:4rem;}
.cardInfo02 .item-subtitle{margin-top:0;}
.adBoxApp{width:88%;}
}
@media only screen and (-webkit-min-device-pixel-ratio:2){
.list-block .item-inner:after{-webkit-transform:scaleY(1);transform:scaleY(1);}
Binary file not shown.

After

Width:  |  Height:  |  Size: 946 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

+10
View File
@@ -1496,6 +1496,16 @@
"fonts/mui.ttf",
"images/icon-clear.png"
],
"refer": [
"views/news/newsDetail.html"
],
"priority": 0
},
"views/news/newsDetail.html": {
"resources": [
"images/icon-comments.png",
"images/icon-praise-grey02.png"
],
"refer": [],
"priority": 0
}
+273 -2
View File
@@ -25,13 +25,54 @@
</button>
<h1 class="title"></h1>
</header>
<div class="content contentText">
<div class="content contentText infinite-scroll infinite-scroll-bottom" data-distance="40">
<div class="content-padded">
<h1 id="title"></h1>
<p><small id="source"></small><small style="float:right;" id="visit_count"><i class="icon icon-eye"></i></small><br><small id="create_time"></small></p>
<div id="content">
</div>
</div>
<div class="newCss">
<ul>
<li><span>房贷</span></li>
<li><span>广州</span></li>
<li><span>首套房</span></li>
</ul>
</div>
<div class="adBoxApp">
<img src="../../images/wx_app.png">
<p><label>有房&nbsp;&nbsp;有家&nbsp;&nbsp;有爱</label><br><small>更多房产资讯上有房APP</small></p>
</div>
<div class="list-block media-list commentList">
<ul>
</ul>
</div>
<!-- 加载提示符 -->
<div class="infinite-scroll-preloader" style="position: relative;top: -70px;">
<div class="preloader"></div>
</div>
</div>
<div class="bar commentInput">
<div class="searchbar row">
<div class="search-input col-66">
<label class="icon icon-comments" for="search"></label>
<input type="text" placeholder="我也说两句">
</div>
<span class="col-33">
<a class="praise"><i class="icon icon-praise-grey02"></i><label id="newsPraise"></label></a>
<a class="collection collection01"><i class="icon icon-collection01"></i></a>
<a class="collection collection02 dn"><i class="icon icon-collection02"></i></a>
</span>
</div>
</div>
</div>
</div>
</div>
@@ -45,16 +86,20 @@ Zepto = $
$.config = {router: false}
</script>
<script type="text/javascript" src="../../js/beacon_release.js"></script>
<script type="text/javascript" src="../../js/light7.js" charset="utf-8"></script>
<script type="text/javascript" src="../../js/cn.js" charset="utf-8"></script>
<script src="../../config.js"></script>
<script type="text/javascript" src="../../js/common.js" ></script>
<script type="text/javascript" src="../../js/axios.min.js"></script>
<script>
document.addEventListener('plusready', onPlusReady, false);
var id = "183627425584775168";
function onPlusReady() {
var self = plus.webview.currentWebview();
var id = self.newsId;
id = self.newsId;
$.ajax({
type : 'get',
url : BASE_PATH + "/rest/news/detail",
@@ -72,13 +117,239 @@ function onPlusReady() {
var dateStr = date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate()
$("#create_time").text(dateStr)
$("#content").html(data.content)
$("#newsPraise").text(data.thumbsUpCount);
//预先加载20条
}
},
error:function(){
}
})
}
//新闻评论列表
$.init()
//加载flag
var loading = false;
//最多可加载的条目
var maxItems = 100;
//上次加载的序号
var lastIndex = 0;
//每次加载添加多少条目
var itemsPerLoad = 10;
var url = BASE_PATH + "/rest/news/comment"
var curpage = 1;
var totalCount = 0;
var curPageSize = 0;
function addItems(number, lastIndex) {
if(!id){
return;
}
curpage = lastIndex/itemsPerLoad + 1;
axios.get(url, {
params: {
newsId: id,
page:curpage,
pageSize:itemsPerLoad
}
})
.then(function (response) {
var results = response.data.data
if(results==null || results.length==0) {
// 加载完毕,则注销无限加载事件,以防不必要的加载
$.detachInfiniteScroll($('.infinite-scroll'));
// 删除加载提示符
$('.infinite-scroll-preloader').remove();
$('.infinite-scroll-bottom').html("");
return;
}
curPageSize = results.length;
// 生成新条目的HTML
var html = '';
for(var i in results){
var vo = results[i];
html = html+"<li>"+
"<a class='item-content'>";
if(vo.headImg!=null){
html = html + "<div class='item-media'><img src='"+vo.headImg+"'></div>";
}else{
html = html + "<div class='item-media'><img src='../../images/headPortrait.png'></div>";
}
html = html + "<div class='item-inner'>";
var name = "游客"
if(vo.wxName){
name = vo.wxName
}else if(vo.name){
name = vo.name
}
html = html + "<div class='item-title-row'>"+
"<div class='item-title'>"+name+"</div>"+
"<div class='item-after'><span><i class='icon icon-praise-grey01'></i>"+vo.praiseCount+"</span></div>"+
"</div>"+
"<div class='item-title-row'>";
var address = "";
if(vo.commentUserProvince && vo.commentUserCity && vo.commentUserProvince == vo.commentUserCity){
html = html + "<div class='item-title'><span>"+vo.commentUserCity+" </span></div>";
}else{
html = html + "<div class='item-title'><span>"+vo.commentUserProvince+vo.commentUserCity+" </span></div>";
}
var curTime = new Date().getTime()
var publishTime = vo.addTime;
var timeString = getDateDiff(curTime, publishTime)
html = html + "<div class='item-after'><span>"+timeString+"</span></div>"+
"</div>"+
"<div class='item-text'>"+vo.content+"</div>"+
"</div>"+
"</a>"+
"</li>";
}
// 添加新条目
$('.commentList ul').append(html);
if($('.commentList li').length== totalCount+1){
// 加载完毕,则注销无限加载事件,以防不必要的加载
$.detachInfiniteScroll($('.infinite-scroll'));
// 删除加载提示符
$('.infinite-scroll-preloader').hide();
}
})
.catch(function (error) {
console.log(error);
});
}
addItems(itemsPerLoad, 0);
//注册'infinite'事件处理函数
$(document).on('infinite', '.infinite-scroll-bottom',function() {
// 如果正在加载,则退出
if (loading) return;
// 设置flag
loading = true;
// 模拟1s的加载过程
setTimeout(function() {
// 重置加载flag
loading = false;
// 更新最后加载的序号
lastIndex = $('.commentList li').length;
if (curPageSize < itemsPerLoad) {
// 加载完毕,则注销无限加载事件,以防不必要的加载
$.detachInfiniteScroll($('.infinite-scroll'));
// 删除加载提示符
$('.infinite-scroll-preloader').hide();
return;
}
// 添加新条目
addItems(itemsPerLoad, $('.commentList li').length);
//容器发生改变,如果是js滚动,需要刷新滚动
// $.refreshScroller();
}, 1000);
});
var MINU_SEC = 60;
var HOUR_SEC = 3600;
var DAY_SEC = HOUR_SEC * 24;
var MONTH_SEC = DAY_SEC * 30;
var YEAR_SEC = MONTH_SEC * 12;
function getDateDiff(curTime, publishTime){
if (publishTime <= curTime) {
var diffSec = (curTime - publishTime) / 1000;
if (diffSec < DAY_SEC) {
if (diffSec >= HOUR_SEC) {
var t = diffSec / HOUR_SEC;
return parseInt(t) + "小时前";
} else if (diffSec >= MINU_SEC) {
var t = diffSec / MINU_SEC;
return parseInt(t) + "分钟前";
} else {
return "刚刚";
}
} else if (DAY_SEC > diffSec && diffSec < DAY_SEC*2) {
return "昨天";
} else {
var date = new Date(publishTime)
var dateStr = date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate()
return dateStr;
}
} else {
return "刚刚";// 输入时间大于 系统时间 返回 "刚刚"
}
}
//添加评论
//点赞
$(".icon-praise-grey02").click(function(){
axios.get(BASE_PATH+"/rest/news/thumbsUp", {
params: {
newsId : id
}
})
.then(function (response) {
var msg = response.data.data
$.toast(msg);
})
.catch(function (error) {
console.log(error);
});
});
//收藏
$(".collection01").on("click", function () {
$(".collection01").hide();
$(".collection02").show();
collect();
});
$(".collection02").on("click", function () {
$(".collection02").hide();
$(".collection01").show();
collect();
});
function collect(){
//var params = new URLSearchParams();
//params.append('newsId', id);
axios.post(BASE_PATH+"/rest/news/collect", {
params: {
newsId : id
}
})
.then(function (response) {
var msg = response.data.data
$.toast(msg);
})
.catch(function (error) {
console.log(error);
});
}
</script>
</body>