Showing
6 changed files
with
69 additions
and
7 deletions
... | @@ -431,6 +431,11 @@ | ... | @@ -431,6 +431,11 @@ |
431 | } | 431 | } |
432 | } | 432 | } |
433 | }, | 433 | }, |
434 | + "jquery": { | ||
435 | + "version": "3.6.0", | ||
436 | + "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.6.0.tgz", | ||
437 | + "integrity": "sha512-JVzAR/AjBvVt2BmYhxRCSYysDsPcssdmTFnzyLEts9qNwmjmu4JTAMYubEfwVOSwpQ1I1sKKFcxhZCI2buerfw==" | ||
438 | + }, | ||
434 | "js-tokens": { | 439 | "js-tokens": { |
435 | "version": "4.0.0", | 440 | "version": "4.0.0", |
436 | "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", | 441 | "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", | ... | ... |
... | @@ -5,7 +5,7 @@ | ... | @@ -5,7 +5,7 @@ |
5 | "scripts": { | 5 | "scripts": { |
6 | "build": "rollup -c", | 6 | "build": "rollup -c", |
7 | "dev": "rollup -c -w", | 7 | "dev": "rollup -c -w", |
8 | - "start": "sirv public --no-clear" | 8 | + "start": "sirv public --no-clear --host 0.0.0.0" |
9 | }, | 9 | }, |
10 | "devDependencies": { | 10 | "devDependencies": { |
11 | "@rollup/plugin-commonjs": "^17.0.0", | 11 | "@rollup/plugin-commonjs": "^17.0.0", |
... | @@ -19,6 +19,7 @@ | ... | @@ -19,6 +19,7 @@ |
19 | }, | 19 | }, |
20 | "dependencies": { | 20 | "dependencies": { |
21 | "engine.io-parser": "^5.0.1", | 21 | "engine.io-parser": "^5.0.1", |
22 | + "jquery": "^3.6.0", | ||
22 | "sirv-cli": "^1.0.0" | 23 | "sirv-cli": "^1.0.0" |
23 | } | 24 | } |
24 | } | 25 | } | ... | ... |
... | @@ -10,6 +10,7 @@ | ... | @@ -10,6 +10,7 @@ |
10 | <link rel='stylesheet' href='/global.css'> | 10 | <link rel='stylesheet' href='/global.css'> |
11 | <link rel='stylesheet' href='/build/bundle.css'> | 11 | <link rel='stylesheet' href='/build/bundle.css'> |
12 | 12 | ||
13 | + <script type="text/javascript" src="//dapi.kakao.com/v2/maps/sdk.js?appkey=046d27f1430524731d3ec6870f0c8923"></script> | ||
13 | <script defer src='/build/bundle.js'></script> | 14 | <script defer src='/build/bundle.js'></script> |
14 | </head> | 15 | </head> |
15 | 16 | ... | ... |
1 | <style> | 1 | <style> |
2 | - #chat_bg { | 2 | + #map_bg { |
3 | box-sizing: border-box; | 3 | box-sizing: border-box; |
4 | + justify-content: center; | ||
4 | display: flex; | 5 | display: flex; |
5 | height: 100vh; | 6 | height: 100vh; |
6 | background-color:#edeff2; | 7 | background-color:#edeff2; |
7 | } | 8 | } |
9 | + | ||
10 | + #map { | ||
11 | + box-sizing: border-box; | ||
12 | + display: flex; | ||
13 | + height: 90vh; | ||
14 | + width: 80vw; | ||
15 | + background-color:#edeff2; | ||
16 | + } | ||
8 | </style> | 17 | </style> |
9 | 18 | ||
10 | <script> | 19 | <script> |
20 | + import jQuery from 'jquery'; | ||
11 | 21 | ||
12 | -</script> | 22 | + var url = "http://api.visitkorea.or.kr/openapi/service/rest/KorService/areaBasedList?ServiceKey=2lFkvQJYgzOOhwUKiUt8aZVNpd1PpBOf%2FfMNW17cl25DE0GUEDddeR9iGnuSUpggjUoIUgamfhcvnKQ3eH1dAw%3D%3D&contentTypeId=15&areaCode=&sigunguCode=&cat1=&cat2=&cat3=&listYN=Y&MobileOS=ETC&MobileApp=TourAPI3.0_Guide&arrange=A&numOfRows=12&pageNo=1&_type=json"; |
23 | + var {kakao} = window; | ||
24 | + | ||
25 | + var url = "http://api.visitkorea.or.kr/openapi/service/rest/KorService/areaBasedList?ServiceKey=2lFkvQJYgzOOhwUKiUt8aZVNpd1PpBOf%2FfMNW17cl25DE0GUEDddeR9iGnuSUpggjUoIUgamfhcvnKQ3eH1dAw%3D%3D&contentTypeId=15&areaCode=&sigunguCode=&cat1=&cat2=&cat3=&listYN=Y&MobileOS=ETC&MobileApp=TourAPI3.0_Guide&arrange=A&numOfRows=12&pageNo=1&_type=json"; | ||
26 | + jQuery.getJSON(url,function(data){ | ||
27 | + console.log(data); | ||
28 | + var mapContainer = document.getElementById('map'), // 지도를 표시할 div | ||
29 | + mapOption = { | ||
30 | + center: new kakao.maps.LatLng(36.46682, 127.37865), // 지도의 중심좌표 | ||
31 | + level: 12, // 지도의 확대 레벨 | ||
32 | + mapTypeId : kakao.maps.MapTypeId.ROADMAP // 지도종류 | ||
33 | + }; | ||
34 | + | ||
35 | + var markers= []; | ||
36 | + // 지도를 생성한다 | ||
37 | + var map = new kakao.maps.Map(mapContainer, mapOption); | ||
38 | + for(var i = 0; i<data.response.body.items.item.length;i++){ | ||
39 | + // 지도에 마커를 생성하고 표시한다 | ||
40 | + var marker = new kakao.maps.Marker({ | ||
41 | + position: new kakao.maps.LatLng(data.response.body.items.item[i].mapy, data.response.body.items.item[i].mapx), // 마커의 좌표 | ||
42 | + map: map // 마커를 표시할 지도 객체 | ||
43 | + }); | ||
44 | + markers.push(marker); | ||
45 | + // 마커 위에 표시할 인포윈도우를 생성한다 | ||
13 | 46 | ||
14 | -<div id="chat_bg"> | 47 | + }; |
48 | + | ||
49 | + for(var i = 0; i<9;i++) { // 왜 9까지 밖에 안되누 ㅠㅠ | ||
50 | + var infowindow = new kakao.maps.InfoWindow({ | ||
51 | + content : '<div style="padding:5px;">'+data.response.body.items.item[i].title+'</div>' // 인포윈도우에 표시할 내용 | ||
52 | + }); | ||
53 | + infowindow.open(map, markers[i]); | ||
54 | + } | ||
55 | + | ||
56 | + // 마우스 휠과 모바일 터치를 이용한 지도 확대, 축소를 막는다 | ||
57 | + map.setZoomable(false); | ||
58 | + | ||
59 | + // 지도에 확대 축소 컨트롤을 생성한다 | ||
60 | + var zoomControl = new kakao.maps.ZoomControl(); | ||
61 | + | ||
62 | + // 지도의 우측에 확대 축소 컨트롤을 추가한다 | ||
63 | + map.addControl(zoomControl, kakao.maps.ControlPosition.RIGHT); | ||
64 | + | ||
65 | + }); | ||
66 | +</script> | ||
15 | 67 | ||
68 | +<div id="map_bg"> | ||
69 | + <div id="map"></div> | ||
16 | </div> | 70 | </div> | ... | ... |
... | @@ -12,7 +12,7 @@ | ... | @@ -12,7 +12,7 @@ |
12 | 12 | ||
13 | <style> | 13 | <style> |
14 | nav { | 14 | nav { |
15 | - background-color: rgb(225, 175, 85); | 15 | + background-color: #4527a0; |
16 | font-family: "Helvetica Neue", "Helvetica", "Arial", sans-serif; | 16 | font-family: "Helvetica Neue", "Helvetica", "Arial", sans-serif; |
17 | height: 70px; | 17 | height: 70px; |
18 | top: 0; | 18 | top: 0; |
... | @@ -32,6 +32,7 @@ | ... | @@ -32,6 +32,7 @@ |
32 | .logo { | 32 | .logo { |
33 | display: flex; | 33 | display: flex; |
34 | position: absolute; | 34 | position: absolute; |
35 | + color: white; | ||
35 | width: 50px; | 36 | width: 50px; |
36 | left: 40px; | 37 | left: 40px; |
37 | top: 25px | 38 | top: 25px | ... | ... |
... | @@ -8,7 +8,7 @@ | ... | @@ -8,7 +8,7 @@ |
8 | <body> | 8 | <body> |
9 | <div id="map" style="width:100%;height:100vh;"></div> | 9 | <div id="map" style="width:100%;height:100vh;"></div> |
10 | 10 | ||
11 | - <script src="https://dapi.kakao.com/v2/maps/sdk.js?appkey=9bb9a71480b6cd2d7fa98fb256053acf"></script> | 11 | + <script src="https://dapi.kakao.com/v2/maps/sdk.js?appkey=046d27f1430524731d3ec6870f0c8923"></script> |
12 | <script> | 12 | <script> |
13 | 13 | ||
14 | var url = "http://api.visitkorea.or.kr/openapi/service/rest/KorService/areaBasedList?ServiceKey=2lFkvQJYgzOOhwUKiUt8aZVNpd1PpBOf%2FfMNW17cl25DE0GUEDddeR9iGnuSUpggjUoIUgamfhcvnKQ3eH1dAw%3D%3D&contentTypeId=15&areaCode=&sigunguCode=&cat1=&cat2=&cat3=&listYN=Y&MobileOS=ETC&MobileApp=TourAPI3.0_Guide&arrange=A&numOfRows=12&pageNo=1&_type=json"; | 14 | var url = "http://api.visitkorea.or.kr/openapi/service/rest/KorService/areaBasedList?ServiceKey=2lFkvQJYgzOOhwUKiUt8aZVNpd1PpBOf%2FfMNW17cl25DE0GUEDddeR9iGnuSUpggjUoIUgamfhcvnKQ3eH1dAw%3D%3D&contentTypeId=15&areaCode=&sigunguCode=&cat1=&cat2=&cat3=&listYN=Y&MobileOS=ETC&MobileApp=TourAPI3.0_Guide&arrange=A&numOfRows=12&pageNo=1&_type=json"; |
... | @@ -17,7 +17,7 @@ | ... | @@ -17,7 +17,7 @@ |
17 | var mapContainer = document.getElementById('map'), // 지도를 표시할 div | 17 | var mapContainer = document.getElementById('map'), // 지도를 표시할 div |
18 | mapOption = { | 18 | mapOption = { |
19 | center: new kakao.maps.LatLng(37.56682, 126.97865), // 지도의 중심좌표 | 19 | center: new kakao.maps.LatLng(37.56682, 126.97865), // 지도의 중심좌표 |
20 | - level: 10, // 지도의 확대 레벨 | 20 | + level: 12, // 지도의 확대 레벨 |
21 | mapTypeId : kakao.maps.MapTypeId.ROADMAP // 지도종류 | 21 | mapTypeId : kakao.maps.MapTypeId.ROADMAP // 지도종류 |
22 | }; | 22 | }; |
23 | 23 | ... | ... |
-
Please register or login to post a comment