components_tianditu_home_vue.html 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. <!--********************************************************************
  2. * Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  3. *********************************************************************-->
  4. <!DOCTYPE html>
  5. <html>
  6. <head>
  7. <meta charset="UTF-8" />
  8. <title data-i18n="resources.title_componentsTianditu_home_Vue"></title>
  9. <script type="text/javascript" include="vue" src="../js/include-web.js"></script>
  10. <script include="iclient-mapboxgl-vue,mapbox-gl-enhance" src="../../dist/mapboxgl/include-mapboxgl.js"></script>
  11. <style>
  12. .container {
  13. margin: 0 auto;
  14. width: 100%;
  15. height: 100%;
  16. }
  17. .nav-header {
  18. width: 100%;
  19. height: 63px;
  20. background-color: #fff;
  21. border-bottom: 1px solid #ccc;
  22. z-index: 12;
  23. transition: 0.3s;
  24. box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  25. border-collapse: separate;
  26. display: flex;
  27. align-items: center;
  28. }
  29. .nav-header .logo {
  30. display: block;
  31. width: 80px;
  32. height: 40px;
  33. margin: 0 20px;
  34. float: left;
  35. cursor: pointer;
  36. }
  37. .nav-header .logo-image {
  38. width: 100%;
  39. height: 100%;
  40. }
  41. .nav-header .imagesLink {
  42. list-style: none;
  43. display: flex;
  44. align-items: center;
  45. height: 100%;
  46. font-size: 15px;
  47. margin-bottom: 0;
  48. }
  49. .nav-header .imagesLink li {
  50. display: inline-block;
  51. padding: 0 10px;
  52. }
  53. .nav-header .imagesLink li a {
  54. color: #333;
  55. }
  56. .nav-header .imagesLink li a:hover {
  57. color: #3385ff;
  58. }
  59. #main {
  60. width: 100%;
  61. height: calc(100% - 63px);
  62. }
  63. .mapboxgl-ctrl button:not(:disabled):hover {
  64. background-color: #269ff0;
  65. }
  66. </style>
  67. </head>
  68. <body style=" margin: 0;overflow: hidden;background: #fff;width: 100%;height:100%;position: absolute;top: 0;">
  69. <div class="container">
  70. <!-- 导航 -->
  71. <div class="nav-header">
  72. <a href="https://www.tianditu.gov.cn/" class="logo"
  73. ><img class="logo-image" src="../img/tianditu/tianditu.png" /></a>
  74. <ul class="imagesLink">
  75. <li><a href="https://www.tianditu.gov.cn/" target="_blank">首页</a></li>
  76. <li><a href="https://zhfw.tianditu.gov.cn/" target="_blank">专题图层</a></li>
  77. <li><a href="http://lbs.tianditu.gov.cn/" target="_blank">开发资源</a></li>
  78. <li><a href="https://app.tianditu.gov.cn/" target="_blank">典型应用</a></li>
  79. <li><a href="https://service.tianditu.gov.cn/" target="_blank">服务资源</a></li>
  80. <li><a href="http://yjfw.tianditu.gov.cn/" target="_blank">应急服务</a></li>
  81. </ul>
  82. </div>
  83. <!-- 天地图及其子组件 -->
  84. <div id="main">
  85. <sm-web-map :map-options="mapOptions">
  86. <!-- 天地图路线查询组件: sm-tdt-route
  87. 天地图搜索组件:sm-tdt-search
  88. 天地图切换组件:sm-tdt-map-switcher-->
  89. <sm-tdt-route position="top-right" :data="{tk:tk}" :collapsed="true"></sm-tdt-route>
  90. <sm-tdt-search position="top-right" :data="{tk:tk}" :collapsed="true"></sm-tdt-search>
  91. <sm-tdt-map-switcher position="top-right" :data="{tk:tk}" :collapsed="true"></sm-tdt-map-switcher>
  92. </sm-web-map>
  93. </div>
  94. </div>
  95. <script>
  96. new Vue({
  97. el: '#main',
  98. data() {
  99. return {
  100. tk: '1d109683f4d84198e37a38c442d68311',
  101. mapOptions: {
  102. center: [126.64318, 45.74141],
  103. zoom: 11,
  104. style: {
  105. version: 8,
  106. sources: {
  107. baseLayer: {
  108. type: 'raster',
  109. tiles: [
  110. 'https://t0.tianditu.gov.cn/img_w/wmts?tk=1d109683f4d84198e37a38c442d68311&service=WMTS&request=GetTile&version=1.0.0&style=default&tilematrixSet=w&format=tiles&width=256&height=256&layer=img&tilematrix={z}&tilerow={y}&tilecol={x}',
  111. ],
  112. tileSize: 256
  113. },
  114. labelLayer: {
  115. type: 'raster',
  116. tiles: [
  117. 'https://t0.tianditu.gov.cn/cia_w/wmts?tk=1d109683f4d84198e37a38c442d68311&service=WMTS&request=GetTile&version=1.0.0&style=default&tilematrixSet=w&format=tiles&width=256&height=256&layer=cia&tilematrix={z}&tilerow={y}&tilecol={x}',
  118. ],
  119. tileSize: 256
  120. }
  121. },
  122. layers: [
  123. {
  124. id: 'baseLayer',
  125. type: 'raster',
  126. source: 'baseLayer',
  127. minzoom: 0,
  128. maxzoom: 18
  129. },
  130. {
  131. id: 'labelLayer',
  132. type: 'raster',
  133. source: 'labelLayer',
  134. minzoom: 0,
  135. maxzoom: 18
  136. }
  137. ]
  138. },
  139. renderWorldCopies: false
  140. }
  141. };
  142. }
  143. });
  144. </script>
  145. </body>
  146. </html>