update
This commit is contained in:
@@ -539,6 +539,8 @@ input::-webkit-input-placeholder{
|
|||||||
|
|
||||||
.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-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;}
|
.commentInput .icon-collection01{display:inline-block;vertical-align:text-bottom;margin:0;}
|
||||||
.commentInput .icon-collection02{display:inline-block;vertical-align:text-bottom;margin:0;}
|
.commentInput .icon-collection02{display:inline-block;vertical-align:text-bottom;margin:0;}
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 749 B |
@@ -77,7 +77,7 @@
|
|||||||
<div class="search-input col-85">
|
<div class="search-input col-85">
|
||||||
<input type="text">
|
<input type="text">
|
||||||
</div>
|
</div>
|
||||||
<a class="col-15">发布</a>
|
<a class="col-15" id="publishBtn">发布</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@@ -103,6 +103,7 @@ $.config = {router: false}
|
|||||||
<script src="../../config.js"></script>
|
<script src="../../config.js"></script>
|
||||||
<script type="text/javascript" src="../../js/common.js" ></script>
|
<script type="text/javascript" src="../../js/common.js" ></script>
|
||||||
<script type="text/javascript" src="../../js/axios.min.js"></script>
|
<script type="text/javascript" src="../../js/axios.min.js"></script>
|
||||||
|
<script type="text/javascript" src="../../js/axiosPlugin.js"></script>
|
||||||
|
|
||||||
<script type="text/javascript" src="../../js/shara/sharaMine.js" ></script>
|
<script type="text/javascript" src="../../js/shara/sharaMine.js" ></script>
|
||||||
<script>
|
<script>
|
||||||
@@ -112,6 +113,9 @@ var shareUrl = BASE_PATH+"/news/newDetail?newsId=";
|
|||||||
var sharehrefTitle = "停车坐爱枫林晚,霜叶红于二月花";
|
var sharehrefTitle = "停车坐爱枫林晚,霜叶红于二月花";
|
||||||
var sharehrefDes = "客观里面请!";
|
var sharehrefDes = "客观里面请!";
|
||||||
var shareId='';
|
var shareId='';
|
||||||
|
var province;
|
||||||
|
var city;
|
||||||
|
var region;
|
||||||
|
|
||||||
function onPlusReady() {
|
function onPlusReady() {
|
||||||
var self = plus.webview.currentWebview();
|
var self = plus.webview.currentWebview();
|
||||||
@@ -141,14 +145,55 @@ function onPlusReady() {
|
|||||||
|
|
||||||
sharehrefTitle = data.title
|
sharehrefTitle = data.title
|
||||||
sharehrefDes = data.introduction
|
sharehrefDes = data.introduction
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
error:function(){
|
error:function(){
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
getPosition();
|
||||||
updateSerivces();
|
updateSerivces();
|
||||||
|
//isCollect();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isCollect();
|
||||||
|
|
||||||
|
function isCollect(){
|
||||||
|
axios.post("/rest/news/checkCollect",{newsId : id}).then(function (response) {
|
||||||
|
var msg = response.data.data
|
||||||
|
if(msg){
|
||||||
|
$(".collection").addClass("collection02")
|
||||||
|
$(".collection i").addClass("icon-collection02")
|
||||||
|
$(".collection").removeClass("collection01")
|
||||||
|
$(".collection i").removeClass("icon-collection01")
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
.catch(function (error) {
|
||||||
|
console.log(error);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 获取当前用户位置
|
||||||
|
function getPosition(){
|
||||||
|
plus.geolocation.getCurrentPosition(function(p){
|
||||||
|
province = p.address.province;
|
||||||
|
city = p.address.city;
|
||||||
|
region = p.address.district;
|
||||||
|
}, function(e){
|
||||||
|
|
||||||
|
},
|
||||||
|
{
|
||||||
|
provider:'baidu',
|
||||||
|
enableHighAccuracy:true,
|
||||||
|
coordsType:'bd09ll'
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//新闻评论列表
|
//新闻评论列表
|
||||||
$.init()
|
$.init()
|
||||||
@@ -163,7 +208,7 @@ var lastIndex = 0;
|
|||||||
//每次加载添加多少条目
|
//每次加载添加多少条目
|
||||||
var itemsPerLoad = 10;
|
var itemsPerLoad = 10;
|
||||||
|
|
||||||
var url = BASE_PATH + "/rest/news/comment"
|
var url = "/rest/news/comment"
|
||||||
|
|
||||||
var curpage = 1;
|
var curpage = 1;
|
||||||
var totalCount = 0;
|
var totalCount = 0;
|
||||||
@@ -218,14 +263,19 @@ function addItems(number, lastIndex) {
|
|||||||
}
|
}
|
||||||
html = html + "<div class='item-title-row'>"+
|
html = html + "<div class='item-title-row'>"+
|
||||||
"<div class='item-title'>"+name+"</div>"+
|
"<div class='item-title'>"+name+"</div>"+
|
||||||
"<div class='item-after'><span><i class='icon icon-praise-grey01'></i>"+vo.praiseCount+"</span></div>"+
|
"<div class='item-after'><span data-cid='"+vo.id+"'><i class='icon icon-praise-grey01'></i><label>"+vo.praiseCount+"</label></span></div>"+
|
||||||
"</div>"+
|
"</div>"+
|
||||||
"<div class='item-title-row'>";
|
"<div class='item-title-row'>";
|
||||||
var address = "";
|
var address = "";
|
||||||
if(vo.commentUserProvince && vo.commentUserCity && vo.commentUserProvince == vo.commentUserCity){
|
if(vo.commentUserProvince && vo.commentUserCity && vo.commentUserProvince == vo.commentUserCity){
|
||||||
html = html + "<div class='item-title'><span>"+vo.commentUserCity+" </span></div>";
|
html = html + "<div class='item-title'><span>"+vo.commentUserCity+" </span></div>";
|
||||||
}else{
|
}else{
|
||||||
html = html + "<div class='item-title'><span>"+vo.commentUserProvince+vo.commentUserCity+" </span></div>";
|
if(vo.commentUserProvince && vo.commentUserCity){
|
||||||
|
html = html + "<div class='item-title'><span>"+vo.commentUserProvince+vo.commentUserCity+" </span></div>";
|
||||||
|
}else{
|
||||||
|
html = html + "<div class='item-title'><span> </span></div>";
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var curTime = new Date().getTime()
|
var curTime = new Date().getTime()
|
||||||
@@ -327,31 +377,71 @@ function getDateDiff(curTime, publishTime){
|
|||||||
//添加评论
|
//添加评论
|
||||||
|
|
||||||
|
|
||||||
//点赞
|
/* 评论点赞 */
|
||||||
$(".icon-praise-grey02").click(function(){
|
$("body").delegate(".commentList span", "click", function () {
|
||||||
console.log(JSON.stringify({newsId : id}));
|
$(this).find(".icon").addClass("icon-praise-orange01");
|
||||||
axios.get(BASE_PATH+"/rest/news/thumbsUp", {
|
var cid = $(this).attr("data-cid")
|
||||||
data:JSON.stringify({newsId : id})
|
$(this).attr("disabled","disabled");
|
||||||
})
|
var text = $(this).find("label").text();
|
||||||
.then(function (response) {
|
axios.get("/rest/comment/thumbsUp", {
|
||||||
|
params: {
|
||||||
|
commentId:cid
|
||||||
|
}
|
||||||
|
}).then(function (response) {
|
||||||
var msg = response.data.data
|
var msg = response.data.data
|
||||||
$.toast(msg);
|
if(msg && msg =="点赞成功"){
|
||||||
|
$("span[data-cid='"+cid+"']").find("label").text(parseInt(text) + 1);
|
||||||
|
$.toast(msg);
|
||||||
|
}else{
|
||||||
|
msg = response.data.message
|
||||||
|
if(msg){
|
||||||
|
$.toast(msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
.catch(function (error) {
|
.catch(function (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/*新闻点赞*/
|
||||||
|
$(".praise").one("click", function () {
|
||||||
|
$(this).find(".icon").addClass("icon-praise-orange02");
|
||||||
|
$(this).attr("disabled","disabled");
|
||||||
|
var text = $(this).find("font").text();
|
||||||
|
axios.get("/rest/news/thumbsUp", {
|
||||||
|
params: {
|
||||||
|
newsId:id
|
||||||
|
}
|
||||||
|
}).then(function (response) {
|
||||||
|
var msg = response.data.data
|
||||||
|
if(msg && msg =="点赞成功"){
|
||||||
|
$(this).find("font").text(parseInt(text) + 1);
|
||||||
|
$.toast(msg);
|
||||||
|
}else{
|
||||||
|
msg = response.data.message
|
||||||
|
if(msg){
|
||||||
|
$.toast(msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
})
|
||||||
|
.catch(function (error) {
|
||||||
|
console.log(error);
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
//收藏
|
//收藏
|
||||||
$(".collection").on("click", function () {
|
$(".collection").on("click", function () {
|
||||||
collect();
|
collect();
|
||||||
});
|
});
|
||||||
|
|
||||||
function collect(){
|
function collect(){
|
||||||
axios.post(BASE_PATH+"/rest/news/collect",
|
axios.post("/rest/news/collect",{newsId : id}).then(function (response) {
|
||||||
JSON.stringify({newsId : id}),{headers: {"Content-Type": "application/json"}}
|
|
||||||
)
|
|
||||||
.then(function (response) {
|
|
||||||
var msg = response.data.data
|
var msg = response.data.data
|
||||||
if(msg == "收藏成功"){
|
if(msg == "收藏成功"){
|
||||||
$(".collection").addClass("collection02")
|
$(".collection").addClass("collection02")
|
||||||
@@ -382,8 +472,28 @@ $(".commentInputBox input").focus(function () {
|
|||||||
$(".commentReleaseBox a").on("click", function () {
|
$(".commentReleaseBox a").on("click", function () {
|
||||||
$(".commentReleaseBox").hide();
|
$(".commentReleaseBox").hide();
|
||||||
$(".commentInputBox").show();
|
$(".commentInputBox").show();
|
||||||
|
var content = $(".commentReleaseBox input").val();
|
||||||
|
if(content){
|
||||||
|
addComment();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function addComment(){
|
||||||
|
var content = $(".commentReleaseBox input").val();
|
||||||
|
axios.post("/rest/comment/add",{commentObjId : id, content:content, commentUserProvince:province, commentUserCity:city}).then(function (response) {
|
||||||
|
var msg = response.data.message
|
||||||
|
if(msg){
|
||||||
|
$.toast(msg);
|
||||||
|
}else{
|
||||||
|
window.location.reload();
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
.catch(function (error) {
|
||||||
|
console.log(error);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
Reference in New Issue
Block a user