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

This commit is contained in:
raoyanhui
2018-05-09 18:31:46 +08:00
2 changed files with 100 additions and 78 deletions
+34 -42
View File
@@ -27,60 +27,52 @@ document.addEventListener("plusready", function() {
if (payload.type == "0") {
plus.ui.alert(title+"\n"+content);
} else if (payload.type == "1") {
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");
plus.ui.alert(title+"\n"+content,function(){
if(plus.webview.getWebviewById('H5693FF3D')==null){
plus.webview.show(plus.webview.getWebviewById("HBuilder"));
}else{
plus.webview.show(plus.webview.getWebviewById("H5693FF3D"));
}
var targetTab = payload.url+".html";
var defaultTab = document.getElementById(targetTab);
//模拟首页点击
mui.trigger(defaultTab, 'tap');
//切换选项卡高亮
var current = document.querySelector(".mui-bar-tab>.mui-tab-item.mui-active");
if (defaultTab != current) {
current.classList.remove('mui-active');
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);
clicked('views/webview_embed.html', true,false,{},{url:payload.url})
});
}
} else {
if (payload.type == "0") {
plus.ui.alert(content);
} else if (payload.type == "1") {
plus.ui.alert(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");
plus.ui.alert(title+"\n"+content,function(){
if(plus.webview.getWebviewById('H5693FF3D')==null){
plus.webview.show(plus.webview.getWebviewById("HBuilder"));
}else{
plus.webview.show(plus.webview.getWebviewById("H5693FF3D"));
}
var targetTab = payload.url+".html";
var defaultTab = document.getElementById(targetTab);
//模拟首页点击
mui.trigger(defaultTab, 'tap');
//切换选项卡高亮
var current = document.querySelector(".mui-bar-tab>.mui-tab-item.mui-active");
if (defaultTab != current) {
current.classList.remove('mui-active');
defaultTab.classList.add('mui-active');
}
});
});
} else if (payload.type == "2") {
plus.ui.alert(content,function(){
openUrl(BASE_PATH+'/message/openView?url='+payload.url);
clicked('views/webview_embed.html', true,false,{},{url:payload.url})
});
}
}
+66 -36
View File
@@ -1248,48 +1248,60 @@ 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);
@@ -1308,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({
@@ -1326,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 = "";