From 2f952c67cb4eddd4ad916a8418b3aee4cae82111 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 02 十一月 2021 10:00:09 +0800 Subject: [PATCH] 2021-11-02 --- src/tabviews/zshare/automatic/index.jsx | 21 +++++++++++++++------ 1 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/tabviews/zshare/automatic/index.jsx b/src/tabviews/zshare/automatic/index.jsx index 8145aa3..1ebc33a 100644 --- a/src/tabviews/zshare/automatic/index.jsx +++ b/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') { -- Gitblit v1.8.0