diff --git a/fangija-zsyf/js/common.js b/fangija-zsyf/js/common.js index 108e558..8863d6a 100644 --- a/fangija-zsyf/js/common.js +++ b/fangija-zsyf/js/common.js @@ -1057,3 +1057,17 @@ document.addEventListener('DOMContentLoaded', function() { }, false); }()); + + +String.prototype.startWith=function(str){ + var reg=new RegExp("^"+str); + return reg.test(this); +} + +function getShareDomain(path) { + if(path.startWith("https")){ + return "http://youfang.fangjia.com"; + } else { + return path; + } +} diff --git a/fangija-zsyf/js/user/myFocus.js b/fangija-zsyf/js/user/myFocus.js index 910426c..9b6b414 100644 --- a/fangija-zsyf/js/user/myFocus.js +++ b/fangija-zsyf/js/user/myFocus.js @@ -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("

您还没有关注小区

"); 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) { ''+ '
'+tagStr+'
'+ ''+ - ''+ + '取消关注'+ ''; }); // 添加新条目 @@ -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); + }); } \ No newline at end of file diff --git a/fangija-zsyf/views/city/regionRanking.html b/fangija-zsyf/views/city/regionRanking.html index 47e6be4..5ab8bf3 100644 --- a/fangija-zsyf/views/city/regionRanking.html +++ b/fangija-zsyf/views/city/regionRanking.html @@ -115,7 +115,7 @@ $.config = {router: false}