index.html 3.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <!DOCTYPE html>
  2. <html lang="en" dir="ltr">
  3. <head>
  4. <script data-ionic="inject">
  5. (function(w){var i=w.Ionic=w.Ionic||{};i.version='3.9.2';i.angular='5.2.11';i.staticDir='build/';})(window);
  6. </script>
  7. <meta charset="UTF-8">
  8. <title>Ionic App</title>
  9. <meta name="viewport" content="viewport-fit=cover, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
  10. <meta name="format-detection" content="telephone=no">
  11. <meta name="msapplication-tap-highlight" content="no">
  12. <link rel="icon" type="image/x-icon" href="assets/icon/favicon.ico">
  13. <link rel="manifest" href="manifest.json">
  14. <meta name="theme-color" content="#4e8ef7">
  15. <!-- add to homescreen for ios -->
  16. <meta name="apple-mobile-web-app-capable" content="yes">
  17. <meta name="apple-mobile-web-app-status-bar-style" content="black">
  18. <!-- cordova.js required for cordova apps (remove if not needed) -->
  19. <script src="cordova.js"></script>
  20. <!-- un-comment this code to enable service worker
  21. <script>
  22. if ('serviceWorker' in navigator) {
  23. navigator.serviceWorker.register('service-worker.js')
  24. .then(() => console.log('service worker installed'))
  25. .catch(err => console.error('Error', err));
  26. }
  27. </script>-->
  28. <link href="build/main.css" rel="stylesheet">
  29. </head>
  30. <body>
  31. <!-- Ionic's root component and where the app will load -->
  32. <ion-app></ion-app>
  33. <script type="text/javascript" src="https://api.map.baidu.com/api?v=2.0&ak=lYGuG0ZagxCX2ra23MgMT5iTyqdrGLh2"></script>
  34. <script>
  35. //2011-7-25
  36. (function(){ //闭包
  37. function load_script(xyUrl, callback){
  38. var head = document.getElementsByTagName('head')[0];
  39. var script = document.createElement('script');
  40. script.type = 'text/javascript';
  41. script.src = xyUrl;
  42. //借鉴了jQuery的script跨域方法
  43. script.onload = script.onreadystatechange = function(){
  44. if((!this.readyState || this.readyState === "loaded" || this.readyState === "complete")){
  45. callback && callback();
  46. // Handle memory leak in IE
  47. script.onload = script.onreadystatechange = null;
  48. if ( head && script.parentNode ) {
  49. head.removeChild( script );
  50. }
  51. }
  52. };
  53. // Use insertBefore instead of appendChild to circumvent an IE6 bug.
  54. head.insertBefore( script, head.firstChild );
  55. }
  56. function translate(point,type,callback){
  57. var callbackName = 'cbk_' + Math.round(Math.random() * 10000); //随机函数名
  58. var xyUrl = "http://api.map.baidu.com/ag/coord/convert?from="+ type + "&to=4&x=" + point.lng + "&y=" + point.lat + "&callback=BMap.Convertor." + callbackName;
  59. //动态创建script标签
  60. load_script(xyUrl);
  61. BMap.Convertor[callbackName] = function(xyResult){
  62. delete BMap.Convertor[callbackName]; //调用完需要删除改函数
  63. var point = new BMap.Point(xyResult.x, xyResult.y);
  64. callback && callback(point);
  65. }
  66. }
  67. window.BMap = window.BMap || {};
  68. BMap.Convertor = {};
  69. BMap.Convertor.translate = translate;
  70. })();
  71. </script>
  72. <!-- The polyfills js is generated during the build process -->
  73. <script src="build/polyfills.js"></script>
  74. <!-- The vendor js is generated during the build process
  75. It contains all of the dependencies in node_modules -->
  76. <script src="build/vendor.js"></script>
  77. <!-- The main bundle js is generated during the build process -->
  78. <script src="build/main.js"></script>
  79. </body>
  80. </html>