收藏
This commit is contained in:
@@ -10,9 +10,9 @@
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||
|
||||
<link rel="stylesheet" href="../../css/sm.css">
|
||||
<link rel="stylesheet" href="../../css/main.css">
|
||||
<link rel="stylesheet" href="../../css/theme-blue.css">
|
||||
<link rel="stylesheet" href="../../css/mui.min.css">
|
||||
<link rel="stylesheet" href="../../css/main.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
@@ -62,7 +62,7 @@
|
||||
</div>
|
||||
|
||||
<div class="bar commentInput">
|
||||
<div class="searchbar row">
|
||||
<div class="searchbar row commentInputBox">
|
||||
<div class="search-input col-66">
|
||||
<label class="icon icon-comments" for="search"></label>
|
||||
<input type="text" placeholder="我也说两句">
|
||||
@@ -70,9 +70,16 @@
|
||||
<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 class="searchbar row commentReleaseBox dn">
|
||||
<div class="search-input col-85">
|
||||
<input type="text">
|
||||
</div>
|
||||
<a class="col-15">发布</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
@@ -128,6 +135,7 @@ function onPlusReady() {
|
||||
var dateStr = date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate()
|
||||
$("#create_time").text(dateStr)
|
||||
$("#content").html(data.content)
|
||||
|
||||
$("#newsPraise").text(data.thumbsUpCount);
|
||||
//预先加载20条
|
||||
|
||||
@@ -321,10 +329,9 @@ function getDateDiff(curTime, publishTime){
|
||||
|
||||
//点赞
|
||||
$(".icon-praise-grey02").click(function(){
|
||||
console.log(JSON.stringify({newsId : id}));
|
||||
axios.get(BASE_PATH+"/rest/news/thumbsUp", {
|
||||
params: {
|
||||
newsId : id
|
||||
}
|
||||
data:JSON.stringify({newsId : id})
|
||||
})
|
||||
.then(function (response) {
|
||||
var msg = response.data.data
|
||||
@@ -336,34 +343,46 @@ $(".icon-praise-grey02").click(function(){
|
||||
});
|
||||
|
||||
//收藏
|
||||
$(".collection01").on("click", function () {
|
||||
$(".collection01").hide();
|
||||
$(".collection02").show();
|
||||
collect();
|
||||
});
|
||||
$(".collection02").on("click", function () {
|
||||
$(".collection02").hide();
|
||||
$(".collection01").show();
|
||||
$(".collection").on("click", function () {
|
||||
collect();
|
||||
});
|
||||
|
||||
function collect(){
|
||||
|
||||
//var params = new URLSearchParams();
|
||||
//params.append('newsId', id);
|
||||
axios.post(BASE_PATH+"/rest/news/collect", {
|
||||
params: {
|
||||
newsId : id
|
||||
}
|
||||
})
|
||||
axios.post(BASE_PATH+"/rest/news/collect",
|
||||
JSON.stringify({newsId : id}),{headers: {"Content-Type": "application/json"}}
|
||||
)
|
||||
.then(function (response) {
|
||||
var msg = response.data.data
|
||||
$.toast(msg);
|
||||
if(msg == "收藏成功"){
|
||||
$(".collection").addClass("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);
|
||||
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log(error);
|
||||
});
|
||||
}
|
||||
|
||||
/* 发布评论 */
|
||||
$(".commentInputBox input").focus(function () {
|
||||
$(".commentInputBox").hide();
|
||||
$(".commentReleaseBox").show();
|
||||
$(".commentReleaseBox input").focus();
|
||||
$(".commentReleaseBox input").val("");
|
||||
});
|
||||
$(".commentReleaseBox a").on("click", function () {
|
||||
$(".commentReleaseBox").hide();
|
||||
$(".commentInputBox").show();
|
||||
});
|
||||
|
||||
</script>
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user