var cityPotentialRankingData = {cityPotentialRankingList:[]}; Vue.component('city_potential_ranking',{ template:'
'+ ''+ '
', data:function(){ return cityPotentialRankingData; }, methods:{ loadCityPotentialRanking:function(){ axios.get("/rest/quotations/potentialUpTopInfos").then(function(response){ list = response.data.data; $(list).each(function(i){ var index = this.index; var totalHalfStar = Math.round(Math.round(index/5)/2) //总半星 var starNum = Math.floor(totalHalfStar/2) //全星 var halfStarNum = totalHalfStar%2 //半星 var noneStarNum = 5-starNum-halfStarNum //空星 this.starNum = starNum; this.halfStarNum = halfStarNum; this.noneStarNum = noneStarNum; }) cityPotentialRankingData.cityPotentialRankingList = response.data.data; }).catch(function(error){ console.log(error) }) }, follow:function(city,event){ axios.get("/rest/quotations/collectCity",{params:{city:city}}).then(function(response){ $(event.target).parent().children().removeClass("dn"); $(event.target).addClass("dn"); loadCityPotentialRanking() }).catch(function(error){ console.log(error) }) }, abolish:function(city,event){ axios.get("/rest/quotations/collectCity",{params:{city:city}}).then(function(response){ $(event.target).parent().children().removeClass("dn"); $(event.target).addClass("dn"); loadCityPotentialRanking() }).catch(function(error){ console.log(error) }) } }, mounted:function(){ this.loadCityPotentialRanking(); } })