Files
youfang-app/fangija-zsyf/views/component/cityIncreaseRankingComponent.js
T
zongzhimin 2219d23dac YOUFANG1.1
2018-04-12 09:41:10 +08:00

71 lines
2.6 KiB
JavaScript

var cityIncreaseRankingData = {cityIncreaseRankingList:[],test:"ttt"};
Vue.component('city_increase_ranking',{
template:'<div class="list-block media-list cityList">'+
'<ul>'+
'<li>'+
'<a class="item-content">'+
'<div class="item-inner">'+
'<div class="item-subtitle row">'+
'<div class="col-5">&nbsp;</div>'+
'<div class="col-20">城市</div>'+
'<div class="col-25">上月均价</div>'+
'<div class="col-25">近30天涨跌幅</div>'+
'<div class="col-20"></div>'+
'</div>'+
'</div>'+
'</a>'+
'</li>'+
'<li v-for="(ci,index) in cityIncreaseRankingList">'+
'<a class="item-content">'+
'<div class="item-inner">'+
'<div class="item-subtitle row">'+
'<div class="col-5">{{index+1}}</div>'+
'<div class="col-20">{{ci.city}}</div>'+
'<div class="col-25">{{!ci.cityTopMonthAvgPrice||ci.cityTopMonthAvgPrice==""?"暂无":""+ci.cityTopMonthAvgPrice+"元/㎡"}}</div>'+
'<div class="col-25">'+
'<em class="up">{{!ci.oneMonthUpDownRange||ci.oneMonthUpDownRange==""?"暂无":Math.abs(100*ci.oneMonthUpDownRange).toFixed(2)+"%"}}<i class="icon" v-bind:class="[ci.oneMonthUpDownRange>0?&quot;icon-arrow-red&quot;:&quot;&quot;,ci.oneMonthUpDownRange<0?&quot;icon-arrow-green&quot;:&quot;&quot;]"></i></em>'+
'</div>'+
'<div class="col-20">'+
'<i class="button theme collection collection01" v-on:click="follow(ci.city,$event)">关注</i>'+
'<i class="button collection collection02 dn" v-on:click="abolish(ci.city,$event)">取消</i>'+
'</div>'+
'</div>'+
'</div>'+
'</a>'+
'</li>'+
'</ul>'+
'</div>',
data:function(){
return cityIncreaseRankingData;
},
methods:{
loadCityIncreaseRanking:function(){
axios.get("/rest/quotations/potentialUpTopInfos").then(function(response){
cityIncreaseRankingData.cityIncreaseRankingList = 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");
}).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");
}).catch(function(error){
console.log(error)
})
}
},
mounted:function(){
this.loadCityIncreaseRanking();
}
})