success-info.js 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. new Vue({
  2. el: "#main",
  3. data: function() {
  4. return {
  5. activeTabIdx: 1,
  6. hospitalId:"",
  7. data: {}
  8. }
  9. },
  10. mounted: function() {
  11. this.hospitalId = this.getRequest("hospitalId");
  12. EventBus.$emit("jump-step", {
  13. step: 4
  14. }); //step:跳转的步数
  15. this.querySimpleHospitalById();
  16. },
  17. methods: {
  18. activeTab: function(idx) {
  19. this.activeTabIdx = idx;
  20. },
  21. //获取医院详情
  22. querySimpleHospitalById: function() {
  23. var vm = this;
  24. appointmentAPI.querySimpleHospitalById({
  25. hospitalId: vm.hospitalId
  26. }).then(function(res) {
  27. if(res.successFlg && res.obj.Code == "10000") {
  28. var obj = res.obj;
  29. vm.data = obj;
  30. vm.doLocate(obj.jd, obj.wd);
  31. }
  32. });
  33. },
  34. backPage: function() {
  35. window.location.href = "select-hospital.html";
  36. },
  37. //根据经纬度定位
  38. doLocate: function(jd, wd) {
  39. // 百度地图API功能
  40. var map = new BMap.Map("div_map");
  41. // 创建Map实例
  42. map.enableScrollWheelZoom();
  43. //启用滚轮放大缩小
  44. map.centerAndZoom(new BMap.Point(jd, wd), 15);
  45. var point = new BMap.Point(jd, wd);
  46. var marker = new BMap.Marker(point);
  47. map.addOverlay(marker);
  48. // map.addOverlay(new BMap.Marker(point));
  49. // marker.enableDragging(); //启用标注拖动
  50. // marker.addEventListener('dragend', function(e) { //拖动标注结束
  51. // var pointNew = e.point;
  52. // console.log(pointNew);
  53. // alert(pointNew.lng + '|' + pointNew.lat);
  54. // });
  55. map.centerAndZoom(point, 15);
  56. // 初始化地图,设置中心点坐标和地图级别。
  57. },
  58. getRequest: function(name) {
  59. var url = window.location.href; //获取地址栏url
  60. var pattern = new RegExp("[?&]" + name + "\=([^&]+)", "g");
  61. var matcher = pattern.exec(url);
  62. var items = null;
  63. if(null != matcher) {
  64. try {
  65. items = decodeURIComponent(decodeURIComponent(matcher[1]));
  66. } catch(e) {
  67. try {
  68. items = decodeURIComponent(matcher[1]);
  69. } catch(e) {
  70. items = matcher[1];
  71. }
  72. }
  73. }
  74. return items;
  75. }
  76. }
  77. })