| | |
| | | } |
| | | |
| | | componentDidMount() { |
| | | if (!window.GLOB.designView) { |
| | | if (sessionStorage.getItem('systemIcons')) { |
| | | this.setState({cusicons: JSON.parse(sessionStorage.getItem('systemIcons'))}) |
| | | } else { |
| | | this.getIcons() |
| | | } |
| | | if (!window.GLOB.designView && window.GLOB.systemIcons) { |
| | | this.setState({cusicons: window.GLOB.systemIcons}) |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | getIcons = () => { |
| | | Api.getSystemConfig({ func: 's_get_icons' }).then(res => { |
| | | const { selectIcon } = this.state |
| | | |
| | | Api.getCloudConfig({ func: 's_get_icons' }).then(res => { |
| | | if (!res.status) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: res.message, |
| | | duration: 5 |
| | | }) |
| | | sessionStorage.setItem('systemIcons', JSON.stringify([])) |
| | | return |
| | | } else if (!res.data) { |
| | | window.GLOB.systemIcons = [] |
| | | return |
| | | } |
| | | |
| | | let icons = res.data.map(item => { |
| | | let icons = (res.data || []).map(item => { |
| | | item.icon_svg = window.decodeURIComponent(window.atob(item.icon_svg)) |
| | | return item |
| | | }) |
| | | |
| | | sessionStorage.setItem('systemIcons', JSON.stringify(icons)) |
| | | window.GLOB.systemIcons = icons |
| | | |
| | | this.setState({cusicons: icons}) |
| | | |
| | | if (icons.length > 0 && selectIcon && /<svg/.test(selectIcon)) { |
| | | setTimeout(() => { |
| | | let node = document.getElementById('mk-custom-tab') |
| | | node && node.click() |
| | | }, 200) |
| | | } |
| | | }) |
| | | } |
| | | |
| | |
| | | |
| | | this.setState({visible: true}) |
| | | |
| | | if (cusicons.length > 0 && selectIcon && /<svg/.test(selectIcon)) { |
| | | if (!window.GLOB.designView && !window.GLOB.systemIcons) { |
| | | this.getIcons() |
| | | } else if (cusicons.length > 0 && selectIcon && /<svg/.test(selectIcon)) { |
| | | setTimeout(() => { |
| | | let node = document.getElementById('mk-custom-tab') |
| | | node && node.click() |