Browse Source

지도 검색 문법 에러 수정

pull/2/head
김장현 2 years ago
parent
commit
896cd88753
  1. 69
      src/components/basis/flight/plan/FlightPlanAreaMap.js

69
src/components/basis/flight/plan/FlightPlanAreaMap.js

@ -1,6 +1,17 @@
import React, { useEffect, useState } from 'react';
import { Card, CardBody, Button, Input, Row, Col, InputGroup, InputGroupAddon, InputGroupText, FormGroup } from 'reactstrap';
import { Search } from 'react-feather'
import {
Card,
CardBody,
Button,
Input,
Row,
Col,
InputGroup,
InputGroupAddon,
InputGroupText,
FormGroup
} from 'reactstrap';
import { Key, Search } from 'react-feather';
import { useDispatch, useSelector } from 'react-redux';
import { FeatureAirZone } from '../../../map/naver/feature/FeatureAirZone';
import {
@ -146,7 +157,7 @@ const FlightPlanAreaMap = props => {
};
const handleSearch = async () => {
const res = await flightPlanAPI.searchArea({query: query});
const res = await flightPlanAPI.searchArea({ query: query });
setIsSearch(true);
setSearchRes(res.data.items);
};
@ -160,17 +171,19 @@ const FlightPlanAreaMap = props => {
};
const handleCoord = (mapx, mapy) => {
let utmk = naver.maps.TransCoord.fromTM128ToUTMK(naver.maps.Point(mapx, mapy));
let utmk = naver.maps.TransCoord.fromTM128ToUTMK(
naver.maps.Point(mapx, mapy)
);
let latlng = naver.maps.TransCoord.fromUTMKToLatLng(utmk);
setIsSearch(false);
let options = {
duration: 800,
easing: 'easeOutCubic'
}
map.morph(latlng, 16, options)
}
};
map.morph(latlng, 16, options);
};
const handleEnter = e => {
if (e.key == 'Enter') {
@ -209,10 +222,7 @@ const FlightPlanAreaMap = props => {
<InputGroup className='search-feather'>
<InputGroupAddon addonType='prepend'>
<InputGroupText>
<Search
size={14}
onClick={handleSearch}
/>
<Search size={14} onClick={handleSearch} />
</InputGroupText>
</InputGroupAddon>
<Input
@ -220,7 +230,7 @@ const FlightPlanAreaMap = props => {
id='searchInput'
name='searchInput'
bsSize='sm'
autocomplete='off'
autoComplete='off'
placeholder='검색명을 입력하세요.'
onChange={handleChange}
onKeyPress={handleEnter}
@ -228,15 +238,16 @@ const FlightPlanAreaMap = props => {
</InputGroup>
<div className='search-result-comp'>
<ul>
{searchRes?.length!=0 && isSearch? (
searchRes?.map((prev, idx) => {
let title = prev.title.replaceAll('<b>','');
title = title.replaceAll('</b>','');
return (
<>
<li onClick={() => handleCoord(prev.mapx, prev.mapy)}>
{searchRes?.length !== 0 && isSearch ? (
searchRes?.map((prev, idx) => {
let title = prev.title.replaceAll('<b>', '');
title = title.replaceAll('</b>', '');
return (
<li
key={prev.address}
onClick={() => handleCoord(prev.mapx, prev.mapy)}
>
<a>
<div className='search-result'>
<div className='title'>
@ -251,13 +262,11 @@ const FlightPlanAreaMap = props => {
</div>
</a>
</li>
</>
)
})
):(
<></>
)}
);
})
) : (
<></>
)}
</ul>
</div>
</div>
@ -282,8 +291,6 @@ const FlightPlanAreaMap = props => {
검색
</Button.Ripple>
</div> */}
</div>
</div>

Loading…
Cancel
Save