From 5c02a348979ff48e138884a4e5f37aef5605fc09 Mon Sep 17 00:00:00 2001 From: Jay Date: Mon, 10 Apr 2017 15:55:16 +0800 Subject: [PATCH] update --- public/js/admin_bundle.js | 8 ++++++++ .../AdminPage/Wristband/LocStatusWloc/index.js | 9 +++++++++ 2 files changed, 17 insertions(+) diff --git a/public/js/admin_bundle.js b/public/js/admin_bundle.js index 375a074..2761d5e 100644 --- a/public/js/admin_bundle.js +++ b/public/js/admin_bundle.js @@ -93788,6 +93788,8 @@ var LocStatusWloc = function (_React$Component) { return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = LocStatusWloc.__proto__ || Object.getPrototypeOf(LocStatusWloc)).call.apply(_ref, [this].concat(args))), _this), _this.state = { loc: [] + }, _this.tick = null, _this.runTick = function () { + _this.getStatus(); }, _this.getLocList = function () { var _this$props = _this.props, toggleLoading = _this$props.toggleLoading, @@ -93803,6 +93805,7 @@ var LocStatusWloc = function (_React$Component) { loc: json.data.record || [] }, function () { _this.getStatus(); + _this.tick = setInterval(_this.runTick, 5000); }); }); }, _this.getStatus = function () { @@ -93841,6 +93844,11 @@ var LocStatusWloc = function (_React$Component) { value: function componentDidMount() { this.getLocList(); } + }, { + key: 'componentWillUnmount', + value: function componentWillUnmount() { + clearInterval(this.tick); + } }, { key: 'render', value: function render() { diff --git a/src/components/AdminPage/Wristband/LocStatusWloc/index.js b/src/components/AdminPage/Wristband/LocStatusWloc/index.js index 480f05b..afdd749 100644 --- a/src/components/AdminPage/Wristband/LocStatusWloc/index.js +++ b/src/components/AdminPage/Wristband/LocStatusWloc/index.js @@ -6,10 +6,18 @@ class LocStatusWloc extends React.Component { state = { loc: [] } + tick = null componentDidMount() { this.getLocList(); } + componentWillUnmount(){ + clearInterval(this.tick); + } + + runTick = ()=>{ + this.getStatus(); + } getLocList = ()=>{ let {toggleLoading, showDialog} = this.props; @@ -23,6 +31,7 @@ class LocStatusWloc extends React.Component { loc: json.data.record || [] }, ()=>{ this.getStatus(); + this.tick = setInterval(this.runTick, 5000); }) }) }