diff --git a/fangija-zsyf/js/district/districtDetail.js b/fangija-zsyf/js/district/districtDetail.js index bf6c3fc..723b81f 100644 --- a/fangija-zsyf/js/district/districtDetail.js +++ b/fangija-zsyf/js/district/districtDetail.js @@ -9,7 +9,21 @@ var curOption; /* 关注&已关注切换 */ $(".collection01").on("click", function () { - + doAddCollect() +}); + +function doAddCollect(){ + if (localStorage.getItem("user_token") == null || localStorage.getItem("user_token") == "") { + clicked('../user/codeSms.html',true,false,{},{},function(){ + doAddCollect(); + }) + return; + } else { + addCollect(); + } +} + +function addCollect(){ axios.post("/rest/districts/addCollect",{city:city,region:region,name:name,lat:lat,lng:lng,address:address, poiTags:tags}).then(function (response) { var msg = response.data.message if(msg){ @@ -24,11 +38,24 @@ $(".collection01").on("click", function () { .catch(function (error) { console.log(error); }); - - -}); +} + $(".collection02").on("click", function () { - + removeCollect(); +}); + +function doRemoveCollect(){ + if (localStorage.getItem("user_token") == null || localStorage.getItem("user_token") == "") { + clicked('../user/codeSms.html',true,false,{},{},function(){ + doRemoveCollect(); + }) + return; + } else { + removeCollect(); + } +} + +function removeCollect(){ axios.post("/rest/districts/removeCollect",{city:city,region:region,name:name}).then(function (response) { var msg = response.data.message if(msg){ @@ -43,8 +70,7 @@ $(".collection02").on("click", function () { .catch(function (error) { console.log(error); }); - -}); +} /* button状态切换 */ $(".content-block .button").on("click", function () { @@ -52,6 +78,16 @@ $(".content-block .button").on("click", function () { $(this).addClass("active"); }); +/* 图表切换 */ +$("#tabAvgDiv").on("click", function () { + $("#tabChart1").css("z-index","1"); + $("#tabChart2").css("z-index","-1"); +}); +$("#tabRentDiv").on("click", function () { + $("#tabChart2").css("z-index","1"); + $("#tabChart1").css("z-index","-1"); +}); + var t1 = window.setTimeout(loadMap,1000); function loadMap(){ if(lng && lat){ @@ -133,6 +169,28 @@ function loadDistrictInfo(){ } } + var starScore = response.data.data.starScore + if(starScore && starScore > 0){ + var regionIndex = response.data.data.regionIndex + var districtPoiCount = response.data.data.districtPoiCount + + var schoolIndex = response.data.data.schoolIndex + var arroundIndex = response.data.data.arroundIndex + + var indexs = [] + indexs.push(vo.index); + indexs.push(regionIndex); + indexs.push(schoolIndex); + indexs.push(arroundIndex); + + /* 小区评级 */ + loadDistrictLevel(indexs); + }else{ + $("#distLevelDiv").hide() + } + + + }else{ $("#noDataDiv").show() baseInfo.name = "小区详情" @@ -183,11 +241,13 @@ function loadDistrictInfo(){ function loadKLineData(city, region, name){ + var type = $("#trendDiv1 a.active").attr("t-v"); axios.get("/rest/trend/kData", { params: { city: city, region:region, - name:name + name:name, + type: type } }).then(function (response) { var datas = response.data.data @@ -234,23 +294,29 @@ function loadKLineData(city, region, name){ $("#trendDiv1 a").click(function(){ $("#trendDiv1 a").removeClass("active") $(this).addClass("active") + //showTrends(); var v = $(this).attr("t-v"); - if(v == "1"){ - curOption.dataZoom[0].start = 95 - }else if(v == "3"){ - curOption.dataZoom[0].start = 90 - }else if(v == "6"){ - curOption.dataZoom[0].start = 80 - }else if(v == "12"){ - curOption.dataZoom[0].start = 50 - }else if(v == "24"){ - curOption.dataZoom[0].start = 0 - }else if(v == "36"){ - curOption.dataZoom[0].start = 0 - } - myChart01.setOption(curOption,true); + showTrends(v) }); +function showTrends(v){ + + + if(v == "36"){ + if (localStorage.getItem("user_token") == null || localStorage.getItem("user_token") == "") { + clicked('../user/codeSms.html',true,false,{},{},function(){ + showTrends(v); + }) + return; + } else { + //curOption.dataZoom[0].start = 0 + loadKLineData(city, region, name) + } + } + //myChart01.setOption(curOption,true); + loadKLineData(city, region, name) +} + var option01 = { animation: false, @@ -680,7 +746,8 @@ function loadRentTrends(city, region, name){ showRentChart2(categories, series); }else{ //没数据 - $("#tabRentDiv").addClass("dn"); + //$("#tabChart2").hide(); + $("#tabRentDiv").addClass("dn") } }).catch(function (error) { alert(error) @@ -755,7 +822,7 @@ function showRentChart2(categories, series){ } /* 小区评级 */ -function loadDistrictLevel(){ +function loadDistrictLevel(datas){ var option03 = { tooltip: { trigger: 'axis', @@ -765,10 +832,10 @@ function loadDistrictLevel(){ radar: [ { indicator: [ - {text: '活跃度评级', max: 100}, + {text: '楼盘潜力评级', max: 100}, {text: '板块评级', max: 100}, {text: '教育评级', max: 100}, - {text: '物业评级', max: 100}, + {text: '生活便利评级', max: 100}, ], radius: 70, name: { @@ -812,7 +879,7 @@ function loadDistrictLevel(){ data: [ { name: '', - value: [25.29, 85.13, 36.42, 57.23] + value: datas } ] } diff --git a/fangija-zsyf/views/component/baseInfoComponent.js b/fangija-zsyf/views/component/baseInfoComponent.js index f8ddedf..b272aa6 100644 --- a/fangija-zsyf/views/component/baseInfoComponent.js +++ b/fangija-zsyf/views/component/baseInfoComponent.js @@ -117,6 +117,7 @@ Vue.component('base-info-component', { $(".collection02").hide(); $(".collection01").show(); } + $(".loadingBg").hide(); if(vo){ if(vo.avgPrice){ lat = vo.lat2; @@ -165,7 +166,48 @@ Vue.component('base-info-component', { dataParam.developer = vo.developer; dataParam.estateCompany = vo.estateCompany; -// loadNearDistrict(vo.lat2, vo.lng2); + var starScore = response.data.data.starScore + + var starHtml = $("#distLevelDiv .star") + if(starHtml.length>0){ + if(starScore && starScore > 0){ + + var html = getStarContent(starScore); + $("#distLevelDiv .star").html(html); + + + + var regionIndex = response.data.data.regionIndex + var districtPoiCount = response.data.data.districtPoiCount + + var schoolIndex = response.data.data.schoolIndex + var arroundIndex = response.data.data.arroundIndex + + var indexs = [] + indexs.push(vo.index); + indexs.push(regionIndex); + indexs.push(schoolIndex); + indexs.push(arroundIndex); + + /* 小区评级 */ + loadDistrictLevel(indexs); + }else{ + $("#distLevelDiv").hide() + } + }else{ + var ht = $("#arroundLevelDiv") + if(ht.length>0){ + var score = response.data.data.arroundIndexStar + if(score > 0){ + var html = getStarContent(score); + $("#arroundLevelDiv .star").html("生活便利 "+html); + }else{ + $("#arroundLevelDiv").hide(); + } + + } + } + }else{ $("#noDataDiv").show() baseInfo.name = "小区详情" @@ -182,3 +224,26 @@ Vue.component('base-info-component', { } }) +function getStarContent(starScore){ + var mod = starScore - parseInt(starScore); + var num = parseInt(starScore); + var nn = 5 - num; + + var html = "" + for(var i=1;i<=num;i++){ + html +="" + } + if(mod==0.5){ + html +="" + } + if(nn >0){ + if(mod==0.5){ + nn = nn -1 + } + for(var j=1;j<=nn;j++){ + html +="" + } + } + return html; +} + diff --git a/fangija-zsyf/views/component/nearDist.js b/fangija-zsyf/views/component/nearDist.js index 4584432..9a860e4 100644 --- a/fangija-zsyf/views/component/nearDist.js +++ b/fangija-zsyf/views/component/nearDist.js @@ -7,7 +7,7 @@ Vue.component('near-dist-component', {