From 04dd71efebbf350fa97ea77fc0a64b75fe5ef889 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 02 十一月 2021 09:35:09 +0800
Subject: [PATCH] 2021-11-02

---
 src/tabviews/zshare/automatic/index.jsx |   18 ++++++++++++++----
 1 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/src/tabviews/zshare/automatic/index.jsx b/src/tabviews/zshare/automatic/index.jsx
index 8145aa3..6a8d387 100644
--- a/src/tabviews/zshare/automatic/index.jsx
+++ b/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})
       }

--
Gitblit v1.8.0