From ab10e496feff0d7de81af939cd7ca1973e1ea220 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期五, 14 一月 2022 18:46:02 +0800 Subject: [PATCH] 2022-01-14 --- src/menu/components/card/cardcomponent/index.jsx | 31 +++++++++++++------------------ 1 files changed, 13 insertions(+), 18 deletions(-) diff --git a/src/menu/components/card/cardcomponent/index.jsx b/src/menu/components/card/cardcomponent/index.jsx index 6dbb4eb..491e76d 100644 --- a/src/menu/components/card/cardcomponent/index.jsx +++ b/src/menu/components/card/cardcomponent/index.jsx @@ -14,7 +14,6 @@ const NormalForm = asyncIconComponent(() => import('@/components/normalform')) const CardCellComponent = asyncComponent(() => import('../cardcellcomponent')) -const CardMenus = asyncComponent(() => import('./menus-wrap')) const CopyComponent = asyncIconComponent(() => import('@/menu/components/share/copycomponent')) const PasteController = asyncIconComponent(() => import('@/components/paste')) @@ -195,7 +194,7 @@ } }) } - return getSettingForm(card.setting, cards.subtype, buttons, card.$cardType, cards.columns) + return getSettingForm(card.setting, cards.subtype, buttons, card.$cardType, cards.columns, card.menus) } updateSetting = (res) => { @@ -221,18 +220,26 @@ }) } + let _card = {...card, setting: res} + + if (res.menus) { + _card.menus = res.menus + + delete res.menus + } + this.setState({ - card: {...card, setting: res} + card: _card }) if (side === 'back' && res.type === 'simple') { this.setState({ side: 'front', - elements: fromJS(card.elements).toJS() + elements: fromJS(_card.elements).toJS() }) } - this.props.updateElement({...card, setting: res}) + this.props.updateElement(_card) } paste = (element, resolve) => { @@ -281,19 +288,9 @@ return } MKEmitter.emit('changeEditMenu', {MenuID: card.setting.menu}) - } else if (card.setting.click === 'menus' && card.menus && card.menus.length > 0 && cards.subtype === 'datacard' && card.$cardType !== 'extendCard' && (appType === 'mob' || appType === 'pc')) { + } else if (card.setting.click === 'menus' && card.menus && card.menus.length > 0 && cards.subtype === 'datacard' && appType) { this.setState({visible: true}) } - } - - updateMenus = (res) => { - const { card } = this.state - - this.setState({ - card: {...card, menus: res} - }) - - this.props.updateElement({...card, menus: res}) } render() { @@ -326,8 +323,6 @@ <NormalForm title="鍗$墖璁剧疆" width={800} update={this.updateSetting} getForms={this.getSettingForms}> <EditOutlined className="edit" title="缂栬緫"/> </NormalForm> - {cards.subtype === 'datacard' && card.$cardType !== 'extendCard' && card.setting.click === 'menus' ? - <CardMenus card={card} updateMenus={this.updateMenus}/> : null} <CopyComponent type="cardcell" card={card}/> <PasteController options={['action', 'customCardElement']} updateConfig={this.paste} /> <FontColorsOutlined className="style" title="璋冩暣鏍峰紡" onClick={this.changeStyle} /> -- Gitblit v1.8.0