列表增加取消关注功能

This commit is contained in:
尹吉欢
2018-05-30 14:12:43 +08:00
parent 8831bff32d
commit 16ec13a7f8
2 changed files with 26 additions and 3 deletions
+24 -3
View File
@@ -12,15 +12,15 @@ var mf_totalCount = 0;
function addEstate(number, lastIndex) {
mf_curpage = mf_lastIndex/mf_itemsPerLoad + 1;
axios.get("/rest/myCollection/loadCollections",{params:{pageSize:mf_itemsPerLoad,page:mf_curpage}}).then(function(response){
data = response.data;
//data = eval( '(' + data + ')' );
if(data['results']==null || data['results'].length==0) {
$('#loadTip2').remove();
//$('.infinite-scroll-bottom #tab1').html("<div class='noData'><img src='../images/noData.png'><p>您还没有关注小区</p></div>");
return;
}
mf_totalCount = data.totalCount;
// tab.mf_num = mf_totalCount;
$("#mf_num").html("关注("+mf_totalCount+")")
// 生成新条目的HTML
var html = '';
@@ -71,7 +71,7 @@ function addEstate(number, lastIndex) {
'</div>'+
'<div class="item-subtitle"><span class="tag">'+tagStr+'</span></div>'+
'</div>'+
'</a>'+
'</a><a class="button collection collection02" onclick="removeCollect(\''+this.city+'\',\''+this.region+'\',\''+this.name+'\',this)">取消关注</a>'+
'</li>';
});
// 添加新条目
@@ -89,4 +89,25 @@ function addEstate(number, lastIndex) {
}).catch(function(error){
console.log(error)
});
}
// 取消关注
function removeCollect(city,region,name,obj){
axios.post("/rest/districts/removeCollect",{city:city,region:region,name:name}).then(function (response) {
var msg = response.data.message
if(msg){
$.toast(msg);
} else {
$.toast("取消关注");
}
/*mf_curpage = 1;
$("#mf_ul").html("");
addEstate(mf_itemsPerLoad, 0);*/
$(obj).parent().remove();
mf_totalCount = mf_totalCount - 1;
$("#mf_num").html("关注("+mf_totalCount+")")
})
.catch(function (error) {
console.log(error);
});
}
+2
View File
@@ -30,6 +30,8 @@
.buttons-tab .button{font-size:0.75rem;color:#999;line-height:2.5rem;height:2.5rem;}
.list-block ul:before{height:0;}
.cardInfo:first-child{border-top:none;}
#tabList2 .collection02{top:inherit;bottom:0.75rem;}
</style>
</head>