This commit is contained in:
xuhe@fangjia.com
2018-04-11 13:26:13 +08:00
parent 74c811818d
commit d55ad1ddc9
6 changed files with 239 additions and 79 deletions
+94 -27
View File
@@ -9,7 +9,21 @@ var curOption;
/* 关注&已关注切换 */ /* 关注&已关注切换 */
$(".collection01").on("click", function () { $(".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) { 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 var msg = response.data.message
if(msg){ if(msg){
@@ -24,11 +38,24 @@ $(".collection01").on("click", function () {
.catch(function (error) { .catch(function (error) {
console.log(error); console.log(error);
}); });
}
});
$(".collection02").on("click", function () { $(".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) { axios.post("/rest/districts/removeCollect",{city:city,region:region,name:name}).then(function (response) {
var msg = response.data.message var msg = response.data.message
if(msg){ if(msg){
@@ -43,8 +70,7 @@ $(".collection02").on("click", function () {
.catch(function (error) { .catch(function (error) {
console.log(error); console.log(error);
}); });
}
});
/* button状态切换 */ /* button状态切换 */
$(".content-block .button").on("click", function () { $(".content-block .button").on("click", function () {
@@ -52,6 +78,16 @@ $(".content-block .button").on("click", function () {
$(this).addClass("active"); $(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); var t1 = window.setTimeout(loadMap,1000);
function loadMap(){ function loadMap(){
if(lng && lat){ 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{ }else{
$("#noDataDiv").show() $("#noDataDiv").show()
baseInfo.name = "小区详情" baseInfo.name = "小区详情"
@@ -183,11 +241,13 @@ function loadDistrictInfo(){
function loadKLineData(city, region, name){ function loadKLineData(city, region, name){
var type = $("#trendDiv1 a.active").attr("t-v");
axios.get("/rest/trend/kData", { axios.get("/rest/trend/kData", {
params: { params: {
city: city, city: city,
region:region, region:region,
name:name name:name,
type: type
} }
}).then(function (response) { }).then(function (response) {
var datas = response.data.data var datas = response.data.data
@@ -234,23 +294,29 @@ function loadKLineData(city, region, name){
$("#trendDiv1 a").click(function(){ $("#trendDiv1 a").click(function(){
$("#trendDiv1 a").removeClass("active") $("#trendDiv1 a").removeClass("active")
$(this).addClass("active") $(this).addClass("active")
//showTrends();
var v = $(this).attr("t-v"); var v = $(this).attr("t-v");
if(v == "1"){ showTrends(v)
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);
}); });
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 = { var option01 = {
animation: false, animation: false,
@@ -680,7 +746,8 @@ function loadRentTrends(city, region, name){
showRentChart2(categories, series); showRentChart2(categories, series);
}else{ }else{
//没数据 //没数据
$("#tabRentDiv").addClass("dn"); //$("#tabChart2").hide();
$("#tabRentDiv").addClass("dn")
} }
}).catch(function (error) { }).catch(function (error) {
alert(error) alert(error)
@@ -755,7 +822,7 @@ function showRentChart2(categories, series){
} }
/* 小区评级 */ /* 小区评级 */
function loadDistrictLevel(){ function loadDistrictLevel(datas){
var option03 = { var option03 = {
tooltip: { tooltip: {
trigger: 'axis', trigger: 'axis',
@@ -765,10 +832,10 @@ function loadDistrictLevel(){
radar: [ radar: [
{ {
indicator: [ indicator: [
{text: '活跃度评级', max: 100}, {text: '楼盘潜力评级', max: 100},
{text: '板块评级', max: 100}, {text: '板块评级', max: 100},
{text: '教育评级', max: 100}, {text: '教育评级', max: 100},
{text: '物业评级', max: 100}, {text: '生活便利评级', max: 100},
], ],
radius: 70, radius: 70,
name: { name: {
@@ -812,7 +879,7 @@ function loadDistrictLevel(){
data: [ data: [
{ {
name: '', name: '',
value: [25.29, 85.13, 36.42, 57.23] value: datas
} }
] ]
} }
@@ -117,6 +117,7 @@ Vue.component('base-info-component', {
$(".collection02").hide(); $(".collection02").hide();
$(".collection01").show(); $(".collection01").show();
} }
$(".loadingBg").hide();
if(vo){ if(vo){
if(vo.avgPrice){ if(vo.avgPrice){
lat = vo.lat2; lat = vo.lat2;
@@ -165,7 +166,48 @@ Vue.component('base-info-component', {
dataParam.developer = vo.developer; dataParam.developer = vo.developer;
dataParam.estateCompany = vo.estateCompany; 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{ }else{
$("#noDataDiv").show() $("#noDataDiv").show()
baseInfo.name = "小区详情" 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 +="<i class='icon icon-star01'></i>"
}
if(mod==0.5){
html +="<i class='icon icon-star02'></i>"
}
if(nn >0){
if(mod==0.5){
nn = nn -1
}
for(var j=1;j<=nn;j++){
html +="<i class='icon icon-star'></i>"
}
}
return html;
}
+5 -2
View File
@@ -7,7 +7,7 @@ Vue.component('near-dist-component', {
<div class="cardNearbyBox cardNearbyBox01"> <div class="cardNearbyBox cardNearbyBox01">
<div class="cardNearbyWin"> <div class="cardNearbyWin">
<div class="card cardNearby" v-for="dist in nearDists"> <div class="card cardNearby" v-for="(dist,index) in nearDists" @click="showDistrict(index)">
<div class="card-header">{{dist.name}}</div> <div class="card-header">{{dist.name}}</div>
<div class="card-content"> <div class="card-content">
<div class="card-content-inner">{{dist.avgPrice}}元/㎡</div> <div class="card-content-inner">{{dist.avgPrice}}元/㎡</div>
@@ -56,8 +56,11 @@ Vue.component('near-dist-component', {
alert(error) alert(error)
console.log(error); console.log(error);
}); });
},
showDistrict:function(index){
clicked('../district/detail.html',true,false,{},{city:distDatas.nearDists[index].city,region:distDatas.nearDists[index].region,name:distDatas.nearDists[index].name});
} }
}, },
mounted:function(){ mounted:function(){
this.loadNearDistrict(); this.loadNearDistrict();
} }
+31 -16
View File
@@ -33,7 +33,12 @@
.tabs{width:100%;height:350px;} .tabs{width:100%;height:350px;}
.tabChart1{z-index:1;} .tabChart1{z-index:1;}
.tabChart2{z-index:-1;} .tabChart2{z-index:-1;}
.mark-icon-box {width:24px;height:30px;position:absolute;z-index:98;}
.mark-icon-box .mark-icon {width: 20px;height: 30px;display: block;cursor: pointer;font-size: 14px; color: #fff;font-weight: bold;text-align: center;line-height: 24px;background: url(../../images/dw.png) no-repeat;} .mark-icon-box .mark-icon {width: 20px;height: 30px;display: block;cursor: pointer;font-size: 14px; color: #fff;font-weight: bold;text-align: center;line-height: 24px;background: url(../../images/dw.png) no-repeat;}
.loadingBg{width:100%;height:100%;background:#fff;overflow:hidden;position:absolute;top:11px;left:0;z-index:100;}
.loadingBg .infinite-scroll-preloader{margin-top:30%;}
</style> </style>
</head> </head>
@@ -42,7 +47,14 @@
<div class="page-group"> <div class="page-group">
<div class="page page-current" id="districtBaseInfo"> <div class="page page-current" id="districtBaseInfo">
<header class="bar bar-nav barBorder">
<div class="loadingBg">
<div class="infinite-scroll-preloader">
<div class="preloader"></div>
</div>
</div>
<header class="bar bar-nav barBorder ">
<button class="button button-link button-nav pull-left" onclick="back(),plus.nativeUI.closeWaiting();"> <button class="button button-link button-nav pull-left" onclick="back(),plus.nativeUI.closeWaiting();">
<span class="icon icon-left"></span> <span class="icon icon-left"></span>
</button> </button>
@@ -112,7 +124,7 @@
<div class="buttons-row theme" style="padding:0 0.75rem;" id="trendDiv1"> <div class="buttons-row theme" style="padding:0 0.75rem;" id="trendDiv1">
<a t-v="6" class="tab-link button active">半年</a> <a t-v="6" class="tab-link button active">半年</a>
<a t-v="12" class="tab-link button">一年</a> <a t-v="12" class="tab-link button">一年</a>
<a t-v="24" class="tab-link button">三年</a> <a t-v="36" class="tab-link button">三年</a>
</div> </div>
<div class="chart" id="chart01" style="height:360px;"></div> <div class="chart" id="chart01" style="height:360px;"></div>
</div> </div>
@@ -129,7 +141,7 @@
</div> </div>
</div> </div>
</div> </div>
<div class="card cardPrice cardPrice02" style="border-bottom:solid 0.5rem #f3f3f3;"> <!--<div class="card cardPrice cardPrice02" style="border-bottom:solid 0.5rem #f3f3f3;">
<div class="card-footer"> <div class="card-footer">
<span> <span>
<em><strong>有房说</strong></em> <em><strong>有房说</strong></em>
@@ -138,9 +150,10 @@
<label style="color:#666;">本小区2月活跃度为20;价格近3个月处于下跌趋势,小区物业一般,交通不便利,所属板块为不活跃。</label> <label style="color:#666;">本小区2月活跃度为20;价格近3个月处于下跌趋势,小区物业一般,交通不便利,所属板块为不活跃。</label>
</span> </span>
</div> </div>
</div> </div>-->
<div class="topic">
<div class="topicTitle" style="font-size:0.7rem;">小区评级结果:<span class="star"><i class="icon icon-star01"></i><i class="icon icon-star01"></i><i class="icon icon-star01"></i><i class="icon icon-star01"></i><i class="icon icon-star"></i></span></div> <div class="topic" id="distLevelDiv">
<div class="topicTitle" style="font-size:0.7rem;">小区评级结果:<span class="star"></span></div>
<div class="topicContent" style="padding:0;"> <div class="topicContent" style="padding:0;">
<div class="chart" id="chart03"></div> <div class="chart" id="chart03"></div>
</div> </div>
@@ -225,8 +238,8 @@ $.config = {router: false}
<script> <script>
var city = "北京" var city = "北京"
var region = "大兴" var region = "顺义"
var name = "兴海家园日苑" var name = "龙湖滟澜山二期"
//var lat = 31.292437 //var lat = 31.292437
//var lng = 121.48703 //var lng = 121.48703
@@ -260,7 +273,10 @@ $.config = {router: false}
developer:"", developer:"",
estateCompany:"", estateCompany:"",
tags:[], tags:[],
nearDists:[] nearDists:[],
regionIndex:"",
schoolIndex:""
} }
}) })
@@ -273,7 +289,7 @@ $.config = {router: false}
<script> <script>
//loadDistrictInfo(); //loadDistrictInfo();
document.addEventListener('plusready', onPlusReady, false); /*document.addEventListener('plusready', onPlusReady, false);
function onPlusReady() { function onPlusReady() {
var self = plus.webview.currentWebview(); var self = plus.webview.currentWebview();
city = self.city city = self.city
@@ -284,11 +300,11 @@ function onPlusReady() {
new Vue({ new Vue({
el: '#baseInfo' el: '#baseInfo'
}) })
} }*/
//new Vue({ new Vue({
// el: '#baseInfo' el: '#baseInfo'
// }) })
function openMapWindow(){ function openMapWindow(){
clicked('arround.html',true,false,{},{city:city,region:region,name:name,lat:lat,lng:lng}); clicked('arround.html',true,false,{},{city:city,region:region,name:name,lat:lat,lng:lng});
@@ -323,8 +339,7 @@ loadKLineData(city, region, name);
/* 小区租金走势 */ /* 小区租金走势 */
loadRentTrends(city, region, name); loadRentTrends(city, region, name);
/* 小区评级 */
loadDistrictLevel();
</script> </script>
</body> </body>
+11 -3
View File
@@ -205,6 +205,12 @@ function selectHouseInfoList(){
lastIndex = $('.cardInfo').length; lastIndex = $('.cardInfo').length;
//每次加载添加多少条目 //每次加载添加多少条目
itemsPerLoad = resultList.length; itemsPerLoad = resultList.length;
//登录状态,但没有数据
if(lastIndex == 0 && resultList.length ==0){
//控制显示
$('#page-group-nologin').hide();
$('#page-group-login').show();
}
//请求后对page进行赋值 //请求后对page进行赋值
page = resultsMap.houseInfoPageList.currentPage; page = resultsMap.houseInfoPageList.currentPage;
pageSize = resultsMap.houseInfoPageList.limit; pageSize = resultsMap.houseInfoPageList.limit;
@@ -224,13 +230,15 @@ function checkIsLogin(){
}else{ }else{
selectHouseInfoList(); selectHouseInfoList();
//控制显示 //控制显示
$('#page-group-nologin').hide(); /*$('#page-group-nologin').hide();
$('#page-group-login').show(); $('#page-group-login').show();*/
} }
} }
function gotoAddHouse(){ function gotoAddHouse(){
clicked('/views/house/add.html',true,false,{},{type:0},function(){}); clicked('/views/house/add.html',true,false,{},{type:0},function(){
checkIsLogin();
})
} }
//界面加载 //界面加载
+32 -30
View File
@@ -24,6 +24,8 @@
.topicContent .list-block ul:after{height:0;} .topicContent .list-block ul:after{height:0;}
.districtMap + .list-block.media-list span{line-height:1.2rem;} .districtMap + .list-block.media-list span{line-height:1.2rem;}
.cardNearbyBox01 .cardNearby .card-header:nth-child(2){padding-top:0;} .cardNearbyBox01 .cardNearby .card-header:nth-child(2){padding-top:0;}
.mark-icon-box {width:24px;height:30px;position:absolute;z-index:98;}
.mark-icon-box .mark-icon {width: 20px;height: 30px;display: block;cursor: pointer;font-size: 14px; color: #fff;font-weight: bold;text-align: center;line-height: 24px;background: url(../../images/dw.png) no-repeat;} .mark-icon-box .mark-icon {width: 20px;height: 30px;display: block;cursor: pointer;font-size: 14px; color: #fff;font-weight: bold;text-align: center;line-height: 24px;background: url(../../images/dw.png) no-repeat;}
</style> </style>
@@ -59,9 +61,9 @@
</span> </span>
</div> </div>
<div class="item-subtitle row" style="margin-top:0.5rem;margin-bottom:0.3rem;"> <div class="item-subtitle row" style="margin-top:0.5rem;margin-bottom:0.3rem;" id="arroundLevelDiv">
<span class="star col-50">小区关注 <i class="icon icon-star01"></i><i class="icon icon-star01"></i><i class="icon icon-star01"></i><i class="icon icon-star01"></i><i class="icon"></i></span> <!--<span class="star col-50">小区关注 <i class="icon icon-star01"></i><i class="icon icon-star01"></i><i class="icon icon-star01"></i><i class="icon icon-star01"></i><i class="icon"></i></span>-->
<span class="star col-50">生活便利 <i class="icon icon-star01"></i><i class="icon icon-star01"></i><i class="icon icon-star01"></i><i class="icon icon-star02"></i><i class="icon"></i></span> <span class="star "> </span>
</div> </div>
</div> </div>
</div> </div>
@@ -154,9 +156,9 @@ $.config = {router: false}
<script type='text/javascript' src='../../js/common.js' charset='utf-8'></script> <script type='text/javascript' src='../../js/common.js' charset='utf-8'></script>
<script> <script>
var city = "上海" var city = "北京"
var region = "长宁" var region = "顺义"
var name = "新泾三村" var name = "龙湾别墅五期"
var lat; var lat;
var lng; var lng;
@@ -182,31 +184,31 @@ $.config = {router: false}
<script type='text/javascript' src='../component/nearDist.js' charset='utf-8'></script> <script type='text/javascript' src='../component/nearDist.js' charset='utf-8'></script>
<script type='text/javascript' src='../component/roomRent.js' charset='utf-8'></script> <script type='text/javascript' src='../component/roomRent.js' charset='utf-8'></script>
<script> <script>
document.addEventListener('plusready', onPlusReady, false); //document.addEventListener('plusready', onPlusReady, false);
function onPlusReady() { //function onPlusReady() {
var self = plus.webview.currentWebview(); // var self = plus.webview.currentWebview();
city = self.city // city = self.city
region = self.region // region = self.region
name = self.name; // name = self.name;
// loadDistrictInfo(); // // loadDistrictInfo();
//
//
// 创建根实例 // // 创建根实例
new Vue({ // new Vue({
el: '#baseInfo' // el: '#baseInfo'
}) // })
//
//new Vue({ ////new Vue({
// el: '#nearDistDiv' //// el: '#nearDistDiv'
//}) ////})
//new Vue({ ////new Vue({
// el: '#mapDiv' //// el: '#mapDiv'
//}) ////})
} //}
//new Vue({ new Vue({
// el: '#baseInfo' el: '#baseInfo'
//}) })