bug update

This commit is contained in:
2018-03-28 13:42:38 +08:00
parent 4357760a09
commit 548805f1c0
3 changed files with 86 additions and 59 deletions
+11 -9
View File
@@ -528,21 +528,23 @@ input::-webkit-input-placeholder{
.list-block.commentList .item-media img{width:2.3rem;height:2.3rem;} .list-block.commentList .item-media img{width:2.3rem;height:2.3rem;}
.list-block.commentList .item-text{height:auto;min-height:1.5rem;} .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;} .commentBox{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;} .commentBox .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;} .commentBox .searchbar .search-input{line-height:36px;}
.commentInput .searchbar .search-input input{height:36px;background:#EFEFEF;} .commentBox .searchbar .search-input input{height:36px;background:#EFEFEF;}
.commentInput .searchbar span{text-align:center;} .commentBox .searchbar.commentInputBox .search-input input{padding-left:1.8rem;}
.commentInput .searchbar span a{font-size:0.65rem;color:#666;line-height:36px;} .commentBox .searchbar span{text-align:center;}
.commentInput .searchbar span .collection{margin-left:0.75rem;position:static;} .commentBox .searchbar span a font{font-size:0.65rem;color:#666;line-height:36px;}
.commentBox .searchbar span .collection{margin-left:0.75rem;position:static;}
.commentBox .searchbar > a{line-height:36px;}
.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-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-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;} .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;}
.icon-praise-orange01{width:14px;height:14px;background:url(../images/icon-praise-orange.png) no-repeat center center;background-size:100%;margin-right:0.3rem;vertical-align:baseline;} .icon-praise-orange01{width:14px;height:14px;background:url(../images/icon-praise-orange.png) no-repeat center center;background-size:100%;margin-right:0.3rem;vertical-align:baseline;}
.icon-praise-orange02{width:16px;height:16px;background:url(../images/icon-praise-orange.png) no-repeat center center;background-size:100%;margin-right:0.3rem;vertical-align:text-bottom;} .icon-praise-orange02{width:16px;height:16px;background:url(../images/icon-praise-orange.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;} .commentBox .icon-collection01{display:inline-block;vertical-align:text-bottom;margin:0;}
.commentInput .icon-collection02{display:inline-block;vertical-align:text-bottom;margin:0;} .commentBox .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{width:100%;padding:0.75rem 0.5rem;border-bottom:solid 1px #dcdcdc;overflow:hidden;position:absolute;top:0;z-index:10;}
View File
+75 -50
View File
@@ -61,14 +61,14 @@
</div> </div>
<div class="bar commentInput"> <div class="bar commentBox">
<div class="searchbar row commentInputBox"> <div class="searchbar row commentInputBox">
<div class="search-input col-66"> <div class="search-input col-66">
<label class="icon icon-comments" for="search"></label> <label class="icon icon-comments" for="search"></label>
<input type="text" placeholder="我也说两句"> <input type="text" placeholder="我也说两句">
</div> </div>
<span class="col-33"> <span class="col-33">
<a class="praise"><i class="icon icon-praise-grey02"></i><label id="newsPraise"></label></a> <a class="praise"><i class="icon icon-praise-grey02"></i><font id="newsPraise">{{ newsDzCount }}</font></a>
<a class="collection collection01"><i class="icon icon-collection01"></i></a> <a class="collection collection01"><i class="icon icon-collection01"></i></a>
</span> </span>
</div> </div>
@@ -98,6 +98,7 @@ $.config = {router: false}
</script> </script>
<script type="text/javascript" src="../../js/beacon_release.js"></script> <script type="text/javascript" src="../../js/beacon_release.js"></script>
<script type="text/javascript" src="../../js/vue.js"></script>
<script type="text/javascript" src="../../js/light7.js" charset="utf-8"></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 type="text/javascript" src="../../js/cn.js" charset="utf-8"></script>
<script src="../../config.js"></script> <script src="../../config.js"></script>
@@ -108,7 +109,7 @@ $.config = {router: false}
<script type="text/javascript" src="../../js/shara/sharaMine.js" ></script> <script type="text/javascript" src="../../js/shara/sharaMine.js" ></script>
<script> <script>
document.addEventListener('plusready', onPlusReady, false); document.addEventListener('plusready', onPlusReady, false);
var id = "183627425584775168"; var id= "183627425584775168";
var shareUrl = BASE_PATH+"/news/newDetail?newsId="; var shareUrl = BASE_PATH+"/news/newDetail?newsId=";
var sharehrefTitle = "停车坐爱枫林晚,霜叶红于二月花"; var sharehrefTitle = "停车坐爱枫林晚,霜叶红于二月花";
var sharehrefDes = "客观里面请!"; var sharehrefDes = "客观里面请!";
@@ -119,6 +120,34 @@ var region;
var picUrl = '_www/logo.png'; var picUrl = '_www/logo.png';
//新闻评论列表
$.init()
//加载flag
var loading = false;
//最多可加载的条目
var maxItems = 100;
//上次加载的序号
var lastIndex = 0;
//每次加载添加多少条目
var itemsPerLoad = 10;
var curpage = 1;
var totalCount = 0;
var curPageSize = 0;
var vm = new Vue({
el: '#newsPraise',
data:{
newsDzCount: 0
}
})
function onPlusReady() { function onPlusReady() {
var self = plus.webview.currentWebview(); var self = plus.webview.currentWebview();
id = self.newsId; id = self.newsId;
@@ -141,8 +170,8 @@ function onPlusReady() {
var dateStr = date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate() var dateStr = date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate()
$("#create_time").text(dateStr) $("#create_time").text(dateStr)
$("#content").html(data.content) $("#content").html(data.content)
//$("#newsPraise").text(data.thumbsUpCount);
$("#newsPraise").text(data.thumbsUpCount); vm.newsDzCount = data.thumbsUpCount
//预先加载20条 //预先加载20条
sharehrefTitle = data.title sharehrefTitle = data.title
@@ -150,6 +179,10 @@ function onPlusReady() {
picUrl = data.coverImg picUrl = data.coverImg
//加载评论列表
addItems(itemsPerLoad, 0);
//是否收藏
isCollect();
} }
}, },
error:function(){ error:function(){
@@ -157,10 +190,9 @@ function onPlusReady() {
}) })
getPosition(); getPosition();
updateSerivces(); updateSerivces();
//isCollect();
} }
isCollect();
function isCollect(){ function isCollect(){
axios.post("/rest/news/checkCollect",{newsId : id}).then(function (response) { axios.post("/rest/news/checkCollect",{newsId : id}).then(function (response) {
@@ -198,34 +230,17 @@ function getPosition(){
//新闻评论列表
$.init()
//加载flag
var loading = false;
//最多可加载的条目
var maxItems = 100;
//上次加载的序号
var lastIndex = 0;
//每次加载添加多少条目
var itemsPerLoad = 10;
var url = "/rest/news/comment"
var curpage = 1;
var totalCount = 0;
var curPageSize = 0;
function addItems(number, lastIndex) { function addItems(number, lastIndex) {
if(!id){ if(!id){
return; return;
} }
curpage = lastIndex/itemsPerLoad + 1; curpage = lastIndex/itemsPerLoad + 1;
axios.get(url, {
axios.get("/rest/news/comment", {
params: { params: {
newsId: id, newsId: id,
page:curpage, page:curpage,
@@ -234,15 +249,15 @@ function addItems(number, lastIndex) {
}) })
.then(function (response) { .then(function (response) {
var results = response.data.data var results = response.data.data
curPageSize = results.length;
if(results==null || results.length==0) { if(results==null || results.length==0) {
// 加载完毕,则注销无限加载事件,以防不必要的加载 // 加载完毕,则注销无限加载事件,以防不必要的加载
$.detachInfiniteScroll($('.infinite-scroll')); $.detachInfiniteScroll($('.infinite-scroll'));
// 删除加载提示符 // 删除加载提示符
$('.infinite-scroll-preloader').remove(); $('.infinite-scroll-preloader').hide();
$('.infinite-scroll-bottom').html("");
return; return;
} }
curPageSize = results.length;
// 生成新条目的HTML // 生成新条目的HTML
var html = ''; var html = '';
for(var i in results){ for(var i in results){
@@ -312,7 +327,7 @@ function addItems(number, lastIndex) {
} }
addItems(itemsPerLoad, 0);
//注册'infinite'事件处理函数 //注册'infinite'事件处理函数
$(document).on('infinite', '.infinite-scroll-bottom',function() { $(document).on('infinite', '.infinite-scroll-bottom',function() {
@@ -347,14 +362,14 @@ $(document).on('infinite', '.infinite-scroll-bottom',function() {
}, 1000); }, 1000);
}); });
var MINU_SEC = 60; var MINU_SEC = 60 * 1000 ;
var HOUR_SEC = 3600; var HOUR_SEC = 60 * MINU_SEC;
var DAY_SEC = HOUR_SEC * 24; var DAY_SEC = HOUR_SEC * 24;
var MONTH_SEC = DAY_SEC * 30; var MONTH_SEC = DAY_SEC * 30;
var YEAR_SEC = MONTH_SEC * 12; var YEAR_SEC = MONTH_SEC * 12;
function getDateDiff(curTime, publishTime){ function getDateDiff(curTime, publishTime){
if (publishTime <= curTime) { if (publishTime <= curTime) {
var diffSec = (curTime - publishTime) / 1000; var diffSec = curTime - publishTime
if (diffSec < DAY_SEC) { if (diffSec < DAY_SEC) {
if (diffSec >= HOUR_SEC) { if (diffSec >= HOUR_SEC) {
var t = diffSec / HOUR_SEC; var t = diffSec / HOUR_SEC;
@@ -363,7 +378,7 @@ function getDateDiff(curTime, publishTime){
var t = diffSec / MINU_SEC; var t = diffSec / MINU_SEC;
return parseInt(t) + "分钟前"; return parseInt(t) + "分钟前";
} else { } else {
return "刚刚"; return "1分钟";
} }
} else if (DAY_SEC > diffSec && diffSec < DAY_SEC*2) { } else if (DAY_SEC > diffSec && diffSec < DAY_SEC*2) {
return "昨天"; return "昨天";
@@ -373,7 +388,7 @@ function getDateDiff(curTime, publishTime){
return dateStr; return dateStr;
} }
} else { } else {
return "刚刚";// 输入时间大于 系统时间 返回 "刚刚" return "1分钟";
} }
} }
@@ -381,11 +396,11 @@ function getDateDiff(curTime, publishTime){
/* 评论点赞 */ /* 评论点赞 */
$("body").delegate(".commentList span", "click", function () { $("body").delegate(".commentList span .icon-praise-grey01", "click", function () {
$(this).find(".icon").addClass("icon-praise-orange01"); $(this).find(".icon").addClass("icon-praise-orange01");
var cid = $(this).attr("data-cid") var cid = $(this).parent().attr("data-cid")
$(this).attr("disabled","disabled"); $(this).attr("disabled","disabled");
var text = $(this).find("label").text(); var text = $(this).parent().text();
axios.get("/rest/comment/thumbsUp", { axios.get("/rest/comment/thumbsUp", {
params: { params: {
commentId:cid commentId:cid
@@ -409,10 +424,10 @@ $("body").delegate(".commentList span", "click", function () {
}); });
/*新闻点赞*/ /*新闻点赞*/
$(".praise").one("click", function () { $(".praise").on("click", function () {
$(this).find(".icon").addClass("icon-praise-orange02"); $(this).find(".icon").addClass("icon-praise-orange02");
$(this).attr("disabled","disabled"); $(this).attr("disabled","disabled");
var text = $(this).find("font").text(); var text = $("#newsPraise").text();
axios.get("/rest/news/thumbsUp", { axios.get("/rest/news/thumbsUp", {
params: { params: {
newsId:id newsId:id
@@ -421,6 +436,8 @@ $(".praise").one("click", function () {
var msg = response.data.data var msg = response.data.data
if(msg && msg =="点赞成功"){ if(msg && msg =="点赞成功"){
$(this).find("font").text(parseInt(text) + 1); $(this).find("font").text(parseInt(text) + 1);
var count = parseInt(text) + 1;
vm.newsDzCount = count
$.toast(msg); $.toast(msg);
}else{ }else{
msg = response.data.message msg = response.data.message
@@ -445,17 +462,25 @@ $(".collection").on("click", function () {
function collect(){ function collect(){
axios.post("/rest/news/collect",{newsId : id}).then(function (response) { axios.post("/rest/news/collect",{newsId : id}).then(function (response) {
var msg = response.data.data
if(msg == "收藏成功"){ var msg = response.data.message
$(".collection").addClass("collection02") if(msg){
$(".collection i").addClass("icon-collection02") if(msg=="用户不能为空"){
$(".collection").removeClass("collection01") //先进行登录
$(".collection i").removeClass("icon-collection01") }
}else{ }else{
$(".collection").addClass("collection01") msg = response.data.data
$(".collection i").addClass("icon-collection01") if(msg == "收藏成功"){
$(".collection").removeClass("collection02") $(".collection").addClass("collection02")
$(".collection i").removeClass("icon-collection02") $(".collection i").addClass("icon-collection02")
$(".collection").removeClass("collection01")
$(".collection i").removeClass("icon-collection01")
}else{
$(".collection").addClass("collection01")
$(".collection i").addClass("icon-collection01")
$(".collection").removeClass("collection02")
$(".collection i").removeClass("icon-collection02")
}
} }
$.toast(msg); $.toast(msg);