From c7aece35a62b6e91fd98a625bf0e53f64bfbd18d Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 17 八月 2023 16:22:15 +0800 Subject: [PATCH] 2023-08-17 --- src/components/mkIcon/index.jsx | 21 +++++++++++++++++---- 1 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/components/mkIcon/index.jsx b/src/components/mkIcon/index.jsx index 0447f06..529f3a4 100644 --- a/src/components/mkIcon/index.jsx +++ b/src/components/mkIcon/index.jsx @@ -65,7 +65,7 @@ } getIcons = () => { - Api.getSystemConfig({ func: 's_get_icons' }).then(res => { + Api.getCloudConfig({ func: 's_get_icons' }).then(res => { if (!res.status) { notification.warning({ top: 92, @@ -89,13 +89,26 @@ }) } + trigger = () => { + const { selectIcon, cusicons } = this.state + + this.setState({visible: true}) + + if (cusicons.length > 0 && selectIcon && /<svg/.test(selectIcon)) { + setTimeout(() => { + let node = document.getElementById('mk-custom-tab') + node && node.click() + }, 200) + } + } + render() { const { selectIcon, visible, icons, allowClear, cusicons } = this.state return ( <div className="mk-icon-box"> {selectIcon ? <MkIcon type={selectIcon}/> : <span style={{color: '#bcbcbc'}}>璇烽�夋嫨</span>} - <MkIcon className="trigger" onClick={() => this.setState({visible: true})} type="swap"/> + <MkIcon className="trigger" onClick={this.trigger} type="swap"/> {allowClear && selectIcon ? <CloseCircleFilled className="close" onClick={() => this.checkIcon('')}/> : null} <Modal wrapClassName="mk-pop-modal mk-icon-wrap" @@ -118,13 +131,13 @@ </Row> </TabPane> <TabPane tab={ - <span className="tab-control"> + <span className="tab-control" id="mk-custom-tab"> <RedoOutlined onClick={(e) => {this.getIcons()}}/> 鑷畾涔� </span> } key="scripts"> <Row> - {cusicons.map(icon => <Col key={icon.id} span={4} onClick={() => this.checkIcon(icon.icon_svg)}> + {cusicons.map(icon => <Col className={icon.icon_svg === selectIcon ? 'active' : ''} key={icon.id} span={4} onClick={() => this.checkIcon(icon.icon_svg)}> <MkIcon type={icon.icon_svg} /> </Col>)} </Row> -- Gitblit v1.8.0