This commit is contained in:
zhangds 2022-09-16 15:36:02 +08:00
commit d4b062df7e
15 changed files with 251 additions and 204 deletions

View File

@ -100,6 +100,8 @@ const menu={
case 3:return '兑换码';break;
case 1:return '白名单';break;
case 2:return '立减金';break;
case 4:return '优惠券';break;
case 8:return '优惠券白名单';break;
}
},
pageTypeStatusBg(params) {
@ -107,6 +109,8 @@ const menu={
case 1:return '#ffaa00';break;
case 2:return '#e64c00';break;
case 3:return '#55aaff';break;
case 4:return '#79AF83';break;
case 8:return '#F2A505';break;
}
},
keysStatus(params) {

View File

@ -18,8 +18,8 @@ export default class edittemplate extends React.Component {
componentWillMount(e) {
let config = JSON.parse(sessionStorage.getItem('editorConfig'));
if (config && config.couponList && config.couponList.product_list) {
let { bgimg } = config.couponList.product_list.backgroundImg;
if (config && config.coupon && config.coupon.product_list) {
let { bgimg } = config.coupon.product_list.backgroundImg;
this.setState({ bgimg });
}
}
@ -102,9 +102,9 @@ export default class edittemplate extends React.Component {
componentWillUnmount() {
let oldobj = JSON.parse(sessionStorage.getItem('editorConfig'));
let couponList = oldobj.couponList;
couponList.product_list.backgroundImg = _.cloneDeep(this.state);
oldobj.couponList = couponList;
let coupon = oldobj.coupon;
coupon.product_list.backgroundImg = _.cloneDeep(this.state);
oldobj.coupon = coupon;
sessionStorage.setItem('editorConfig', JSON.stringify(oldobj));
}
render() {

View File

@ -13,7 +13,7 @@ export default class edittemplate extends React.Component {
constructor(props) {
super(props)
this.state = {
iswitch:false,
iswitch:true,
comType:1,
navlist:[
{
@ -53,9 +53,14 @@ export default class edittemplate extends React.Component {
}
}
componentWillMount(e) {
Bus.addListener('componentLibClose', (prop) => {
if(prop=='bottomBar'){
this.setState({iswitch:false})
}
})
let config = JSON.parse(sessionStorage.getItem('editorConfig'));
if (config && config.couponList && config.couponList.product_list) {
let { navlist, defaultText, selectText, background,iswitch } = config.couponList.product_list.bottomBar;
if (config && config.coupon && config.coupon.product_list) {
let { navlist, defaultText, selectText, background,iswitch } = config.coupon.product_list.bottomBar;
this.setState({ navlist, defaultText, selectText, background,iswitch });
}
}
@ -169,9 +174,9 @@ export default class edittemplate extends React.Component {
};
componentWillUnmount() {
let oldobj = JSON.parse(sessionStorage.getItem('editorConfig'));
let couponList = oldobj.couponList;
couponList.product_list.bottomBar = _.cloneDeep(this.state);
oldobj.couponList = couponList;
let coupon = oldobj.coupon;
coupon.product_list.bottomBar = _.cloneDeep(this.state);
oldobj.coupon = coupon;
sessionStorage.setItem('editorConfig', JSON.stringify(oldobj));
}
render() {

View File

@ -25,8 +25,8 @@ export default class edittemplate extends React.Component {
}
componentWillMount(e) {
let config = JSON.parse(sessionStorage.getItem('editorConfig'));
if (config && config.couponList && config.couponList.product_list) {
this.setState({ model: config.couponList.product_list });
if (config && config.coupon && config.coupon.product_list) {
this.setState({ model: config.coupon.product_list });
}
}
onListChange(e) {
@ -187,15 +187,15 @@ export default class edittemplate extends React.Component {
};
componentWillUnmount() {
let oldobj = JSON.parse(sessionStorage.getItem('editorConfig'));
if (oldobj && oldobj.couponList) {
let couponList = oldobj.couponList
couponList.product_list = this.state.model;
oldobj.couponList = couponList;
if (oldobj && oldobj.coupon) {
let coupon = oldobj.coupon
coupon.product_list = this.state.model;
oldobj.coupon = coupon;
} else {
oldobj = {}
let couponList = {}
couponList.product_list = this.state.model;
oldobj.couponList = couponList;
let coupon = {}
coupon.product_list = this.state.model;
oldobj.coupon = coupon;
}
sessionStorage.setItem('editorConfig', JSON.stringify(oldobj));
}

View File

@ -11,19 +11,22 @@ export default class edittemplate extends React.Component {
constructor(props) {
super(props)
this.state = {
iswitch:false,
iswitch:true,
img:'',
jumpType:'0',//0不跳转 1跳转
jumpUrl:''
}
}
componentWillMount(e) {
Bus.addListener('componentLibClose', (prop) => {
if(prop=='picture'){
this.setState({iswitch:false})
}
})
let config = JSON.parse(sessionStorage.getItem('editorConfig'));
if (config && config.couponList && config.couponList.product_list) {
let {img,jumpType,jumpUrl,iswitch}=config.couponList.product_list.picture;
console.log(21,config.couponList.product_list.picture);
this.setState({ img,jumpType,jumpUrl,iswitch});
if (config && config.coupon && config.coupon.product_list) {
let {img,jumpType,jumpUrl}=config.coupon.product_list.picture;
this.setState({ img,jumpType,jumpUrl});
}
}
@ -97,13 +100,14 @@ export default class edittemplate extends React.Component {
};
componentWillUnmount() {
let oldobj = JSON.parse(sessionStorage.getItem('editorConfig'));
let couponList = oldobj.couponList;
couponList.product_list.picture = _.cloneDeep(this.state);
oldobj.couponList = couponList;
let coupon = oldobj.coupon;
console.log(105,this.state);
coupon.product_list.picture = _.cloneDeep(this.state);
oldobj.coupon = coupon;
sessionStorage.setItem('editorConfig', JSON.stringify(oldobj));
}
render() {
console.log(105,this.state);
return (
<div className="assembly">
<div className='control page-title-control'>

View File

@ -11,7 +11,7 @@ export default class Searchbar extends React.Component {
constructor(props) {
super(props)
this.state = {
switch:false,
iswitch:true,
shape: 'circular',
textAlign: 'center',
borderColor: '#333',
@ -21,9 +21,16 @@ export default class Searchbar extends React.Component {
}
}
componentWillMount(e) {
//关闭
Bus.addListener('componentLibClose', (prop) => {
console.log(999,prop);
if(prop=='search'){
this.setState({iswitch:false})
}
})
let config = JSON.parse(sessionStorage.getItem('editorConfig'));
if (config && config.couponList && config.couponList.product_list) {
let { shape, textAlign, borderColor, placeholder } = config.couponList.product_list.search;
if (config && config.coupon && config.coupon.product_list) {
let { shape, textAlign, borderColor, placeholder } = config.coupon.product_list.search;
this.setState({ shape, textAlign, borderColor, placeholder });
}
}
@ -72,9 +79,9 @@ export default class Searchbar extends React.Component {
}
componentWillUnmount() {
let oldobj = JSON.parse(sessionStorage.getItem('editorConfig'));
let couponList = oldobj.couponList;
couponList.product_list.search = _.cloneDeep(this.state);
oldobj.couponList = couponList;
let coupon = oldobj.coupon;
coupon.product_list.search = _.cloneDeep(this.state);
oldobj.coupon = coupon;
sessionStorage.setItem('editorConfig', JSON.stringify(oldobj));
}
render() {

View File

@ -11,7 +11,7 @@ export default class Title extends React.Component {
constructor(props) {
super(props)
this.state = {
switch:false,
switch:true,
text: '商品标题',
textAlign: 'left',
fontColor: '#333',
@ -21,9 +21,15 @@ export default class Title extends React.Component {
}
}
componentWillMount(e) {
Bus.addListener('componentLibClose', (prop) => {
console.log(999,prop);
if(prop=='title'){
this.setState({iswitch:false})
}
})
let config = JSON.parse(sessionStorage.getItem('editorConfig'));
if (config && config.couponList && config.couponList.product_list) {
let { text, textAlign, fontColor, fontSize } = config.couponList.product_list.title;
if (config && config.coupon && config.coupon.product_list) {
let { text, textAlign, fontColor, fontSize } = config.coupon.product_list.title;
this.setState({ text, textAlign, fontColor, fontSize });
}
}
@ -122,9 +128,9 @@ export default class Title extends React.Component {
componentWillUnmount() {
let oldobj = JSON.parse(sessionStorage.getItem('editorConfig'));
let couponList = oldobj.couponList;
couponList.product_list.title = _.cloneDeep(this.state);
oldobj.couponList = couponList;
let coupon = oldobj.coupon;
coupon.product_list.title = _.cloneDeep(this.state);
oldobj.coupon = coupon;
sessionStorage.setItem('editorConfig', JSON.stringify(oldobj));
}
render() {

View File

@ -1,11 +1,11 @@
import React from 'react';
import { Button, Select, ImageUpload, ColorPicker, NumberInput } from 'zent';
import "./main.less"
import "../../../edittemplate/goodstemplate.less"
import { Notify, RadioGroup, RadioButton } from 'zent';
import Ipt from "@/components/input/main"
import Form from "@/components/form/main"
import FormItem from "@/components/form-item/main"
import Bus from '@/assets/eventBus.js'
import { uploadImg, handelResponse, getThemeType } from "@/assets/api.js"
import Wangeditor from '@/pages/exchangepage/edittemplate/wangeditorCom.js'
export default class edittemplate extends React.Component {
@ -28,18 +28,25 @@ export default class edittemplate extends React.Component {
}
componentWillMount(e) {
console.log(1,'组件');
let self = this;
let config = JSON.parse(sessionStorage.getItem('editorConfig'));
let moudTyle = sessionStorage.getItem('mouldType');
if (moudTyle && moudTyle == 0) {
this.setState({ isSystemModel: true });
}
if (config && config.couponList && config.couponList.land) {
let data = config.couponList.land;
this.setState({ model: data });
} else {
}
let data = config.coupon.land;
console.log(111,data);
this.setState({ model: data });
// Bus.addListener('refreshcoupon', (prop) => {
// console.log(46, config);
// if (config && config.coupon && config.coupon.land) {
// let data = config.coupon.land;
// this.setState({ model: data });
// }
// config.coupon.land = this.state.model;
// sessionStorage.setItem('editorConfig', JSON.stringify(config));
// })
getThemeType().then(res => {
handelResponse(res, (req, msg) => {
let typeListSource = res.data.map(it => {
@ -223,17 +230,11 @@ export default class edittemplate extends React.Component {
//组件将要销毁阶段
componentWillUnmount() {
console.log(2,'jieshu');
let oldobj = JSON.parse(sessionStorage.getItem('editorConfig'));
if (oldobj && oldobj.couponList) {
let couponList = oldobj.couponList
couponList.land = this.state.model;
oldobj.couponList = couponList;
} else {
oldobj = {}
let couponList = {}
couponList.land = this.state.model;
oldobj.couponList = couponList;
}
let coupon= oldobj.coupon
coupon.land = this.state.model;
oldobj.coupon = coupon;
sessionStorage.setItem('editorConfig', JSON.stringify(oldobj));
}
@ -243,100 +244,65 @@ export default class edittemplate extends React.Component {
return (
<div>
<div className='control page-title-control'>
<h1 style={{ fontSize: '16px' }}>落地页设置</h1>
<h1 style={{ fontSize: '16px' }}>落地页设置123</h1>
</div>
<div style={{ width: "92%", "margin": "0 auto 60px", "overflow": "auto", "maxHeight": "100%" }}>
<div style={{ fontWeight: 'bold' }}>基础设置</div>
<div style={{ width: "92%", "margin": "0 auto 60px", "overflow": "auto", "maxHeight": "100%" }}>
<div style={{ fontWeight: 'bold' }}>基础设置</div>
<Form model={this.state.model} ref="form1">
<FormItem labelname="落地页标题:" prop="title" id="title" labelwidth="100px">
<Ipt onChange={(e) => {
let model2 = this.state.model;
model2.title = e;
this.setState({ model: model2 })
this.props.settitle(e)
}}
onClearItem={(e) => {
<Form model={this.state.model} ref="form1">
<FormItem labelname="落地页标题:" prop="title" id="title" labelwidth="100px">
<Ipt onChange={(e) => {
let model2 = this.state.model;
model2.title = "";
model2.title = e;
this.setState({ model: model2 })
this.props.settitle(e)
}}
value={this.state.model.title} placeholder={"请输入"} labelWidth={'0px'} maxLength={12} height={'36px'} width={'300px'} alignment={'left'} />
</FormItem>
{
this.state.isSystemModel ? (
<FormItem labelname="权重" required={false} prop="sort" id="sort" labelwidth="100px">
<NumberInput onChange={c => this.sortFn(c)} value={this.state.model.sort} placeholder="请输入数字" integer={true} max={999} />
</FormItem>) : null
}
{
this.state.isSystemModel ? (
<FormItem labelname="模板分类" labelwidth="100px" prop="scope" id="scope">
<Select options={this.state.mouldWay} onChange={(e) => { this.onmouldChange(e) }} placeholder="选择一项" width={300} value={this.state.model.type_id} />
</FormItem>
) : null
}
<div style={{ marginTop: '20px', marginBottom: '15px', fontWeight: 'bold' }}>样式</div>
<FormItem labelname="背景颜色:" prop="font_color" id="font_color" labelwidth="80px">
<div className="colorItembg dfleac">
<span className="cicle" style={{ border: '1px solid #f1f2f3' }} className={this.state.model.bg_color == '#ffffff' ? "cicle activecicle" : "cicle"} onClick={() => { this.bgcolor('#ffffff') }}></span>
<span className={this.state.model.bg_color == '#EEEEEE' ? "activecicle cicle cicle1" : "cicle cicle1"} onClick={() => { this.bgcolor('#EEEEEE') }}></span>
<span className={this.state.model.bg_color == '#000000' ? "activecicle cicle cicle2" : "cicle cicle2"} onClick={() => { this.bgcolor('#000000') }}></span>
<div className="selfset" >
<ColorPicker className="setbgColor" color={this.state.model.bg_color} onChange={this.handleChange} />
onClearItem={(e) => {
let model2 = this.state.model;
model2.title = "";
this.setState({ model: model2 })
}}
value={this.state.model.title} placeholder={"请输入"} labelWidth={'0px'} maxLength={12} height={'36px'} width={'300px'} alignment={'left'} />
</FormItem>
{
this.state.isSystemModel ? (
<FormItem labelname="权重" required={false} prop="sort" id="sort" labelwidth="100px">
<NumberInput onChange={c => this.sortFn(c)} value={this.state.model.sort} placeholder="请输入数字" integer={true} max={999} />
</FormItem>) : null
}
{
this.state.isSystemModel ? (
<FormItem labelname="模板分类" labelwidth="100px" prop="scope" id="scope">
<Select options={this.state.mouldWay} onChange={(e) => { this.onmouldChange(e) }} placeholder="选择一项" width={300} value={this.state.model.type_id} />
</FormItem>
) : null
}
<div style={{ marginTop: '20px', marginBottom: '15px', fontWeight: 'bold' }}>样式</div>
<FormItem labelname="背景颜色:" prop="font_color" id="font_color" labelwidth="80px">
<div className="colorItembg dfleac">
<span className="cicle" style={{ border: '1px solid #f1f2f3' }} className={this.state.model.bg_color == '#ffffff' ? "cicle activecicle" : "cicle"} onClick={() => { this.bgcolor('#ffffff') }}></span>
<span className={this.state.model.bg_color == '#EEEEEE' ? "activecicle cicle cicle1" : "cicle cicle1"} onClick={() => { this.bgcolor('#EEEEEE') }}></span>
<span className={this.state.model.bg_color == '#000000' ? "activecicle cicle cicle2" : "cicle cicle2"} onClick={() => { this.bgcolor('#000000') }}></span>
<div className="selfset" >
<ColorPicker className="setbgColor" color={this.state.model.bg_color} onChange={this.handleChange} />
</div>
</div>
</div>
</FormItem>
<FormItem labelname="字体颜色:" prop="bg_color" id="bg_color" labelwidth="80px">
<div className="colorItemfont dfleac">
<span style={{ border: '1px solid #f1f2f3' }} className={this.state.model.font_color == '#ffffff' ? "cicle activecicle" : "cicle"} onClick={() => { this.fontcolor('#ffffff') }}></span>
<span className={this.state.model.font_color == '#04C160' ? "activecicle cicle cicle6" : "cicle cicle6"} onClick={() => { this.fontcolor('#04C160') }}></span>
<span className={this.state.model.font_color == '#AE99D3' ? "activecicle cicle cicle3" : "cicle cicle3"} onClick={() => { this.fontcolor('#AE99D3') }}></span>
<span className={this.state.model.font_color == '#FACD6A' ? "activecicle cicle cicle4" : "cicle cicle4"} onClick={() => { this.fontcolor('#FACD6A') }}></span>
<span className={this.state.model.font_color == '#FE7962' ? "activecicle cicle cicle5" : "cicle cicle5"} onClick={() => { this.fontcolor('#FE7962') }}></span>
<div className="selfset">
<ColorPicker className="setbgColor" color={this.state.model.font_color} onChange={this.handleChange1} />
</FormItem>
<FormItem labelname="字体颜色:" prop="bg_color" id="bg_color" labelwidth="80px">
<div className="colorItemfont dfleac">
<span style={{ border: '1px solid #f1f2f3' }} className={this.state.model.font_color == '#ffffff' ? "cicle activecicle" : "cicle"} onClick={() => { this.fontcolor('#ffffff') }}></span>
<span className={this.state.model.font_color == '#04C160' ? "activecicle cicle cicle6" : "cicle cicle6"} onClick={() => { this.fontcolor('#04C160') }}></span>
<span className={this.state.model.font_color == '#AE99D3' ? "activecicle cicle cicle3" : "cicle cicle3"} onClick={() => { this.fontcolor('#AE99D3') }}></span>
<span className={this.state.model.font_color == '#FACD6A' ? "activecicle cicle cicle4" : "cicle cicle4"} onClick={() => { this.fontcolor('#FACD6A') }}></span>
<span className={this.state.model.font_color == '#FE7962' ? "activecicle cicle cicle5" : "cicle cicle5"} onClick={() => { this.fontcolor('#FE7962') }}></span>
<div className="selfset">
<ColorPicker className="setbgColor" color={this.state.model.font_color} onChange={this.handleChange1} />
</div>
</div>
</div>
</FormItem>
<div style={{ marginTop: '20px', fontWeight: 'bold' }}>基础图层</div>
<FormItem labelname="顶部banner:" prop="top" id="top" labelwidth="100px">
<ImageUpload
className="zent-image-upload-demo"
maxSize={5 * 1024 * 1024}
maxAmount={1}
multiple
sortable
tips="单张图片不超过 5M"
onChange={(e) => { this.onUploadChange(e) }}
onUpload={this.onUpload}
defaultFileList={this.state.model.top_image ? [{ 'src': this.state.model.top_image }] : null}
onError={this.onUploadError}
/>
</FormItem>
<FormItem labelname="输入框:" prop="center" id="center" labelwidth="100px">
<ImageUpload
className="zent-image-upload-demo"
maxSize={5 * 1024 * 1024}
maxAmount={1}
multiple
sortable
tips="单张图片不超过 5M"
onChange={(e) => { this.onUploadChange1(e) }}
defaultFileList={this.state.model.middle_image ? [{ 'src': this.state.model.middle_image }] : null}
onUpload={this.onUpload}
onError={this.onUploadError}
/>
</FormItem>
<FormItem myClassName="activeSet" required={false} labelname="活动说明:" prop="bottom" id="bottom" labelwidth="100px">
<RadioGroup onChange={(e) => { this.onactivityChange(e) }} value={this.state.model.describe.type}>
<RadioButton value={"1"} onClick={() => this.hasItemFn(1)}>图片</RadioButton>
<RadioButton value={"2"} onClick={() => this.hasItemFn(2)}>富文本</RadioButton>
</RadioGroup>
</FormItem>
{
this.state.model.describe.type == 1 ? <FormItem required={false} labelname=" " prop="bottom" id="bottom" labelwidth="100px">
</FormItem>
<div style={{ marginTop: '20px', fontWeight: 'bold' }}>基础图层</div>
<FormItem labelname="顶部banner:" prop="top" id="top" labelwidth="100px">
<ImageUpload
className="zent-image-upload-demo"
maxSize={5 * 1024 * 1024}
@ -344,15 +310,13 @@ export default class edittemplate extends React.Component {
multiple
sortable
tips="单张图片不超过 5M"
onChange={(e) => { this.onUploadChange2(e) }}
onChange={(e) => { this.onUploadChange(e) }}
onUpload={this.onUpload}
defaultFileList={this.state.model.top_image ? [{ 'src': this.state.model.top_image }] : null}
onError={this.onUploadError}
defaultFileList={this.state.model.describe.bg_image ? [{ 'src': this.state.model.describe.bg_image }] : null}
/>
</FormItem> : null
}
{
this.state.model.describe.type == 2 ? <FormItem required={false} labelname="背景图案:" prop="bottom" id="bottom" labelwidth="100px">
</FormItem>
<FormItem labelname="输入框:" prop="center" id="center" labelwidth="100px">
<ImageUpload
className="zent-image-upload-demo"
maxSize={5 * 1024 * 1024}
@ -360,16 +324,53 @@ export default class edittemplate extends React.Component {
multiple
sortable
tips="单张图片不超过 5M"
onChange={(e) => { this.onUploadChange2(e) }}
onChange={(e) => { this.onUploadChange1(e) }}
defaultFileList={this.state.model.middle_image ? [{ 'src': this.state.model.middle_image }] : null}
onUpload={this.onUpload}
onError={this.onUploadError}
defaultFileList={this.state.model.describe.bg_image ? [{ 'src': this.state.model.describe.bg_image }] : null}
/>
</FormItem> : null
}
{this.state.model.describe.type == 2 ? <Wangeditor pageType="landeditor" setEdittext={c => this.getEditext(c)} /> : null}
</Form>
</div>
</FormItem>
<FormItem myClassName="activeSet" required={false} labelname="活动说明:" prop="bottom" id="bottom" labelwidth="100px">
<RadioGroup onChange={(e) => { this.onactivityChange(e) }} value={this.state.model.describe.type}>
<RadioButton value={"1"} onClick={() => this.hasItemFn(1)}>图片</RadioButton>
<RadioButton value={"2"} onClick={() => this.hasItemFn(2)}>富文本</RadioButton>
</RadioGroup>
</FormItem>
{
this.state.model.describe.type == 1 ? <FormItem required={false} labelname=" " prop="bottom" id="bottom" labelwidth="100px">
<ImageUpload
className="zent-image-upload-demo"
maxSize={5 * 1024 * 1024}
maxAmount={1}
multiple
sortable
tips="单张图片不超过 5M"
onChange={(e) => { this.onUploadChange2(e) }}
onUpload={this.onUpload}
onError={this.onUploadError}
defaultFileList={this.state.model.describe.bg_image ? [{ 'src': this.state.model.describe.bg_image }] : null}
/>
</FormItem> : null
}
{
this.state.model.describe.type == 2 ? <FormItem required={false} labelname="背景图案:" prop="bottom" id="bottom" labelwidth="100px">
<ImageUpload
className="zent-image-upload-demo"
maxSize={5 * 1024 * 1024}
maxAmount={1}
multiple
sortable
tips="单张图片不超过 5M"
onChange={(e) => { this.onUploadChange2(e) }}
onUpload={this.onUpload}
onError={this.onUploadError}
defaultFileList={this.state.model.describe.bg_image ? [{ 'src': this.state.model.describe.bg_image }] : null}
/>
</FormItem> : null
}
{this.state.model.describe.type == 2 ? <Wangeditor pageType="landeditor" setEdittext={c => this.getEditext(c)} /> : null}
</Form>
</div>
</div>
)
}

View File

@ -37,16 +37,16 @@ export default class edittemplate extends React.Component {
}
componentWillMount(e) {
let config = JSON.parse(sessionStorage.getItem('editorConfig'));
if (config && config.couponList && config.couponList.product_detail) {
let { font_color, button_color } = config.couponList.product_detail.reduce;
if (config && config.coupon && config.coupon.product_detail) {
let { font_color, button_color } = config.coupon.product_detail.reduce;
this.setState({ font_color, button_color });
}
}
componentWillUnmount() {
let oldobj = JSON.parse(sessionStorage.getItem('editorConfig'));
let couponList = oldobj.couponList;
couponList.product_detail.reduce = _.cloneDeep(this.state);
oldobj.couponList = couponList;
let coupon = oldobj.coupon;
coupon.product_detail.reduce = _.cloneDeep(this.state);
oldobj.coupon = coupon;
sessionStorage.setItem('editorConfig', JSON.stringify(oldobj));
}
render() {

View File

@ -139,15 +139,15 @@ export default class edittemplate extends React.Component {
}
componentWillMount() {
let config = JSON.parse(sessionStorage.getItem('editorConfig'));
if (config && config.couponList && config.couponList.product_detail) {
this.setState({ model: config.couponList.product_detail });
if (config && config.coupon && config.coupon.product_detail) {
this.setState({ model: config.coupon.product_detail });
}
}
componentWillUnmount() {
let oldobj = JSON.parse(sessionStorage.getItem('editorConfig'));
let couponList = oldobj.couponList;
couponList.product_detail = _.cloneDeep(this.state.model);
oldobj.couponList = couponList;
let coupon = oldobj.coupon;
coupon.product_detail = _.cloneDeep(this.state.model);
oldobj.coupon = coupon;
sessionStorage.setItem('editorConfig', JSON.stringify(oldobj));
}

View File

@ -24,7 +24,7 @@ export default class edittemplate extends React.Component{
this.props.detaildata.describe.type==2?<img className="susactive_tip" onClick={this.opendescFn.bind(this)} src={'https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/img/acticeTextTip.png'}/>:null
}
{
this.props.templateType!=2?<button className="exchangeBtn" style={{background:this.props.detaildata.button_color,color:this.props.detaildata.font_color}}>立即兑换</button>:
[1,3].includes(this.props.templateType)?<button className="exchangeBtn" style={{background:this.props.detaildata.button_color,color:this.props.detaildata.font_color}}>立即兑换</button>:
<div className="dflexaj payBtn-view">
<div className="coupon-price">
<p>0.00</p>

View File

@ -25,7 +25,6 @@ import CouponGoodsListForm from '../couponTemplate/goodsPage/config/main' //优
import CouponGoodsDetailForm from './couponconfig' //优惠券商品详情页
import CouponReduceDetailForm from './couponReduceDetail' //优惠券立减金详情页
import CouponComLib from '../couponTemplate/goodsPage/componentLib/main' //优惠券组件库
// import
import _ from 'lodash'
//落地页
let model = {
@ -332,37 +331,45 @@ export default class edittemplate extends React.Component {
whiteList['land'].title = newEditor.title
whiteList['land'].sort = newEditor.sort
//优惠券
let couponList = newEditor.couponList
if (!couponList) {
couponList = {}
couponList.land = model
couponList.product_list = couponProduct_list
couponList.product_detail = product_detail
let coupon = newEditor.coupon
if (!coupon) {
coupon = {}
coupon.land = model
coupon.product_list = couponProduct_list
coupon.product_detail = product_detail
}
couponList['land'].title = newEditor.title
couponList['land'].sort = newEditor.sort
newEditor.exchangeList = exchangeList
newEditor.whiteList = whiteList
newEditor.couponList = couponList;
if (template == 1) { //1-白名单 2-兑换码
coupon['land'].title = newEditor.title
coupon['land'].sort = newEditor.sort
newEditor.exchangeList = exchangeList
newEditor.whiteList = whiteList
newEditor.coupon = coupon;
if (template == 1) { //1-白名单 3-兑换码
this.setState({
model: newEditor.whiteList.land,
product_list: newEditor.whiteList.product_list,
product_detail: newEditor.whiteList.product_detail
})
} else {
} else if (template ==3){
this.setState({
model: newEditor.exchangeList.land,
product_list: newEditor.exchangeList.product_list,
product_detail: newEditor.exchangeList.product_detail
})
}else{
this.setState({
model: newEditor.coupon.land,
product_list: newEditor.coupon.product_list,
product_detail: newEditor.coupon.product_detail
})
}
sessionStorage.setItem('editorConfig', JSON.stringify(newEditor))
if (mouldType != 0 && pageChange == 1) {
this.setState({ pagedisable: true })
}
} else {//新增数据
let obj = {}, whiteList = {}, exchangeList = {}, couponList = {}
console.log(369,sessionStorage.getItem('editorConfig'));
let obj = {}, whiteList = {}, exchangeList = {}, coupon = {}
let sourceObj = {//模板数据结构
land: model,
product_list,
@ -375,10 +382,10 @@ export default class edittemplate extends React.Component {
}
whiteList = _.cloneDeep(sourceObj);
exchangeList = _.cloneDeep(sourceObj);
couponList = _.cloneDeep(sourcecouponObj);
coupon = _.cloneDeep(sourcecouponObj);
obj.exchangeList = exchangeList
obj.whiteList = whiteList
obj.couponList = couponList
obj.coupon = coupon
sessionStorage.setItem('editorConfig', JSON.stringify(obj))
}
}
@ -488,11 +495,21 @@ export default class edittemplate extends React.Component {
infoExchange.product_detail = exchangeState.product_detail
delete infoExchange.land.sort
delete infoExchange.land.title
if (this.state.showType == 3) {
//兑换码
formdata.exchange = infoExchange
} else if (this.state.showType == 1) {
formdata.access_conf = infoExchange
switch(this.state.showType){
case 3://兑换码
formdata.exchange = infoExchange;
break;
case 1://白名单
formdata.access_conf = infoExchange
break;
case 4://优惠券
formdata.coupon = infoExchange;
break;
case 8://优惠券白名单
formdata.coupon = infoExchange;
break;
default:
break;
}
if (myInfoData) {
//编辑
@ -638,7 +655,7 @@ export default class edittemplate extends React.Component {
}
onmodelChange(e) {
this.setState({ showType: e.target.value, activeNavStatus: 1 })
let editorData = JSON.parse(sessionStorage.getItem('editorConfig'))
let editorData = _.cloneDeep(JSON.parse(sessionStorage.getItem('editorConfig')))
if (e.target.value == 1) {
let whiteData = editorData.whiteList
let { land, product_list, product_detail } = whiteData;
@ -652,9 +669,10 @@ 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) {
let couponData = editorData.couponList
} else{//优惠券+优惠券白名单
let couponData = editorData.coupon
let { land, product_list, product_detail } = couponData;
console.log(222,this.state.model);
this.setState({ model: land, product_list, product_detail })
}
}
@ -800,7 +818,7 @@ export default class edittemplate extends React.Component {
this.setState({ componentOfconfig: c });
}
render() {
console.log(761,window.screen.width / 1920 * 100);
console.log(761,this.state);
return (
<div className='edittemplate'>
<div className='topHeader'>
@ -838,9 +856,12 @@ export default class edittemplate extends React.Component {
<RadioButton value={1} disabled={this.state.pagedisable}>
白名单
</RadioButton>
<RadioButton value={2} disabled={this.state.pagedisable}>
<RadioButton value={4} disabled={this.state.pagedisable}>
优惠券
</RadioButton>
<RadioButton value={8} disabled={this.state.pagedisable}>
优惠券白名单
</RadioButton>
</RadioGroup>
</div>
{/* 兑换码 */}
@ -877,7 +898,7 @@ export default class edittemplate extends React.Component {
) : (
<img src={this.state.model.middle_image} id='top' />
)}
{this.state.showType == 1 ? (
{[1,4].includes(this.state.showType)? (
<img
src={
'https://lsxd-yunshanfu.oss-cn-hangzhou.aliyuncs.com/common_image/20220127/22e5d4c1b1190a0a7bc8db43e1490d67.png'
@ -938,12 +959,12 @@ export default class edittemplate extends React.Component {
</div>
{/* 组件库 */}
{
this.state.showType == 2 && this.state.activeNavStatus == 2 ? <CouponComLib componentName={(c) => this.componentName(c)} /> : null
[4,8].includes(this.state.showType) && this.state.activeNavStatus == 2 ? <CouponComLib componentName={(c) => this.componentName(c)} /> : null
}
</div>
<div className='xj-wrapper' style={{ 'zIndex': '1' }}>
<div className={this.state.showType == 2 && this.state.activeNavStatus == 2 ? 'xj-center-small' : 'xj-center'}>
<div className={[4,8].includes(this.state.showType)&& this.state.activeNavStatus == 2 ? 'xj-center-small' : 'xj-center'}>
{this.state.activeNavStatus == 1 ? (
<div>
<img
@ -1047,7 +1068,7 @@ export default class edittemplate extends React.Component {
src={this.state.model.middle_image}
/>
)}
{this.state.showType == 1 ? (
{[1,4].includes(this.state.showType) ? (
<img
src={
'https://lsxd-yunshanfu.oss-cn-hangzhou.aliyuncs.com/common_image/20220127/22e5d4c1b1190a0a7bc8db43e1490d67.png'
@ -1155,8 +1176,7 @@ export default class edittemplate extends React.Component {
<div
className='schema-editor-container'
data-editor-role='XJWebsitePage'>
{
this.state.showType != 2 ? (
{[1,3].includes(this.state.showType)? (
<div className='control page-title-control'>
{this.state.activeNavStatus == 1 ? (
<h1 style={{ fontSize: '16px' }}>落地页设置</h1>

View File

@ -18,7 +18,7 @@ export default class edittemplate extends React.Component{
<img src={'https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/img/backprepageBtn.png'} className="preBtn"/>
<img src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/img/coupon/reduce_pic.png" alt="" className="reduce-pic"/>
{
this.props.templateType==2?
[2,4].includes(this.props.templateType)?
<div className="dflexaj payBtn-view">
<div className="coupon-price">
<p>0.00</p>