1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- new Vue({
- el: "#main",
- data: function() {
- return {
- activeTabIdx: 1,
- hospitalId:"",
- data: {}
- }
- },
- mounted: function() {
- this.hospitalId = this.getRequest("hospitalId");
- EventBus.$emit("jump-step", {
- step: 4
- }); //step:跳转的步数
- this.querySimpleHospitalById();
- },
- methods: {
- activeTab: function(idx) {
- this.activeTabIdx = idx;
- },
- //获取医院详情
- querySimpleHospitalById: function() {
- var vm = this;
- appointmentAPI.querySimpleHospitalById({
- hospitalId: vm.hospitalId
- }).then(function(res) {
- if(res.successFlg && res.obj.Code == "10000") {
- var obj = res.obj;
- vm.data = obj;
- vm.doLocate(obj.jd, obj.wd);
- }
- });
- },
- backPage: function() {
- window.location.href = "select-hospital.html";
- },
- //根据经纬度定位
- doLocate: function(jd, wd) {
- // 百度地图API功能
- var map = new BMap.Map("div_map");
- // 创建Map实例
- map.enableScrollWheelZoom();
- //启用滚轮放大缩小
- map.centerAndZoom(new BMap.Point(jd, wd), 15);
- var point = new BMap.Point(jd, wd);
- var marker = new BMap.Marker(point);
- map.addOverlay(marker);
- // map.addOverlay(new BMap.Marker(point));
- // marker.enableDragging(); //启用标注拖动
- // marker.addEventListener('dragend', function(e) { //拖动标注结束
- // var pointNew = e.point;
- // console.log(pointNew);
- // alert(pointNew.lng + '|' + pointNew.lat);
- // });
- map.centerAndZoom(point, 15);
- // 初始化地图,设置中心点坐标和地图级别。
- },
- getRequest: function(name) {
- var url = window.location.href; //获取地址栏url
- var pattern = new RegExp("[?&]" + name + "\=([^&]+)", "g");
- var matcher = pattern.exec(url);
- var items = null;
- if(null != matcher) {
- try {
- items = decodeURIComponent(decodeURIComponent(matcher[1]));
- } catch(e) {
- try {
- items = decodeURIComponent(matcher[1]);
- } catch(e) {
- items = matcher[1];
- }
- }
- }
- return items;
- }
- }
- })
|