Showing
18 changed files
with
126 additions
and
117 deletions
... | @@ -5,6 +5,10 @@ | ... | @@ -5,6 +5,10 @@ |
5 | # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm | 5 | # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm |
6 | # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 | 6 | # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 |
7 | 7 | ||
8 | +build | ||
9 | +build/ | ||
10 | +.idea | ||
11 | + | ||
8 | # User-specific stuff | 12 | # User-specific stuff |
9 | .idea | 13 | .idea |
10 | .idea/**/workspace.xml | 14 | .idea/**/workspace.xml | ... | ... |
... | @@ -1377,7 +1377,7 @@ body > .navbar-collapse[data-color="purple"]:after { | ... | @@ -1377,7 +1377,7 @@ body > .navbar-collapse[data-color="purple"]:after { |
1377 | .navbar .btn-simple { | 1377 | .navbar .btn-simple { |
1378 | font-size: 16px; } | 1378 | font-size: 16px; } |
1379 | .navbar.fixed { | 1379 | .navbar.fixed { |
1380 | - width: calc(100% - $sidebar-width); | 1380 | + width: calc(100% - #{$sidebar-width}); |
1381 | right: 0; | 1381 | right: 0; |
1382 | left: auto; | 1382 | left: auto; |
1383 | border-radius: 0; } | 1383 | border-radius: 0; } | ... | ... |
This diff could not be displayed because it is too large.
... | @@ -22,7 +22,7 @@ export class Card extends Component { | ... | @@ -22,7 +22,7 @@ export class Card extends Component { |
22 | return ( | 22 | return ( |
23 | <div className={"card" + (this.props.plain ? " card-plain" : "")}> | 23 | <div className={"card" + (this.props.plain ? " card-plain" : "")}> |
24 | <div className={"header" + (this.props.hCenter ? " text-center" : "")}> | 24 | <div className={"header" + (this.props.hCenter ? " text-center" : "")}> |
25 | - <h4 className="title">{this.props.title}</h4> | 25 | + <h4 className="title" style={{fontWeight: 400}}>{this.props.title}</h4> |
26 | <p className="category">{this.props.category}</p> | 26 | <p className="category">{this.props.category}</p> |
27 | </div> | 27 | </div> |
28 | <div | 28 | <div | ... | ... |
... | @@ -26,25 +26,18 @@ class Footer extends Component { | ... | @@ -26,25 +26,18 @@ class Footer extends Component { |
26 | <nav className="pull-left"> | 26 | <nav className="pull-left"> |
27 | <ul> | 27 | <ul> |
28 | <li> | 28 | <li> |
29 | - <a href="#pablo">Home</a> | 29 | + <a href="http://mate.ryulth.com/admin/kickboard">Home</a> |
30 | </li> | 30 | </li> |
31 | <li> | 31 | <li> |
32 | - <a href="#pablo">Company</a> | 32 | + <a href="http://mate.ryulth.com/admin/kickboard">Company</a> |
33 | - </li> | ||
34 | - <li> | ||
35 | - <a href="#pablo">Portfolio</a> | ||
36 | - </li> | ||
37 | - <li> | ||
38 | - <a href="#pablo">Blog</a> | ||
39 | </li> | 33 | </li> |
40 | </ul> | 34 | </ul> |
41 | </nav> | 35 | </nav> |
42 | <p className="copyright pull-right"> | 36 | <p className="copyright pull-right"> |
43 | © {new Date().getFullYear()}{" "} | 37 | © {new Date().getFullYear()}{" "} |
44 | - <a href="http://www.creative-tim.com?ref=lbr-footer"> | 38 | + <a href="#"> |
45 | - Creative Tim | 39 | + Wico |
46 | </a> | 40 | </a> |
47 | - , made with love for a better web | ||
48 | </p> | 41 | </p> |
49 | </Grid> | 42 | </Grid> |
50 | </footer> | 43 | </footer> | ... | ... |
... | @@ -6,22 +6,6 @@ let map; | ... | @@ -6,22 +6,6 @@ let map; |
6 | let markers = []; | 6 | let markers = []; |
7 | let infoWindow; | 7 | let infoWindow; |
8 | 8 | ||
9 | -const getGroupUrlStringByGroup = group => { | ||
10 | - if (group === "renting") { | ||
11 | - // 사용중 | ||
12 | - return "_inuse"; | ||
13 | - } else if (group === "ready") { | ||
14 | - // 대기중 | ||
15 | - return ""; | ||
16 | - } else if (group === "target") { | ||
17 | - // 수거대상 | ||
18 | - return "_pickup"; | ||
19 | - } else if (group === "collect") { | ||
20 | - // 수거 | ||
21 | - return "_deactive"; | ||
22 | - } | ||
23 | -}; | ||
24 | - | ||
25 | const getBatteryUrlStringByBattery = battery => { | 9 | const getBatteryUrlStringByBattery = battery => { |
26 | if (battery >= 0 && battery < 25) { | 10 | if (battery >= 0 && battery < 25) { |
27 | return "0-25"; | 11 | return "0-25"; |
... | @@ -47,7 +31,7 @@ class GoogleMap extends React.Component { | ... | @@ -47,7 +31,7 @@ class GoogleMap extends React.Component { |
47 | // .then(d => { | 31 | // .then(d => { |
48 | // if(!d.success || !d.data.length) return; | 32 | // if(!d.success || !d.data.length) return; |
49 | // | 33 | // |
50 | - // console.log(d.data) | 34 | + // // console.log(d.data) |
51 | // this.setState({ | 35 | // this.setState({ |
52 | // kickboards: d.data | 36 | // kickboards: d.data |
53 | // }) | 37 | // }) |
... | @@ -79,7 +63,7 @@ class GoogleMap extends React.Component { | ... | @@ -79,7 +63,7 @@ class GoogleMap extends React.Component { |
79 | infoWindow = new window.google.maps.InfoWindow({}); | 63 | infoWindow = new window.google.maps.InfoWindow({}); |
80 | 64 | ||
81 | map = new google.maps.Map(document.getElementById("map"), { | 65 | map = new google.maps.Map(document.getElementById("map"), { |
82 | - zoom: 11, | 66 | + zoom: 8, |
83 | center: {lat: -34.397, lng: 150.644}, | 67 | center: {lat: -34.397, lng: 150.644}, |
84 | disableDefaultUI: true, | 68 | disableDefaultUI: true, |
85 | zoomControl: true | 69 | zoomControl: true |
... | @@ -109,20 +93,21 @@ class GoogleMap extends React.Component { | ... | @@ -109,20 +93,21 @@ class GoogleMap extends React.Component { |
109 | } | 93 | } |
110 | 94 | ||
111 | drawMarkers() { | 95 | drawMarkers() { |
112 | - if (map == null) return; | 96 | + if (map === null) return; |
113 | - const selectedMarker = new window.google.maps.Marker({}); | 97 | + // const selectedMarker = new window.google.maps.Marker({}); |
114 | 98 | ||
115 | markers = this.state.kickboards.map(item => { | 99 | markers = this.state.kickboards.map(item => { |
100 | + | ||
116 | const marker = new window.google.maps.Marker({ | 101 | const marker = new window.google.maps.Marker({ |
117 | position: new window.google.maps.LatLng({ | 102 | position: new window.google.maps.LatLng({ |
118 | - lat: item.coordinates.lat, | 103 | + lat: item.coordinates.y, |
119 | - lng: item.coordinates.lon | 104 | + lng: item.coordinates.x |
120 | }) | 105 | }) |
121 | }); | 106 | }); |
122 | 107 | ||
123 | const markerContent = ` | 108 | const markerContent = ` |
124 | <div> | 109 | <div> |
125 | - <div style="color:black"> 시리얼번호: ${item.serialNumber} </div> | 110 | + <div style="color:black"> 시리얼번호: ${item.serial_number} </div> |
126 | </div> | 111 | </div> |
127 | `; | 112 | `; |
128 | 113 | ||
... | @@ -134,14 +119,18 @@ class GoogleMap extends React.Component { | ... | @@ -134,14 +119,18 @@ class GoogleMap extends React.Component { |
134 | infoWindow.close(); | 119 | infoWindow.close(); |
135 | infoWindow.setContent(markerContent); | 120 | infoWindow.setContent(markerContent); |
136 | infoWindow.open(map, marker); | 121 | infoWindow.open(map, marker); |
137 | - this.props.setKbId(item.serialNumber); | 122 | + this.props.setKbId(item.serial_number); |
138 | }); | 123 | }); |
139 | 124 | ||
140 | window.google.maps.event.addListener(marker, "mouseover", () => { | 125 | window.google.maps.event.addListener(marker, "mouseover", () => { |
126 | + infoWindow.close(); | ||
127 | + infoWindow.setContent(markerContent); | ||
128 | + infoWindow.open(map, marker); | ||
141 | this.highlightMarker(marker); | 129 | this.highlightMarker(marker); |
142 | }); | 130 | }); |
143 | 131 | ||
144 | window.google.maps.event.addListener(marker, "mouseout", () => { | 132 | window.google.maps.event.addListener(marker, "mouseout", () => { |
133 | + infoWindow.close(); | ||
145 | this.renderMarker(marker); | 134 | this.renderMarker(marker); |
146 | }); | 135 | }); |
147 | 136 | ||
... | @@ -151,31 +140,59 @@ class GoogleMap extends React.Component { | ... | @@ -151,31 +140,59 @@ class GoogleMap extends React.Component { |
151 | } | 140 | } |
152 | 141 | ||
153 | renderMarker(marker) { | 142 | renderMarker(marker) { |
154 | - const { group, battery } = marker.item; | 143 | + const { battery } = marker.item; |
155 | - | ||
156 | - const groupString = getGroupUrlStringByGroup(group); | ||
157 | const batteryString = getBatteryUrlStringByBattery(battery); | 144 | const batteryString = getBatteryUrlStringByBattery(battery); |
158 | 145 | ||
159 | - const iconUrl = require(`../../assets/marker/ic_map_pin_battery${batteryString}${groupString}.png`); | 146 | + const iconUrl = require(`../../assets/marker/ic_map_pin_battery${batteryString}.png`); |
160 | marker.setIcon(iconUrl); | 147 | marker.setIcon(iconUrl); |
161 | } | 148 | } |
162 | 149 | ||
163 | - | ||
164 | highlightMarker(marker) { | 150 | highlightMarker(marker) { |
165 | - const { group, battery } = marker.item; | 151 | + const { battery } = marker.item; |
166 | - | ||
167 | - const groupString = getGroupUrlStringByGroup(group); | ||
168 | const batteryString = getBatteryUrlStringByBattery(battery); | 152 | const batteryString = getBatteryUrlStringByBattery(battery); |
169 | 153 | ||
170 | - const iconUrl = require(`../../assets/marker/ic_map_pin_battery${batteryString}${groupString}_selected.png`); | 154 | + const iconUrl = require(`../../assets/marker/ic_map_pin_battery${batteryString}_selected.png`); |
171 | marker.setIcon(iconUrl); | 155 | marker.setIcon(iconUrl); |
172 | } | 156 | } |
173 | 157 | ||
158 | + moveToMarker(kbId) { | ||
159 | + if (map == null || markers.length === 0) { | ||
160 | + return; | ||
161 | + } | ||
162 | + | ||
163 | + const searchedMarker = markers.find( | ||
164 | + marker => marker.item.serial_number === kbId | ||
165 | + ); | ||
166 | + | ||
167 | + if(!searchedMarker) return; | ||
168 | + const markerContent = ` | ||
169 | + <div> | ||
170 | + <div style="color:black"> 시리얼번호: ${kbId} </div> | ||
171 | + </div> | ||
172 | + `; | ||
173 | + | ||
174 | + infoWindow.close(); | ||
175 | + infoWindow.setContent(markerContent); | ||
176 | + infoWindow.open(map, searchedMarker); | ||
177 | + | ||
178 | + map.setCenter( | ||
179 | + new window.google.maps.LatLng({ | ||
180 | + lat: searchedMarker.item.coordinates.y, | ||
181 | + lng: searchedMarker.item.coordinates.x | ||
182 | + }) | ||
183 | + ); | ||
184 | + map.setZoom(14); | ||
185 | + } | ||
186 | + | ||
187 | + componentDidUpdate(prevProps, prevState, snapshot) { | ||
188 | + this.moveToMarker(this.props.kbId); | ||
189 | + } | ||
190 | + | ||
174 | render() { | 191 | render() { |
175 | this.drawMarkers(); | 192 | this.drawMarkers(); |
176 | 193 | ||
177 | return ( | 194 | return ( |
178 | - <div id="map" style={{height:this.props.containerWidth, backgroundColor:'pink'}}> | 195 | + <div id="map" style={{height:this.props.containerWidth}}> |
179 | </div> | 196 | </div> |
180 | ) | 197 | ) |
181 | } | 198 | } | ... | ... |
... | @@ -3,6 +3,7 @@ import { Card } from "components/Card/Card.jsx"; | ... | @@ -3,6 +3,7 @@ import { Card } from "components/Card/Card.jsx"; |
3 | import Dimensions from 'react-dimensions' | 3 | import Dimensions from 'react-dimensions' |
4 | import moment from 'moment'; | 4 | import moment from 'moment'; |
5 | import GoogleMap from './GoogleMap'; | 5 | import GoogleMap from './GoogleMap'; |
6 | +import KickboardStatusCard from "./KickboardStatusCard"; | ||
6 | 7 | ||
7 | const GoogleMapCard = (props) => { | 8 | const GoogleMapCard = (props) => { |
8 | const getStats = `마지막 업데이트 ${moment().format("YYYY/MM/DD hh:mm")}`; | 9 | const getStats = `마지막 업데이트 ${moment().format("YYYY/MM/DD hh:mm")}`; |
... | @@ -11,11 +12,10 @@ const GoogleMapCard = (props) => { | ... | @@ -11,11 +12,10 @@ const GoogleMapCard = (props) => { |
11 | <Card | 12 | <Card |
12 | id="chartActivity" | 13 | id="chartActivity" |
13 | title="서비스 현황" | 14 | title="서비스 현황" |
14 | - category="All products including Taxes" | ||
15 | stats={getStats} | 15 | stats={getStats} |
16 | statsIcon="fa fa-history" | 16 | statsIcon="fa fa-history" |
17 | content={ | 17 | content={ |
18 | - <GoogleMap setKbId={props.setKbId}/> | 18 | + <GoogleMap kbId={props.kbId} setKbId={props.setKbId}/> |
19 | } | 19 | } |
20 | /> | 20 | /> |
21 | ); | 21 | ); | ... | ... |
1 | import React from "react"; | 1 | import React from "react"; |
2 | import {Table} from "react-bootstrap"; | 2 | import {Table} from "react-bootstrap"; |
3 | import { Card } from "components/Card/Card.jsx"; | 3 | import { Card } from "components/Card/Card.jsx"; |
4 | -import { tdArray } from "variables/Variables.jsx"; | 4 | +import styled from "styled-components"; |
5 | + | ||
6 | +const A = styled.a` | ||
7 | + color: #333; | ||
8 | + text-decoration: underline; | ||
9 | + font-weight: 500; | ||
10 | +`; | ||
5 | 11 | ||
6 | const UserDataKey = { | 12 | const UserDataKey = { |
7 | user_id: '유저ID', | 13 | user_id: '유저ID', |
... | @@ -25,7 +31,7 @@ const KickboardHistoryTable = (props) => { | ... | @@ -25,7 +31,7 @@ const KickboardHistoryTable = (props) => { |
25 | 31 | ||
26 | return ( | 32 | return ( |
27 | <Card | 33 | <Card |
28 | - title={`${kbId}번 킥보드 사용자 히스토리`} | 34 | + title={`${kbId}번 킥보드 사용자 대여 히스토리`} |
29 | ctTableFullWidth | 35 | ctTableFullWidth |
30 | ctTableResponsive | 36 | ctTableResponsive |
31 | content={ | 37 | content={ |
... | @@ -40,10 +46,11 @@ const KickboardHistoryTable = (props) => { | ... | @@ -40,10 +46,11 @@ const KickboardHistoryTable = (props) => { |
40 | <tbody> | 46 | <tbody> |
41 | {historyData.map((data, idx) => { | 47 | {historyData.map((data, idx) => { |
42 | const {user_id, rent_datetime, return_datetime, rental_time, rental_distance, rental_fee} = data; | 48 | const {user_id, rent_datetime, return_datetime, rental_time, rental_distance, rental_fee} = data; |
49 | + const userHistoryUrl = `http://mate.ryulth.com/admin/user/?userId=${user_id}`; | ||
43 | 50 | ||
44 | return ( | 51 | return ( |
45 | <tr key={idx}> | 52 | <tr key={idx}> |
46 | - <td>{user_id}</td> | 53 | + <td><A href={userHistoryUrl}>{user_id}</A></td> |
47 | <td>{timestampToString(rent_datetime)}</td> | 54 | <td>{timestampToString(rent_datetime)}</td> |
48 | <td>{timestampToString(return_datetime)}</td> | 55 | <td>{timestampToString(return_datetime)}</td> |
49 | <td>{rental_time}분</td> | 56 | <td>{rental_time}분</td> | ... | ... |
... | @@ -35,11 +35,12 @@ const SearchButton = (props) => { | ... | @@ -35,11 +35,12 @@ const SearchButton = (props) => { |
35 | const inputEl = useRef(null); | 35 | const inputEl = useRef(null); |
36 | 36 | ||
37 | const searchKickboard = (e) => { | 37 | const searchKickboard = (e) => { |
38 | - const searchText = e.target.value; | 38 | + const searchText = inputEl.current.value; |
39 | + | ||
39 | fetch(`http://1.201.143.67:5901/kickboard/${searchText}`) | 40 | fetch(`http://1.201.143.67:5901/kickboard/${searchText}`) |
40 | .then(r => r.json()) | 41 | .then(r => r.json()) |
41 | .then(d => { | 42 | .then(d => { |
42 | - if(d.success && d.data.length) setKbId(); | 43 | + if(d.success && d.data.length) setKbId(searchText); |
43 | else window.alert('해당 번호의 킥보드가 존재하지 않습니다!') | 44 | else window.alert('해당 번호의 킥보드가 존재하지 않습니다!') |
44 | }) | 45 | }) |
45 | .catch(err => console.log(err)); | 46 | .catch(err => console.log(err)); | ... | ... |
1 | -const res = ` | 1 | +// const res = ` |
2 | -{"success":true,"data":[{"serialNumber":"000000","battery":0,"dailyDrivenDistance":0,"dailyDrivenTime":0,"coordinates":{"lon":126.885654,"lat":37.480045},"modelName":"MA01","isGoodReception":false,"isGoodPosture":false,"connected":false,"createdAt":"2020-02-13T09:59:22.303Z","group":"target","state":"알 수 없는 오류"},{"serialNumber":"000001","battery":0,"dailyDrivenDistance":0,"dailyDrivenTime":0,"coordinates":{"lon":127.078668,"lat":37.244634},"modelName":"MA01","isGoodReception":false,"isGoodPosture":false,"connected":false,"createdAt":"2020-02-13T09:59:24.316Z","group":"target","state":"알 수 없는 오류"},{"serialNumber":"000002","battery":0,"dailyDrivenDistance":0,"dailyDrivenTime":52257,"coordinates":{"lon":126.886552,"lat":37.479997},"modelName":"MA01","isGoodReception":false,"isGoodPosture":true,"connected":true,"createdAt":"2020-04-16T08:40:51.817Z","group":"ready","state":"대기 중"},{"serialNumber":"000003","battery":78,"dailyDrivenDistance":0,"dailyDrivenTime":0,"coordinates":{"lon":127.05006,"lat":37.545254},"modelName":"MA01","isGoodReception":false,"isGoodPosture":false,"connected":false,"createdAt":"2020-02-04T01:57:45.032Z","group":"collect","state":"수거됨"},{"serialNumber":"000004","battery":0,"dailyDrivenDistance":0,"dailyDrivenTime":0,"coordinates":{"lon":127.078668,"lat":37.244634},"modelName":"MA01","isGoodReception":false,"isGoodPosture":false,"connected":false,"createdAt":"2020-02-13T09:59:26.569Z","group":"target","state":"알 수 없는 오류"},{"serialNumber":"000005","battery":0,"dailyDrivenDistance":0,"dailyDrivenTime":0,"coordinates":{"lon":127.050652,"lat":37.545297},"modelName":"MA01","isGoodReception":false,"isGoodPosture":false,"connected":false,"createdAt":"2020-02-13T15:02:15.601Z","group":"collect","state":"수거됨"},{"serialNumber":"000006","battery":94,"dailyDrivenDistance":0,"dailyDrivenTime":439119,"coordinates":{"lon":126.885743,"lat":37.479925},"modelName":"MA01","isGoodReception":false,"isGoodPosture":false,"connected":true,"createdAt":"2020-02-13T15:02:15.601Z","group":"ready","state":"서비스 종료"},{"serialNumber":"000007","battery":0,"dailyDrivenDistance":0,"dailyDrivenTime":0,"coordinates":{"lon":126.87614,"lat":37.482151},"modelName":"MA01","isGoodReception":false,"isGoodPosture":false,"connected":false,"createdAt":"2020-02-13T15:02:15.601Z","group":"target","state":"알 수 없는 오류"},{"serialNumber":"000008","battery":40,"dailyDrivenDistance":0,"dailyDrivenTime":29,"coordinates":{"lon":127.050652,"lat":37.545297},"modelName":"MA01","isGoodReception":false,"isGoodPosture":false,"connected":true,"createdAt":"2020-02-13T15:02:15.601Z","group":"collect","state":"수거됨"}]}` | 2 | +// {"success":true,"data":[{"serialNumber":"000000","battery":0,"dailyDrivenDistance":0,"dailyDrivenTime":0,"coordinates":{"lon":126.885654,"lat":37.480045},"modelName":"MA01","isGoodReception":false,"isGoodPosture":false,"connected":false,"createdAt":"2020-02-13T09:59:22.303Z","group":"target","state":"알 수 없는 오류"},{"serialNumber":"000001","battery":0,"dailyDrivenDistance":0,"dailyDrivenTime":0,"coordinates":{"lon":127.078668,"lat":37.244634},"modelName":"MA01","isGoodReception":false,"isGoodPosture":false,"connected":false,"createdAt":"2020-02-13T09:59:24.316Z","group":"target","state":"알 수 없는 오류"},{"serialNumber":"000002","battery":0,"dailyDrivenDistance":0,"dailyDrivenTime":52257,"coordinates":{"lon":126.886552,"lat":37.479997},"modelName":"MA01","isGoodReception":false,"isGoodPosture":true,"connected":true,"createdAt":"2020-04-16T08:40:51.817Z","group":"ready","state":"대기 중"},{"serialNumber":"000003","battery":78,"dailyDrivenDistance":0,"dailyDrivenTime":0,"coordinates":{"lon":127.05006,"lat":37.545254},"modelName":"MA01","isGoodReception":false,"isGoodPosture":false,"connected":false,"createdAt":"2020-02-04T01:57:45.032Z","group":"collect","state":"수거됨"},{"serialNumber":"000004","battery":0,"dailyDrivenDistance":0,"dailyDrivenTime":0,"coordinates":{"lon":127.078668,"lat":37.244634},"modelName":"MA01","isGoodReception":false,"isGoodPosture":false,"connected":false,"createdAt":"2020-02-13T09:59:26.569Z","group":"target","state":"알 수 없는 오류"},{"serialNumber":"000005","battery":0,"dailyDrivenDistance":0,"dailyDrivenTime":0,"coordinates":{"lon":127.050652,"lat":37.545297},"modelName":"MA01","isGoodReception":false,"isGoodPosture":false,"connected":false,"createdAt":"2020-02-13T15:02:15.601Z","group":"collect","state":"수거됨"},{"serialNumber":"000006","battery":94,"dailyDrivenDistance":0,"dailyDrivenTime":439119,"coordinates":{"lon":126.885743,"lat":37.479925},"modelName":"MA01","isGoodReception":false,"isGoodPosture":false,"connected":true,"createdAt":"2020-02-13T15:02:15.601Z","group":"ready","state":"서비스 종료"},{"serialNumber":"000007","battery":0,"dailyDrivenDistance":0,"dailyDrivenTime":0,"coordinates":{"lon":126.87614,"lat":37.482151},"modelName":"MA01","isGoodReception":false,"isGoodPosture":false,"connected":false,"createdAt":"2020-02-13T15:02:15.601Z","group":"target","state":"알 수 없는 오류"},{"serialNumber":"000008","battery":40,"dailyDrivenDistance":0,"dailyDrivenTime":29,"coordinates":{"lon":127.050652,"lat":37.545297},"modelName":"MA01","isGoodReception":false,"isGoodPosture":false,"connected":true,"createdAt":"2020-02-13T15:02:15.601Z","group":"collect","state":"수거됨"}]}` |
3 | 3 | ||
4 | +const res = ` | ||
5 | +{"success":true,"data":[{"serial_number":"000237","coordinates":{"x":127.050413,"y":37.546026},"battery":0,"states":"{lowBattery,collect}"},{"serial_number":"000200","coordinates":{"x":127.050413,"y":37.546026},"battery":0,"states":"{lowBattery}"},{"serial_number":"000264","coordinates":{"x":127.050413,"y":37.546026},"battery":35,"states":"{collect}"},{"serial_number":"000302","coordinates":{"x":127.050413,"y":37.546026},"battery":0,"states":"{collect}"},{"serial_number":"000273","coordinates":{"x":127.050413,"y":37.546026},"battery":33,"states":"{}"},{"serial_number":"000274","coordinates":{"x":127.031578,"y":37.520911},"battery":36,"states":"{}"},{"serial_number":"000116","coordinates":{"x":128.68613,"y":35.242142},"battery":96,"states":"{collect}"},{"serial_number":"000078","coordinates":{"x":128.603483,"y":35.308886},"battery":0,"states":"{lowBattery,collect,shutdown}"},{"serial_number":"000136","coordinates":{"x":128.68559,"y":35.242462},"battery":100,"states":"{collect}"},{"serial_number":"000112","coordinates":{"x":128.68542,"y":35.242336},"battery":86,"states":"{collect}"},{"serial_number":"000282","coordinates":{"x":127.050413,"y":37.546026},"battery":40,"states":"{collect}"},{"serial_number":"000281","coordinates":{"x":127.050413,"y":37.546026},"battery":37,"states":"{collect}"},{"serial_number":"000063","coordinates":{"x":128.59869,"y":35.288071},"battery":42,"states":"{collect,shutdown}"},{"serial_number":"000060","coordinates":{"x":128.59871,"y":35.288094},"battery":24,"states":"{lowBattery,shutdown,collect}"},{"serial_number":"000117","coordinates":{"x":128.68541,"y":35.242359},"battery":100,"states":"{collect}"},{"serial_number":"000025","coordinates":{"x":128.48674,"y":35.852573},"battery":83,"states":"{shutdown}"},{"serial_number":"000126","coordinates":{"x":128.68542,"y":35.242367},"battery":100,"states":"{collect}"},{"serial_number":"000283","coordinates":{"x":127.050413,"y":37.546026},"battery":31,"states":"{collect}"},{"serial_number":"000256","coordinates":{"x":127.050413,"y":37.546026},"battery":0,"states":"{lowBattery,collect}"},{"serial_number":"000268","coordinates":{"x":127.050413,"y":37.546026},"battery":24,"states":"{lowBattery,collect}"},{"serial_number":"000087","coordinates":{"x":128.55783,"y":35.180756},"battery":100,"states":"{shutdown}"},{"serial_number":"000082","coordinates":{"x":128.56021,"y":35.17952},"battery":100,"states":"{shutdown}"},{"serial_number":"000138","coordinates":{"x":128.68541,"y":35.242371},"battery":100,"states":"{collect}"},{"serial_number":"000014","coordinates":{"x":128.48584,"y":35.854103},"battery":57,"states":"{shutdown}"},{"serial_number":"000172","coordinates":{"x":126.63202,"y":37.39566},"battery":48,"states":"{collect}"},{"serial_number":"000253","coordinates":{"x":127.050413,"y":37.546026},"battery":0,"states":"{lowBattery,collect}"},{"serial_number":"000228","coordinates":{"x":127.050413,"y":37.546026},"battery":0,"states":"{lowBattery,collect}"},{"serial_number":"000225","coordinates":{"x":127.050413,"y":37.546026},"battery":0,"states":"{lowBattery,collect}"},{"serial_number":"000041","coordinates":{"x":128.49156,"y":35.851913},"battery":98,"states":"{shutdown}"},{"serial_number":"000170","coordinates":{"x":126.62963,"y":37.373707},"battery":44,"states":"{}"},{"serial_number":"000275","coordinates":{"x":127.050413,"y":37.546026},"battery":37,"states":"{collect}"},{"serial_number":"000278","coordinates":{"x":127.050413,"y":37.546026},"battery":28,"states":"{lowBattery,collect}"},{"serial_number":"000271","coordinates":{"x":127.050413,"y":37.546026},"battery":36,"states":"{collect}"},{"serial_number":"000240","coordinates":{"x":127.050413,"y":37.546026},"battery":0,"states":"{lowBattery,collect}"},{"serial_number":"000045","coordinates":{"x":128.48882,"y":35.857899},"battery":62,"states":"{shutdown}"},{"serial_number":"000098","coordinates":{"x":128.55273,"y":35.184776},"battery":97,"states":"{shutdown}"},{"serial_number":"000142","coordinates":{"x":128.68547,"y":35.242344},"battery":97,"states":"{collect}"},{"serial_number":"000113","coordinates":{"x":128.68536,"y":35.242474},"battery":100,"states":"{collect}"},{"serial_number":"000149","coordinates":{"x":128.68532,"y":35.242386},"battery":100,"states":"{collect}"},{"serial_number":"000051","coordinates":{"x":128.48878,"y":35.857849},"battery":56,"states":"{shutdown}"},{"serial_number":"000254","coordinates":{"x":127.050413,"y":37.546026},"battery":0,"states":"{lowBattery,collect}"},{"serial_number":"000011","coordinates":{"x":128.48766,"y":35.852894},"battery":57,"states":"{shutdown}"},{"serial_number":"000257","coordinates":{"x":127.050413,"y":37.546026},"battery":28,"states":"{lowBattery,collect}"},{"serial_number":"000119","coordinates":{"x":128.68541,"y":35.242359},"battery":100,"states":"{collect}"},{"serial_number":"000024","coordinates":{"x":128.48715,"y":35.859211},"battery":60,"states":"{shutdown}"},{"serial_number":"000140","coordinates":{"x":128.68538,"y":35.242401},"battery":99,"states":"{collect}"},{"serial_number":"000015","coordinates":{"x":128.47974,"y":35.853157},"battery":78,"states":"{shutdown}"},{"serial_number":"000124","coordinates":{"x":128.68524,"y":35.242451},"battery":100,"states":"{collect}"},{"serial_number":"000222","coordinates":{"x":127.050413,"y":37.546026},"battery":0,"states":"{collect}"},{"serial_number":"000223","coordinates":{"x":127.050413,"y":37.546026},"battery":0,"states":"{collect}"},{"serial_number":"000249","coordinates":{"x":127.050413,"y":37.546026},"battery":0,"states":"{lowBattery,collect}"},{"serial_number":"000245","coordinates":{"x":127.050413,"y":37.546026},"battery":0,"states":"{lowBattery,collect}"},{"serial_number":"000272","coordinates":{"x":127.050413,"y":37.546026},"battery":34,"states":"{collect}"},{"serial_number":"000244","coordinates":{"x":127.050413,"y":37.546026},"battery":23,"states":"{lowBattery,collect}"},{"serial_number":"000226","coordinates":{"x":127.050413,"y":37.546026},"battery":0,"states":"{lowBattery,collect}"},{"serial_number":"000229","coordinates":{"x":127.050413,"y":37.546026},"battery":0,"states":"{lowBattery,collect}"},{"serial_number":"000303","coordinates":{"x":127.050413,"y":37.546026},"battery":0,"states":"{collect}"},{"serial_number":"000304","coordinates":{"x":127.050413,"y":37.546026},"battery":0,"states":"{collect}"},{"serial_number":"000205","coordinates":{"x":127.050413,"y":37.546026},"battery":0,"states":"{lowBattery,collect}"},{"serial_number":"000072","coordinates":{"x":128.55763,"y":35.180714},"battery":100,"states":"{shutdown}"},{"serial_number":"000216","coordinates":{"x":127.050413,"y":37.546026},"battery":0,"states":"{collect}"},{"serial_number":"000217","coordinates":{"x":127.050413,"y":37.546026},"battery":0,"states":"{lowBattery}"},{"serial_number":"000219","coordinates":{"x":127.050413,"y":37.546026},"battery":0,"states":"{collect}"},{"serial_number":"000221","coordinates":{"x":127.050413,"y":37.546026},"battery":0,"states":"{collect}"},{"serial_number":"000247","coordinates":{"x":127.050413,"y":37.546026},"battery":0,"states":"{lowBattery,collect}"},{"serial_number":"000210","coordinates":{"x":127.050413,"y":37.546026},"battery":0,"states":"{}"},{"serial_number":"000095","coordinates":{"x":128.56006,"y":35.179478},"battery":100,"states":"{shutdown}"},{"serial_number":"000115","coordinates":{"x":128.68541,"y":35.242325},"battery":100,"states":"{collect}"},{"serial_number":"000053","coordinates":{"x":128.48926,"y":35.857613},"battery":49,"states":"{shutdown}"},{"serial_number":"000234","coordinates":{"x":127.050413,"y":37.546026},"battery":0,"states":"{lowBattery,collect}"},{"serial_number":"000276","coordinates":{"x":127.050413,"y":37.546026},"battery":30,"states":"{lowBattery,collect}"},{"serial_number":"000258","coordinates":{"x":127.050413,"y":37.546026},"battery":24,"states":"{lowBattery,collect}"},{"serial_number":"000088","coordinates":{"x":128.56004,"y":35.179726},"battery":88,"states":"{shutdown}"},{"serial_number":"000070","coordinates":{"x":128.59871,"y":35.288055},"battery":42,"states":"{breakdown,shutdown,collect}"},{"serial_number":"000068","coordinates":{"x":128.55762,"y":35.180756},"battery":97,"states":"{shutdown}"},{"serial_number":"000122","coordinates":{"x":128.68509,"y":35.242611},"battery":100,"states":"{collect}"},{"serial_number":"000144","coordinates":{"x":128.68527,"y":35.242409},"battery":87,"states":"{collect}"},{"serial_number":"000110","coordinates":{"x":128.68538,"y":35.242413},"battery":100,"states":"{collect}"},{"serial_number":"000130","coordinates":{"x":128.68532,"y":35.242344},"battery":81,"states":"{collect}"},{"serial_number":"000054","coordinates":{"x":128.48581,"y":35.854118},"battery":57,"states":"{shutdown}"},{"serial_number":"000056","coordinates":{"x":128.48982,"y":35.853874},"battery":43,"states":"{shutdown}"},{"serial_number":"000285","coordinates":{"x":127.050413,"y":37.546026},"battery":0,"states":"{collect}"},{"serial_number":"000286","coordinates":{"x":127.050413,"y":37.546026},"battery":0,"states":"{collect}"},{"serial_number":"000287","coordinates":{"x":127.050413,"y":37.546026},"battery":0,"states":"{collect}"},{"serial_number":"000288","coordinates":{"x":127.050413,"y":37.546026},"battery":0,"states":"{collect}"},{"serial_number":"000289","coordinates":{"x":127.050413,"y":37.546026},"battery":0,"states":"{collect}"},{"serial_number":"000290","coordinates":{"x":127.050413,"y":37.546026},"battery":0,"states":"{collect}"},{"serial_number":"000291","coordinates":{"x":127.050413,"y":37.546026},"battery":0,"states":"{collect}"},{"serial_number":"000292","coordinates":{"x":127.050413,"y":37.546026},"battery":0,"states":"{collect}"},{"serial_number":"000293","coordinates":{"x":127.050413,"y":37.546026},"battery":0,"states":"{collect}"},{"serial_number":"000294","coordinates":{"x":127.050413,"y":37.546026},"battery":0,"states":"{collect}"},{"serial_number":"000295","coordinates":{"x":127.050413,"y":37.546026},"battery":0,"states":"{collect}"},{"serial_number":"000296","coordinates":{"x":127.050413,"y":37.546026},"battery":0,"states":"{collect}"},{"serial_number":"000297","coordinates":{"x":127.050413,"y":37.546026},"battery":0,"states":"{collect}"},{"serial_number":"000298","coordinates":{"x":127.050413,"y":37.546026},"battery":0,"states":"{collect}"},{"serial_number":"000299","coordinates":{"x":127.050413,"y":37.546026},"battery":0,"states":"{collect}"},{"serial_number":"000300","coordinates":{"x":127.050413,"y":37.546026},"battery":0,"states":"{collect}"},{"serial_number":"000301","coordinates":{"x":127.050413,"y":37.546026},"battery":0,"states":"{collect}"},{"serial_number":"000252","coordinates":{"x":127.050413,"y":37.546026},"battery":0,"states":"{lowBattery,collect}"},{"serial_number":"000262","coordinates":{"x":127.050413,"y":37.546026},"battery":25,"states":"{lowBattery,collect}"},{"serial_number":"000263","coordinates":{"x":127.050413,"y":37.546026},"battery":35,"states":"{collect}"},{"serial_number":"000061","coordinates":{"x":128.59871,"y":35.288052},"battery":92,"states":"{shutdown,collect}"},{"serial_number":"000057","coordinates":{"x":128.48828,"y":35.85577},"battery":60,"states":"{shutdown}"},{"serial_number":"000038","coordinates":{"x":128.48709,"y":35.854645},"battery":59,"states":"{shutdown}"},{"serial_number":"000108","coordinates":{"x":128.55811,"y":35.180981},"battery":100,"states":"{shutdown}"},{"serial_number":"000123","coordinates":{"x":128.68526,"y":35.242416},"battery":100,"states":"{collect}"},{"serial_number":"000184","coordinates":{"x":126.63737,"y":37.390133},"battery":29,"states":"{lowBattery}"},{"serial_number":"000173","coordinates":{"x":126.63992,"y":37.386776},"battery":79,"states":"{}"},{"serial_number":"000236","coordinates":{"x":127.050413,"y":37.546026},"battery":0,"states":"{lowBattery,collect}"},{"serial_number":"000261","coordinates":{"x":127.050413,"y":37.546026},"battery":40,"states":"{collect}"},{"serial_number":"000265","coordinates":{"x":127.050413,"y":37.546026},"battery":28,"states":"{lowBattery,collect}"},{"serial_number":"000197","coordinates":{"x":126.63149,"y":37.395306},"battery":53,"states":"{breakdown}"},{"serial_number":"000092","coordinates":{"x":128.55814,"y":35.180927},"battery":100,"states":"{shutdown}"},{"serial_number":"000034","coordinates":{"x":128.48596,"y":35.855175},"battery":53,"states":"{shutdown}"},{"serial_number":"000135","coordinates":{"x":128.68533,"y":35.242355},"battery":100,"states":"{collect}"},{"serial_number":"000129","coordinates":{"x":128.68542,"y":35.242332},"battery":100,"states":"{collect}"},{"serial_number":"000161","coordinates":{"x":126.63254,"y":37.372768},"battery":45,"states":"{}"},{"serial_number":"000250","coordinates":{"x":127.050413,"y":37.546026},"battery":0,"states":"{lowBattery,collect}"},{"serial_number":"000048","coordinates":{"x":128.49016,"y":35.85273},"battery":49,"states":"{shutdown}"},{"serial_number":"000104","coordinates":{"x":128.59866,"y":35.288086},"battery":0,"states":"{lowBattery,breakdown,shutdown,collect}"},{"serial_number":"000114","coordinates":{"x":128.68541,"y":35.242355},"battery":100,"states":"{collect}"},{"serial_number":"000280","coordinates":{"x":127.050413,"y":37.546026},"battery":36,"states":"{collect}"},{"serial_number":"000270","coordinates":{"x":127.050413,"y":37.546026},"battery":33,"states":"{collect}"},{"serial_number":"000284","coordinates":{"x":127.050413,"y":37.546026},"battery":36,"states":"{collect}"},{"serial_number":"000127","coordinates":{"x":128.68532,"y":35.24239},"battery":100,"states":"{collect}"},{"serial_number":"000132","coordinates":{"x":128.68536,"y":35.242424},"battery":99,"states":"{collect}"},{"serial_number":"000131","coordinates":{"x":128.68552,"y":35.242348},"battery":100,"states":"{collect}"},{"serial_number":"000266","coordinates":{"x":127.050413,"y":37.546026},"battery":30,"states":"{lowBattery,collect}"},{"serial_number":"000251","coordinates":{"x":127.050413,"y":37.546026},"battery":27,"states":"{lowBattery,collect}"},{"serial_number":"000233","coordinates":{"x":127.050413,"y":37.546026},"battery":0,"states":"{lowBattery,collect}"},{"serial_number":"000255","coordinates":{"x":127.050413,"y":37.546026},"battery":30,"states":"{lowBattery,collect}"},{"serial_number":"000073","coordinates":{"x":128.59859,"y":35.288082},"battery":55,"states":"{breakdown,shutdown,collect}"},{"serial_number":"000023","coordinates":{"x":128.48975,"y":35.857269},"battery":58,"states":"{shutdown}"},{"serial_number":"000046","coordinates":{"x":128.48669,"y":35.852547},"battery":88,"states":"{shutdown}"},{"serial_number":"000279","coordinates":{"x":127.050413,"y":37.546026},"battery":38,"states":"{collect}"},{"serial_number":"000267","coordinates":{"x":127.050413,"y":37.546026},"battery":39,"states":"{collect}"},{"serial_number":"000242","coordinates":{"x":127.050413,"y":37.546026},"battery":21,"states":"{lowBattery,collect}"},{"serial_number":"000021","coordinates":{"x":128.4879,"y":35.859158},"battery":85,"states":"{shutdown}"},{"serial_number":"000269","coordinates":{"x":127.050413,"y":37.546026},"battery":0,"states":"{lowBattery,collect}"},{"serial_number":"000277","coordinates":{"x":127.050413,"y":37.546026},"battery":41,"states":"{collect}"},{"serial_number":"000022","coordinates":{"x":128.48969,"y":35.857151},"battery":58,"states":"{shutdown}"},{"serial_number":"000148","coordinates":{"x":128.68539,"y":35.242352},"battery":100,"states":"{collect}"},{"serial_number":"000069","coordinates":{"x":128.56099,"y":35.180141},"battery":100,"states":"{shutdown}"},{"serial_number":"000050","coordinates":{"x":128.49167,"y":35.855564},"battery":89,"states":"{shutdown}"},{"serial_number":"000101","coordinates":{"x":128.5527,"y":35.184032},"battery":74,"states":"{shutdown}"},{"serial_number":"000246","coordinates":{"x":127.050413,"y":37.546026},"battery":22,"states":"{lowBattery,collect}"},{"serial_number":"000259","coordinates":{"x":127.050413,"y":37.546026},"battery":34,"states":"{collect}"},{"serial_number":"000118","coordinates":{"x":128.68539,"y":35.242424},"battery":100,"states":"{collect}"},{"serial_number":"000091","coordinates":{"x":128.55833,"y":35.180943},"battery":100,"states":"{shutdown}"},{"serial_number":"000064","coordinates":{"x":128.5601,"y":35.179558},"battery":100,"states":"{shutdown}"},{"serial_number":"000180","coordinates":{"x":126.63976,"y":37.386524},"battery":87,"states":"{}"},{"serial_number":"000227","coordinates":{"x":127.050413,"y":37.546026},"battery":21,"states":"{lowBattery,collect}"},{"serial_number":"000097","coordinates":{"x":128.59863,"y":35.288086},"battery":40,"states":"{collect,shutdown}"},{"serial_number":"000183","coordinates":{"x":126.63882,"y":37.395435},"battery":57,"states":"{}"},{"serial_number":"000158","coordinates":{"x":126.66502,"y":37.379177},"battery":48,"states":"{}"},{"serial_number":"000150","coordinates":{"x":126.64136,"y":37.38821},"battery":86,"states":"{}"},{"serial_number":"000187","coordinates":{"x":126.65464,"y":37.388729},"battery":59,"states":"{}"},{"serial_number":"000155","coordinates":{"x":126.63209,"y":37.395725},"battery":100,"states":"{collect}"},{"serial_number":"000111","coordinates":{"x":128.68535,"y":35.242352},"battery":92,"states":"{collect}"},{"serial_number":"000154","coordinates":{"x":126.65164,"y":37.371201},"battery":90,"states":"{}"},{"serial_number":"000166","coordinates":{"x":126.64482,"y":37.391342},"battery":60,"states":"{}"},{"serial_number":"000080","coordinates":{"x":128.5648,"y":35.180134},"battery":90,"states":"{shutdown}"},{"serial_number":"000049","coordinates":{"x":128.47971,"y":35.85323},"battery":76,"states":"{shutdown}"},{"serial_number":"000019","coordinates":{"x":128.49153,"y":35.853905},"battery":38,"states":"{shutdown}"},{"serial_number":"000029","coordinates":{"x":128.49103,"y":35.855743},"battery":79,"states":"{shutdown}"},{"serial_number":"000030","coordinates":{"x":128.48566,"y":35.856144},"battery":85,"states":"{shutdown}"},{"serial_number":"000012","coordinates":{"x":128.48015,"y":35.856594},"battery":77,"states":"{shutdown}"},{"serial_number":"000035","coordinates":{"x":128.49098,"y":35.855797},"battery":79,"states":"{shutdown}"},{"serial_number":"000043","coordinates":{"x":128.48659,"y":35.852516},"battery":81,"states":"{shutdown}"},{"serial_number":"000013","coordinates":{"x":128.49103,"y":35.855804},"battery":46,"states":"{shutdown}"},{"serial_number":"000075","coordinates":{"x":128.55568,"y":35.18372},"battery":98,"states":"{shutdown}"},{"serial_number":"000047","coordinates":{"x":128.48625,"y":35.852581},"battery":83,"states":"{shutdown}"},{"serial_number":"000042","coordinates":{"x":128.48767,"y":35.85899},"battery":78,"states":"{shutdown}"},{"serial_number":"000121","coordinates":{"x":128.68535,"y":35.242294},"battery":100,"states":"{collect}"},{"serial_number":"000085","coordinates":{"x":128.55824,"y":35.180988},"battery":80,"states":"{shutdown}"},{"serial_number":"000052","coordinates":{"x":128.49019,"y":35.852802},"battery":47,"states":"{shutdown}"},{"serial_number":"000076","coordinates":{"x":128.55884,"y":35.174332},"battery":76,"states":"{shutdown}"},{"serial_number":"000093","coordinates":{"x":128.55571,"y":35.183659},"battery":100,"states":"{shutdown}"},{"serial_number":"000010","coordinates":{"x":128.48969,"y":35.857227},"battery":39,"states":"{shutdown}"},{"serial_number":"000157","coordinates":{"x":126.63492,"y":37.382137},"battery":49,"states":"{}"},{"serial_number":"000020","coordinates":{"x":128.49097,"y":35.85186},"battery":86,"states":"{shutdown}"},{"serial_number":"000044","coordinates":{"x":128.49181,"y":35.858891},"battery":45,"states":"{shutdown}"},{"serial_number":"000032","coordinates":{"x":128.4825,"y":35.853092},"battery":0,"states":"{lowBattery,shutdown}"},{"serial_number":"000016","coordinates":{"x":128.49164,"y":35.85556},"battery":45,"states":"{shutdown}"},{"serial_number":"000100","coordinates":{"x":128.55846,"y":35.178837},"battery":84,"states":"{shutdown}"},{"serial_number":"000079","coordinates":{"x":128.59883,"y":35.288006},"battery":31,"states":"{breakdown,shutdown,collect}"},{"serial_number":"000089","coordinates":{"x":128.55269,"y":35.184845},"battery":100,"states":"{shutdown}"},{"serial_number":"000128","coordinates":{"x":128.68529,"y":35.242359},"battery":100,"states":"{collect}"},{"serial_number":"000058","coordinates":{"x":128.49158,"y":35.85191},"battery":83,"states":"{shutdown}"},{"serial_number":"000102","coordinates":{"x":128.56105,"y":35.180134},"battery":96,"states":"{shutdown}"},{"serial_number":"000062","coordinates":{"x":128.55522,"y":35.184566},"battery":91,"states":"{shutdown}"},{"serial_number":"000191","coordinates":{"x":126.63166,"y":37.395519},"battery":85,"states":"{}"},{"serial_number":"000006","coordinates":{"x":126.885743,"y":37.479925},"battery":94,"states":"{shutdown}"},{"serial_number":"000152","coordinates":{"x":126.65967,"y":37.372875},"battery":58,"states":"{}"},{"serial_number":"000199","coordinates":{"x":126.639,"y":37.385899},"battery":50,"states":"{}"},{"serial_number":"000181","coordinates":{"x":126.65187,"y":37.379066},"battery":0,"states":"{lowBattery}"},{"serial_number":"000196","coordinates":{"x":126.64489,"y":37.391376},"battery":71,"states":"{}"},{"serial_number":"000120","coordinates":{"x":128.68536,"y":35.242386},"battery":100,"states":"{collect}"},{"serial_number":"000134","coordinates":{"x":128.68536,"y":35.242466},"battery":100,"states":"{collect}"},{"serial_number":"000139","coordinates":{"x":128.6853,"y":35.242397},"battery":100,"states":"{collect}"},{"serial_number":"000027","coordinates":{"x":128.49158,"y":35.851887},"battery":70,"states":"{shutdown}"},{"serial_number":"000067","coordinates":{"x":128.55275,"y":35.184063},"battery":82,"states":"{shutdown}"},{"serial_number":"000143","coordinates":{"x":128.68523,"y":35.242352},"battery":100,"states":"{collect}"},{"serial_number":"000141","coordinates":{"x":128.68546,"y":35.242397},"battery":100,"states":"{collect}"},{"serial_number":"000033","coordinates":{"x":128.49176,"y":35.855431},"battery":56,"states":"{shutdown}"},{"serial_number":"000162","coordinates":{"x":126.63754,"y":37.390091},"battery":48,"states":"{}"},{"serial_number":"000083","coordinates":{"x":128.56017,"y":35.179363},"battery":100,"states":"{shutdown}"},{"serial_number":"000074","coordinates":{"x":128.55936,"y":35.173824},"battery":97,"states":"{shutdown}"},{"serial_number":"000084","coordinates":{"x":128.55275,"y":35.184845},"battery":93,"states":"{shutdown}"},{"serial_number":"000018","coordinates":{"x":128.47954,"y":35.85611},"battery":45,"states":"{shutdown}"},{"serial_number":"000026","coordinates":{"x":128.48665,"y":35.852501},"battery":57,"states":"{shutdown}"},{"serial_number":"000231","coordinates":{"x":127.050413,"y":37.546026},"battery":0,"states":"{lowBattery,collect}"},{"serial_number":"000243","coordinates":{"x":127.050413,"y":37.546026},"battery":0,"states":"{lowBattery,collect}"},{"serial_number":"000232","coordinates":{"x":127.050413,"y":37.546026},"battery":0,"states":"{lowBattery,collect}"},{"serial_number":"000238","coordinates":{"x":127.050413,"y":37.546026},"battery":0,"states":"{lowBattery,collect}"},{"serial_number":"000239","coordinates":{"x":127.050413,"y":37.546026},"battery":0,"states":"{lowBattery,collect}"},{"serial_number":"000248","coordinates":{"x":127.050413,"y":37.546026},"battery":0,"states":"{lowBattery,collect}"},{"serial_number":"000179","coordinates":{"x":126.65153,"y":37.378719},"battery":54,"states":"{}"},{"serial_number":"000194","coordinates":{"x":126.66325,"y":37.376774},"battery":41,"states":"{}"},{"serial_number":"000107","coordinates":{"x":128.55832,"y":35.18108},"battery":100,"states":"{shutdown}"},{"serial_number":"000103","coordinates":{"x":128.5611,"y":35.18042},"battery":87,"states":"{shutdown}"},{"serial_number":"000028","coordinates":{"x":128.49158,"y":35.851906},"battery":70,"states":"{shutdown}"},{"serial_number":"000145","coordinates":{"x":128.68536,"y":35.242409},"battery":100,"states":"{collect}"},{"serial_number":"000147","coordinates":{"x":128.68532,"y":35.24231},"battery":100,"states":"{collect}"},{"serial_number":"000133","coordinates":{"x":128.68559,"y":35.24242},"battery":99,"states":"{collect}"},{"serial_number":"000037","coordinates":{"x":128.48787,"y":35.859158},"battery":73,"states":"{shutdown}"},{"serial_number":"000105","coordinates":{"x":128.55836,"y":35.181004},"battery":91,"states":"{shutdown}"},{"serial_number":"000039","coordinates":{"x":128.491,"y":35.851856},"battery":82,"states":"{shutdown}"},{"serial_number":"000109","coordinates":{"x":128.59863,"y":35.288193},"battery":0,"states":"{lowBattery,breakdown,collect,shutdown}"},{"serial_number":"000106","coordinates":{"x":128.55859,"y":35.180622},"battery":95,"states":"{shutdown}"},{"serial_number":"000099","coordinates":{"x":128.55995,"y":35.178864},"battery":83,"states":"{shutdown,collect}"},{"serial_number":"000193","coordinates":{"x":126.67162,"y":37.38451},"battery":91,"states":"{}"},{"serial_number":"000241","coordinates":{"x":127.050413,"y":37.546026},"battery":0,"states":"{lowBattery,collect}"},{"serial_number":"000186","coordinates":{"x":126.63434,"y":37.376736},"battery":64,"states":"{}"},{"serial_number":"000235","coordinates":{"x":127.050413,"y":37.546026},"battery":0,"states":"{lowBattery,collect}"},{"serial_number":"000096","coordinates":{"x":128.5527,"y":35.184036},"battery":73,"states":"{shutdown}"},{"serial_number":"000159","coordinates":{"x":126.64333,"y":37.387665},"battery":51,"states":"{}"},{"serial_number":"000031","coordinates":{"x":128.4847,"y":35.857811},"battery":47,"states":"{shutdown}"},{"serial_number":"000182","coordinates":{"x":126.63379,"y":37.372128},"battery":21,"states":"{lowBattery}"},{"serial_number":"000156","coordinates":{"x":126.63519,"y":37.391769},"battery":97,"states":"{}"},{"serial_number":"000094","coordinates":{"x":128.55481,"y":35.18314},"battery":96,"states":"{shutdown}"},{"serial_number":"000036","coordinates":{"x":128.48003,"y":35.856781},"battery":51,"states":"{shutdown}"},{"serial_number":"000081","coordinates":{"x":128.601742,"y":35.300969},"battery":67,"states":"{collect,shutdown}"},{"serial_number":"000008","coordinates":{"x":126.872168,"y":37.477157},"battery":40,"states":"{collect,shutdown}"},{"serial_number":"000003","coordinates":{"x":127.078668,"y":37.244634},"battery":0,"states":"{lowBattery,shutdown,breakdown}"},{"serial_number":"000004","coordinates":{"x":127.078668,"y":37.244634},"battery":0,"states":"{lowBattery,shutdown}"},{"serial_number":"000230","coordinates":{"x":127.050413,"y":37.546026},"battery":0,"states":"{lowBattery,collect}"},{"serial_number":"000065","coordinates":{"x":128.59842,"y":35.287716},"battery":100,"states":"{collect,shutdown}"},{"serial_number":"000160","coordinates":{"x":126.65345,"y":37.378155},"battery":63,"states":"{}"},{"serial_number":"000164","coordinates":{"x":126.63607,"y":37.391586},"battery":29,"states":"{lowBattery}"},{"serial_number":"000192","coordinates":{"x":126.64223,"y":37.388081},"battery":53,"states":"{}"},{"serial_number":"000188","coordinates":{"x":126.63686,"y":37.395939},"battery":75,"states":"{collect}"},{"serial_number":"000198","coordinates":{"x":126.62984,"y":37.3741},"battery":66,"states":"{}"},{"serial_number":"000005","coordinates":{"x":128.83887,"y":35.903736},"battery":0,"states":"{lowBattery,collect,shutdown}"},{"serial_number":"000185","coordinates":{"x":126.63357,"y":37.393284},"battery":71,"states":"{}"},{"serial_number":"000211","coordinates":{"x":127.050413,"y":37.546026},"battery":0,"states":"{lowBattery}"},{"serial_number":"000177","coordinates":{"x":126.6521,"y":37.373055},"battery":0,"states":"{lowBattery,breakdown}"},{"serial_number":"000195","coordinates":{"x":126.67195,"y":37.384193},"battery":55,"states":"{}"},{"serial_number":"000174","coordinates":{"x":126.64968,"y":37.390728},"battery":70,"states":"{}"},{"serial_number":"000165","coordinates":{"x":126.64504,"y":37.39101},"battery":72,"states":"{}"},{"serial_number":"000178","coordinates":{"x":126.65102,"y":37.396862},"battery":72,"states":"{}"},{"serial_number":"000071","coordinates":{"x":128.55888,"y":35.18066},"battery":100,"states":"{shutdown}"},{"serial_number":"000169","coordinates":{"x":126.66001,"y":37.383919},"battery":25,"states":"{lowBattery}"},{"serial_number":"000189","coordinates":{"x":126.63506,"y":37.391766},"battery":48,"states":"{}"},{"serial_number":"000167","coordinates":{"x":126.6511,"y":37.372475},"battery":50,"states":"{}"},{"serial_number":"000168","coordinates":{"x":126.64373,"y":37.387196},"battery":56,"states":"{}"},{"serial_number":"000163","coordinates":{"x":126.65977,"y":37.390862},"battery":63,"states":"{}"},{"serial_number":"000090","coordinates":{"x":128.56012,"y":35.179558},"battery":86,"states":"{shutdown}"},{"serial_number":"000176","coordinates":{"x":126.64191,"y":37.388588},"battery":67,"states":"{}"},{"serial_number":"000151","coordinates":{"x":126.63647,"y":37.397041},"battery":31,"states":"{}"},{"serial_number":"000175","coordinates":{"x":126.65736,"y":37.370216},"battery":34,"states":"{}"},{"serial_number":"000040","coordinates":{"x":128.49156,"y":35.855484},"battery":53,"states":"{shutdown}"},{"serial_number":"000017","coordinates":{"x":128.49182,"y":35.859493},"battery":50,"states":"{shutdown}"},{"serial_number":"000066","coordinates":{"x":128.55269,"y":35.184811},"battery":95,"states":"{shutdown}"},{"serial_number":"000055","coordinates":{"x":128.48351,"y":35.850906},"battery":75,"states":"{shutdown}"},{"serial_number":"000171","coordinates":{"x":126.65102,"y":37.371387},"battery":89,"states":"{}"},{"serial_number":"000190","coordinates":{"x":126.66607,"y":37.383934},"battery":80,"states":"{}"},{"serial_number":"000059","coordinates":{"x":128.862477,"y":35.874904},"battery":0,"states":"{lowBattery,shutdown}"},{"serial_number":"000224","coordinates":{"x":127.050413,"y":37.546026},"battery":0,"states":"{lowBattery}"},{"serial_number":"000207","coordinates":{"x":127.050413,"y":37.546026},"battery":0,"states":"{lowBattery}"},{"serial_number":"000208","coordinates":{"x":127.050413,"y":37.546026},"battery":0,"states":"{lowBattery}"},{"serial_number":"000086","coordinates":{"x":128.59836,"y":35.287998},"battery":0,"states":"{lowBattery,breakdown,collect,shutdown}"},{"serial_number":"000220","coordinates":{"x":127.050413,"y":37.546026},"battery":0,"states":"{lowBattery}"},{"serial_number":"000201","coordinates":{"x":127.050413,"y":37.546026},"battery":0,"states":"{lowBattery}"},{"serial_number":"000214","coordinates":{"x":127.050413,"y":37.546026},"battery":0,"states":"{lowBattery}"},{"serial_number":"000215","coordinates":{"x":127.050413,"y":37.546026},"battery":0,"states":"{lowBattery}"},{"serial_number":"000209","coordinates":{"x":127.050413,"y":37.546026},"battery":0,"states":"{lowBattery}"},{"serial_number":"000203","coordinates":{"x":127.050413,"y":37.546026},"battery":0,"states":"{lowBattery}"},{"serial_number":"000213","coordinates":{"x":127.050413,"y":37.546026},"battery":0,"states":"{lowBattery}"},{"serial_number":"000202","coordinates":{"x":127.050413,"y":37.546026},"battery":0,"states":"{lowBattery}"},{"serial_number":"000218","coordinates":{"x":127.050413,"y":37.546026},"battery":0,"states":"{lowBattery}"},{"serial_number":"000206","coordinates":{"x":127.050413,"y":37.546026},"battery":0,"states":"{lowBattery}"},{"serial_number":"000212","coordinates":{"x":127.050413,"y":37.546026},"battery":0,"states":"{lowBattery}"},{"serial_number":"000204","coordinates":{"x":127.050413,"y":37.546026},"battery":0,"states":"{lowBattery}"},{"serial_number":"000007","coordinates":{"x":126.87614,"y":37.482151},"battery":0,"states":"{lowBattery,shutdown}"},{"serial_number":"000153","coordinates":{"x":126.63745,"y":37.389938},"battery":86,"states":"{}"},{"serial_number":"000260","coordinates":{"x":127.050413,"y":37.546026},"battery":0,"states":"{lowBattery,collect}"},{"serial_number":"000125","coordinates":{"x":128.68489,"y":35.243015},"battery":0,"states":"{lowBattery,collect}"},{"serial_number":"000137","coordinates":{"x":128.6853,"y":35.242352},"battery":0,"states":"{lowBattery,collect}"},{"serial_number":"000146","coordinates":{"x":128.69785,"y":35.237259},"battery":0,"states":"{lowBattery,collect}"},{"serial_number":"000077","coordinates":{"x":128.59868,"y":35.288116},"battery":100,"states":"{collect,shutdown}"},{"serial_number":"000002","coordinates":{"x":126.883435,"y":37.480514},"battery":42,"states":"{}"},{"serial_number":"000000","coordinates":{"x":126.885654,"y":37.480045},"battery":0,"states":"{lowBattery,shutdown}"},{"serial_number":"000001","coordinates":{"x":127.078668,"y":37.244634},"battery":0,"states":"{lowBattery,shutdown}"}]} | ||
6 | +`; | ||
4 | 7 | ||
5 | export default res; | 8 | export default res; |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
... | @@ -49,7 +49,7 @@ class Header extends Component { | ... | @@ -49,7 +49,7 @@ class Header extends Component { |
49 | <Navbar fluid> | 49 | <Navbar fluid> |
50 | <Navbar.Header> | 50 | <Navbar.Header> |
51 | <Navbar.Brand> | 51 | <Navbar.Brand> |
52 | - <a href="#pablo">{this.props.brandText}</a> | 52 | + <a href="#pablo" style={{color: '#333333'}}>{this.props.brandText}</a> |
53 | </Navbar.Brand> | 53 | </Navbar.Brand> |
54 | <Navbar.Toggle onClick={this.mobileSidebarToggle} /> | 54 | <Navbar.Toggle onClick={this.mobileSidebarToggle} /> |
55 | </Navbar.Header> | 55 | </Navbar.Header> | ... | ... |
... | @@ -20,55 +20,9 @@ import { NavItem, Nav, NavDropdown, MenuItem } from "react-bootstrap"; | ... | @@ -20,55 +20,9 @@ import { NavItem, Nav, NavDropdown, MenuItem } from "react-bootstrap"; |
20 | 20 | ||
21 | class AdminNavbarLinks extends Component { | 21 | class AdminNavbarLinks extends Component { |
22 | render() { | 22 | render() { |
23 | - const notification = ( | ||
24 | - <div> | ||
25 | - <i className="fa fa-globe" /> | ||
26 | - <b className="caret" /> | ||
27 | - <span className="notification">5</span> | ||
28 | - <p className="hidden-lg hidden-md">Notification</p> | ||
29 | - </div> | ||
30 | - ); | ||
31 | return ( | 23 | return ( |
32 | <div> | 24 | <div> |
33 | - <Nav> | ||
34 | - <NavItem eventKey={1} href="#"> | ||
35 | - <i className="fa fa-dashboard" /> | ||
36 | - <p className="hidden-lg hidden-md">Dashboard</p> | ||
37 | - </NavItem> | ||
38 | - <NavDropdown | ||
39 | - eventKey={2} | ||
40 | - title={notification} | ||
41 | - noCaret | ||
42 | - id="basic-nav-dropdown" | ||
43 | - > | ||
44 | - <MenuItem eventKey={2.1}>Notification 1</MenuItem> | ||
45 | - <MenuItem eventKey={2.2}>Notification 2</MenuItem> | ||
46 | - <MenuItem eventKey={2.3}>Notification 3</MenuItem> | ||
47 | - <MenuItem eventKey={2.4}>Notification 4</MenuItem> | ||
48 | - <MenuItem eventKey={2.5}>Another notifications</MenuItem> | ||
49 | - </NavDropdown> | ||
50 | - <NavItem eventKey={3} href="#"> | ||
51 | - <i className="fa fa-search" /> | ||
52 | - <p className="hidden-lg hidden-md">Search</p> | ||
53 | - </NavItem> | ||
54 | - </Nav> | ||
55 | <Nav pullRight> | 25 | <Nav pullRight> |
56 | - <NavItem eventKey={1} href="#"> | ||
57 | - Account | ||
58 | - </NavItem> | ||
59 | - <NavDropdown | ||
60 | - eventKey={2} | ||
61 | - title="Dropdown" | ||
62 | - id="basic-nav-dropdown-right" | ||
63 | - > | ||
64 | - <MenuItem eventKey={2.1}>Action</MenuItem> | ||
65 | - <MenuItem eventKey={2.2}>Another action</MenuItem> | ||
66 | - <MenuItem eventKey={2.3}>Something</MenuItem> | ||
67 | - <MenuItem eventKey={2.4}>Another action</MenuItem> | ||
68 | - <MenuItem eventKey={2.5}>Something</MenuItem> | ||
69 | - <MenuItem divider /> | ||
70 | - <MenuItem eventKey={2.5}>Separated link</MenuItem> | ||
71 | - </NavDropdown> | ||
72 | <NavItem eventKey={3} href="#"> | 26 | <NavItem eventKey={3} href="#"> |
73 | Log out | 27 | Log out |
74 | </NavItem> | 28 | </NavItem> | ... | ... |
... | @@ -35,7 +35,7 @@ class Sidebar extends Component { | ... | @@ -35,7 +35,7 @@ class Sidebar extends Component { |
35 | > | 35 | > |
36 | <div className="logo" style={{display: 'flex',justifyContent: 'center', alignItems: 'center'}}> | 36 | <div className="logo" style={{display: 'flex',justifyContent: 'center', alignItems: 'center'}}> |
37 | <a | 37 | <a |
38 | - href="https://www.creative-tim.com?ref=lbd-sidebar" | 38 | + href="http://mate.ryulth.com/admin/kickboard" |
39 | > | 39 | > |
40 | <img src={mate_logo} alt="logo_image" style={{width: '135px'}}/> | 40 | <img src={mate_logo} alt="logo_image" style={{width: '135px'}}/> |
41 | </a> | 41 | </a> | ... | ... |
... | @@ -40,34 +40,34 @@ const UserDataCard = (props) => { | ... | @@ -40,34 +40,34 @@ const UserDataCard = (props) => { |
40 | <div> | 40 | <div> |
41 | <Row> | 41 | <Row> |
42 | <Col md={6} sm={6} xs={12}> | 42 | <Col md={6} sm={6} xs={12}> |
43 | - <UserData>이름 : {name}</UserData> | 43 | + <UserData><strong>이름 : </strong>{name}</UserData> |
44 | </Col> | 44 | </Col> |
45 | <Col md={6} sm={6} xs={12}> | 45 | <Col md={6} sm={6} xs={12}> |
46 | - <UserData>사용자 ID : {user_id}</UserData> | 46 | + <UserData><strong>사용자 ID : </strong>{user_id}</UserData> |
47 | </Col> | 47 | </Col> |
48 | </Row> | 48 | </Row> |
49 | <Row> | 49 | <Row> |
50 | <Col md={6} sm={6} xs={12}> | 50 | <Col md={6} sm={6} xs={12}> |
51 | - <UserData>전화번호 : {phone_number}</UserData> | 51 | + <UserData><strong>전화번호 : </strong>{phone_number}</UserData> |
52 | </Col> | 52 | </Col> |
53 | <Col md={6} sm={6} xs={12}> | 53 | <Col md={6} sm={6} xs={12}> |
54 | - <UserData>이메일 : {email}</UserData> | 54 | + <UserData><strong>이메일 : </strong>{email}</UserData> |
55 | </Col> | 55 | </Col> |
56 | </Row> | 56 | </Row> |
57 | <Row> | 57 | <Row> |
58 | <Col md={6} sm={6} xs={12}> | 58 | <Col md={6} sm={6} xs={12}> |
59 | - <UserData>가입 날짜 : {timestampToString(created_datetime)}</UserData> | 59 | + <UserData><strong>가입 날짜 : </strong>{timestampToString(created_datetime)}</UserData> |
60 | </Col> | 60 | </Col> |
61 | <Col md={6} sm={6} xs={12}> | 61 | <Col md={6} sm={6} xs={12}> |
62 | - <UserData>최근 로그인 날짜 : {timestampToString(recent_login_datetime)}</UserData> | 62 | + <UserData><strong>최근 로그인 날짜 : </strong>{timestampToString(recent_login_datetime)}</UserData> |
63 | </Col> | 63 | </Col> |
64 | </Row> | 64 | </Row> |
65 | <Row> | 65 | <Row> |
66 | <Col md={6} sm={6} xs={12}> | 66 | <Col md={6} sm={6} xs={12}> |
67 | - <UserData>면허증 등록 여부 : {license_registered ? '등록됨' : '미등록'}</UserData> | 67 | + <UserData><strong>면허증 등록 여부 : </strong>{license_registered ? '등록됨' : '미등록'}</UserData> |
68 | </Col> | 68 | </Col> |
69 | <Col md={6} sm={6} xs={12}> | 69 | <Col md={6} sm={6} xs={12}> |
70 | - <UserData>카드 등록 여부 : {license_registered ? '등록됨' : '미등록'}</UserData> | 70 | + <UserData><strong>카드 등록 여부 : </strong>{license_registered ? '등록됨' : '미등록'}</UserData> |
71 | </Col> | 71 | </Col> |
72 | </Row> | 72 | </Row> |
73 | </div> | 73 | </div> | ... | ... |
... | @@ -23,7 +23,7 @@ const dashboardRoutes = [ | ... | @@ -23,7 +23,7 @@ const dashboardRoutes = [ |
23 | // layout: "/admin" | 23 | // layout: "/admin" |
24 | // }, | 24 | // }, |
25 | { | 25 | { |
26 | - path: "/table", | 26 | + path: "/user", |
27 | name: "사용자 정보", | 27 | name: "사용자 정보", |
28 | icon: "pe-7s-users", | 28 | icon: "pe-7s-users", |
29 | component: UserHistory, | 29 | component: UserHistory, | ... | ... |
... | @@ -8,6 +8,7 @@ import SearchButton from '../components/Kickboard/SearchButton'; | ... | @@ -8,6 +8,7 @@ import SearchButton from '../components/Kickboard/SearchButton'; |
8 | 8 | ||
9 | const Kickboard = () => { | 9 | const Kickboard = () => { |
10 | const [kbId, setKbId] = useState('-1'); | 10 | const [kbId, setKbId] = useState('-1'); |
11 | + | ||
11 | const [kbData, setKbData] = useState({}); | 12 | const [kbData, setKbData] = useState({}); |
12 | const [historyData, setHistoryData] = useState([]); | 13 | const [historyData, setHistoryData] = useState([]); |
13 | 14 | ||
... | @@ -26,11 +27,16 @@ const Kickboard = () => { | ... | @@ -26,11 +27,16 @@ const Kickboard = () => { |
26 | .catch(err => console.log(err)); | 27 | .catch(err => console.log(err)); |
27 | },[kbId]); | 28 | },[kbId]); |
28 | 29 | ||
29 | - if(Number(kbId)<0) { | 30 | + if(kbId<0) { |
30 | return ( | 31 | return ( |
31 | <div className="content"> | 32 | <div className="content"> |
32 | <Grid fluid> | 33 | <Grid fluid> |
33 | <Row> | 34 | <Row> |
35 | + <Col md={4} mdOffset={8} sm={3} smOffset={9} style={{marginBottom:15}}> | ||
36 | + <SearchButton setKbId={setKbId}/> | ||
37 | + </Col> | ||
38 | + </Row> | ||
39 | + <Row> | ||
34 | <Col md={8} mdOffset={2}> | 40 | <Col md={8} mdOffset={2}> |
35 | <GoogleMapCard setKbId={setKbId}/> | 41 | <GoogleMapCard setKbId={setKbId}/> |
36 | </Col> | 42 | </Col> |
... | @@ -51,7 +57,7 @@ const Kickboard = () => { | ... | @@ -51,7 +57,7 @@ const Kickboard = () => { |
51 | </Row> | 57 | </Row> |
52 | <Row> | 58 | <Row> |
53 | <Col md={6}> | 59 | <Col md={6}> |
54 | - <GoogleMapCard setKbId={setKbId}/> | 60 | + <GoogleMapCard kbId={kbId} setKbId={setKbId}/> |
55 | </Col> | 61 | </Col> |
56 | <Col md={6}> | 62 | <Col md={6}> |
57 | <KickboardStatusCard kbId={kbId} kbData={kbData}/> | 63 | <KickboardStatusCard kbId={kbId} kbData={kbData}/> | ... | ... |
... | @@ -5,20 +5,44 @@ import UserHistoryCard from '../components/UserHistory/UserHistoryCard'; | ... | @@ -5,20 +5,44 @@ import UserHistoryCard from '../components/UserHistory/UserHistoryCard'; |
5 | import SearchButton from "../components/UserHistory/SearchButton"; | 5 | import SearchButton from "../components/UserHistory/SearchButton"; |
6 | import Fallback from '../components/UserHistory/Fallback'; | 6 | import Fallback from '../components/UserHistory/Fallback'; |
7 | 7 | ||
8 | +const convertQueryStringToObject = s => { | ||
9 | + const hashParams = {}; | ||
10 | + let e; | ||
11 | + const a = /\+/g, // Regex for replacing addition symbol with a space | ||
12 | + r = /([^&;=]+)=?([^&;]*)/g, | ||
13 | + d = function(s) { | ||
14 | + return decodeURIComponent(s.replace(a, ' ')); | ||
15 | + }, | ||
16 | + q = s.replace(/\?/g, ''); | ||
17 | + | ||
18 | + while ((e = r.exec(q))) hashParams[d(e[1])] = d(e[2]); | ||
19 | + | ||
20 | + return hashParams; | ||
21 | +}; | ||
22 | + | ||
8 | const UserHistory = () => { | 23 | const UserHistory = () => { |
9 | const [userId, setUserId] = useState('0'); | 24 | const [userId, setUserId] = useState('0'); |
10 | const [userData, setUserData] = useState({}); | 25 | const [userData, setUserData] = useState({}); |
11 | const [rentData, setRentData] = useState([]); | 26 | const [rentData, setRentData] = useState([]); |
12 | 27 | ||
13 | useEffect(() => { | 28 | useEffect(() => { |
14 | - // TODO: componentDidMount > 쿼리 검사하기 | 29 | + // component did mount |
30 | + console.log('component did mount') | ||
31 | + const queryString = window.location.href.split('?')[1]; | ||
32 | + const queryObject = queryString ? convertQueryStringToObject(queryString) : {}; | ||
33 | + | ||
34 | + if(queryObject && queryObject.userId) { | ||
35 | + setTimeout(() => setUserId(queryObject.userId), 300) | ||
36 | + } | ||
15 | },[]); | 37 | },[]); |
16 | 38 | ||
17 | useEffect(() => { | 39 | useEffect(() => { |
18 | if(Number(userId)<0) return; | 40 | if(Number(userId)<0) return; |
41 | + console.log(userId); | ||
19 | fetch(`http://1.201.143.67:5901/user/${userId}`) | 42 | fetch(`http://1.201.143.67:5901/user/${userId}`) |
20 | .then(r => r.json()) | 43 | .then(r => r.json()) |
21 | .then(d => { | 44 | .then(d => { |
45 | + console.log(d); | ||
22 | if(!d.success) setUserId('0'); // 유효하지 않은 userId인 경우 | 46 | if(!d.success) setUserId('0'); // 유효하지 않은 userId인 경우 |
23 | if(d.data && d.data.length) setUserData(d.data[0]); | 47 | if(d.data && d.data.length) setUserData(d.data[0]); |
24 | 48 | ... | ... |
-
Please register or login to post a comment