diff --git a/src/components/AdminPage/Wristband/LocStatus/index.js b/src/components/AdminPage/Wristband/LocStatus/index.js index b7a01d1..03fa382 100644 --- a/src/components/AdminPage/Wristband/LocStatus/index.js +++ b/src/components/AdminPage/Wristband/LocStatus/index.js @@ -89,6 +89,7 @@ class LocStatus extends React.Component{ render (){ let {i18n} = this.props; + console.log(this.state.list); return ( diff --git a/src/tools/index.js b/src/tools/index.js index 56aaca0..ef7ee9f 100644 --- a/src/tools/index.js +++ b/src/tools/index.js @@ -7,11 +7,12 @@ * @return {string} */ export const padding = (str, lng = 0, arrow = -1, txt = '0') => { - if(typeof str != 'string') str = str.toString(); - if(typeof txt != 'string') txt = txt.toString(); - if(!isFinite(lng) || lng <= 0) return str; - if(str.length < lng) return padding(arrow < 0 ? `${txt}${str}` : `${str}${txt}`, lng, arrow, txt); - return str; + if (!str) str = ''; + if (typeof str != 'string') str = str.toString(); + if (typeof txt != 'string') txt = txt.toString(); + if (!isFinite(lng) || lng <= 0) return str; + if (str.length < lng) return padding(arrow < 0 ? `${txt}${str}` : `${str}${txt}`, lng, arrow, txt); + return str; } /** @@ -21,7 +22,7 @@ export const padding = (str, lng = 0, arrow = -1, txt = '0') => { * @return {string} */ export const convertTime = (timestamp, showSec = false) => { - timestamp = padding(timestamp, 13, 1, '0'); - let d = new Date(parseInt(timestamp)); - return `${d.getFullYear()}-${padding(d.getMonth() + 1, 2)}-${padding(d.getDate(), 2)} ${padding(d.getHours(), 2)}:${padding(d.getMinutes(), 2)}${showSec ? `:${padding(d.getSeconds(), 2)}` : ''}` + timestamp = padding(timestamp, 13, 1, '0'); + let d = new Date(parseInt(timestamp)); + return `${d.getFullYear()}-${padding(d.getMonth() + 1, 2)}-${padding(d.getDate(), 2)} ${padding(d.getHours(), 2)}:${padding(d.getMinutes(), 2)}${showSec ? `:${padding(d.getSeconds(), 2)}` : ''}` } \ No newline at end of file