Merge branch 'YOUFANGAPP1.1.2' of 192.168.0.27:dev0/youfang-app into xh-YOUFANGAPP1.1.2
# Conflicts: # fangija-zsyf/css/main.css
This commit is contained in:
+193
-62
@@ -118,7 +118,7 @@
|
||||
<div class="content-block-title cardNearbyName" id="nearAddress"><i class="icon icon-address02"></i><span id="nearDistrictSpan"></span><i class="icon arrow-up"></i></div>
|
||||
<div class="cardNearbyBox" id="nearDistricts">
|
||||
</div>
|
||||
<div class="content-block-title recommend" id="todayNews">今日推荐</div>
|
||||
<div class="content-block-title recommend dn" id="todayNews">今日推荐</div>
|
||||
<div id="newsList">
|
||||
|
||||
</div>
|
||||
@@ -1195,7 +1195,21 @@ $.config = {router: false}
|
||||
<script type="text/javascript" src="js/city.js" ></script>
|
||||
|
||||
<script>
|
||||
function openHangQing(city){
|
||||
function openHangQing(city,id){
|
||||
var eventType = "newsClick";
|
||||
var dataMap = {};
|
||||
dataMap["city"]=city;
|
||||
dataMap["type"]="推荐城市";
|
||||
saveBehaviorLog(eventType,dataMap); //保存用户点击事件
|
||||
|
||||
axios.get("/rest/news/addCount",{params:{newsId:id}}).then(function(response){
|
||||
if(response.data.code==200){
|
||||
|
||||
}
|
||||
|
||||
}).catch(function(error){
|
||||
console.log(error)
|
||||
});
|
||||
clicked('views/house/cityDetail.html',true,false,{},{city:city},function(){
|
||||
|
||||
})
|
||||
@@ -1221,6 +1235,7 @@ var lat = 0;
|
||||
var lng = 0;
|
||||
var address = "";
|
||||
var cat;
|
||||
var todayDeployFlag = true;
|
||||
var timestamp1 = new Date().getTime();
|
||||
document.addEventListener('plusready', onPlusReady, false);
|
||||
//扩展API加载完毕,现在可以正常调用扩展API
|
||||
@@ -1228,60 +1243,71 @@ function onPlusReady(){
|
||||
getPosition();
|
||||
versionUpdate();
|
||||
}
|
||||
|
||||
// 获取当前用户位置
|
||||
function getPosition(){
|
||||
plus.geolocation.getCurrentPosition(function(p){
|
||||
if(p.address.city==undefined){
|
||||
city = "上海";
|
||||
$("#input_city").text(city);
|
||||
initData();
|
||||
}else{
|
||||
address = p.address.street;
|
||||
province = p.address.province;
|
||||
city = p.address.city;
|
||||
region = p.address.district;
|
||||
lng = p.coords.longitude;//获取到当前位置的经度
|
||||
lat = p.coords.latitude;//获取到当前位置的纬度;
|
||||
oriLng = p.coords.longitude;
|
||||
oriLat = p.coords.latitude;
|
||||
//alert("4"+oriLng);
|
||||
|
||||
if(city){
|
||||
city = formatBaiduCity(city);
|
||||
}
|
||||
if(region.endWith("区")){
|
||||
region = region.substring(0, region.length-1);
|
||||
}
|
||||
oriRegion = region;
|
||||
oriCity = city;
|
||||
$("#input_city").text(city);
|
||||
axios.get("/rest/index/isChinaCity", {
|
||||
params: {
|
||||
city: city
|
||||
}
|
||||
})
|
||||
.then(function (response) {
|
||||
if(response.data.data.status==1){
|
||||
address = p.address.street;
|
||||
province = p.address.province;
|
||||
|
||||
region = p.address.district;
|
||||
lng = p.coords.longitude;//获取到当前位置的经度
|
||||
lat = p.coords.latitude;//获取到当前位置的纬度;
|
||||
oriLng = p.coords.longitude;
|
||||
oriLat = p.coords.latitude;
|
||||
|
||||
if(region.endWith("区")){
|
||||
region = region.substring(0, region.length-1);
|
||||
}
|
||||
oriRegion = region;
|
||||
oriCity = city;
|
||||
}else{
|
||||
city = "上海";
|
||||
$("#input_city").text(city);
|
||||
initRegionSelect(city);
|
||||
localStorage.setItem("init_city", city);
|
||||
//addLocation(lat,lng);
|
||||
initBaseInfo(city,"","",0,0);
|
||||
$("#ShangHaiDiv").show();
|
||||
$("#otherCityDiv").hide();
|
||||
}
|
||||
initData();
|
||||
})
|
||||
.catch(function (error) {
|
||||
setTimeout(function(){
|
||||
mui.init();
|
||||
mui.openWindow({
|
||||
url: 'error.html',
|
||||
id:'error.html',
|
||||
extras:{
|
||||
//扩展参数
|
||||
}
|
||||
});
|
||||
},10000)
|
||||
console.log(error);
|
||||
});
|
||||
}
|
||||
localStorage.setItem("init_city", city);
|
||||
addLocation(lat,lng);
|
||||
$(".nowCity").text(city);
|
||||
/*city="北京";
|
||||
region="";
|
||||
$("#input_city").text("北京");
|
||||
getDistrictList($("#input_city").text(),0,0,"",6,0,0,"");*/
|
||||
|
||||
initBaseInfo(city,region,address,lat,lng);
|
||||
if(city!="上海"){
|
||||
//$(".content").removeClass("pull-to-refresh-content");
|
||||
$.destroyPullToRefresh(".content")
|
||||
initRegionSelect(city);
|
||||
$("#ShangHaiDiv").hide();
|
||||
$("#otherCityDiv").show();
|
||||
}else{
|
||||
$.initPullToRefresh(".content")
|
||||
$("#ShangHaiDiv").show();
|
||||
$("#otherCityDiv").hide();
|
||||
}
|
||||
}, function(e){
|
||||
city = "上海";
|
||||
$("#input_city").text(city);
|
||||
initRegionSelect(city);
|
||||
localStorage.setItem("init_city", city);
|
||||
addLocation(lat,lng);
|
||||
//addLocation(lat,lng);
|
||||
initBaseInfo(city,"","",0,0);
|
||||
$("#ShangHaiDiv").show();
|
||||
$("#otherCityDiv").hide();
|
||||
@@ -1294,6 +1320,24 @@ function getPosition(){
|
||||
);
|
||||
}
|
||||
|
||||
function initData(){
|
||||
$("#input_city").text(city);
|
||||
localStorage.setItem("init_city", city);
|
||||
//addLocation(lat,lng);
|
||||
$(".nowCity").text(city);
|
||||
|
||||
initBaseInfo(city,region,address,lat,lng);
|
||||
if(city!="上海"){
|
||||
$.destroyPullToRefresh(".content")
|
||||
initRegionSelect(city);
|
||||
$("#ShangHaiDiv").hide();
|
||||
$("#otherCityDiv").show();
|
||||
}else{
|
||||
$.initPullToRefresh(".content")
|
||||
$("#ShangHaiDiv").show();
|
||||
$("#otherCityDiv").hide();
|
||||
}
|
||||
}
|
||||
/* 获取#region字数,截取#region前4字,并添加... */
|
||||
|
||||
var baseInfo = new Vue({
|
||||
@@ -1312,7 +1356,7 @@ var baseInfo = new Vue({
|
||||
|
||||
function initBaseInfo(city,region,address,lat,lng){
|
||||
//显示附近地址
|
||||
if(address!=""){
|
||||
if(address!="" || address!=undefined){
|
||||
var nearAddressParam = address;
|
||||
var length = address.length;
|
||||
var textStr = "";
|
||||
@@ -1474,6 +1518,11 @@ function loadRegion(){
|
||||
});
|
||||
}
|
||||
$("body").delegate("#regionStatusButton", "click", function (){
|
||||
var eventType = "changeRegionClick";
|
||||
var dataMap = {};
|
||||
dataMap["region"]=regionPicker;
|
||||
saveBehaviorLog(eventType,dataMap); //保存用户点击事件
|
||||
|
||||
regionChangeRegion = false;
|
||||
regionChangeCount += 1;
|
||||
var region_copy = $("#region_copy").val();
|
||||
@@ -1541,8 +1590,8 @@ function initNews(page){
|
||||
axios.get("/rest/news/list", {
|
||||
params: {
|
||||
city: $("#input_city").text(),
|
||||
page:page,
|
||||
deviceId:plus.device.uuid
|
||||
page:page/*,
|
||||
deviceId:plus.device.uuid*/
|
||||
}
|
||||
})
|
||||
.then(function (response) {
|
||||
@@ -1556,13 +1605,16 @@ function initNews(page){
|
||||
// 加载完毕,则注销无限加载事件,以防不必要的加载
|
||||
$.detachInfiniteScroll($('.infinite-scroll'));
|
||||
}
|
||||
if(page==1 && response.data.data.list.length == 0){
|
||||
if(page==1){
|
||||
todayDeployFlag = true;
|
||||
$("#todayNews").hide();
|
||||
}else{
|
||||
$("#todayNews").show();
|
||||
}
|
||||
for(var i in response.data.data.list){
|
||||
dataObj.push(response.data.data.list[i])
|
||||
if(dataObj[i].todayDeploy && todayDeployFlag){
|
||||
todayDeployFlag = false;
|
||||
$("#todayNews").show();
|
||||
}
|
||||
}
|
||||
lastIndex = $('.cardInfo').length;
|
||||
itemsPerLoad = response.data.data.list.length;
|
||||
@@ -1603,6 +1655,7 @@ $("body").delegate(".vote01 .icon-light-grey", "click", function () {
|
||||
return;
|
||||
}
|
||||
var id = $(this).attr("data-val");
|
||||
|
||||
var voteFavorCount = parseInt($("#voteFavorCount_"+id).text().split(" ")[0].replace("票",""))+1;
|
||||
var voteNoFavorCount = parseInt($("#voteNoFavorCount_"+id).text().split(" ")[0].replace("票",""));
|
||||
var voteFavorCountRate = Math.round((voteFavorCount*100)/(voteFavorCount+voteNoFavorCount));
|
||||
@@ -1625,6 +1678,13 @@ $("body").delegate(".vote01 .icon-light-grey", "click", function () {
|
||||
$("#voteFavorCountRate_"+id).css("width",voteFavorCountRate+'%');
|
||||
$("#voteNoFavorCount_"+id).text(voteNoFavorCount+'票 '+voteNoFavorCountRate+'%');
|
||||
$("#voteNoFavorCountRate_"+id).css("width",voteNoFavorCountRate+'%');
|
||||
|
||||
var eventType = "newsClick";
|
||||
var dataMap = {};
|
||||
dataMap["vote"]=0;
|
||||
dataMap["id"]=id;
|
||||
dataMap["type"]="投票";
|
||||
saveBehaviorLog(eventType,dataMap); //保存用户点击事件
|
||||
} else {
|
||||
$.toast("已投票");
|
||||
}
|
||||
@@ -1643,6 +1703,7 @@ $("body").delegate(".vote02 .icon-light-grey", "click", function () {
|
||||
return;
|
||||
}
|
||||
var id = $(this).attr("data-val");
|
||||
|
||||
var voteFavorCount = parseInt($("#voteFavorCount_"+id).text().split(" ")[0].replace("票",""));
|
||||
var voteNoFavorCount = parseInt($("#voteNoFavorCount_"+id).text().split(" ")[0].replace("票",""))+1;
|
||||
var voteFavorCountRate = Math.round((voteFavorCount*100)/(voteFavorCount+voteNoFavorCount));
|
||||
@@ -1665,6 +1726,13 @@ $("body").delegate(".vote02 .icon-light-grey", "click", function () {
|
||||
$("#voteNoFavorCountRate_"+id).css("width",voteNoFavorCountRate+'%');
|
||||
$(".vote01 .icon-light-grey").removeClass("icon-light-red");
|
||||
$(".vote02 .icon-light-grey").addClass("icon-light-blue");
|
||||
|
||||
var eventType = "newsClick";
|
||||
var dataMap = {};
|
||||
dataMap["vote"]=1;
|
||||
dataMap["id"]=id;
|
||||
dataMap["type"]="投票";
|
||||
saveBehaviorLog(eventType,dataMap); //保存用户点击事件
|
||||
} else {
|
||||
$.toast("已投票");
|
||||
}
|
||||
@@ -1777,6 +1845,9 @@ function addItems(number, lastIndex) {
|
||||
return;
|
||||
}
|
||||
var html = '';
|
||||
if(lastIndex == 0){
|
||||
yesterDayDeployFlag = true;
|
||||
}
|
||||
for(var i in dataObj){
|
||||
if(i>=lastIndex){
|
||||
if((dataObj.length<lastIndex + number) || (i < lastIndex + number)){
|
||||
@@ -1785,7 +1856,7 @@ function addItems(number, lastIndex) {
|
||||
html += '<div class="content-block-title recommend" style="border-top:solid 0.5rem #f3f3f3;">历史推荐</div>';
|
||||
}
|
||||
if(dataObj[i].type=="专题"){
|
||||
html += '<div class="card cardInfo cardInfo01" onclick="openNewsView(\''+dataObj[i].id+'\')">'+
|
||||
html += '<div class="card cardInfo cardInfo01" onclick="openNewsView(\''+dataObj[i].id+'\',\''+dataObj[i].type+'\')">'+
|
||||
'<div class="card-header">'+dataObj[i].title+'</div>'+
|
||||
'<img src="cardInfoPlaceholderImg.png" onload="loadImg(\''+dataObj[i].coverImg+'\', this)">'+
|
||||
'<div class="card-footer">'+
|
||||
@@ -1797,7 +1868,7 @@ function addItems(number, lastIndex) {
|
||||
'</div>';
|
||||
}
|
||||
if(dataObj[i].type=="推荐小区"){
|
||||
html += '<div class="card cardInfo cardInfo02" onclick="openDistWindow(\''+dataObj[i].recommendDistrictCity+'\',\''+dataObj[i].recommendDistrictRegion+'\',\''+dataObj[i].recommendDistrictName+'\')">'+
|
||||
html += '<div class="card cardInfo cardInfo02" onclick="openNewsDistWindow(\''+dataObj[i].recommendDistrictCity+'\',\''+dataObj[i].recommendDistrictRegion+'\',\''+dataObj[i].recommendDistrictName+'\',\''+dataObj[i].id+'\')">'+
|
||||
'<div class="card-content">'+
|
||||
'<div class="list-block media-list"><ul><li class="item-content">'+
|
||||
'<div class="item-media"><img src="cardInfoPlaceholderImg.png" onload="loadImg(\''+dataObj[i].coverImg+'\',this)"></div>'+
|
||||
@@ -1821,7 +1892,7 @@ function addItems(number, lastIndex) {
|
||||
}
|
||||
if(dataObj[i].type=="活动"){
|
||||
if(dataObj[i].adUrl!=null && dataObj[i].adUrl!=""){
|
||||
html += '<div class="card cardInfo cardInfo01 cardInfo01b" onclick="openUrl(\''+BASE_PATH+'/message/openView?url='+dataObj[i].adUrl+'\')">';
|
||||
html += '<div class="card cardInfo cardInfo01 cardInfo01b" onclick="openUrl(\''+BASE_PATH+'/message/openView?url='+dataObj[i].adUrl+'\',\''+dataObj[i].id+'\')">';
|
||||
}else{
|
||||
html += '<div class="card cardInfo cardInfo01 cardInfo01b">';
|
||||
}
|
||||
@@ -1830,7 +1901,7 @@ function addItems(number, lastIndex) {
|
||||
'<div class="card-footer"><span>'+dataObj[i].introduction+'</span></div></div>';
|
||||
}
|
||||
if(dataObj[i].type=="推荐城市"){
|
||||
html += '<div class="card cardInfo cardInfo01 cardInfo01a" onclick="openHangQing(\''+dataObj[i].recommendCity+'\')">'+
|
||||
html += '<div class="card cardInfo cardInfo01 cardInfo01a" onclick="openHangQing(\''+dataObj[i].recommendCity+'\',\''+dataObj[i].id+'\')">'+
|
||||
'<div class="card-header">推荐城市——'+dataObj[i].recommendCity+'</div>';
|
||||
if(dataObj[i].recommendCityTags != "" && dataObj[i].recommendCityTags != null){
|
||||
var arry = dataObj[i].recommendCityTags.split("_");
|
||||
@@ -1867,6 +1938,7 @@ function addItems(number, lastIndex) {
|
||||
html += '<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-star01"></i>';
|
||||
}
|
||||
html += '</span></div><div class="card-footer" style="margin-top:-0.75rem;">';
|
||||
|
||||
if(dataObj[i].recommendCityYoy){
|
||||
html += '<span>近1年涨跌幅:';
|
||||
if(dataObj[i].recommendCityYoy>0){
|
||||
@@ -1889,7 +1961,7 @@ function addItems(number, lastIndex) {
|
||||
|
||||
}
|
||||
if(dataObj[i].type=="新闻"){
|
||||
html += '<div class="card cardInfo cardInfo02" onclick="openNewsView(\''+dataObj[i].id+'\')"><div class="card-content"><div class="list-block media-list">'+
|
||||
html += '<div class="card cardInfo cardInfo02" onclick="openNewsView(\''+dataObj[i].id+'\',\''+dataObj[i].type+'\')"><div class="card-content"><div class="list-block media-list">'+
|
||||
'<ul><li class="item-content">'+
|
||||
'<div class="item-inner"><div class="item-title-row"><div class="item-title">'+
|
||||
dataObj[i].title+'</div></div>'+
|
||||
@@ -2035,7 +2107,6 @@ function addItems(number, lastIndex) {
|
||||
function loadImg(url, obj){
|
||||
if($(obj).attr("src") == 'cardInfoPlaceholderImg.png'){
|
||||
$(obj).attr("src", url)
|
||||
console.log("+=============="+url);
|
||||
}
|
||||
}
|
||||
//数量进行转换
|
||||
@@ -2087,6 +2158,8 @@ $(document).on('refresh', '.pull-to-refresh-content',function(e) {
|
||||
page = 1;
|
||||
dataObj = [];
|
||||
$("#newsList").html("");
|
||||
$(".infinite-scroll-preloader").show();
|
||||
$.attachInfiniteScroll($('.infinite-scroll'));
|
||||
initNews(page);
|
||||
}
|
||||
// 加载完毕需要重置
|
||||
@@ -2214,6 +2287,10 @@ $(document).on('click','#notFound_btn', function () {
|
||||
});
|
||||
/* 获取城市 */
|
||||
$("body").delegate(".popup-about01 p", "click", function () {
|
||||
var eventType = "changeCityClick";
|
||||
var dataMap = {};
|
||||
dataMap["city"]=$(this).text();
|
||||
saveBehaviorLog(eventType,dataMap); //保存用户点击事件
|
||||
changeCity($(this).text())
|
||||
});
|
||||
$("body").delegate(".popup-about01 .cityGPS", "click", function () {
|
||||
@@ -2336,7 +2413,21 @@ function req(cityStr){
|
||||
//potenialIndex(city,sort);
|
||||
}
|
||||
|
||||
function openUrl(url){
|
||||
function openUrl(url,id){
|
||||
var eventType = "newsClick";
|
||||
var dataMap = {};
|
||||
dataMap["type"]="活动";
|
||||
saveBehaviorLog(eventType,dataMap); //保存用户点击事件
|
||||
|
||||
axios.get("/rest/news/addCount",{params:{newsId:id}}).then(function(response){
|
||||
if(response.data.code==200){
|
||||
|
||||
}
|
||||
|
||||
}).catch(function(error){
|
||||
console.log(error)
|
||||
});
|
||||
|
||||
clicked(url,true);
|
||||
}
|
||||
|
||||
@@ -2700,14 +2791,13 @@ function getDistrictList(cityParam,latParam,lngParam,regionParam,order,minPrice,
|
||||
});
|
||||
}
|
||||
mui.init();
|
||||
function openNewsView(newId) {
|
||||
//mui.openWindow({
|
||||
// url: 'views/news/newsDetail.html',
|
||||
// id:'newsDetail.html',
|
||||
// extras:{
|
||||
// newsId:newId //扩展参数
|
||||
// }
|
||||
// });
|
||||
function openNewsView(newId,type) {
|
||||
var eventType = "newsClick";
|
||||
var dataMap = {};
|
||||
dataMap["newId"]=newId;
|
||||
dataMap["type"]=type;
|
||||
saveBehaviorLog(eventType,dataMap); //保存用户点击事件
|
||||
|
||||
clicked('views/news/newsDetail.html',true,false,{},{newsId:newId},function(newId){
|
||||
axios.post("/rest/comment/getCommentCount",{commentObjId : newId}).then(function (response) {
|
||||
var msg = response.data.message
|
||||
@@ -2725,12 +2815,45 @@ function openNewsView(newId) {
|
||||
}
|
||||
}
|
||||
function openNewView(viewHtml) {
|
||||
var eventType = "";
|
||||
var dataMap = {};
|
||||
if(viewHtml.indexOf("houseList")>0){
|
||||
eventType = "houseManageClick";
|
||||
}else if(viewHtml.indexOf("intelligentHouse")>0){
|
||||
eventType = "intelligentHouseClick";
|
||||
}
|
||||
saveBehaviorLog(eventType,dataMap); //保存用户点击事件
|
||||
clicked(viewHtml,true,false,{},{})
|
||||
}
|
||||
function openIntelligentHouseView() {
|
||||
clicked('views/intelligentHouse/index.html',true,false,{},{})
|
||||
|
||||
function openNewsDistWindow(city, region, name,id){
|
||||
var eventType = "newsClick";
|
||||
var dataMap = {};
|
||||
dataMap["city"]=city;
|
||||
dataMap["region"]=region;
|
||||
dataMap["name"]=name;
|
||||
dataMap["type"]="推荐小区";
|
||||
saveBehaviorLog(eventType,dataMap); //保存用户点击事件
|
||||
|
||||
axios.get("/rest/news/addCount",{params:{newsId:id}}).then(function(response){
|
||||
if(response.data.code==200){
|
||||
|
||||
}
|
||||
|
||||
}).catch(function(error){
|
||||
console.log(error)
|
||||
});
|
||||
|
||||
clicked('views/district/detail.html',true,false,{},{city:city,region:region,name:name});
|
||||
}
|
||||
|
||||
function openDistWindow(city, region, name){
|
||||
var eventType = "nearDistrictClick";
|
||||
var dataMap = {};
|
||||
dataMap["city"]=city;
|
||||
dataMap["region"]=region;
|
||||
dataMap["name"]=name;
|
||||
saveBehaviorLog(eventType,dataMap); //保存用户点击事件
|
||||
clicked('views/district/detail.html',true,false,{},{city:city,region:region,name:name});
|
||||
}
|
||||
|
||||
@@ -2757,6 +2880,14 @@ $("body").delegate("#hotList ul li", "click", function () {
|
||||
var select_region = $(this).find("a").attr("data-region");
|
||||
var select_name = $(this).find("a").attr("data-name");
|
||||
saveHistory({district:select_region,name:select_name,city:select_city})
|
||||
|
||||
var eventType = "hotDistrictClick";
|
||||
var dataMap = {};
|
||||
dataMap["city"]=select_city;
|
||||
dataMap["region"]=select_region;
|
||||
dataMap["name"]=select_name;
|
||||
saveBehaviorLog(eventType,dataMap); //保存用户点击事件
|
||||
|
||||
//clicked(BASE_PATH+'/district/details?city='+select_city+'®ion='+select_region+'&name='+select_name,true);
|
||||
if(cat == "rent"){
|
||||
clicked('views/rent/rent.html',true,false,{},{city:select_city,region:select_region,name:select_name})
|
||||
|
||||
Reference in New Issue
Block a user