king
2021-11-02 2f952c67cb4eddd4ad916a8418b3aee4cae82111
src/tabviews/zshare/automatic/index.jsx
@@ -15,10 +15,18 @@
  state = {
    running: false,
    line: 1,
    init: true
    gap: 2000
  }
  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 +68,7 @@
  autoExecOver = (btnId, type) => {
    const { autoMatic, config } = this.props
    const { gap } = this.state
    if (!this.state.running || btnId !== autoMatic.action) return
@@ -70,12 +79,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 +93,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})
      }
@@ -104,7 +113,7 @@
    setTimeout(() => {
      MKEmitter.emit('triggerBtnId', autoMatic.action, [data], 'autoMatic')
      if (['prompt', 'pop'].includes(autoMatic.OpenType)) {
        let delay = this.state.init && autoMatic.OpenType === 'pop' ? 2000 : 200
        let delay = autoMatic.OpenType === 'pop' ? 2000 : 300
        setTimeout(() => {
          if (autoMatic.OpenType === 'prompt') {