diff --git a/src/assets/comm.css b/src/assets/comm.css index 639200ce..d1e42580 100644 --- a/src/assets/comm.css +++ b/src/assets/comm.css @@ -1,147 +1,200 @@ /* flex布局 */ -.dflexaj{ +.dflexaj { display: flex; align-items: center; justify-content: space-between; } -.dflexj{ + +.dflexj { display: flex; justify-content: space-between; } -.dflexajc{ + +.dflexajc { display: flex; align-items: center; justify-content: space-between; flex-direction: column; } -.dflexajcs{ + +.dflexajcs { display: flex; - justify-content:flex-start; + justify-content: flex-start; } -.dflexajce{ + +.dflexajce { display: flex; - justify-content:flex-end; + justify-content: flex-end; } -.dflexac{ + +.dflexac { display: flex; align-items: center; justify-content: center; flex-direction: column; } -.dflexacs{ + +.dflexacs { display: flex; justify-content: flex-start; flex-direction: column; } -.dflexacsa{ + +.dflexacsa { display: flex; justify-content: flex-start; align-items: center; } -.dflexa{ + +.dflexa { display: flex; align-items: center; } -.dfleac{ + +.dfleac { display: flex; justify-content: flex-start; align-items: center; } -.dflexs{ + +.dflexs { display: flex; justify-content: flex-start; flex-direction: column; } + /* 怪异盒子 */ -.boxs{ +.boxs { box-sizing: border-box; } /* 边距 */ -.ml15{ +.ml15 { margin-left: 15px; } -.mr15{ + +.mr15 { margin-right: 15px; } -.mt15{ + +.mt15 { margin-top: 15px; } -.pd24{ + +.pd24 { padding: 24px; } -.pd15{ + +.pd15 { padding: 15px; } -.pdr200{ + +.pdr200 { padding: 200px; } -.pdtrl15{ +.pdtrl15 { padding: 15px 15px 9px; } -.pdtrl20{ + +.pdtrl20 { padding: 20px 20px 14px; } -.mt5{ + +.mt5 { margin-top: 5px; } -.mt24{ - margin-top:24px; + +.mt24 { + margin-top: 24px; } -html,body,h1,h2,h3,h4,h5,h6,p,ul,li,dl,dd,dt,ol,input{ +html, +body, +h1, +h2, +h3, +h4, +h5, +h6, +p, +ul, +li, +dl, +dd, +dt, +ol, +input { padding: 0; margin: 0; } /* 颜色 */ -.col31{ +.col31 { color: #313233; } -.maincenter{ +.maincenter { width: 98%; margin: 0 auto; - min-height:560px; + min-height: 560px; } -@media screen and (min-width:1700px ){ - .maincenter{ + +@media screen and (min-width:1700px) { + .maincenter { min-height: 800px; } } /* 表格状态的图标 */ -.icon{ +.icon { display: inline-block; width: 6px; height: 6px; background: #f00; - border-radius:3px; + border-radius: 3px; vertical-align: middle; /* border: 2px solid rgb(159, 222, 252); */ margin-right: 5px; } -.delfilebtn{ +.delfilebtn { color: #296bef; cursor: pointer; } -.fz16{ + +.fz16 { font-size: 16px; } -.fz12{ - font-size: 12px!important; + +.fz12 { + font-size: 12px !important; } -.center{ + +.center { text-align: center; } -.left{ + +.left { text-align: left; } -.right{ + +.right { text-align: right; } -.square{ + +.square { border-radius: 0px !important; +} + +.mini { + font-size: 12px; +} + +.standard { + font-size: 14px; +} + +.big { + font-size: 16px; } \ No newline at end of file diff --git a/src/components/UseCouponAddEdit/index.jsx b/src/components/UseCouponAddEdit/index.jsx index 7c4a3134..42885562 100644 --- a/src/components/UseCouponAddEdit/index.jsx +++ b/src/components/UseCouponAddEdit/index.jsx @@ -241,6 +241,14 @@ const UseCouponAddEdit = forwardRef((props, ref) => { const onReturn = () => {}; const onChangeCombinedDate = (e) => { setForm_info_data({ date_time: e }); + // 传入时间 + sessionStorage.setItem( + "knockGold_effectDate", + JSON.stringify({ + begin_time: e[0], + end_time: e[1], + }) + ); }; const onDisabledRange = (date, type) => { let disabled = false; @@ -358,7 +366,7 @@ const UseCouponAddEdit = forwardRef((props, ref) => { // 优惠券弹窗 提交 const scopePopSubmit = (data) => { - console.log("scopePopSubmit =>", data); + // console.log("scopePopSubmit =>", data); }; return ( diff --git a/src/components/UseGoodsScopePop/index.jsx b/src/components/UseGoodsScopePop/index.jsx index a925cd0f..8183eb36 100644 --- a/src/components/UseGoodsScopePop/index.jsx +++ b/src/components/UseGoodsScopePop/index.jsx @@ -34,10 +34,17 @@ const UseGoodsScopePop = forwardRef((props, ref) => { try { if (visible) { - if (type === "addProduct") { - scope_table_data = sessionStorage.getItem("productData"); + scope_table_data = sessionStorage.getItem("productData"); + if (scope_table_data) { + scope_table_data = JSON.parse(scope_table_data); } - submit(JSON.parse(scope_table_data)); + // 第二步: 数据格式化 + if (type === "addProduct") { + } + console.log("提交数据 =>", scope_table_data); + + // submit(JSON.parse(scope_table_data)); + onClose(); } } catch (err) { console.log("err =>", err); diff --git a/src/pages/coupon/list/index.jsx b/src/pages/coupon/list/index.jsx index e3db2844..42771a62 100644 --- a/src/pages/coupon/list/index.jsx +++ b/src/pages/coupon/list/index.jsx @@ -190,6 +190,7 @@ const UseCouponList = () => { ]; sessionStorage.setItem("breaknav", JSON.stringify(activerou)); + sessionStorage.setItem("productData", ""); history.push("/home/coupon-add-edit"); }; const selectionFun = () => {}; diff --git a/src/pages/exchangepage/couponTemplate/goodsPage/config/title.js b/src/pages/exchangepage/couponTemplate/goodsPage/config/title.js index 019897ff..6e3c52fe 100644 --- a/src/pages/exchangepage/couponTemplate/goodsPage/config/title.js +++ b/src/pages/exchangepage/couponTemplate/goodsPage/config/title.js @@ -12,7 +12,7 @@ export default class Title extends React.Component { super(props) this.state = { switch:false, - text: 'circular', + text: '', textAlign: 'left', fontColor: '#333', fontSize: 1 @@ -25,162 +25,32 @@ export default class Title extends React.Component { this.setState({ text, textAlign, fontColor, fontSize }); } } - onListChange(e) { - let model = this.state.model; - model.list = e.target.value; - this.setState({ model: model }) - this.props.setarrayType(e.target.value); + + + //文字格式 + textAlignChange(e) { + this.setState({ textAlign: e.target.value }) + Bus.emit('titleAlign',e.target.value) } - //活动说明 - onactivityChange(e) { - let model1 = this.state.model; - model1.describe.type = e.target.value; - this.setState({ model: model1 }) - this.props.setactiveType(e.target.value); - } - hasItemFn(c) { - let model1 = this.state.model; - if (c == model1.describe.type) { - model1.describe.type = ''; - this.setState({ model: model1 }); - this.props.setactiveType(''); - } - } - - //顶部banner - onUploadChange(files) { - if (files.length > 0 && files[0].status == "success") { - let model = this.state.model; - model.top_image = files[0].src; - this.setState({ model: model }) - this.props.setbanner(files[0].src); - } else { - let model = this.state.model; - model.top_image = ''; - this.setState({ model: model }) - this.props.setbanner(""); - } - }; - - //悬浮富文本 - getsusEditext(c) { - let model1 = this.state.model; - model1.describe.content = c; - this.setState({ model: model1 }); - this.props.seteditorHtml(c); - } - //富文本 - getEditext(c) { - let model1 = this.state.model; - model1.describe.content = c; - this.setState({ model: model1 }); - this.props.seteditorHtml(c); - } - - //底部描述图 - onUploadChange2(files) { - if (files.length > 0 && files[0].status == "success") { - let model1 = this.state.model; - model1.describe.bg_image = files[0].src; - this.setState({ model: model1 }) - this.props.setbottomImg(files[0].src); - } else { - let model1 = this.state.model; - model1.describe.bg_image = ''; - this.setState({ model: model1 }) - this.props.setbottomImg(""); - } - }; - - - - onUploadError = (type, data) => { - if (type === 'overMaxAmount') { - Notify.error(`最多可上传 ${data.maxAmount} 张图片`); - } else if (type === 'overMaxSize') { - Notify.error(`图片大小不能超过 ${data.formattedMaxSize}`); - } - }; - handleChange = (color) => { - let model1 = this.state.model; - model1.font_color = color; - this.setState({ - model: model1 - }); - this.props.setButtonbgcolor(color); - - } handleChange1 = (color) => { - let model1 = this.state.model; - model1.button_color = color; this.setState({ - model: model1 + fontColor: color }); - this.props.setButtoncolor(color); + Bus.emit('fontColor',color) } // 字体颜色 fontcolor(cor) { - let models = this.state.model; - models.button_color = cor; - this.setState({ model: models }); - this.props.setButtoncolor(cor); + this.setState({ fontColor: cor }); + Bus.emit('fontColor', cor) } - // 背景颜色 - bgcolor(cor) { - let models = this.state.model; - models.font_color = cor; - this.setState({ model: models }); - this.props.setButtonbgcolor(cor); + fontSizeChange(e) { + this.setState({ fontSize: e.target.value }) + Bus.emit('fontSize', e.target.value) } - onUpload = (file, report) => { - let self = this; - console.log('上传头像', file); - return new Promise((resolve, reject) => { - let path = "" - let formdata = new FormData(); - formdata.append("file", file) - formdata.append("path", "common_image") - uploadImg(formdata).then((res) => { - handelResponse(res, (req, msg) => { - path = req.path; - - }, (err) => { - reject(); - }) - }); - - let count = 0; - const update = () => { - if (path) { - - resolve( - path - ); - - } - else { - - if (count < 100) { - count += 2; - report(count); - setTimeout(update, 500); - console.log("上传中") - } - else { - - reject(); - } - } - - - }; - setTimeout(update, 500); - }); - - }; + componentWillUnmount() { let oldobj = JSON.parse(sessionStorage.getItem('editorConfig')); let couponList = oldobj.couponList; @@ -197,42 +67,41 @@ export default class Title extends React.Component {
- + { - this.setState({ model: model2 }) - this.props.settitle(e) + this.setState({ text: e }) + Bus.emit('title', e) }} onClearItem={(e) => { - let model2 = this.state.model; - model2.title = ""; - this.setState({ model: model2 }) + this.setState({ text: '' }) + Bus.emit('title', '') }} - value={this.state.model.title} placeholder={"请输入"} labelWidth={'0px'} maxLength={12} height={'36px'} width={'300px'} alignment={'left'} /> + value={this.state.text} placeholder={"请输入"} labelWidth={'0px'} maxLength={12} height={'36px'} width={'300px'} alignment={'left'} /> - - { this.onactivityChange(e) }} value={this.state.model.describe.type}> - this.hasItemFn(1)} value={"1"}>居左 - this.hasItemFn(2)} value={"2"}>居中 - this.hasItemFn(2)} value={"2"}>居右 + + { this.textAlignChange(e) }} value={this.state.textAlign}> + 居左 + 居中 + 居右 - +
- { this.fontcolor('#f0f') }}> - { this.fontcolor('#04C160') }}> - { this.fontcolor('#AE99D3') }}> - { this.fontcolor('#FACD6A') }}> - { this.fontcolor('#FE7962') }}> + { this.fontcolor('#fff') }}> + { this.fontcolor('#04C160') }}> + { this.fontcolor('#AE99D3') }}> + { this.fontcolor('#FACD6A') }}> + { this.fontcolor('#FE7962') }}>
- +
- - { this.onactivityChange(e) }} value={this.state.model.describe.type}> - this.hasItemFn(1)} value={"1"}>A- - this.hasItemFn(2)} value={"2"}>A - this.hasItemFn(2)} value={"2"}>A+ + + { this.fontSizeChange(e) }} value={this.state.fontSize}> + A- + A + A+ diff --git a/src/pages/exchangepage/edittemplate/goodstemplate.js b/src/pages/exchangepage/edittemplate/goodstemplate.js index ce7c3983..a025b1f3 100644 --- a/src/pages/exchangepage/edittemplate/goodstemplate.js +++ b/src/pages/exchangepage/edittemplate/goodstemplate.js @@ -13,28 +13,31 @@ export default class edittemplate extends React.Component { render() { let goodsConfig=this.props.goodsdata; return ( -
+
{ goodsConfig.search?:null } { - !this.props.goodsdata.top_image ? : + !goodsConfig.top_image ? : } { - this.props.goodsdata.picture? :null + goodsConfig.picture? :null } { - this.props.goodsdata.list == 2 ? : this.props.goodsdata.list == 3 ? : + goodsConfig.title?
{goodsConfig.title.text}
:null } { - this.props.goodsdata.list == 2 ? : null + goodsConfig.list == 2 ? : goodsConfig.list == 3 ? : } { - this.props.goodsdata.describe.type == 1 ? : this.props.goodsdata.describe.type == 3 ?
: null + goodsConfig.list == 2 ? : null } { - this.props.goodsdata.describe.type == 2 ? : null + goodsConfig.describe.type == 1 ? : goodsConfig.describe.type == 3 ?
: null + } + { + goodsConfig.describe.type == 2 ? : null }
) diff --git a/src/pages/exchangepage/edittemplate/goodstemplate.less b/src/pages/exchangepage/edittemplate/goodstemplate.less index f99e0b55..654fde35 100644 --- a/src/pages/exchangepage/edittemplate/goodstemplate.less +++ b/src/pages/exchangepage/edittemplate/goodstemplate.less @@ -16,6 +16,14 @@ width:100%; height: 187px; } + >.content-title{ + position: relative; + z-index: 999; + height: 40px; + line-height: 40px; + margin-bottom: 50px; + padding:0 13px; + } >.goodsPic,>.goodsPicMatrax{ width:349px; height: 195px; diff --git a/src/pages/exchangepage/edittemplate/main.js b/src/pages/exchangepage/edittemplate/main.js index e0d6803a..7750301a 100644 --- a/src/pages/exchangepage/edittemplate/main.js +++ b/src/pages/exchangepage/edittemplate/main.js @@ -71,23 +71,23 @@ let couponProduct_list = { font_color: '#ffffff', button_color: '#FACD6A', describe: { type: '', content: '', bg_image: '' }, - picture:{ - img:'', - jumpType:'0',//0不跳转 1跳转 - jumpUrl:'' + picture: { + img: '', + jumpType: '0',//0不跳转 1跳转 + jumpUrl: '' }, - backgroundImg:{ - bgImg:'' + backgroundImg: { + bgImg: '' }, - search:{ - switch:false, - shape:'circular', - textAlign:'left', - borderColor:'#333', - placeholder:'请输入关键字搜索' + search: { + switch: false, + shape: 'circular', + textAlign: 'left', + borderColor: '#333', + placeholder: '请输入关键字搜索' }, - title:{ - switch:false, + title: { + switch: false, text: 'circular', textAlign: 'left', fontColor: '#333', @@ -101,7 +101,7 @@ export default class edittemplate extends React.Component { mouldType: 1,//区分是系统模板还是落地页 0-系统模板 1-落地页新增 2-落地页编辑 activeshow: true, //控制商品列表页活动说明显示与否 loading_visible: false,//保存加载效果 - componentOfconfig:'',//选择组件库 + componentOfconfig: '',//选择组件库 detailactiveshow: true, pagedisable: false, showType: 3, //兑换码/白名单/立减金 @@ -159,6 +159,27 @@ export default class edittemplate extends React.Component { searchConfig.search.borderColor = prop this.setState({ product_list: searchConfig }) }) + //标题设置 + Bus.addListener('title', (prop) => { + let titleConfig = this.state.product_list + titleConfig.title.text = prop + this.setState({ product_list: titleConfig }) + }) + Bus.addListener('titleAlign', (prop) => { + let titleConfig = this.state.product_list + titleConfig.title.textAlign = prop + this.setState({ product_list: titleConfig }) + }) + Bus.addListener('fontColor', (prop) => { + let titleConfig = this.state.product_list + titleConfig.title.fontColor = prop + this.setState({ product_list: titleConfig }) + }) + Bus.addListener('fontSize', (prop) => { + let titleConfig = this.state.product_list + titleConfig.title.fontSize = prop + this.setState({ product_list: titleConfig }) + }) setTimeout(() => { let img = document.getElementById('center-img') let center = document.getElementById('center') @@ -212,7 +233,7 @@ export default class edittemplate extends React.Component { } whiteList['land'].title = newEditor.title whiteList['land'].sort = newEditor.sort - //优惠券 + //优惠券 let couponList = newEditor.couponList if (!couponList) { couponList = {} @@ -224,7 +245,7 @@ export default class edittemplate extends React.Component { couponList['land'].sort = newEditor.sort newEditor.exchangeList = exchangeList newEditor.whiteList = whiteList - newEditor.couponList=couponList; + newEditor.couponList = couponList; if (template == 1) { //1-白名单 2-兑换码 this.setState({ model: newEditor.whiteList.land, @@ -243,7 +264,7 @@ export default class edittemplate extends React.Component { this.setState({ pagedisable: true }) } } else {//新增数据 - let obj = {}, whiteList = {}, exchangeList = {},couponList = {} + let obj = {}, whiteList = {}, exchangeList = {}, couponList = {} let sourceObj = {//模板数据结构 land: model, product_list, @@ -251,7 +272,7 @@ export default class edittemplate extends React.Component { } let sourcecouponObj = {//模板数据结构 land: model, - product_list:couponProduct_list, + product_list: couponProduct_list, product_detail } whiteList = _.cloneDeep(sourceObj); @@ -532,7 +553,7 @@ export default class edittemplate extends React.Component { let exchangeData = editorData.exchangeList let { land, product_list, product_detail } = exchangeData; this.setState({ model: land, product_list, product_detail }) - }else if (e.target.value == 2) { + } else if (e.target.value == 2) { let couponData = editorData.couponList let { land, product_list, product_detail } = couponData; this.setState({ model: land, product_list, product_detail }) @@ -666,8 +687,8 @@ export default class edittemplate extends React.Component { } } //组件名 - componentName(c){ - this.setState({componentOfconfig:c}); + componentName(c) { + this.setState({ componentOfconfig: c }); } render() { return ( @@ -732,8 +753,8 @@ export default class edittemplate extends React.Component { } /> ) : ( - - )} + + )}
{!this.state.model.middle_image ? ( @@ -744,8 +765,8 @@ export default class edittemplate extends React.Component { } /> ) : ( - - )} + + )} {this.state.showType == 1 ? ( ) : ( - - )} + + )}
{this.state.model.describe && this.state.model.describe.bg_image ? ( - - ) : null} + + ) : null}

商品列表页:

this.activeChoice(2)} - + className={ this.state.activeNavStatus == 2 ? 'activeNav thumbheader' : 'thumbheader' }> -
- { - this.state.product_list.search?:null - } +
+ { + this.state.product_list.search ? : null + } ) : ( - - )} - { - this.state.product_list.picture? :null - } + + )} + { + this.state.product_list.picture ? : null + } + { + this.state.product_list.title ?
{this.state.product_list.title.text}
: null + } {this.state.product_list.list == 2 ? ( ) : ( - - )} + + )} {this.state.product_list.list == 2 ? (
- {/* 组件库 */} - { - this.state.showType==2&&this.state.activeNavStatus==2? this.componentName(c)}/>:null - } + {/* 组件库 */} + { + this.state.showType == 2 && this.state.activeNavStatus == 2 ? this.componentName(c)} /> : null + }
- +
-
+
{this.state.activeNavStatus == 1 ? (
) : ( -
- - -
- )} +
+ + +
+ )}
) : ( - - )} + + )}
{!this.state.model.middle_image ? ( @@ -1024,12 +1048,12 @@ export default class edittemplate extends React.Component { } /> ) : ( - - )} + + )} {this.state.showType == 1 ? ( ) : ( - - )} + + )}
@@ -1054,29 +1078,29 @@ export default class edittemplate extends React.Component { this.state.model.describe.type == 0 ? null : this.state .model.describe && this.state.model.describe.type == 1 ? ( - - ) : ( -
- {this.state.model.describe && - this.state.model.describe.bg_image ? ( - ) : null} - {this.state.model.describe && - this.state.model.describe.content ? ( -
- ) : null} -
- )} + ) : ( +
+ {this.state.model.describe && + this.state.model.describe.bg_image ? ( + + ) : null} + {this.state.model.describe && + this.state.model.describe.content ? ( +
+ ) : null} +
+ )}
@@ -1085,49 +1109,49 @@ export default class edittemplate extends React.Component { {this.state.activeNavStatus != 2 ? null : this.state.activeshow && this.state.product_list.describe.type == 2 && this.state.product_list.describe.content ? ( - this.showactiveIcon(c)} - goodsdata={this.state.product_list} - /> - ) : ( - this.setState({ activeshow: true })} - goodsdata={this.state.product_list} - /> - )} + this.showactiveIcon(c)} + goodsdata={this.state.product_list} + /> + ) : ( + this.setState({ activeshow: true })} + goodsdata={this.state.product_list} + /> + )} {this.state.activeNavStatus != 3 ? null : this.state .detailactiveshow && this.state.product_detail.describe.type == 2 && this.state.product_detail.describe.content ? ( - this.showactivedetail(c)} - goodsdata={this.state.product_detail} - /> - ) : ( -
-
- { - this.ondetailTypeChange(e) - }} - value={this.state.detailType}> - - 权益 + this.showactivedetail(c)} + goodsdata={this.state.product_detail} + /> + ) : ( +
+
+ { + this.ondetailTypeChange(e) + }} + value={this.state.detailType}> + + 权益 - - 立减金 + + 立减金 - + +
+ { + this.state.detailType == 1 ? this.setState({ detailactiveshow: true })} + detaildata={this.state.product_detail} + /> : + }
- { - this.state.detailType == 1 ? this.setState({ detailactiveshow: true })} - detaildata={this.state.product_detail} - /> : - } -
- )} + )}
{ - this.state.showType!=2?( + this.state.showType != 2 ? (
- {this.state.activeNavStatus == 1 ? ( -

落地页设置

- ) : this.state.activeNavStatus == 2 ? ( -

商品列表页设置

- ) : ( -

商品详情页设置

- )} -
- ):null + {this.state.activeNavStatus == 1 ? ( +

落地页设置

+ ) : this.state.activeNavStatus == 2 ? ( +

商品列表页设置

+ ) : ( +

商品详情页设置

+ )} +
+ ) : null } {this.state.showType == 3 ? ( this.state.activeNavStatus == 1 ? ( @@ -1183,7 +1207,7 @@ export default class edittemplate extends React.Component { setdetailftc={(c) => this.getdetailfont_color(c)} /> ) : - ) :this.state.showType==1? this.state.activeNavStatus == 1 ? ( + ) : this.state.showType == 1 ? this.state.activeNavStatus == 1 ? ( this.getTitle(c)} @@ -1216,7 +1240,7 @@ export default class edittemplate extends React.Component { setbottomImg={(c) => this.getbottomimgFn(c)} setdetailftc={(c) => this.getdetailfont_color(c)} /> - ) : :this.state.activeNavStatus == 1 ? (//优惠券 + ) : : this.state.activeNavStatus == 1 ? (//优惠券 this.getTitle(c)} landbgcolor={(c) => this.getlandbgcolor(c)} diff --git a/src/pages/exchangepage/edittemplate/main.less b/src/pages/exchangepage/edittemplate/main.less index a869306b..1dd00d87 100644 --- a/src/pages/exchangepage/edittemplate/main.less +++ b/src/pages/exchangepage/edittemplate/main.less @@ -599,6 +599,15 @@ width: 100%; height: 70px; } + >.content-title{ + position: relative; + z-index: 999; + height: 20px; + line-height:20px; + margin-bottom: 20px; + padding:0 8px; + font-size: 8px; + } .searchBar{ transform: scale(0.8); font-size: 10px;