Merge branch 'YOUFANGAPP1.1.1' of 192.168.0.27:dev0/youfang-app into xh-youfangApp1.0.4

This commit is contained in:
xuhe@fangjia.com
2018-05-02 10:24:58 +08:00
42 changed files with 4764 additions and 450 deletions
+105
View File
@@ -0,0 +1,105 @@
function loanCalculat(){
var loanPrice = $("input[name=loanPrice]").val();
if(loanPrice=="" || loanPrice=="0"){
$("#price_error").show();
return false;
}else{
$("#price_error").hide();
}
var rate = $("input[name=rate]").val();
if(rate=="" || rate=="0"){
$("#rate_error").show();
return false;
}else{
$("#rate_error").hide();
}
var repaymentWay = $("select[name=repaymentWay]").val();//贷款方式
var amount = parseFloat(loanPrice);//贷款金额
var month = parseInt($("select[name=loanMonth]").val());//贷款年限
rate = parseFloat(rate);//年利率
if(repaymentWay == "1"){
var payMonth = getPayMonth1(amount, month, rate);
var totalInterest = getTotalInterest1(payMonth, month, amount);
$("#payMonth").html(payMonth.toFixed(3)+"<label>元</label>");
$("#interest").html(totalInterest.toFixed(2)+"<label>元</label>");
$("#payTotalPrice").html((totalInterest+amount*10000).toFixed(2)+"<label>元</label>");
}else if(repaymentWay == "2"){
var firstMonthPay = getPayMonth2(amount, month, rate);
var totalInterest = getTotalInterest2(amount, month, rate);
var lessPrice = getLessMonth(amount, month, rate);
$("#interest").html(totalInterest.toFixed(2)+"<label>元</label>");
$("#payTotalPrice").html((totalInterest+amount*10000).toFixed(2)+"<label>元</label>");
var s = "";
for(var i=1;i<=month;i++){
if(i!=1){
firstMonthPay = firstMonthPay - lessPrice;
}
s = s + "<p>"+i+"期,"+firstMonthPay.toFixed(2)+"元</p>"
}
$("#payMonth").html(s);
}
}
//每月还款额(等额本息还款法)
function getPayMonth1(amount, month, rate) {
var monthRate = rate / 1200;
var b = Math.pow(1 + monthRate, month) - 1;
return amount * 10000 * monthRate * Math.pow(1 + monthRate, month) / b;
}
/**
* (等额本息还款法)
* 总利息=每月还款额*还款月数-贷款额
* payMonth:月供(元)
* month:贷款月数
* amount:贷款金额(万元)
*/
function getTotalInterest1(payMonth, month, amount) {
return payMonth * month - amount * 10000;
}
/**
* (等额本金还款法)
* 首月还款额=贷款额/还款月数+贷款额*月利率
* amount:贷款金额(万元)
* month:贷款月数
* rate:年利率
*/
function getPayMonth2(amount, month, rate) {
var monthRate = rate / 1200;
return amount * 10000 / month + amount * 10000 * monthRate;
}
/**
* (等额本金还款法)
* 总利息=贷款额*月利率*(还款月数+1)/2
* amount:贷款金额(万元)
* month:贷款月数
* rate:年利率
*/
function getTotalInterest2(amount, month, rate) {
var monthRate = rate / 1200;
return amount * 10000 * monthRate * (month + 1) / 2;
}
/**
* (等额本金还款法)
* 还款每月递减额=贷款额/还款月数*月利率
* amount:贷款金额(万元)
* month:贷款月数
* rate:年利率
*/
function getLessMonth(amount, month, rate) {
var monthRate = rate / 1200;
return amount * 10000 / month * monthRate;
}
+323 -199
View File
@@ -12,9 +12,17 @@ var mapLoadCount = 0;
function doAddCollect(){
if (localStorage.getItem("user_token") == null || localStorage.getItem("user_token") == "") {
clicked('../user/codeSms.html',true,false,{},{},function(){
plus.webview.getWebviewById('views/user/userInfo.html').reload();
plus.webview.getWebviewById('views/house/houseDetail.html').reload();
plus.webview.getWebviewById('views/house/houseManageList.html').reload();
if(plus.webview.getWebviewById('views/house/houseDetail.html')!= null) {
plus.webview.getWebviewById('views/house/houseDetail.html').reload();
}
if(plus.webview.getWebviewById('views/house/houseManageList.html') != null) {
plus.webview.getWebviewById('views/house/houseManageList.html').reload();
}
if(plus.webview.getWebviewById('views/user/userInfo.html')!= null){
plus.webview.getWebviewById('views/user/userInfo.html').reload();
}
doAddCollect();
})
return;
@@ -32,7 +40,9 @@ function addCollect(){
$(".collection01").hide();
$(".collection02").show();
$.toast("随时掌握小区动态");
plus.webview.getWebviewById('views/user/userInfo.html').reload();
if(plus.webview.getWebviewById('views/user/userInfo.html')!= null){
plus.webview.getWebviewById('views/user/userInfo.html').reload();
}
}
})
@@ -49,7 +59,9 @@ function doRemoveCollect(){
if (localStorage.getItem("user_token") == null || localStorage.getItem("user_token") == "") {
clicked('../user/codeSms.html',true,false,{},{},function(){
doRemoveCollect();
plus.webview.getWebviewById('views/user/userInfo.html').reload();
if(plus.webview.getWebviewById('views/user/userInfo.html')!= null){
plus.webview.getWebviewById('views/user/userInfo.html').reload();
}
})
return;
} else {
@@ -67,47 +79,61 @@ function removeCollect(){
$(".collection01").show();
$.toast("取消关注");
}
plus.webview.getWebviewById('views/user/userInfo.html').reload();
if(plus.webview.getWebviewById('views/house/houseManageList.html') != null) {
plus.webview.getWebviewById('views/house/houseManageList.html').reload();
}
if(plus.webview.getWebviewById('views/user/userInfo.html')!= null){
plus.webview.getWebviewById('views/user/userInfo.html').reload();
}
plus.webview.getWebviewById('yfindex.html').reload();
plus.webview.getWebviewById('views/house/houseManageList.html').reload();
})
.catch(function (error) {
console.log(error);
});
}
/* button状态切换 */
/*$("#trendTabDiv .button").on("click", function () {
$(this).parent().children().removeClass("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.setInterval(loadMap,1000);
function loadMap(){
mapLoadCount++;
if(lng && lat){
loadMapPoi();
$("#mapDiv").show();
window.clearInterval(t1);
}else{
if(mapLoadCount == 10){
$("#mapDiv").hide();
window.clearInterval(t1);
}else{
$("#mapDiv").hide();
}
//图表 初始化
function inintChart(){
var type = $("#trendDiv1 a.active").attr("t-v");
/* 小区均价分析 */
loadLineData(city, region, name, type)
/* 小区租金走势 */
loadRentTrends(city, region, name,2);
}
function clickLineChart(type){
if(mode == "kLine"){
loadKLineData(city, region, name, type)
}else if(mode == "line"){
loadLineData(city, region, name, type);
}
}*/
}
/* 图表切换 */
function lineChart() {
mode = "kLine"
$(".icon-chart01a").hide();
$(".icon-chart01").show();
$("#chart01a").css("z-index","-1");
$("#chart01").css("z-index","1");
var type = $("#trendDiv1 a.active").attr("t-v");
loadKLineData(city, region, name, type);
}
function kLineChart() {
mode = "line"
$(".icon-chart01").hide();
$(".icon-chart01a").show();
$("#chart01").css("z-index","-1");
$("#chart01a").css("z-index","1");
var type = $("#trendDiv1 a.active").attr("t-v");
loadLineData(city, region, name, type);
};
function showLoadRentTrends(type) {
if(type == 3) {
document.getElementById("trendDivTab3").setAttribute("class","tab-link button active");
@@ -120,151 +146,42 @@ function showLoadRentTrends(type) {
loadRentTrends(city, region, name,type);
}
//小区详情
function loadDistrictInfo(){
axios.get("/rest/districts/detail", {
params: {
city: city,
region:region,
name: name
}
}).then(function (response) {
var vo = response.data.data.detail
var cityPrice = response.data.data.cityPrice
var collected = response.data.data.collected
if(cityPrice){
baseInfo.cityPrice = cityPrice
}
if(collected){
$(".collection02").show();
$(".collection01").hide();
}else{
$(".collection02").hide();
$(".collection01").show();
}
if(vo){
if(vo.avgPrice){
lat = vo.lat2;
lng = vo.lng2;
//loadMapPoi();
baseInfo.city = vo.city
baseInfo.region = vo.region
baseInfo.address = vo.address;
baseInfo.name = vo.name
baseInfo.avgPrice = vo.avgPrice;
baseInfo.oneMonthUpDownRange = vo.oneMonthUpDownRange;
if(vo.rank){
baseInfo.priceRate = vo.rank.substring(0, vo.rank.indexOf("/"));
}
//baseInfo.cityPrice = vo.cityPrice;
var finishDate = ""
if(vo.finishBuildingDate){
if(vo.finishBuildingDate.indexOf("~")!=-1){
finishDate = vo.finishBuildingDate.replace("年","");
}else{
finishDate = vo.finishBuildingDate.substring(0,4)+"年"
}
}
baseInfo.finishBuildingDate = finishDate;
baseInfo.householdCount = vo.householdCount;
baseInfo.cubagePercent = vo.cubagePercent;
baseInfo.carSiteCount = vo.carSiteCount;
baseInfo.virescencePercent = vo.virescencePercent;
baseInfo.estateCharge = vo.estateCharge;
baseInfo.moreArea = vo.moreArea;
baseInfo.developer = vo.developer;
baseInfo.estateCompany = vo.estateCompany;
address = vo.address;
tags = vo.poiTags;
if(vo.poiTags){
if(vo.poiTags.length>=3){
baseInfo.tags = vo.poiTags.slice(0,3);
}else{
baseInfo.tags = vo.poiTags;
}
}
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 = "小区详情"
}
function loadKLineData(city, region, name, type){
if(type == "36"){
if (localStorage.getItem("user_token") == null || localStorage.getItem("user_token") == "") {
clicked('../user/codeSms.html',true,false,{},{},function(){
if(localStorage.getItem("user_token") == null || localStorage.getItem("user_token") == ""){
}else{
$("#trendDiv1 a").removeClass("active")
$("a[t-v='36']").addClass("active")
doLoadKLineData(city, region, name, type)
plus.webview.getWebviewById('views/user/userInfo.html').reload();
plus.webview.getWebviewById('views/house/houseDetail.html').reload();
plus.webview.getWebviewById('views/house/houseManageList.html').reload();
}
})
return;
} else {
$("#trendDiv1 a").removeClass("active")
$("a[t-v='36']").addClass("active")
doLoadKLineData(city, region, name, type)
}
}).catch(function (error) {
console.log(error);
});
}else{
$("#trendDiv1 a").removeClass("active")
if(type == 12){
$("a[t-v='12']").addClass("active")
}else{
$("a[t-v='6']").addClass("active")
}
doLoadKLineData(city, region, name, type)
}
}
//附近小区
/*function loadNearDistrict(lat, lng){
axios.get("/rest/districts/nearDistrict", {
params: {
lat: lat,
lng:lng
}
}).then(function (response) {
var datas = response.data.data
if(datas){
var ret = []
for(var v in datas){
var o = datas[v]
if(o.city == city && o.district == region && o.name == name){
continue;
}else{
if(ret.length <= 5){
ret.push(o);
}
}
}
baseInfo.nearDists = ret;
$("#nearDistDiv .cardNearbyWin").css("width",(7.5*ret.length)+"rem");
}else{
$("#nearDistDiv").hide()
}
}).catch(function (error) {
console.log(error);
});
}*/
function loadKLineData(city, region, name){
var type = $("#trendDiv1 a.active").attr("t-v");
axios.get("/rest/trend/kData", {
function doLoadKLineData(city, region, name, type){
axios.get("/rest/trend/kData", {
params: {
city: city,
region:region,
@@ -313,9 +230,17 @@ function showTrends(v){
if (localStorage.getItem("user_token") == null || localStorage.getItem("user_token") == "") {
clicked('../user/codeSms.html',true,false,{},{},function(){
showTrends(v);
plus.webview.getWebviewById('views/user/userInfo.html').reload();
plus.webview.getWebviewById('views/house/houseDetail.html').reload();
plus.webview.getWebviewById('views/house/houseManageList.html').reload();
if(plus.webview.getWebviewById('views/house/houseDetail.html')!= null) {
plus.webview.getWebviewById('views/house/houseDetail.html').reload();
}
if(plus.webview.getWebviewById('views/house/houseManageList.html') != null) {
plus.webview.getWebviewById('views/house/houseManageList.html').reload();
}
if(plus.webview.getWebviewById('views/user/userInfo.html')!= null){
plus.webview.getWebviewById('views/user/userInfo.html').reload();
}
})
return;
} else {
@@ -364,10 +289,10 @@ var option01 = {
},
formatter: function (params) {
var res = params[0].seriesName + ' ' + params[0].name;
res += '<br/> 月初 : ' + params[0].value[1];
res += '<br/> 月末 : ' + params[0].value[2];
res += '<br/> 最低 : ' + params[0].value[3];
res += '<br/> 最高 : ' + params[0].value[4];
res += '<br/> 月初 : ' + params[0].value[1]+ '元/㎡';
res += '<br/> 月末 : ' + params[0].value[2]+ '元/㎡';
res += '<br/> 最低 : ' + params[0].value[3]+ '元/㎡';
res += '<br/> 最高 : ' + params[0].value[4]+ '元/㎡';
return res;
},
position: function (pos, params, el, elRect, size) {
@@ -408,7 +333,7 @@ var option01 = {
axisLine: { lineStyle: { color: '#666' } },
axisLabel: {
formatter: function (value) {
return echarts.format.formatTime('MM-dd', value);
return echarts.format.formatTime('yyyy-MM', value);
}
},
min: 'dataMin',
@@ -534,13 +459,6 @@ var option01 = {
};
/*$("#trendDiv2 a").click(function(){
$("#trendDiv2 a").removeClass("active")
$(this).addClass("active")
//var v = $(this).attr("t-v");
loadRentTrends(city, region, name);
});*/
/* 小区租金走势 */
function loadRentTrends(city, region, name, type){
@@ -560,6 +478,9 @@ function loadRentTrends(city, region, name, type){
var m = re.times;
var pm = re.distMap
var rooms = re.rooms;
var estateType = re.estateType
var roomKeys = []
if(m && rooms.length>0){
@@ -568,6 +489,17 @@ function loadRentTrends(city, region, name, type){
}
for(var k in rooms){
var room = rooms[k]
roomKeys.push(room + "室");
if(estateType && estateType.indexOf("别墅")>-1){
if(room > 8){
continue;
}
}else{
if(room > 5){
continue;
}
}
var distM = pm[room];
var distObj = new Object();
var distDatas = new Array();
@@ -582,14 +514,12 @@ function loadRentTrends(city, region, name, type){
distObj.name = room+"室"
distObj.data = distDatas;
distObj.type = 'line';
distObj.symbolSize = 0;
distObj.symbolSize = 6;
distObj.symbol = 'circle';
series.push(distObj);
//alert(distDatas);
}
//alert(categories);
//showRentChart(categories, series);
showRentChart2(categories, series);
showRentChart2(categories, series, roomKeys);
}else{
//没数据
//$("#tabChart2").hide();
@@ -603,13 +533,17 @@ function loadRentTrends(city, region, name, type){
}
function showRentChart2(categories, series){
function showRentChart2(categories, series, roomDatas){
var option03 = {
tooltip: {
trigger: 'axis',
textStyle: {
fontFamily: 'arial,华文细黑',
fontSize: 12
},
formatter: function (params) {
var res = params[0].name + ' <br/>' + "租金:"+params[0].value + '元/月';
return res;
}
},
grid:{
@@ -621,6 +555,7 @@ function showRentChart2(categories, series){
},
color: ['#F88C9F', '#FFBF5C', '#AAD672', '#78CDE6', '#AE94E9'],
legend: {
data: roomDatas,
y: 'bottom',
textStyle: {
fontFamily: '华文细黑',
@@ -647,6 +582,7 @@ function showRentChart2(categories, series){
},
yAxis: {
type: 'value',
scale: true,
axisLine: {
lineStyle: {
color: '#ccc'
@@ -733,3 +669,191 @@ function loadDistrictLevel(datas){
var myChart03 = echarts.init(document.getElementById('chart03'));
myChart03.setOption(option03,true);
}
//曲线图
function loadLineData(city, region, name, type){
//var type = $("#trendDiv1 a.active").attr("t-v");
if(type == "36"){
if (localStorage.getItem("user_token") == null || localStorage.getItem("user_token") == "") {
clicked('../user/codeSms.html',true,false,{},{},function(){
if(localStorage.getItem("user_token") == null || localStorage.getItem("user_token") == ""){
}else{
$("#trendDiv1 a").removeClass("active")
$("a[t-v='36']").addClass("active")
doLoadLineData(city, region, name, type)
plus.webview.getWebviewById('views/user/userInfo.html').reload();
plus.webview.getWebviewById('views/house/houseDetail.html').reload();
plus.webview.getWebviewById('views/house/houseManageList.html').reload();
}
})
return;
} else {
$("#trendDiv1 a").removeClass("active")
$("a[t-v='36']").addClass("active")
doLoadLineData(city, region, name, type)
}
}else{
$("#trendDiv1 a").removeClass("active")
if(type == 12){
$("a[t-v='12']").addClass("active")
}else{
$("a[t-v='6']").addClass("active")
}
doLoadLineData(city, region, name, type)
}
}
function doLoadLineData(city, region, name, type){
axios.get("/rest/trend/distTrends", {
params: {
city: city,
region:region,
name:name,
type: type
}
}).then(function (response) {
var distDatas = response.data.data.districtAvgZouShi
var times = response.data.data.timeKeys
if(times){
var districtTrends = [];
for(var d in times){
var t = times[d]
var distPrice = distDatas[t]
if(distPrice){
districtTrends.push(distPrice);
}else{
districtTrends.push(null);
}
}
//option01b.xAxis.data = times
//option01b.series.data = districtTrends
showLineChart(times, districtTrends);
}
}).catch(function (error) {
console.log(error);
});
}
function showLineChart(times, datas){
var option01b = {
tooltip: {
triggerOn: 'none',
transitionDuration: 0,
confine: true,
bordeRadius: 4,
borderWidth: 1,
borderColor: '#666',
backgroundColor: 'rgba(255,255,255,0.9)',
textStyle: {
fontSize: 12,
color: '#666'
},
formatter: function (params) {
var res = params[0].name + ' <br/>' + "均价:"+params[0].value + '元/㎡';
return res;
},
position: function (pos, params, el, elRect, size) {
var obj = {
top: 60
};
obj[['left', 'right'][+(pos[0] < size.viewSize[0] / 2)]] = 5;
return obj;
}
},
grid:{
x: 20,
y: 10,
x2: 20,
y2: 60,
top: 60,
height: 120
},
color: ['#78CDE6'],
dataZoom: [{
realtime: false,
start: 1,
end: 99,
top: 5,
height: 20,
handleIcon: 'M10.7,11.9H9.3c-4.9,0.3-8.8,4.4-8.8,9.4c0,5,3.9,9.1,8.8,9.4h1.3c4.9-0.3,8.8-4.4,8.8-9.4C19.5,16.3,15.6,12.2,10.7,11.9z M13.3,24.4H6.7V23h6.6V24.4z M13.3,19.6H6.7v-1.4h6.6V19.6z',
handleSize: '120%'
}],
xAxis: {
type: 'category',
boundaryGap: false,
axisLine: {
lineStyle: {
color: '#ccc'
}
},
axisLabel: {
textStyle: {
fontFamily: 'Arial, Verdana, sans-serif',
color: '#666'
}
},
axisPointer: {
type: 'line',
label: {show: false},
triggerTooltip: true,
handle: {
show: true,
margin: 50,
color: '#F18D00'
}
},
data: times,
},
yAxis: {
type: 'value',
scale: true,
position: 'right',
axisLine: {
lineStyle: {
color: '#ccc'
}
},
axisLabel: {
inside: true,
textStyle: {
fontFamily: 'Arial, Verdana, sans-serif',
color: '#666'
}
}
},
series: [
{
name: '',
type: 'line',
smooth: true,
symbol: 'none',
sampling: 'average',
areaStyle: {
normal: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
offset: 0,
color: '#78CDE6'
}, {
offset: 1,
color: '#fff'
}])
}
},
data: datas
}
]
};
var myChart01b = echarts.init(document.getElementById('chart01a'));
myChart01b.setOption(option01b,true);
}
+27 -9
View File
@@ -198,9 +198,17 @@ function clickTrend(city, type){
if (localStorage.getItem("user_token") == null || localStorage.getItem("user_token") == "") {
clicked('../user/codeSms.html',true,false,{},{},function(){
clickTrend(city, type);
plus.webview.getWebviewById('views/user/userInfo.html').reload();
plus.webview.getWebviewById('views/house/houseDetail.html').reload();
plus.webview.getWebviewById('views/house/houseManageList.html').reload();
if(plus.webview.getWebviewById('views/house/houseDetail.html')!= null) {
plus.webview.getWebviewById('views/house/houseDetail.html').reload();
}
if(plus.webview.getWebviewById('views/house/houseManageList.html') != null) {
plus.webview.getWebviewById('views/house/houseManageList.html').reload();
}
if(plus.webview.getWebviewById('views/user/userInfo.html')!= null){
plus.webview.getWebviewById('views/user/userInfo.html').reload();
}
})
return;
} else {
@@ -543,9 +551,13 @@ function collectCity(city, type){
if (localStorage.getItem("user_token") == null || localStorage.getItem("user_token") == "") {
clicked('../user/codeSms.html',true,false,{},{},function(){
collectCity(city, type)
plus.webview.getWebviewById('views/house/houseManageList.html').reload();
plus.webview.getWebviewById('views/user/userInfo.html').reload();
//plus.webview.getWebviewById('views/house/houseDetail.html').reload();
if(plus.webview.getWebviewById('views/house/houseManageList.html') != null) {
plus.webview.getWebviewById('views/house/houseManageList.html').reload();
}
if(plus.webview.getWebviewById('views/user/userInfo.html')!= null){
plus.webview.getWebviewById('views/user/userInfo.html').reload();
}
})
return;
} else {
@@ -562,7 +574,9 @@ function collectCity(city, type){
// plus.webview.getWebviewById('views/house/houseDetail.html').reload();
},function(){
plus.webview.getWebviewById('views/house/houseDetail.html').reload();
if(plus.webview.getWebviewById('views/house/houseDetail.html')!= null) {
plus.webview.getWebviewById('views/house/houseDetail.html').reload();
}
//loadMyCollectCity();
});
@@ -602,13 +616,17 @@ function docollectCity(city, type){
//loadMyCollectCity();
$("a[href='#tabQuotation1']").click();
plus.webview.getWebviewById('views/house/houseDetail.html').reload();
if(plus.webview.getWebviewById('views/house/houseDetail.html')!= null) {
plus.webview.getWebviewById('views/house/houseDetail.html').reload();
}
//reloadMyFocus();
//reloadCityPotentialRanking()
//reloadCityIncreaseRanking()
}else if(msg == "关注成功"){
cityInfoVue.$data.collecd = true;
plus.webview.getWebviewById('views/house/houseDetail.html').reload();
if(plus.webview.getWebviewById('views/house/houseDetail.html')!= null) {
plus.webview.getWebviewById('views/house/houseDetail.html').reload();
}
//reloadMyFocus();
//reloadCityPotentialRanking()
//reloadCityIncreaseRanking()
+11 -3
View File
@@ -528,10 +528,18 @@ function showRegionInfo(city){
function collectCity(city, index){
if (localStorage.getItem("user_token") == null || localStorage.getItem("user_token") == "") {
clicked('../user/codeSms.html',true,false,{},{},function(){
plus.webview.getWebviewById('views/house/houseDetail.html').reload();
if(plus.webview.getWebviewById('views/house/houseDetail.html')!= null) {
plus.webview.getWebviewById('views/house/houseDetail.html').reload();
}
collectCity(city)
plus.webview.getWebviewById('views/house/houseManageList.html').reload();
plus.webview.getWebviewById('views/user/userInfo.html').reload();
if(plus.webview.getWebviewById('views/house/houseManageList.html') != null) {
plus.webview.getWebviewById('views/house/houseManageList.html').reload();
}
if(plus.webview.getWebviewById('views/user/userInfo.html')!= null){
plus.webview.getWebviewById('views/user/userInfo.html').reload();
}
})
return;
+48
View File
@@ -12,6 +12,12 @@ var searchDistVue = new Vue({
}else{
clicked('views/district/detail.html',true,false,{},{city:this.searchDistricts[index].city,region:this.searchDistricts[index].region,name:this.searchDistricts[index].name});
}
},
clickDistrict:function(index){
saveHistory({district:this.searchDistricts[index].region,name:this.searchDistricts[index].name,city:this.searchDistricts[index].city})
$("#input_district").val(this.searchDistricts[index].name);
$("input[name=region]").val(this.searchDistricts[index].region);
$("input[name=city]").val(this.searchDistricts[index].city);
}
}
})
@@ -122,9 +128,30 @@ $("body").delegate(".open-about02", "click", function () {
addHotDistricts($("#input_city").text());
addHistory();
$.popup(".popup-about02")
$.popup(".popup-about02")
$("input").blur()
});
/* 弹出置换小区搜索页面 */
$("body").delegate(".open-about02b", "click", function () {
$("#districtName").val("");
if($("#input_city").text()==""){
$.toast("请选择城市")
return false;
}
$('.historyList').show();
$("#notFound").hide();
$('.hotList').show();
$('.searchList').hide();
addHotDistricts($("#input_city").text());
addHistoryFilter($("#input_city").text());
$.popup(".popup-about02b")
$("input").blur()
});
//添加热门小区
function addHotDistricts(cityParam){
axios.get(BASE_PATH+"/rest/districts/hotDistricts", {
@@ -164,6 +191,11 @@ var historyVue = new Vue({
}else{
clicked('views/district/detail.html',true,false,{},{city:this.histories[index].city,region:this.histories[index].region,name:this.histories[index].name});
}
},
clickDistrict:function(index){
$("#input_district").val(this.histories[index].name);
$("input[name=region]").val(this.histories[index].region);
$("input[name=city]").val(this.histories[index].city);
}
}
})
@@ -183,6 +215,22 @@ function addHistory(){
}*/
}
function addHistoryFilter(curCity){
var history = recover()
if(history.length>0){
histories = []
$(history).each(function(){
if(this.city==curCity){
var map={city:this.city, region:this.district, name:this.name};
histories.push(map)
}
})
historyVue.histories=histories;
}/*else{
$(".historyList #districtList").empty();
}*/
}
//点击清空
$("#clearSearchHistory").click(function(){
//$.cookie('history',JSON.stringify([]) ,{ expires: 7});
+2 -2
View File
@@ -78,10 +78,10 @@ function shareMessage(msg,s){
var ss=shares['weixin'];
ss&&ss.nativeClient&&(shareBts.push({title:'微信朋友圈',s:ss,x:'WXSceneTimeline'}),
shareBts.push({title:'微信好友',s:ss,x:'WXSceneSession'}));
ss=shares['qq'];
/* ss=shares['qq'];
ss&&ss.nativeClient&&shareBts.push({title:'QQ',s:ss});
ss=shares['sinaweibo'];
ss&&shareBts.push({title:'新浪微博',s:ss});
ss&&shareBts.push({title:'新浪微博',s:ss});*/
// 弹出分享列表
shareBts.length>0?plus.nativeUI.actionSheet({title:'分享链接',cancel:'取消',buttons:shareBts},function(e){
(e.index>0)&&shareAction(shareBts[e.index-1],true);
+106 -25
View File
@@ -1,13 +1,15 @@
var versionUpdate = function(){
var isAndroid = isAndroidUser();
plus.runtime.getProperty(plus.runtime.appid, function(inf) {
var localVersion =inf.version;
var curVersion = versionInfo();
if(parseFloat(localVersion)<curVersion.version){
plus.nativeUI.alert( curVersion.updateDesc,
var isAndroid = isAndroidUser();
plus.runtime.getProperty(plus.runtime.appid, function(inf) {
var localVersion = inf.version;
var curVersion = versionInfo();
if(compareVersion(localVersion, curVersion.version)){
//判断升级方式(0:提示 1:静默)
if(curVersion.upgradeType == 0){
plus.nativeUI.alert(curVersion.updateDesc,
function(){
if(isAndroid){
downApp()
downApp();
}else{
plus.nativeUI.showWaiting("版本更新中...");
var url='https://itunes.apple.com/cn/app/id1341557643?mt=8';
@@ -15,12 +17,13 @@ var versionUpdate = function(){
}
}, "发现新版本", "立即升级"
);
}
})
 
};
}else if(curVersion.upgradeType == 1){
//不区分Android 和 ios直接增量包更新(Android已测试,ios待测试)
downAppWgt(curVersion.fileUrl);
}
}
})
}
//判断是不是安卓系统
var isAndroidUser = function(){
@@ -33,8 +36,9 @@ var isAndroidUser = function(){
}
return isAndroid;
}
//判断是否需要安装
var versionInfo = function(){
var versionInfo = function(){
var flag = null;
$.ajax({
type: "GET",
@@ -46,28 +50,29 @@ var versionInfo = function(){
flag = data.data;
}
}
})
})
return flag;
}
//下载后安装
var downApp =function(){
var url="http://app.fangjia.com/download/youfang.apk"; // 下载文件地址
plus.nativeUI.showWaiting("下载wgt文件...");
var downApp = function(){
var url="http://app.fangjia.com/download/youfang.apk"; //下载文件地址
plus.nativeUI.showWaiting("下载apk文件...");
var dtask = plus.downloader.createDownload( url, {}, function ( d, status ) {
if ( status == 200 ) { // 下载成功
installWgt(d.filename)
if (status == 200) {
//下载成功
install(d.filename);
} else {//下载失败
alert( "Download failed: " + status );
plus.nativeUI.alert("Download failed: " + status);
}
plus.nativeUI.closeWaiting()
plus.nativeUI.closeWaiting();
});
dtask.start();
}
//安装
function installWgt(path){
plus.nativeUI.showWaiting("安装wgt文件...");
function install(path){
plus.nativeUI.showWaiting("安装apk文件...");
plus.runtime.install(path,{},function(){
plus.nativeUI.closeWaiting();
plus.nativeUI.alert("应用资源更新完成!",function(){
@@ -75,6 +80,82 @@ function installWgt(path){
});
},function(e){
plus.nativeUI.closeWaiting();
plus.nativeUI.alert("安装wgt文件失败["+e.code+"]:"+e.message);
plus.nativeUI.alert("安装apk文件失败["+e.code+"]:"+e.message);
});
}
//静默安装下载
var downAppWgt = function(url){
var dtask = plus.downloader.createDownload( url, {}, function ( d, status ) {
if (status == 200) {
//下载成功
installWgt(d.filename)
} else {
//下载失败
}
});
dtask.start();
}
/**
* 静默安装
* force: (Boolean 类型 )是否强制安装
* true表示强制安装,不进行版本号的校验;false则需要版本号校验
* @param {Object} path
*/
function installWgt(path){
plus.runtime.install(path, {force:true}, function(){
plus.runtime.restart();
},function(e){
});
}
/**
* 版本比较(添加时候已经控制版本格式xx.xx ~ xx.xx.xx)
* @param {Object} _currentVersion 当前版本
* @param {Object} _onLineVersion 系统最新上架版本
*/
function compareVersion(_currentVersion, _onLineVersion){
try{
var onLineVersion = _onLineVersion.split('.');
var currentVersion = _currentVersion.split('.');
//先比较第一位
if(parseFloat(onLineVersion[0]) > parseFloat(currentVersion[0])){
return true;
}else if(parseFloat(onLineVersion[0]) == parseFloat(currentVersion[0])){
//在比较第二位
if(parseFloat(onLineVersion[1]) > parseFloat(currentVersion[1])){
return true;
}else if(parseFloat(onLineVersion[1]) == parseFloat(currentVersion[1])){
//判断第三位是否存在,存在才可以进行比较
if(onLineVersion.length > currentVersion.length){
//如果当前输入的version大于maxVersion的length
return true;
}else if(onLineVersion.length == currentVersion.length){
if(onLineVersion.length == 2){
return false;
}else{
//当length相等,且存在第三位
if(parseFloat(onLineVersion[2]) > parseFloat(currentVersion[2])){
return true;
}else if(parseFloat(onLineVersion[2]) == parseFloat(currentVersion[2])){
return false;
}else{
return false;
}
}
}else{
//如果当前输入的version小于maxVersion的length
return false;
}
}else{
return false;
}
}else{
return false;
}
}catch(e){
return false;
}
}