新增单独的城市
This commit is contained in:
@@ -356,7 +356,6 @@ var option01 = {
|
||||
res += '<br/> 月末 : ' + params[0].value[2];
|
||||
res += '<br/> 最低 : ' + params[0].value[3];
|
||||
res += '<br/> 最高 : ' + params[0].value[4];
|
||||
res += '<br/> '+params[0].seriesName + ' : ' +params[0].value;
|
||||
return res;
|
||||
},
|
||||
position: function (pos, params, el, elRect, size) {
|
||||
|
||||
@@ -0,0 +1,480 @@
|
||||
var ret = []
|
||||
|
||||
function loadMyCollectCity(){
|
||||
axios.get("/rest/quotations/userCollectCitys",{}).then(function (response) {
|
||||
var curDatas = response.data.data
|
||||
if(curDatas){
|
||||
if(IsInArray(curDatas, city)){
|
||||
cityInfoVue.$data.collecd = true;
|
||||
}else{
|
||||
cityInfoVue.$data.collecd = false;
|
||||
}
|
||||
}
|
||||
|
||||
}).catch(function (error) {
|
||||
alert(error)
|
||||
console.log(error);
|
||||
});
|
||||
}
|
||||
|
||||
function loadCityPriceInfo(city){
|
||||
|
||||
axios.get("/rest/quotations/cityPriceInfo", {
|
||||
params: {
|
||||
city: city
|
||||
}
|
||||
}).then(function (response) {
|
||||
var data1 = response.data.data
|
||||
if(data1){
|
||||
var cityObj = new Object();
|
||||
cityObj.city = data1.city
|
||||
cityObj.cityTopMonthAvgPrice = data1.cityTopMonthAvgPrice
|
||||
cityObj.downChance = data1.downChance
|
||||
cityObj.follow = data1.follow
|
||||
cityObj.index = data1.index
|
||||
cityObj.oneMonthUpDownRange = (data1.oneMonthUpDownRange*100).toFixed(2)
|
||||
cityObj.oneYearUpDownRange = data1.oneYearUpDownRange
|
||||
cityObj.rangeLevel = data1.rangeLevel
|
||||
cityObj.time = year + month
|
||||
cityInfoVue.$data.myCityMap = cityObj;
|
||||
}
|
||||
}).catch(function (error) {
|
||||
alert(error)
|
||||
console.log(error);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function loadUpOrDown(city){
|
||||
axios.get("/rest/quotations/hosueQuatations", {
|
||||
params: {
|
||||
city: city
|
||||
}
|
||||
}).then(function (response) {
|
||||
var data2 = response.data.data
|
||||
if(data2){
|
||||
loadUpOrDownChart(data2.downRate, data2.upRate);
|
||||
}
|
||||
}).catch(function (error) {
|
||||
alert(error)
|
||||
console.log(error);
|
||||
});
|
||||
}
|
||||
|
||||
function loadCityPricesAndCounts(city){
|
||||
axios.get("/rest/quotations/loadCityPriceTrends", {
|
||||
params: {
|
||||
city: city,
|
||||
type:2
|
||||
}
|
||||
}).then(function (response) {
|
||||
var data3 = response.data.data
|
||||
if(data3){
|
||||
loadTrends(data3.times, data3.cityPriceMap , data3.countMap);
|
||||
}
|
||||
}).catch(function (error) {
|
||||
alert(error)
|
||||
console.log(error);
|
||||
});
|
||||
}
|
||||
|
||||
function loadHotDistrict(city){
|
||||
|
||||
axios.get("/rest/districts/hotDistricts", {
|
||||
params: {
|
||||
city: city,
|
||||
top:5
|
||||
}
|
||||
}).then(function (response) {
|
||||
var data4 = response.data.data
|
||||
if(data4){
|
||||
var nears = []
|
||||
for(var n in data4){
|
||||
var v = data4[n]
|
||||
var nearObj = new Object();
|
||||
nearObj.city = v.city
|
||||
nearObj.region = v.region
|
||||
nearObj.name = v.name;
|
||||
nearObj.sname = nameConver(v.name)
|
||||
nearObj.avgPrice = v.avgPrice
|
||||
nears.push(nearObj);
|
||||
}
|
||||
cityInfoVue.$data.nears = nears;
|
||||
}
|
||||
}).catch(function (error) {
|
||||
alert(error)
|
||||
console.log(error);
|
||||
});
|
||||
}
|
||||
|
||||
/*点击走势TAB页*/
|
||||
function clickTrend(city, type){
|
||||
if(type == 5){
|
||||
if (localStorage.getItem("user_token") == null || localStorage.getItem("user_token") == "") {
|
||||
clicked('../user/codeSms.html',true,false,{},{},function(){
|
||||
clickTrend(city, type);
|
||||
})
|
||||
return;
|
||||
} else {
|
||||
startingLoadCharts(city, type);
|
||||
}
|
||||
}else{
|
||||
startingLoadCharts(city, type);
|
||||
}
|
||||
}
|
||||
|
||||
function startingLoadCharts(city, type){
|
||||
axios.get("/rest/quotations/loadCityPriceTrends", {
|
||||
params: {
|
||||
city: city,
|
||||
type:type
|
||||
}
|
||||
}).then(function (response) {
|
||||
|
||||
var datas = response.data.data
|
||||
var prices = []
|
||||
var counts = []
|
||||
var times = datas.times
|
||||
for(var i in times){
|
||||
var time = times[i]
|
||||
time = parseInt(time.replace("-",""))
|
||||
var pm = datas.cityPriceMap;
|
||||
var cm = datas.countMap;
|
||||
if(pm){
|
||||
if(pm[time]){
|
||||
prices.push(pm[time])
|
||||
}else{
|
||||
prices.push(null)
|
||||
}
|
||||
|
||||
}
|
||||
if(cm){
|
||||
if(cm[time]){
|
||||
counts.push(cm[time]);
|
||||
}else{
|
||||
counts.push(null);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
$("#trendDiv a").removeClass("active");
|
||||
$("a[v='"+type+"']").addClass("active")
|
||||
showChart("price_chart", times, prices, counts)
|
||||
|
||||
}).catch(function (error) {
|
||||
alert(error)
|
||||
console.log(error);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function loadUpOrDownChart(downRate, upRate){
|
||||
if(upRate){
|
||||
var cityObj1 = new Object();
|
||||
cityObj1.name= ""
|
||||
cityObj1.value = upRate
|
||||
|
||||
var cityObj2 = new Object();
|
||||
cityObj2.name= ""
|
||||
cityObj2.value = 100 - upRate
|
||||
|
||||
dataUp = [cityObj1, cityObj2]
|
||||
addUpChart(dataUp)
|
||||
}else{
|
||||
$("#up_chart").parent().parent().hide()
|
||||
}
|
||||
|
||||
if(downRate){
|
||||
var cityObj3 = new Object();
|
||||
cityObj3.name= ""
|
||||
cityObj3.value = downRate
|
||||
|
||||
var cityObj4 = new Object();
|
||||
cityObj4.name= ""
|
||||
cityObj4.value = 100 - downRate
|
||||
|
||||
dataDown = [cityObj3, cityObj4]
|
||||
addDownChart(dataDown)
|
||||
}else{
|
||||
$("#down_chart").parent().parent().hide()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
function loadTrends(times, cityPriceMap, countMap){
|
||||
var prices = []
|
||||
var counts = []
|
||||
for(var i in times){
|
||||
var time = times[i]
|
||||
time = parseInt(time.replace("-",""))
|
||||
var pm = cityPriceMap;
|
||||
var cm = countMap;
|
||||
if(pm){
|
||||
prices.push(pm[time])
|
||||
}
|
||||
if(cm){
|
||||
counts.push(cm[time]);
|
||||
}
|
||||
}
|
||||
showChart("price_chart", times, prices, counts)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*跳转区域列表*/
|
||||
function showRegionInfo(city){
|
||||
clicked('../house/regions.html',true,false,{},{city:city});
|
||||
}
|
||||
/*跳转小区详情*/
|
||||
function showDistrictDetail(city, region, name){
|
||||
clicked('../district/detail.html',true,false,{},{city:city,region:region,name:name});
|
||||
}
|
||||
|
||||
|
||||
|
||||
function showChart(idDom, categories, prices, counts){
|
||||
if(!prices){
|
||||
prices = []
|
||||
}
|
||||
if(!counts){
|
||||
counts = []
|
||||
}
|
||||
|
||||
if(prices.length==0 && counts.length == 0){
|
||||
$("#trendChartDiv").hide();
|
||||
}else{
|
||||
/* 城市均价及挂牌走势 */
|
||||
var chart = Highcharts.chart(idDom, {
|
||||
colors: ['#ff7f50','#87cefa'],
|
||||
title: {
|
||||
text: '城市楼市均价及挂牌走势',
|
||||
y: -30
|
||||
},
|
||||
|
||||
xAxis: [{
|
||||
categories:categories,
|
||||
crosshair: true
|
||||
}],
|
||||
yAxis: [{
|
||||
|
||||
title: {
|
||||
text: '元/㎡',
|
||||
align: 'high',
|
||||
offset: 4,
|
||||
rotation: 0,
|
||||
y: -20
|
||||
},
|
||||
|
||||
allowDecimals: false,
|
||||
plotLines: [{
|
||||
value: 0,
|
||||
width: 1,
|
||||
color: '#808080'
|
||||
}]
|
||||
}, { // Secondary yAxis
|
||||
title: {
|
||||
text: '套',
|
||||
align: 'high',
|
||||
offset: 25,
|
||||
rotation: 0,
|
||||
y: -20
|
||||
},
|
||||
|
||||
allowDecimals: false,
|
||||
opposite: true
|
||||
}],
|
||||
tooltip: {
|
||||
shared: true
|
||||
},
|
||||
credits: {
|
||||
enabled: false
|
||||
},
|
||||
plotOptions: {
|
||||
line: {
|
||||
connectNulls: true //该设置会连接空值点
|
||||
},
|
||||
|
||||
series: {
|
||||
events: {
|
||||
legendItemClick: function(e) {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
marker: {
|
||||
radius: 3, //曲线点半径,默认是4
|
||||
symbol: 'circle' //曲线点类型:"circle", "square", "diamond", "triangle","triangle-down",默认是"circle"
|
||||
}
|
||||
}
|
||||
},
|
||||
series: [{
|
||||
name: '均价',
|
||||
type: 'line',
|
||||
zIndex: 1,
|
||||
tooltip: {
|
||||
valueSuffix: ' 元/㎡'
|
||||
},
|
||||
data: prices
|
||||
},{
|
||||
name: '挂牌量',
|
||||
type: 'column',
|
||||
yAxis: 1,
|
||||
tooltip: {
|
||||
valueSuffix: ' 套'
|
||||
},
|
||||
data: counts
|
||||
}]
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
function nameConver(textName){
|
||||
var length = textName.length;
|
||||
var textStr = textName;
|
||||
if(length > 5){
|
||||
textStr = textName.substr(0,5)+ "...";
|
||||
}
|
||||
return textStr;
|
||||
}
|
||||
|
||||
|
||||
function IsInArray(arr, val){
|
||||
var testStr=','+arr.join(",")+",";
|
||||
return testStr.indexOf(","+val+",")!=-1;
|
||||
}
|
||||
|
||||
function addUpChart(dataUp, num){
|
||||
/* 小区上涨 */
|
||||
//var dataUp = [];
|
||||
optionUp = {
|
||||
title: {
|
||||
text: dataUp[0].value + '%',
|
||||
subtext: '小区上涨',
|
||||
x: 'center',
|
||||
y: 'center',
|
||||
itemGap: -8,
|
||||
textStyle: {
|
||||
fontFamily: 'Arial, Verdana, sans-serif',
|
||||
fontSize: 30,
|
||||
color: '#333',
|
||||
fontWeight: 'normal'
|
||||
},
|
||||
subtextStyle: {
|
||||
fontFamily: '华文细黑',
|
||||
fontSize: 12,
|
||||
color: '#666'
|
||||
}
|
||||
},
|
||||
color: ['#EB5F34', '#e7e7e7'],
|
||||
series: [
|
||||
{
|
||||
name: '小区上涨',
|
||||
type: 'pie',
|
||||
radius: ['90%', '100%'],
|
||||
itemStyle: {
|
||||
normal: {
|
||||
label: {
|
||||
show: true
|
||||
},
|
||||
labelLine: {
|
||||
show: false
|
||||
}
|
||||
}
|
||||
},
|
||||
data: dataUp
|
||||
}
|
||||
]
|
||||
};
|
||||
var myChartUp = echarts.init(document.getElementById('up_chart'));
|
||||
myChartUp.setOption(optionUp,true);
|
||||
}
|
||||
|
||||
function addDownChart(dataDown){
|
||||
/* 小区下跌 */
|
||||
optionDown = {
|
||||
title: {
|
||||
text: dataDown[0].value + '%',
|
||||
subtext: '小区下跌',
|
||||
x: 'center',
|
||||
y: 'center',
|
||||
itemGap: -8,
|
||||
textStyle: {
|
||||
fontFamily: 'Arial, Verdana, sans-serif',
|
||||
fontSize: 30,
|
||||
color: '#333',
|
||||
fontWeight: 'normal'
|
||||
},
|
||||
subtextStyle: {
|
||||
fontFamily: '华文细黑',
|
||||
fontSize: 12,
|
||||
color: '#666'
|
||||
}
|
||||
},
|
||||
color: ['#88D053', '#e7e7e7'],
|
||||
series: [
|
||||
{
|
||||
name: '小区下跌',
|
||||
type: 'pie',
|
||||
radius: ['90%', '100%'],
|
||||
itemStyle: {
|
||||
normal: {
|
||||
label: {
|
||||
show: true
|
||||
},
|
||||
labelLine: {
|
||||
show: false
|
||||
}
|
||||
}
|
||||
},
|
||||
data: dataDown
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
var myChartUp = echarts.init(document.getElementById('down_chart'));
|
||||
myChartUp.setOption(optionDown,true);
|
||||
}
|
||||
|
||||
|
||||
function collectCity(city){
|
||||
if (localStorage.getItem("user_token") == null || localStorage.getItem("user_token") == "") {
|
||||
clicked('../user/codeSms.html',true,false,{},{},function(){
|
||||
collectCity(city)
|
||||
})
|
||||
return;
|
||||
} else {
|
||||
docollectCity(city)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function docollectCity(city){
|
||||
axios.get("/rest/quotations/collectCity",{
|
||||
params:{
|
||||
city : city
|
||||
}
|
||||
}).then(function (response) {
|
||||
var msg = response.data.message;
|
||||
if(msg){
|
||||
if(msg == "取消关注成功"){
|
||||
cityInfoVue.$data.collecd = false;
|
||||
}else if(msg == "关注成功"){
|
||||
cityInfoVue.$data.collecd = true;
|
||||
}else{
|
||||
$.toast(msg);
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log(error);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -329,7 +329,6 @@ function loadChart(){
|
||||
|
||||
loadTrends();
|
||||
|
||||
|
||||
window.clearInterval(t1);
|
||||
}
|
||||
}
|
||||
@@ -531,7 +530,7 @@ function showRegionInfo(city){
|
||||
function collectCity(city, index){
|
||||
if (localStorage.getItem("user_token") == null || localStorage.getItem("user_token") == "") {
|
||||
clicked('../user/codeSms.html',true,false,{},{},function(){
|
||||
docollectCity(city)
|
||||
collectCity(city)
|
||||
})
|
||||
return;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user