diff --git a/src/pages/exchangepage/edittemplate/goodstemplate.js b/src/pages/exchangepage/edittemplate/goodstemplate.js index d5e0c9a0..a6f8828d 100644 --- a/src/pages/exchangepage/edittemplate/goodstemplate.js +++ b/src/pages/exchangepage/edittemplate/goodstemplate.js @@ -5,6 +5,7 @@ import './goodstemplate.less' import SearchBarView from './couponConfig/searchBar' //商品详情搜索栏 import BottomBarView from './couponConfig/bottomBar' //底部栏 import {Sweetalert} from 'zent' +import Bus from '@/assets/eventBus.js' export default class edittemplate extends React.Component { constructor(props) { super(props) @@ -30,11 +31,13 @@ export default class edittemplate extends React.Component { } } deleteFn(){ + let selectDom=this.state.selectDom;//需删除组件名称 Sweetalert.confirm({ title:'确认信息', content:

确认删除该模块?

, onConfirm:()=>{ - + this.setState({selectDom:''}); + Bus.emit('componentLibClose',selectDom) }, onCancel:()=>{ @@ -50,14 +53,14 @@ export default class edittemplate extends React.Component {
{ goodsConfig.search&&goodsConfig.search.iswitch? -
this.customComponent(e,'searchBar','marketing-sousuolan-')} className={this.state.selectDom=='searchBar'?'selectBorder':''} ref="searchBar">
:null +
this.customComponent(e,'search','marketing-sousuolan-')} className={this.state.selectDom=='search'?'selectBorder':''} ref="search">
:null } { !goodsConfig.top_image ? : } { - goodsConfig.picture&&goodsConfig.picture.iswitch?
this.customComponent(e,'picBar','marketing-tupian')} ref="picBar" className={this.state.selectDom=='picBar'?'selectBorder':''}>
:null + goodsConfig.picture&&goodsConfig.picture.iswitch?
this.customComponent(e,'picture','marketing-tupian')} ref="picture" className={this.state.selectDom=='picture'?'selectBorder':''}>
:null } { goodsConfig.title&&goodsConfig.title.iswitch?
this.customComponent(e,'title','marketing-fuwenbenkuang')} ref="title" className={this.state.selectDom=='title'?'selectBorder':''}>
{goodsConfig.title.text}
:null @@ -85,7 +88,7 @@ export default class edittemplate extends React.Component { this.state.selectDom?
| - 删除 + 删除
:null } diff --git a/src/pages/exchangepage/edittemplate/main.js b/src/pages/exchangepage/edittemplate/main.js index d5dc3dc6..782fa043 100644 --- a/src/pages/exchangepage/edittemplate/main.js +++ b/src/pages/exchangepage/edittemplate/main.js @@ -169,11 +169,18 @@ export default class edittemplate extends React.Component { this.setState({ model: val }) } componentDidMount() { + //开启 Bus.addListener('componentLib', (prop) => { let coupongoodsConfig = this.state.product_list coupongoodsConfig[prop.name].iswitch= true this.setState({ product_list: coupongoodsConfig }) }) + //关闭 + Bus.addListener('componentLibClose', (prop) => { + let coupongoodsConfig = this.state.product_list + coupongoodsConfig[prop].iswitch= false + this.setState({ product_list: coupongoodsConfig,componentOfconfig: '' }) + }) Bus.addListener('picture', (prop) => { let coupongoodsConfig = this.state.product_list coupongoodsConfig.picture.img = prop