This commit is contained in:
Jay 2017-04-10 15:55:16 +08:00
parent 59331f9b1c
commit 5c02a34897
2 changed files with 17 additions and 0 deletions

View File

@ -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 = { return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = LocStatusWloc.__proto__ || Object.getPrototypeOf(LocStatusWloc)).call.apply(_ref, [this].concat(args))), _this), _this.state = {
loc: [] loc: []
}, _this.tick = null, _this.runTick = function () {
_this.getStatus();
}, _this.getLocList = function () { }, _this.getLocList = function () {
var _this$props = _this.props, var _this$props = _this.props,
toggleLoading = _this$props.toggleLoading, toggleLoading = _this$props.toggleLoading,
@ -93803,6 +93805,7 @@ var LocStatusWloc = function (_React$Component) {
loc: json.data.record || [] loc: json.data.record || []
}, function () { }, function () {
_this.getStatus(); _this.getStatus();
_this.tick = setInterval(_this.runTick, 5000);
}); });
}); });
}, _this.getStatus = function () { }, _this.getStatus = function () {
@ -93841,6 +93844,11 @@ var LocStatusWloc = function (_React$Component) {
value: function componentDidMount() { value: function componentDidMount() {
this.getLocList(); this.getLocList();
} }
}, {
key: 'componentWillUnmount',
value: function componentWillUnmount() {
clearInterval(this.tick);
}
}, { }, {
key: 'render', key: 'render',
value: function render() { value: function render() {

View File

@ -6,10 +6,18 @@ class LocStatusWloc extends React.Component {
state = { state = {
loc: [] loc: []
} }
tick = null
componentDidMount() { componentDidMount() {
this.getLocList(); this.getLocList();
} }
componentWillUnmount(){
clearInterval(this.tick);
}
runTick = ()=>{
this.getStatus();
}
getLocList = ()=>{ getLocList = ()=>{
let {toggleLoading, showDialog} = this.props; let {toggleLoading, showDialog} = this.props;
@ -23,6 +31,7 @@ class LocStatusWloc extends React.Component {
loc: json.data.record || [] loc: json.data.record || []
}, ()=>{ }, ()=>{
this.getStatus(); this.getStatus();
this.tick = setInterval(this.runTick, 5000);
}) })
}) })
} }