Commit 68aac287 authored by fengruiyu's avatar fengruiyu

修改JS

配合JS添加 搜索地址返回到地图上标记功能已完成
parent 5cdb56e9
...@@ -40,9 +40,11 @@ var vm = new Vue({ ...@@ -40,9 +40,11 @@ var vm = new Vue({
markes: [], markes: [],
pxValue: 50, pxValue: 50,
gdcenter: null, gdcenter: null,
vipLevel: 11, vipLevel: 14,
notVipLevels: [1, 11, 14] notVipLevels: [1, 11, 14],
nowP: null,
nowS: null,
iconType: 0,
}, },
created: function () { created: function () {
// console.log('llll') // console.log('llll')
...@@ -127,10 +129,10 @@ var vm = new Vue({ ...@@ -127,10 +129,10 @@ var vm = new Vue({
title: msg.bvid, title: msg.bvid,
}) })
marker.addListener("click", (ss) => { marker.addListener("click", (ss) => {
if (this.isVip == false) { // if (this.isVip == false) {
this.needPay('p'); // this.needPay('p');
return; // return;
} // }
params = vm.getSeLabel(marker.getTitle()); params = vm.getSeLabel(marker.getTitle());
if (params != null) { if (params != null) {
// console.log(params); // console.log(params);
...@@ -161,11 +163,13 @@ var vm = new Vue({ ...@@ -161,11 +163,13 @@ var vm = new Vue({
th.showScenics = inMsg.showScenics == 1; th.showScenics = inMsg.showScenics == 1;
th.scenics = inMsg.scenics; th.scenics = inMsg.scenics;
th.isVip = inMsg.vip == 1; th.isVip = inMsg.vip == 1;
th.initZsMap(inMsg, true); th.iconType = 0;
th.initZsMap(inMsg);
}, },
initZsMap: function (inMsg, init) { initZsMap: function (inMsg) {
var th = this; var th = this;
th.isVip = inMsg.vip == 1; th.isVip = inMsg.vip == 1;
th.iconType = inMsg.iconType == null ? 0 : inMsg.iconType;
if (inMsg.lat == 0 || inMsg.lng == 0 || if (inMsg.lat == 0 || inMsg.lng == 0 ||
inMsg.lat == '0' || inMsg.lng == '0') { inMsg.lat == '0' || inMsg.lng == '0') {
...@@ -179,18 +183,17 @@ var vm = new Vue({ ...@@ -179,18 +183,17 @@ var vm = new Vue({
if (inMsg.inner == null) { if (inMsg.inner == null) {
toGPoint(point, function (r) { toGPoint(point, function (r) {
console.log("定位 》》》toGooglePoint", r) console.log("定位 》》》toGooglePoint", r)
th.G_initMap(r, th.getLevel(), init); th.G_initMap(r, th.getLevel());
}) })
} else { } else {
if (inMsg.inner == 0 || inMsg == '0') { if (inMsg.inner == 0 || inMsg == '0') {
toGPoint(point, function (r) { toGPoint(point, function (r) {
console.log("国内 》》》toGooglePoint", r) console.log("国内 》》》toGooglePoint", r)
th.G_initMap(r, th.getLevel(), init); th.G_initMap(r, th.getLevel());
}) })
} else { } else {
console.log("国外 》》》toGooglePoint", point) console.log("国外 》》》toGooglePoint", point)
th.G_initMap(point, th.getLevel());
th.G_initMap(point, th.getLevel(), init);
} }
} }
...@@ -240,16 +243,16 @@ var vm = new Vue({ ...@@ -240,16 +243,16 @@ var vm = new Vue({
return; return;
} }
}, },
needPay:function(d){ needPay: function (d) {
console.log("<<请开启会员") console.log("<<请开启会员")
if(d!=undefined&&d!=null&&d=='p'){ if (d != undefined && d != null && d == 'p') {
needPay(); needPay();
return; return;
} }
needPayPopup(); needPayPopup();
}, },
G_initMap: function (point, zoomLevel, init) { G_initMap: function (point, zoomLevel) {
if (zoomLevel == undefined || zoomLevel == null) if (zoomLevel == undefined || zoomLevel == null)
zoomLevel = 15; zoomLevel = 15;
var th = this; var th = this;
...@@ -307,36 +310,47 @@ var vm = new Vue({ ...@@ -307,36 +310,47 @@ var vm = new Vue({
}, false); }, false);
if (init) {//初始化 vm.setNowO(point);
new google.maps.Marker({
position: point,
map: G_MAP,
icon: "./common/n.png",//msg.img,
// animation: google.maps.Animation.DROP,
optimized: true,
map: G_MAP,
// label: {
// text: "i am here",
// className: "zsmaker",
// // fontFamily: "Material Icons",
// color: "#ffffff",
// fontSize: "13px",
// fontWeight: '500'
// },
});
if (vm.showScenics) if (vm.showScenics)
vm.doShowScenics(); vm.doShowScenics();
}
} }
window.google.maps.Load && window.google.maps.Load(G_ZSYDA); window.google.maps.Load && window.google.maps.Load(G_ZSYDA);
} else { } else {
G_MAP.panTo(point) //第二次初始化 G_MAP.panTo(point) //第二次初始化
G_MAP.setZoom(zoomLevel) G_MAP.setZoom(zoomLevel)
vm.setNowO(point);
} }
}, },
setNowO: function (point) {
if (this.iconType == 0) {
if (this.nowP == null) {
this.nowP = new google.maps.Marker({
position: point,
map: G_MAP,
icon: "./common/n2.png",//msg.img,
optimized: true,
map: G_MAP,
});
} else {
this.nowP.setPosition(point)
}
} else {
if (this.nowS == null) {
this.nowS = new google.maps.Marker({
position: point,
map: G_MAP,
icon: "./common/jd.png",//msg.img,
optimized: true,
map: G_MAP,
});
} else {
this.nowS.setPosition(point)
}
}
}
} }
}) })
......
...@@ -129,8 +129,5 @@ ...@@ -129,8 +129,5 @@
<script type="text/javascript" charset="UTF-8" src="./zsmap_files/onion.js"></script> <script type="text/javascript" charset="UTF-8" src="./zsmap_files/onion.js"></script>
<script type="text/javascript" charset="UTF-8" src="./zsmap_files/controls.js"></script> <script type="text/javascript" charset="UTF-8" src="./zsmap_files/controls.js"></script>
<script src="./zsmap_files/js" async=""></script> <script src="./zsmap_files/js" async=""></script>
<script src="./common/vconsole.min.js"></script>
<script>
var vConsole = new VConsole();
</script>
</html> </html>
...@@ -8,6 +8,7 @@ class InitMapBean { ...@@ -8,6 +8,7 @@ class InitMapBean {
var lng: Double = 0.0 var lng: Double = 0.0
var vip: Int? = 0//0 非vip 1 vip var vip: Int? = 0//0 非vip 1 vip
var inner: Int? = 0// 0国内 ,1国外 var inner: Int? = 0// 0国内 ,1国外
var iconType: Int? = 0// 定位icon还是搜索之后的icon 0国内 ,1国外
var mapType:String?=null//当前地图类型 var mapType:String?=null//当前地图类型
var showVrButton: Int? = 0 //是否展示街景按钮 1 展示,0 不展示 var showVrButton: Int? = 0 //是否展示街景按钮 1 展示,0 不展示
var showScenics: Int? = 0 //是否展示景点推荐 1 展示 ,0 不展示 var showScenics: Int? = 0 //是否展示景点推荐 1 展示 ,0 不展示
......
...@@ -127,7 +127,7 @@ class GoogleMapFragment() : BaseFragment<ActivityGoogleMapBinding, HomeViewModel ...@@ -127,7 +127,7 @@ class GoogleMapFragment() : BaseFragment<ActivityGoogleMapBinding, HomeViewModel
//点击调转页面 //点击调转页面
viewModel.authorized(bvid, name) viewModel.authorized(bvid, name)
//更新当前坐标(控制js页面做回调) //更新当前坐标(控制js页面做回调)
loadPosition(lat?.toDouble(), lng?.toDouble()) loadPosition(lat?.toDouble(), lng?.toDouble(),iconType = 1)
} }
} }
}).init().show() }).init().show()
...@@ -243,7 +243,7 @@ class GoogleMapFragment() : BaseFragment<ActivityGoogleMapBinding, HomeViewModel ...@@ -243,7 +243,7 @@ class GoogleMapFragment() : BaseFragment<ActivityGoogleMapBinding, HomeViewModel
* 调用JS * 调用JS
* 定位 * 定位
*/ */
private fun loadPosition(lat: Double? = null, lng: Double? = null, inner: Int = 0) { private fun loadPosition(lat: Double? = null, lng: Double? = null, inner: Int = 0,iconType:Int=0) {
val initMapBean = InitMapBean() val initMapBean = InitMapBean()
initMapBean.lat = lat ?: gps.lat initMapBean.lat = lat ?: gps.lat
initMapBean.lng = lng ?: gps.lng initMapBean.lng = lng ?: gps.lng
...@@ -256,6 +256,7 @@ class GoogleMapFragment() : BaseFragment<ActivityGoogleMapBinding, HomeViewModel ...@@ -256,6 +256,7 @@ class GoogleMapFragment() : BaseFragment<ActivityGoogleMapBinding, HomeViewModel
} }
initMapBean.inner = inner initMapBean.inner = inner
initMapBean.iconType = iconType
binding.webview.callHandler( binding.webview.callHandler(
"initZsMap", Gson().toJson(initMapBean) "initZsMap", Gson().toJson(initMapBean)
) { ) {
...@@ -433,7 +434,7 @@ class GoogleMapFragment() : BaseFragment<ActivityGoogleMapBinding, HomeViewModel ...@@ -433,7 +434,7 @@ class GoogleMapFragment() : BaseFragment<ActivityGoogleMapBinding, HomeViewModel
}) })
//搜索页面回调参数 //搜索页面回调参数
viewModel.pt.observe(this, Observer { viewModel.pt.observe(this, Observer {
loadPosition(it.lat, it.lng, it.inner) loadPosition(it.lat, it.lng, it.inner,1)
binding.scrollLayout.toggle(ScrollLayout.STATUS_CLOSE) binding.scrollLayout.toggle(ScrollLayout.STATUS_CLOSE)
}) })
//获取地图展示样式 //获取地图展示样式
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment