收藏
This commit is contained in:
@@ -2,6 +2,6 @@
|
||||
//var BASE_PATH = "http://192.168.10.128:8084";
|
||||
//var BASE_PATH = "http://192.168.10.47:8086";
|
||||
var BASE_PATH = "http://192.168.10.53:8084";
|
||||
var BASE_PATH = "http://192.168.10.171:8084";
|
||||
//var BASE_PATH = "http://192.168.10.171:8084";
|
||||
/**是否显示过启动页面**/
|
||||
var lauchFlag = false;
|
||||
@@ -5,7 +5,7 @@
|
||||
*{font-size:16px;font-family:arial,"华文细黑";}
|
||||
ul li{list-style:none;}
|
||||
img{display:block;}
|
||||
a{color:#18a2ff;}
|
||||
a{color:#F18D00;}
|
||||
em{font-style:normal;}
|
||||
em.up{color:#ff1100;}
|
||||
em.down{color:#2cb66a;}
|
||||
@@ -531,7 +531,7 @@ input::-webkit-input-placeholder{
|
||||
.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 .search-input input{height:36px;background:#EFEFEF;}
|
||||
.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;}
|
||||
|
||||
@@ -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