king
2021-11-02 04dd71efebbf350fa97ea77fc0a64b75fe5ef889
src/tabviews/zshare/automatic/index.jsx
@@ -15,10 +15,19 @@
  state = {
    running: false,
    line: 1,
    gap: 2000,
    init: true
  }
  timer = null
  UNSAFE_componentWillMount() {
    const { autoMatic } = this.props
    if (autoMatic.gap && autoMatic.gap >= 1) {
      this.setState({gap: autoMatic.gap * 1000})
    }
  }
  componentDidMount () {
    MKEmitter.addListener('modifyTabs', this.breakOff)
@@ -60,6 +69,7 @@
  autoExecOver = (btnId, type) => {
    const { autoMatic, config } = this.props
    const { gap } = this.state
    if (!this.state.running || btnId !== autoMatic.action) return
@@ -70,12 +80,12 @@
        this.setState({line: this.state.line + 1}, () => {
          setTimeout(() => {
            MKEmitter.emit('autoQueryData', config.MenuID, this.state.line)
          }, 2000)
          }, gap)
        })
      } else if (autoMatic.onFail === 'stay') {
        setTimeout(() => {
          MKEmitter.emit('autoQueryData', config.MenuID, this.state.line)
        }, 2000)
        }, gap)
      } else {
        this.setState({running: false})
      }
@@ -84,12 +94,12 @@
        this.setState({line: this.state.line + 1}, () => {
          setTimeout(() => {
            MKEmitter.emit('autoQueryData', config.MenuID, this.state.line)
          }, 2000)
          }, gap)
        })
      } else if (autoMatic.onSuccess === 'stay') {
        setTimeout(() => {
          MKEmitter.emit('autoQueryData', config.MenuID, this.state.line)
        }, 2000)
        }, gap)
      } else {
        this.setState({running: false})
      }