| | |
| | | oriConfig: null, |
| | | openEdition: '', |
| | | config: null, |
| | | customComponents: [] |
| | | } |
| | | |
| | | UNSAFE_componentWillMount() { |
| | |
| | | componentDidMount () { |
| | | MKEmitter.addListener('delButtons', this.delButtons) |
| | | MKEmitter.addListener('submitComponentStyle', this.updateComponentStyle) |
| | | MKEmitter.addListener('updateCustomComponent', this.updateCustomComponent) |
| | | this.updateCustomComponent() |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | |
| | | } |
| | | MKEmitter.removeListener('delButtons', this.delButtons) |
| | | MKEmitter.removeListener('submitComponentStyle', this.updateComponentStyle) |
| | | MKEmitter.removeListener('updateCustomComponent', this.updateCustomComponent) |
| | | } |
| | | |
| | | updateCustomComponent = () => { |
| | | Api.getSystemConfig({ |
| | | func: 's_get_custom_components', |
| | | typecharone: '' |
| | | }).then(res => { |
| | | let coms = [] |
| | | if (res.cus_list && res.cus_list.length > 0) { |
| | | res.cus_list.forEach(item => { |
| | | let config = '' |
| | | |
| | | try { |
| | | config = JSON.parse(window.decodeURIComponent(window.atob(item.long_param))) |
| | | } catch (e) { |
| | | console.warn('Parse Failure') |
| | | config = '' |
| | | } |
| | | |
| | | if (!config || !item.c_name) return |
| | | |
| | | coms.push({ |
| | | type: 'menu', |
| | | title: item.c_name, |
| | | url: item.images, |
| | | component: config.type, |
| | | subtype: config.subtype, |
| | | config |
| | | }) |
| | | }) |
| | | } |
| | | this.setState({customComponents: coms}) |
| | | }) |
| | | } |
| | | |
| | | updateComponentStyle = (parentId, keys, style) => { |
| | |
| | | |
| | | render () { |
| | | const { btn } = this.props |
| | | const { activeKey, MenuType, dict, config, menuloading } = this.state |
| | | const { activeKey, MenuType, dict, config, menuloading, customComponents } = this.state |
| | | |
| | | return ( |
| | | <DndProvider backend={HTML5Backend}> |
| | |
| | | <Panel header={dict['mob.component']} key="component"> |
| | | <SourceWrap MenuType={MenuType} /> |
| | | </Panel> |
| | | {customComponents && customComponents.length ? <Panel header="自定义组件" key="cuscomponent"> |
| | | <SourceWrap components={customComponents} MenuType={MenuType} /> |
| | | </Panel> : null} |
| | | <Panel header={'背景'} key="background"> |
| | | {config ? <BgController config={config} updateConfig={this.updateConfig} /> : null} |
| | | </Panel> |