import React from 'react'; import ReactDOM from 'react-dom'; import { Modal, List, Menu, Button, Input, Label } from 'semantic-ui-react'; import Datetime from 'react-datetime'; import {convertTime, padding} from '../../../../tools' const getDayTime = ()=>{ let d = new Date(); d.setHours(0, 0, 0, 0); return d.getTime(); } class WristbandPathInfo extends React.Component{ state = { list: [], stime: (getDayTime()), etime: (Date.now()) } componentDidMount(){ } closeView = () => { this.setState({ list: [], stime: (getDayTime()), etime: (Date.now()) }, ()=>{ this.props.closeModal(); }) } getList = () => { let {mac, showDialog, getRequest} = this.props; fetch('/api/wristband/getwristbandlocpath', getRequest({ mac, stime: Math.floor(this.state.stime / 1000), etime: Math.floor(this.state.etime / 1000) })) .then(response=>response.json()) .then(json => { if(json.status != 1) return showDialog(json.message); this.setState({ list: json.data.record || [] }) }) } render() { let {closeModal, open} = this.props; return ( {this.closeView()}}> 手環名稱: {this.props.wbname} { this.setState({stime: (e.valueOf())}) }} /> }/> { this.setState({etime: (e.valueOf())}) }} /> }/> { this.state.list.map((t,idx) => { return ( { t.devname ? `時間 ${convertTime(t.wloclogtst, true)} 位於 ${t.devname} 附近` : `時間 ${convertTime(t.wloclogtst, true)} 不在範圍內` } ) }) } ) } } export default WristbandPathInfo;