diff --git a/yam-view/src/components/Data/markerData.js b/yam-view/src/components/Data/markerData.js index e50c8fb..d2de912 100644 --- a/yam-view/src/components/Data/markerData.js +++ b/yam-view/src/components/Data/markerData.js @@ -49,8 +49,8 @@ export const dummyData = [ restaurantId: 1, restaurantName: "카페", // 이름 restaurantNumber: "010-1111-1111", // 전화번호 - y_coordinate: 37.62197524055062, // 위도 - x_coordinate: 127.16017523675508, // 경도 + y_coordinate: 37.620842424005616, // 위도 + x_coordinate: 127.1583774403176, // 경도 address: "대전광역시 00구 00동", heart: 3, category: "cafe", @@ -68,8 +68,8 @@ export const dummyData = [ restaurantId: 1, restaurantName: "일본집", // 이름 restaurantNumber: "010-1111-1111", // 전화번호 - y_coordinate: 37.62197524055062, // 위도 - x_coordinate: 127.16017523675508, // 경도 + y_coordinate: 37.624915253753194, // 위도 + x_coordinate: 127.15122688059974, // 경도 address: "대전광역시 00구 00동", heart: 3, category: "japan", @@ -87,8 +87,8 @@ export const dummyData = [ restaurantId: 1, restaurantName: "중국집", // 이름 restaurantNumber: "010-1111-1111", // 전화번호 - y_coordinate: 37.62197524055062, // 위도 - x_coordinate: 127.16017523675508, // 경도 + y_coordinate: 37.62456273069659, // 위도 + x_coordinate: 127.15211256646381, // 경도 address: "대전광역시 00구 00동", heart: 3, category: "china", diff --git a/yam-view/src/pages/WebView.js b/yam-view/src/pages/WebView.js index 68c4348..21bdb6c 100644 --- a/yam-view/src/pages/WebView.js +++ b/yam-view/src/pages/WebView.js @@ -4,6 +4,7 @@ import { dummyData, markerdata } from "../components/Data/markerData"; import "./WebView.css"; import $ from "jquery"; import { filterTag } from "../utils/filterTag"; +import { findCategoryEtoK, findCategoryKtoE } from "../utils/findCategory"; const { kakao } = window; @@ -41,7 +42,11 @@ const requestPermission = () => { DATE_CREATED: Date(), */ const WebView = () => { - const [result, setResult] = useState({}); + const [result, setResult] = useState({ + tagList: "", + openTime: "", + dist: "", + }); /** react native 환경에서만 가능 */ const onMessageHandler = (e) => { @@ -128,16 +133,23 @@ const WebView = () => { var zoomControl = new kakao.maps.ZoomControl(); map.addControl(zoomControl, kakao.maps.ControlPosition.BOTTOMLEFT); + let data; // 음식점 data map if (result.tagList) { - let filterData = filterTag(dummyData, result.tagList.split(",")); - console.log(filterData); + let categoryList = result.tagList + .split(",") + .map((el) => findCategoryKtoE(el)); + let filterData = filterTag(dummyData, categoryList); + + data = [...filterData]; + } else { + data = [...dummyData]; } - markerdata.map((el, index) => { + data.map((el, index) => { var markerPosition = new kakao.maps.LatLng( - el.Y_COORDINATE, - el.X_COORDINATE + el.y_coordinate, + el.x_coordinate ); var marker = createImageMarker( @@ -152,10 +164,10 @@ const WebView = () => {