diff --git a/fangija-zsyf/css/main.css b/fangija-zsyf/css/main.css index 8067a11..fd42d82 100644 --- a/fangija-zsyf/css/main.css +++ b/fangija-zsyf/css/main.css @@ -693,7 +693,7 @@ input::-webkit-input-placeholder{ .topic .topicContent .topicContent_center div .icon.icon-menu04a{background:url(../images/icon-menu04a.png) no-repeat center center;background-size:100%;} .topic .topicContent .topicContent_center div .icon.icon-menu05a{background:url(../images/icon-menu05a.png) no-repeat center center;background-size:100%;} -.topic .topicContent .topicContent_center.home div{width:25%;border-left:none;} +.topic .topicContent .topicContent_center.home div{width:33%;border-left:none;} .topic .topicContent .topicContent_center.home div .icon{width:45px;height:45px;display:block;margin:0 auto;} .topic .topicContent .topicContent_center.home div .icon.icon-home01{background:url(../images/icon-home01.png) no-repeat center center;background-size:100%;} diff --git a/fangija-zsyf/images/icon-eye.png b/fangija-zsyf/images/icon-eye.png new file mode 100644 index 0000000..8d00c3a Binary files /dev/null and b/fangija-zsyf/images/icon-eye.png differ diff --git a/fangija-zsyf/js/push-common.js b/fangija-zsyf/js/push-common.js index 647943c..1c9eb7d 100644 --- a/fangija-zsyf/js/push-common.js +++ b/fangija-zsyf/js/push-common.js @@ -3,7 +3,6 @@ * yinjihuan */ document.addEventListener("plusready", function() { - message = document.getElementById("message"); // 监听点击消息事件 plus.push.addEventListener("click", function(msg) { // 判断是从本地创建还是离线推送的消息 @@ -16,13 +15,35 @@ document.addEventListener("plusready", function() { break; default: if (plus.os.name == "Android"){ - payload = JSON.parse(payload); + try { + payload = JSON.parse(payload); + } catch(err) { + + } if (payload.type == "0") { plus.ui.alert(title+"\n"+content); } else if (payload.type == "1") { - plus.ui.alert(title+"\n"+content,function(){ - window.location.href = payload.url; - }); + plus.ui.alert(title+"\n"+content,function(){ + if (payload.url == '/house/index') { + plus.webview.show('yfindex.html'); + } else { + plus.webview.show(BASE_PATH + payload.url); + } + //切换选项卡高亮 + var defaultTab = document.getElementById("defaultTab"); + var quotations = document.getElementById("quotations"); + var selfInfo = document.getElementById("selfInfo"); + defaultTab.classList.remove("mui-active"); + quotations.classList.remove("mui-active"); + selfInfo.classList.remove("mui-active"); + if (payload.url == '/quotations/index') { + quotations.classList.add("mui-active"); + } else if(payload.url == '/selfInfo/index') { + selfInfo.classList.add("mui-active"); + } else { + defaultTab.classList.add("mui-active"); + } + }); } else if (payload.type == "2") { plus.ui.alert(title+"\n"+content,function(){ openUrl(BASE_PATH+'/message/openView?url='+payload.url); @@ -33,11 +54,29 @@ document.addEventListener("plusready", function() { plus.ui.alert(content); } else if (payload.type == "1") { plus.ui.alert(content,function(){ - window.location.href = payload.url; - }); + if (payload.url == '/house/index') { + plus.webview.show('yfindex.html'); + } else { + plus.webview.show(BASE_PATH + payload.url); + } + //切换选项卡高亮 + var defaultTab = document.getElementById("defaultTab"); + var quotations = document.getElementById("quotations"); + var selfInfo = document.getElementById("selfInfo"); + defaultTab.classList.remove("mui-active"); + quotations.classList.remove("mui-active"); + selfInfo.classList.remove("mui-active"); + if (payload.url == '/quotations/index') { + quotations.classList.add("mui-active"); + } else if(payload.url == '/selfInfo/index') { + selfInfo.classList.add("mui-active"); + } else { + defaultTab.classList.add("mui-active"); + } + }); } else if (payload.type == "2") { plus.ui.alert(content,function(){ - openUrl(basePath+'/message/openView?url='+payload.url); + openUrl(BASE_PATH+'/message/openView?url='+payload.url); }); } } @@ -55,7 +94,26 @@ document.addEventListener("plusready", function() { plus.ui.alert(title+"\n"+content); } else if (payload.type == "1") { plus.ui.alert(title+"\n"+content,function(){ - window.location.href = payload.url; + if (payload.url == '/house/index') { + plus.webview.show('yfindex.html'); + } else { + plus.webview.show(BASE_PATH + payload.url); + } + + //切换选项卡高亮 + var defaultTab = document.getElementById("defaultTab"); + var quotations = document.getElementById("quotations"); + var selfInfo = document.getElementById("selfInfo"); + defaultTab.classList.remove("mui-active"); + quotations.classList.remove("mui-active"); + selfInfo.classList.remove("mui-active"); + if (payload.url == '/quotations/index') { + quotations.classList.add("mui-active"); + } else if(payload.url == '/selfInfo/index') { + selfInfo.classList.add("mui-active"); + } else { + defaultTab.classList.add("mui-active"); + } }); } else if (payload.type == "2") { plus.ui.alert(title+"\n"+content,function(){ @@ -63,4 +121,8 @@ document.addEventListener("plusready", function() { }); } }, false); -}, false); \ No newline at end of file +}, false); + +function openUrl(url){ + clicked(url,true); +} \ No newline at end of file diff --git a/fangija-zsyf/main.html b/fangija-zsyf/main.html index 0724f32..5e42f54 100644 --- a/fangija-zsyf/main.html +++ b/fangija-zsyf/main.html @@ -29,7 +29,8 @@ - + + + + + + + + + + \ No newline at end of file diff --git a/fangija-zsyf/yfindex.html b/fangija-zsyf/yfindex.html index 86d644e..57a9a8a 100644 --- a/fangija-zsyf/yfindex.html +++ b/fangija-zsyf/yfindex.html @@ -48,6 +48,7 @@ + @@ -93,10 +94,10 @@ 房价查询 -
+
@@ -105,6 +106,9 @@
{{todayDate}}
+
+ +
- + +
+
+
@@ -1547,8 +1554,17 @@ function getPosition(){ ); } /* 获取#region字数,截取#region前4字,并添加... */ -/*city="上海" -init();*/ +city="上海" +init(); +var baseInfo = new Vue({ + el: '#baseInfo', + data: { + region : "", + topMonth:"", + momAvgPrice: "", + momRate: "" + } +}) function init(){ //显示附近地址 var nearAddressParam = address; @@ -1573,24 +1589,21 @@ function init(){ } }) .then(function (response) { - new Vue({ - el: '#baseInfo', - data: { - region: response.data.data.region, - topMonth:response.data.data.topMonth, - momAvgPrice: response.data.data.momAvgPrice, - momRate: response.data.data.momRate - } - }) - new Vue({ + baseInfo.region = response.data.data.region; + baseInfo.topMonth = response.data.data.topMonth; + baseInfo.momAvgPrice = response.data.data.momAvgPrice; + baseInfo.momRate = response.data.data.momRate; + regionChange(response.data.data.region); + + new Vue({ el: '#todayDate', data: { - todayDate:response.data.data.todayDate + todayDate : response.data.data.todayDate } }) $("#region").picker({ toolbarTemplate: '
\ - \ + \

选择区域

\
', cols: [ @@ -1600,8 +1613,8 @@ function init(){ } ] }); - regionChange(); - + + if(response.data.data.dtos.length==0){ $("#nearAddress").css("display",none); $("#nearDistricts").css("display",none); @@ -1619,107 +1632,246 @@ function init(){ html += '
'; $("#nearDistricts").html(html); $("#nearbyDistrictList").css("width",(7.5*response.data.data.dtos.length)+"rem"); - }) .catch(function (error) { - alert(error) console.log(error); }); - - + initNews(); +} +function initNews(){ //资讯列表 axios.get(BASE_PATH+"/rest/news/list", { params: { - city: cityParam, + city: $("input_city").val(), page:1 } }) .then(function (response) { - var html = ''; - for(var i in response.data.data.list){ - if(response.data.data.list[i].type=="专题"){ - html += '
'+ - ''+ - '
'+ - '
'+response.data.data.list[i].title+'
'+ - ''+ - '
'; - } - /*if(response.data.data.list[i].type=="房源"){ - html += '
'+ - ''+ - '
'+ - '
'+response.data.data.list[i].title+'今日推荐
'+ - '
'+ - '
浦东-周康
'+ - '
'+ - ''+ - '
'; - }*/ - if(response.data.data.list[i].type=="活动"){ - html += '
'+ - ''+ - '
'+ - '
'+response.data.data.list[i].title+'
'+ - ''+ - '
'; - } - /*if(response.data.data.list[i].type=="城市"){ -
- -
-
-
-
上海
-
- -
- }*/ - if(response.data.data.list[i].type=="新闻"){ - html += '
'+ - '
  • '+ - '
    '+ - '
    '+response.data.data.list[i].title+'
    '+ - '
    '+response.data.data.list[i].introduction+'
    '+ - '
    2022人'+ - /*'1245条'+*/ - '
'; - } - if(response.data.data.list[i].type=="投票"){ - html += '
'+response.data.data.list[i].title+ - '
'+ - '同意'+ - '
'+ - '
反对'+ - '
V.S
'; - } - } - $("#todayDate").append(html); + dataObj = response.data.data.list; + lastIndex = 0; + addItems(itemsPerLoad, 0) + if(dataObj.length>5){ + $(".infinite-scroll-preloader").show(); + }else{ + $(".infinite-scroll-preloader").hide(); + } + lastIndex = $('.cardInfo').length; + }) + .catch(function (error) { + console.log(error); + }); +} +/*$("#region").click(function(e){ + $(document).click(function(e){ + alert($("#region").val()); + var region_copy = $("#region_copy").val(); + var value = $(".picker-selected").text(); + if(region_copy != value && value!="" && value!=null){ + alert($("#region").val()); + changeRegion(); + } + }) +})*/ + +/*$("#regionStatusButton").click(function(e){ + var region_copy = $("#region_copy").val(); + var value = $(".picker-selected").text(); + alert($("#region").val()); + if(region_copy != value && value!="" && value!=null){ + alert($("#region").val()); + changeRegion(); + } +})*/ +$("body").delegate("#regionStatusButton", "click", function () { + var region_copy = $("#region_copy").val(); + var value = $(".picker-selected").text(); + if(region_copy != value && value!="" && value!=null){ + changeRegion(); + } +}); + +$("body").delegate(".icon-light-red", "click", function () { + var id = $(this).attr("data-val"); + doVote(id,0); +}); + +$("body").delegate(".icon-light-grey", "click", function () { + var id = $(this).attr("data-val"); + doVote(id,1); +}); +function doVote(id,flag){ + axios.get(BASE_PATH+"/rest/news/vote", { + params: { + newsId: id, + type:flag + } + }) + .then(function (response) { + $("#newsList").html(''); + initNews(); }) .catch(function (error) { console.log(error); }); - } -function regionChange(){ - var text = $("#region").val(); - var length = $("#region").val().length; +function changeRegion(){ + axios.get(BASE_PATH+"/houseApi/home", { + params: { + city: $("#input_city").text(), + region:$("#region").val(), + lat:0, + lng:0 + } + }) + .then(function (response) { + baseInfo.region = response.data.data.region; + baseInfo.topMonth = response.data.data.topMonth; + baseInfo.momAvgPrice = response.data.data.momAvgPrice; + baseInfo.momRate = response.data.data.momRate; + regionChange(response.data.data.region); + $("#region_copy").val(response.data.data.region); + }) + .catch(function (error) { + console.log(error); + }); +} +/* 页面底部无限加载事件 */ +$.init(); +var loading = false; +// 最多可加载的条目 +var maxItems = 60; +// 每次加载添加多少条目 +var itemsPerLoad = 5; +var dataObj = {}; +function addItems(number, lastIndex) { + // 生成新条目的HTML + if(dataObj.length == 0) { + // 加载完毕,则注销无限加载事件,以防不必要的加载 + $.detachInfiniteScroll($('.infinite-scroll')); + // 删除加载提示符 + $('.infinite-scroll-preloader').remove(); + $('.infinite-scroll-bottom .list-container ul ').html("
"); + return; + } + var html = ''; + for(var i in dataObj){ + if(i>=lastIndex){ + if((dataObj.length'+ + '
'+ + '
'+dataObj[i].title+'
'+ + ''+ + '
'; + } + /*if(dataObj[i].type=="房源"){ + html += '
'+ + ''+ + '
'+ + '
'+dataObj[i].title+'今日推荐
'+ + '
'+ + '
浦东-周康
'+ + '
'+ + ''+ + '
'; + }*/ + if(dataObj[i].type=="活动"){ + html += '
'+ + ''+ + '
'+ + '
'+dataObj[i].title+'
'+ + ''+ + '
'; + } + /*if(dataObj[i].type=="城市"){ +
+ +
+
+
+
上海
+
+ +
+ }*/ + if(dataObj[i].type=="新闻"){ + html += '
'+ + '
  • '+ + '
    '+ + '
    '+dataObj[i].title+'
    '+ + '
    '+dataObj[i].introduction+'
    '+ + '
    '+dataObj[i].visitCount+'人'+ + /*'1245条'+*/ + '
'; + } + if(dataObj[i].type=="投票"){ + var voteFavorCount = dataObj[i].voteFavorCount; + var voteNoFavorCount = dataObj[i].voteNoFavorCount; + var voteFavorCountRate = (voteFavorCount/(voteFavorCount+voteNoFavorCount)).toFixed(2); + var voteNoFavorCountRate = 1-voteFavorCountRate; + html += '
'+dataObj[i].title+ + '
'+ + '同意'+ + '
'+ + '
反对'+ + '
V.S
'; + } + } + } + } + + if(dataObj.length<=(lastIndex + number)){ + $(".infinite-scroll-preloader").hide(); + } + // 添加新条目 + if(lastIndex == 0){ + $("#newsList").html(html); + }else{ + $('#newsList').append(html); + } + } + +// 上次加载的序号 +var lastIndex = 5; + +// 注册'infinite'事件处理函数 +$(document).on('infinite', '.infinite-scroll-bottom',function() { + // 如果正在加载,则退出 + if (loading) return; + // 设置flag + loading = true; + + // 模拟1s的加载过程 + setTimeout(function() { + // 重置加载flag + loading = false; + // 添加新条目 + addItems(itemsPerLoad, lastIndex); + // 更新最后加载的序号 + lastIndex = $('.cardInfo').length; + }, 500); +}); + +function regionChange(region){ + var text = region; + var length = region.length; var textStr = ""; if(length > 4){ textStr = text.substr(0,4);