From 809987a63ced6f35a7d37623af33bdba31ca6c93 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期六, 08 十月 2022 15:24:03 +0800 Subject: [PATCH] 2022-10-08 --- src/tabviews/custom/index.jsx | 28 +++++++++++++++++++--------- 1 files changed, 19 insertions(+), 9 deletions(-) diff --git a/src/tabviews/custom/index.jsx b/src/tabviews/custom/index.jsx index 669e36e..4e1324e 100644 --- a/src/tabviews/custom/index.jsx +++ b/src/tabviews/custom/index.jsx @@ -65,7 +65,6 @@ data: null, // 鍒楄〃鏁版嵁闆� loading: false, // 鍒楄〃鏁版嵁鍔犺浇涓� visible: false, // 鏍囩椤垫帶鍒� - treevisible: false, // 鑿滃崟缁撴瀯鏍戝脊妗嗘樉绀洪殣钘忔帶鍒� shortcuts: null // 蹇嵎閿� } @@ -210,7 +209,7 @@ this.setState({ BID: BID, - shortcuts, + shortcuts: shortcuts.length > 0 ? shortcuts : null, config, mainSearch }, () => { @@ -246,11 +245,6 @@ setShortcut = () => { const { shortcuts } = this.state - if (!shortcuts || shortcuts.length === 0) { - document.onkeydown = () => {} - return - } - document.onkeydown = (event) => { let e = event || window.event let keyCode = e.keyCode || e.which || e.charCode @@ -265,8 +259,18 @@ } if (!preKey || !keyCode) return - + let _shortcut = `${preKey}+${keyCode}` + + if (window.GLOB.breakpoint && _shortcut === 'ctrl+67') { + window.debugger = false + window.GLOB.breakpoint = false + sessionStorage.removeItem('breakpoint') + + MKEmitter.emit('debugChange') + } + + if (!shortcuts) return shortcuts.some(item => { if (item.$shortcut === _shortcut) { @@ -1151,6 +1155,7 @@ } componentDidMount () { + MKEmitter.addListener('debugChange', this.debugChange) MKEmitter.addListener('reloadMenuView', this.reloadMenuView) MKEmitter.addListener('resetActiveMenu', this.resetActiveMenu) } @@ -1162,11 +1167,16 @@ this.setState = () => { return } + MKEmitter.removeListener('debugChange', this.debugChange) MKEmitter.removeListener('reloadMenuView', this.reloadMenuView) MKEmitter.removeListener('resetActiveMenu', this.resetActiveMenu) window.GLOB.CacheData.delete(this.props.MenuID) this.deleteCache(this.state.config.components) + } + + debugChange = () => { + this.setState({visible: !this.state.visible}) } deleteCache = (components) => { @@ -1368,7 +1378,7 @@ <Row className="component-wrap">{this.getComponents()}</Row> {config && window.GLOB.breakpoint ? <DebugTable /> : null} {!window.GLOB.mkHS && window.GLOB.systemType !== 'production' ? <PagemsgComponent menu={{MenuName: this.props.MenuName, MenuNo: this.props.MenuNo}} config={config} dict={this.state.dict} /> : null} - {!window.GLOB.mkHS && shortcuts ? <SettingComponent config={config} dict={this.state.dict} shortcuts={shortcuts}/> : null} + {!window.GLOB.mkHS && config ? <SettingComponent config={config} dict={this.state.dict} shortcuts={shortcuts || []}/> : null} {viewlost ? <NotFount msg={this.state.lostmsg} /> : null} </div> ) -- Gitblit v1.8.0