From a60fcf202cb28d1318f73744bb57a21e80fa0ceb Mon Sep 17 00:00:00 2001 From: gaojuan Date: Fri, 13 Apr 2018 13:30:31 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=8D=95=E7=8B=AC=E7=9A=84?= =?UTF-8?q?=E5=9F=8E=E5=B8=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fangija-zsyf/js/district/districtDetail.js | 1 - fangija-zsyf/js/quotations/cityDetail.js | 480 +++++++++++++++++++++ fangija-zsyf/js/quotations/collectCity.js | 3 +- fangija-zsyf/manifest.json | 7 +- fangija-zsyf/views/house/cityDetail.html | 184 ++++++++ fangija-zsyf/views/house/houseDetail.html | 15 +- 6 files changed, 681 insertions(+), 9 deletions(-) create mode 100644 fangija-zsyf/js/quotations/cityDetail.js create mode 100644 fangija-zsyf/views/house/cityDetail.html diff --git a/fangija-zsyf/js/district/districtDetail.js b/fangija-zsyf/js/district/districtDetail.js index a7b7b3d..4eb5ef7 100644 --- a/fangija-zsyf/js/district/districtDetail.js +++ b/fangija-zsyf/js/district/districtDetail.js @@ -356,7 +356,6 @@ var option01 = { res += '
月末 : ' + params[0].value[2]; res += '
最低 : ' + params[0].value[3]; res += '
最高 : ' + params[0].value[4]; - res += '
'+params[0].seriesName + ' : ' +params[0].value; return res; }, position: function (pos, params, el, elRect, size) { diff --git a/fangija-zsyf/js/quotations/cityDetail.js b/fangija-zsyf/js/quotations/cityDetail.js new file mode 100644 index 0000000..8c27744 --- /dev/null +++ b/fangija-zsyf/js/quotations/cityDetail.js @@ -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); + }); +} + diff --git a/fangija-zsyf/js/quotations/collectCity.js b/fangija-zsyf/js/quotations/collectCity.js index 0b8c69a..bef734b 100644 --- a/fangija-zsyf/js/quotations/collectCity.js +++ b/fangija-zsyf/js/quotations/collectCity.js @@ -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 { diff --git a/fangija-zsyf/manifest.json b/fangija-zsyf/manifest.json index 706ef27..8ed8840 100644 --- a/fangija-zsyf/manifest.json +++ b/fangija-zsyf/manifest.json @@ -1616,7 +1616,8 @@ ], "refer": [ "views/user/passLogin.html", - "views/district/detail.html" + "views/district/detail.html", + "views/setting/setting.html" ], "priority": 0 }, @@ -1667,7 +1668,9 @@ "resources": [], "refer": [ "views/house/regions.html", - "views/district/detail.html" + "views/district/detail.html", + "views/user/codeSms.html", + "views/house/cityDetail.html" ], "priority": 0 } diff --git a/fangija-zsyf/views/house/cityDetail.html b/fangija-zsyf/views/house/cityDetail.html new file mode 100644 index 0000000..f84dc38 --- /dev/null +++ b/fangija-zsyf/views/house/cityDetail.html @@ -0,0 +1,184 @@ + + + + + +房产行情 + + + + + + + + + + + + + + + + +
+
+ +
+ +
+ +
+
+
+ + 取消 + 关注 + +
+
+ 当前参考均价 +
+
+
{{myCityMap.cityTopMonthAvgPrice}}元/㎡
+
+ +
+ +
+
{{myCityMap.time}}楼市行情区县涨跌详情
+
+
+ +
+
+ +
+
+
+
+
+
+
城市均价及挂牌走势 +
+
+ 半年 + 一年 + 三年 +
+
+
+
+
+
+
+ +
+
热门小区
+
+
+
+
+
{{nearDist.sname}}
+
+
{{nearDist.avgPrice}}元/㎡
+
+
+ +
+
+
+
+ +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/fangija-zsyf/views/house/houseDetail.html b/fangija-zsyf/views/house/houseDetail.html index ed6cd92..75174c9 100644 --- a/fangija-zsyf/views/house/houseDetail.html +++ b/fangija-zsyf/views/house/houseDetail.html @@ -19,6 +19,9 @@ .cardInfo02 .item-subtitle{margin-top:0.2rem;} .cardCity01 .card-footer span:nth-child(2){text-align:center;} .cardNearbyBox01 .cardNearby .card-content-inner{padding-bottom:0.25rem;} + .tabs .topic{margin-bottom:0;} + .buttons-tab{overflow-x:auto;border-bottom:solid 1px #e7e7e7;} + .buttons-tab:after{height:0;} @@ -148,15 +151,15 @@
房产热点城市
-
- +
+

北京

-
+

上海

-
+

深圳

@@ -1476,6 +1479,10 @@ function addFocus(city){ }) } +function hotCity(city){ + clicked('../house/cityDetail.html',true,false,{},{city:city}); +} +