From 29a6c337010198e6931b648024140a19f7a4e208 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 18 七月 2023 10:40:42 +0800 Subject: [PATCH] 2023-07-18 --- src/tabviews/zshare/automatic/index.jsx | 37 +++++++++++++++++++++++++++---------- 1 files changed, 27 insertions(+), 10 deletions(-) diff --git a/src/tabviews/zshare/automatic/index.jsx b/src/tabviews/zshare/automatic/index.jsx index c020117..951001a 100644 --- a/src/tabviews/zshare/automatic/index.jsx +++ b/src/tabviews/zshare/automatic/index.jsx @@ -9,6 +9,7 @@ class AutoMatic extends Component { static propTpyes = { autoMatic: PropTypes.object, + tabId: PropTypes.string, config: PropTypes.object } @@ -21,10 +22,18 @@ timer = null UNSAFE_componentWillMount() { - const { autoMatic } = this.props + const { autoMatic, tabId } = this.props if (autoMatic.gap && autoMatic.gap >= 1) { this.setState({gap: autoMatic.gap * 1000}) + } + + if (tabId && tabId === sessionStorage.getItem('autoExecId')) { + sessionStorage.removeItem('autoExecId') + + setTimeout(() => { + this.trigger() + }, 10000) } } @@ -180,7 +189,7 @@ } autoMaticOver = (MenuID) => { - const { config, autoMatic } = this.props + const { config, autoMatic, tabId } = this.props if (!this.state.running || MenuID !== config.MenuID) return @@ -189,16 +198,24 @@ if (autoMatic.onFinish !== 'over') { let interval = autoMatic.interval * 1000 || 10 - if (autoMatic.restart === 'first') { - this.setState({line: 1}) + if (autoMatic.restart === 'refresh') { + this.timer = setTimeout(() => { + sessionStorage.setItem('ThirdMenu', tabId) + sessionStorage.setItem('autoExecId', tabId) + window.location.reload() + }, interval) } else { - this.setState({line: this.state.line + 1}) + if (autoMatic.restart === 'first') { + this.setState({line: 1}) + } else { + this.setState({line: this.state.line + 1}) + } + + this.timer = setTimeout(() => { + this.setState({running: true}) + MKEmitter.emit('autoQueryData', config.MenuID, this.state.line) + }, interval) } - - this.timer = setTimeout(() => { - this.setState({running: true}) - MKEmitter.emit('autoQueryData', config.MenuID, this.state.line) - }, interval) } } -- Gitblit v1.8.0