Commit 4d37bd73 authored by fengruiyu's avatar fengruiyu

修改JS(z3map)

parent 044c435b
......@@ -105,6 +105,15 @@ function centerChanged() {
}
}
function needPay() {
try {
doAppFun("needPay");
} catch (e) {
// console.log("tips", msg)
//alert("app未弹框==>" + msg + e)
}
}
function tips(msg) {
try {
doAppFun("tips", msg);
......@@ -197,6 +206,12 @@ connectWebViewJavascriptBridge(function (bridge) {
responseCallback(getVmMsg("suc:changeMapType"));
});
bridge.registerHandler("changeToVip", function (data, responseCallback) {
vm.changeToVip();
responseCallback(getVmMsg("suc:changeToVip"));
});
})
......
......@@ -20,30 +20,11 @@
let G_MAP; //gmap
function GF_addZoom() {
var zoom = G_MAP.getZoom();
if (zoom == 20) {
tip("已放大至最大级别")
return;
}
zoom += 1;
G_MAP.setZoom(zoom);
}
function GF_reduceZoom() {
var zoom = G_MAP.getZoom();
if (zoom == 0) {
tip("已缩放至最小级别")
return;
}
zoom -= 1;
G_MAP.setZoom(zoom);
}
var vm = new Vue({
el: '#maps',
data: {
isVip: false,
showVrButton: true,
showScenics: false,
mapScale: "",
......@@ -58,7 +39,9 @@ var vm = new Vue({
scenics: [],
markes: [],
pxValue: 50,
gdcenter: null
gdcenter: null,
vipLevel: 16,
notVipLevels: [8, 9, 10]
},
created: function () {
......@@ -68,7 +51,10 @@ var vm = new Vue({
vrs: function () {
var th = this;
console.log(th.canclick)
if(this.isVip==false){
this.needPay();
return;
}
if (th.canclick) {
th.canclick = false;
setTimeout(function () {
......@@ -114,8 +100,6 @@ var vm = new Vue({
vm.markes[i].setMap(G_MAP);
}
}
// G_MAP.setZoom(10)
},
......@@ -144,20 +128,26 @@ var vm = new Vue({
title: msg.bvid,
})
marker.addListener("click", (ss) => {
if(this.isVip==false){
this.needPay();
return;
}
params = vm.getSeLabel(marker.getTitle());
if (params != null) {
console.log(params);
openScenicsFrame(params);
G_MAP.setCenter({
lat:params.lat,
lng:params.lng
lat: params.lat,
lng: params.lng
})
}
});
vm.markes.push(marker);
}
},
changeToVip:function(){
this.isVip=true;
},
getSeLabel: function (bvid) {
for (i in this.scenics) {
if (this.scenics[i].bvid == bvid)
......@@ -165,22 +155,15 @@ var vm = new Vue({
}
return null;
},
addZoom: function () {
GF_addZoom();
},
reduceZoom: function () {
GF_reduceZoom();
},
initZsMap: function (inMsg) {
var th = this;
if (inMsg.lat == 0 || inMsg.lng == 0 ||
inMsg.lat == '0' || inMsg.lng == '0') {
inMsg = {
"lat": 39.90960456049752,
"lng": 116.3972282409668,
"inner": 0
};
inMsg.lat = 39.90960456049752;
inMsg.lng = 116.3972282409668;
}
th.isVip = inMsg.vip == 1;
var point = {
lat: parseFloat(inMsg.lat),
lng: parseFloat(inMsg.lng)
......@@ -188,23 +171,71 @@ var vm = new Vue({
if (inMsg.inner == null) {
toGPoint(point, function (r) {
console.log("定位 》》》toGooglePoint", r)
th.G_initMap(r, 16);
th.G_initMap(r, th.getLevel());
})
} else {
if (inMsg.inner == 0 || inMsg == '0') {
toGPoint(point, function (r) {
console.log("国内 》》》toGooglePoint", r)
th.G_initMap(r, 16);
th.G_initMap(r, th.getLevel());
})
} else {
console.log("国外 》》》toGooglePoint", point)
th.G_initMap(point, 16);
th.G_initMap(point, th.getLevel());
}
}
},
getLevel: function () {
if (this.isVip)
return this.vipLevel;
return this.notVipLevels[1];
},
addZoom: function () {
var zoom = G_MAP.getZoom();
if (zoom == 20) {
tip("已放大至最大级别")
return;
}
zoom += 1;
vm.checkZoom(zoom);
G_MAP.setZoom(zoom);
},
reduceZoom: function () {
var zoom = G_MAP.getZoom();
if (zoom == 0) {
tip("已缩放至最小级别")
return;
}
zoom -= 1;
vm.checkZoom(zoom);
G_MAP.setZoom(zoom);
},
checkZoom: function (zoom) {
if (zoom == undefined || zoom == null)
zoom = G_MAP.getZoom();
console.log(zoom)
if (zoom < vm.notVipLevels[0]) {
G_MAP.setZoom(vm.notVipLevels[0]);
this.needPay();
return;
}
if (zoom > vm.notVipLevels[2]) {
G_MAP.setZoom(vm.notVipLevels[2]);
this.needPay();
return;
}
},
needPay:function(){
console.log("<<请开启会员")
needPay();
},
G_initMap: function (point, zoomLevel) {
if (zoomLevel == undefined || zoomLevel == null)
zoomLevel = 15;
......@@ -244,8 +275,13 @@ var vm = new Vue({
var lat = G_MAP.getCenter().lat();
var zoomLevel = G_MAP.getZoom();
vm.mapScale = getScaleInfos(zoomLevel, lat, vm);
});
if (vm.isVip)
return;
vm.checkZoom();
});
G_MAP.addListener("dragend", () => {
......@@ -267,9 +303,7 @@ var vm = new Vue({
// }
// }, false);
// G_MAP.addListener('zoom_changed', () => {
// console.log(G_MAP.getCenter().lat())
// });
}
window.google.maps.Load && window.google.maps.Load(G_ZSYDA);
} else {
......@@ -287,71 +321,71 @@ window.onload = function () {
}
function init() {
vm.initZsMap({"lng": 0, "lat": 0})
//
// setTimeout(function () {
// vm.doShowScenics([
// {
// "name": "故宫",
// "img": "https://mints-pkg.oss-cn-beijing.aliyuncs.com/pkg_camera/img/ui/homepage/1628578695759.jpeg",
// "desc": "北京故宫呀",
// "lng": "116.313355",
// "lat": "39.983856",
// "blng": "116.32222419295384",
// "blat": "39.99602192441332",
// "bvid": "01002200001309200841046795L"
// }
// ]);
// }, 3000)
//
// setTimeout(function () {
// vm.showVrButton = true;
// }, 5000)
//
// setTimeout(function () {
// vm.showVrButton = false;
// }, 7000)
//
// setTimeout(function () {
// vm.showVrButton = true;
// }, 8000)
//
// setTimeout(function () {
// vm.doCloseScenics();
// }, 6000)
//
// setTimeout(function () {
// G_MAP.setMapTypeId('roadmap');
//
// }, 7000)
// setTimeout(function () {
// G_MAP.setMapTypeId('terrain');
//
// }, 11000)
//
// setTimeout(function () {
// G_MAP.setMapTypeId('satellite');
//
// }, 13000)
// setTimeout(function () {
// G_MAP.setMapTypeId('hybrid');
//
// }, 15000)
//
// setTimeout(function () {
// vm.doShowScenics([
// {
// "name": "故宫",
// "img": "https://mints-pkg.oss-cn-beijing.aliyuncs.com/pkg_camera/img/ui/homepage/1628578695759.jpeg",
// "desc": "北京故宫呀",
// "lng": "116.313355",
// "lat": "39.983856",
// "blng": "116.32222419295384",
// "blat": "39.99602192441332",
// "bvid": "01002200001309200841046795L"
// }
// ]);
// }, 9000)
vm.initZsMap({"lng": 0, "lat": 0, "vip": 0,"inner":1})
setTimeout(function () {
vm.doShowScenics([
{
"name": "故宫",
"img": "https://mints-pkg.oss-cn-beijing.aliyuncs.com/pkg_camera/img/ui/homepage/1628578695759.jpeg",
"desc": "北京故宫呀",
"lng": "116.313355",
"lat": "39.983856",
"blng": "116.32222419295384",
"blat": "39.99602192441332",
"bvid": "01002200001309200841046795L"
}
]);
}, 3000)
setTimeout(function () {
vm.showVrButton = true;
}, 5000)
setTimeout(function () {
vm.showVrButton = false;
}, 7000)
setTimeout(function () {
vm.showVrButton = true;
}, 8000)
setTimeout(function () {
vm.doCloseScenics();
}, 6000)
setTimeout(function () {
G_MAP.setMapTypeId('roadmap');
}, 7000)
setTimeout(function () {
G_MAP.setMapTypeId('terrain');
}, 11000)
setTimeout(function () {
G_MAP.setMapTypeId('satellite');
}, 13000)
setTimeout(function () {
G_MAP.setMapTypeId('hybrid');
}, 15000)
setTimeout(function () {
vm.doShowScenics([
{
"name": "故宫",
"img": "https://mints-pkg.oss-cn-beijing.aliyuncs.com/pkg_camera/img/ui/homepage/1628578695759.jpeg",
"desc": "北京故宫呀",
"lng": "116.313355",
"lat": "39.983856",
"blng": "116.32222419295384",
"blat": "39.99602192441332",
"bvid": "01002200001309200841046795L"
}
]);
}, 9000)
}
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