From 1fa59939a8a1a8907d40a3fca7dfc17f60584871 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AE=B8=E7=BA=A2=E6=A2=85?= <1924913374@qq.com> Date: Tue, 13 Sep 2022 17:58:55 +0800 Subject: [PATCH 1/8] =?UTF-8?q?=E7=BC=96=E8=BE=91=E5=99=A8=E8=9E=8D?= =?UTF-8?q?=E5=85=A5=E4=BC=98=E6=83=A0=E5=88=B8=E7=99=BD=E5=90=8D=E5=8D=95?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../exchangepage/edittemplate/detailstemplate.js | 2 +- src/pages/exchangepage/edittemplate/main.js | 14 ++++++++------ src/pages/exchangepage/edittemplate/reduce.js | 2 +- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/pages/exchangepage/edittemplate/detailstemplate.js b/src/pages/exchangepage/edittemplate/detailstemplate.js index 620d556c..d6ceae6c 100644 --- a/src/pages/exchangepage/edittemplate/detailstemplate.js +++ b/src/pages/exchangepage/edittemplate/detailstemplate.js @@ -24,7 +24,7 @@ export default class edittemplate extends React.Component{ this.props.detaildata.describe.type==2?:null } { - this.props.templateType!=2?: + [1,3].includes(this.props.templateType)?:

¥0.00

diff --git a/src/pages/exchangepage/edittemplate/main.js b/src/pages/exchangepage/edittemplate/main.js index 81dce7a8..38600118 100644 --- a/src/pages/exchangepage/edittemplate/main.js +++ b/src/pages/exchangepage/edittemplate/main.js @@ -841,6 +841,9 @@ export default class edittemplate extends React.Component { 优惠券 + + 优惠券白名单 +
{/* 兑换码 */} @@ -877,7 +880,7 @@ export default class edittemplate extends React.Component { ) : ( )} - {this.state.showType == 1 ? ( + {[1,4].includes(this.state.showType)? ( {/* 组件库 */} { - this.state.showType == 2 && this.state.activeNavStatus == 2 ? this.componentName(c)} /> : null + [2,4].includes(this.state.showType) && this.state.activeNavStatus == 2 ? this.componentName(c)} /> : null }
-
+
{this.state.activeNavStatus == 1 ? (
)} - {this.state.showType == 1 ? ( + {[1,4].includes(this.state.showType) ? ( - { - this.state.showType != 2 ? ( + {[1,3].includes(this.state.showType)? (
{this.state.activeNavStatus == 1 ? (

落地页设置

diff --git a/src/pages/exchangepage/edittemplate/reduce.js b/src/pages/exchangepage/edittemplate/reduce.js index f2700941..6f3a5240 100644 --- a/src/pages/exchangepage/edittemplate/reduce.js +++ b/src/pages/exchangepage/edittemplate/reduce.js @@ -18,7 +18,7 @@ export default class edittemplate extends React.Component{ { - this.props.templateType==2? + [2,4].includes(this.props.templateType)?

¥0.00

From 8f90a194b9e10492a00b4ba246f95d8f7bb1024c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AE=B8=E7=BA=A2=E6=A2=85?= <1924913374@qq.com> Date: Wed, 14 Sep 2022 13:39:42 +0800 Subject: [PATCH 2/8] =?UTF-8?q?=E7=BC=96=E8=BE=91=E5=99=A8=E4=BC=98?= =?UTF-8?q?=E6=83=A0=E5=88=B8=E7=99=BD=E5=90=8D=E5=8D=95=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../couponTemplate/landingPage/config/main.js | 236 ++++++++++-------- src/pages/exchangepage/edittemplate/main.js | 28 ++- 2 files changed, 152 insertions(+), 112 deletions(-) diff --git a/src/pages/exchangepage/couponTemplate/landingPage/config/main.js b/src/pages/exchangepage/couponTemplate/landingPage/config/main.js index ee3660a2..96662aea 100644 --- a/src/pages/exchangepage/couponTemplate/landingPage/config/main.js +++ b/src/pages/exchangepage/couponTemplate/landingPage/config/main.js @@ -6,6 +6,7 @@ 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 +29,34 @@ export default class edittemplate extends React.Component { } componentWillMount(e) { + console.log(6666,'组件初始化啦'); 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; + if (this.props.templateType == 4) { + let data = config.couponWhiteList.land; this.setState({ model: data }); } else { - + let data = config.couponList.land; + this.setState({ model: data }); } + Bus.addListener('refreshcoupon', (prop) => { + console.log(46, config); + if (config && config.couponList && config.couponList.land) { + let data = config[prop].land; + this.setState({ model: data }); + } + console.log(52,prop); + if(prop=='couponList'){ + config.couponWhiteList.land = this.state.model; + }else{ + config.couponList.land = this.state.model; + } + sessionStorage.setItem('editorConfig', JSON.stringify(config)); + }) getThemeType().then(res => { handelResponse(res, (req, msg) => { let typeListSource = res.data.map(it => { @@ -224,119 +241,87 @@ export default class edittemplate extends React.Component { //组件将要销毁阶段 componentWillUnmount() { let oldobj = JSON.parse(sessionStorage.getItem('editorConfig')); - if (oldobj && oldobj.couponList) { - let couponList = oldobj.couponList + let couponList; + if (this.props.templateType == 4) { + couponList = oldobj.couponWhiteList couponList.land = this.state.model; - oldobj.couponList = couponList; + oldobj.couponWhiteList = couponList; } else { - oldobj = {} - let couponList = {} + couponList = oldobj.couponList couponList.land = this.state.model; oldobj.couponList = couponList; } sessionStorage.setItem('editorConfig', JSON.stringify(oldobj)); } - + componentWillReceiveProps(val) { + console.log(123, val); + } render() { + console.log(262,this.state); return (
-

落地页设置

+

落地页设置123

-
-
基础设置
+
+
基础设置
-
- - { - let model2 = this.state.model; - model2.title = e; - this.setState({ model: model2 }) - this.props.settitle(e) - }} - onClearItem={(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'} /> - - { - this.state.isSystemModel ? ( - - this.sortFn(c)} value={this.state.model.sort} placeholder="请输入数字" integer={true} max={999} /> - ) : null - } - { - this.state.isSystemModel ? ( - - { this.onmouldChange(e) }} placeholder="选择一项" width={300} value={this.state.model.type_id} /> + + ) : null + } +
样式
+ +
+ { this.bgcolor('#ffffff') }}> + { this.bgcolor('#EEEEEE') }}> + { this.bgcolor('#000000') }}> +
+ +
-
- - -
- { this.fontcolor('#ffffff') }}> - { this.fontcolor('#04C160') }}> - { this.fontcolor('#AE99D3') }}> - { this.fontcolor('#FACD6A') }}> - { this.fontcolor('#FE7962') }}> -
- + + +
+ { this.fontcolor('#ffffff') }}> + { this.fontcolor('#04C160') }}> + { this.fontcolor('#AE99D3') }}> + { this.fontcolor('#FACD6A') }}> + { this.fontcolor('#FE7962') }}> +
+ +
-
- -
基础图层
- - { this.onUploadChange(e) }} - onUpload={this.onUpload} - defaultFileList={this.state.model.top_image ? [{ 'src': this.state.model.top_image }] : null} - onError={this.onUploadError} - /> - - - { this.onUploadChange1(e) }} - defaultFileList={this.state.model.middle_image ? [{ 'src': this.state.model.middle_image }] : null} - onUpload={this.onUpload} - onError={this.onUploadError} - /> - - - { this.onactivityChange(e) }} value={this.state.model.describe.type}> - this.hasItemFn(1)}>图片 - this.hasItemFn(2)}>富文本 - - - { - this.state.model.describe.type == 1 ? + +
基础图层
+ { 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} /> - : null - } - { - this.state.model.describe.type == 2 ? + + { 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} /> - : null - } - {this.state.model.describe.type == 2 ? this.getEditext(c)} /> : null} - -
+
+ + { this.onactivityChange(e) }} value={this.state.model.describe.type}> + this.hasItemFn(1)}>图片 + this.hasItemFn(2)}>富文本 + + + { + this.state.model.describe.type == 1 ? + { this.onUploadChange2(e) }} + onUpload={this.onUpload} + onError={this.onUploadError} + defaultFileList={this.state.model.describe.bg_image ? [{ 'src': this.state.model.describe.bg_image }] : null} + /> + : null + } + { + this.state.model.describe.type == 2 ? + { this.onUploadChange2(e) }} + onUpload={this.onUpload} + onError={this.onUploadError} + defaultFileList={this.state.model.describe.bg_image ? [{ 'src': this.state.model.describe.bg_image }] : null} + /> + : null + } + {this.state.model.describe.type == 2 ? this.getEditext(c)} /> : null} + +
) } diff --git a/src/pages/exchangepage/edittemplate/main.js b/src/pages/exchangepage/edittemplate/main.js index 38600118..8d9ca635 100644 --- a/src/pages/exchangepage/edittemplate/main.js +++ b/src/pages/exchangepage/edittemplate/main.js @@ -341,9 +341,20 @@ export default class edittemplate extends React.Component { } couponList['land'].title = newEditor.title couponList['land'].sort = newEditor.sort - newEditor.exchangeList = exchangeList - newEditor.whiteList = whiteList - newEditor.couponList = couponList; + //优惠券白名单 + let couponWhiteList = newEditor.couponWhiteList + if (!couponWhiteList) { + couponWhiteList = {} + couponWhiteList.land = model + couponWhiteList.product_list = couponProduct_list + couponWhiteList.product_detail = product_detail + } + couponWhiteList['land'].title = newEditor.title + couponWhiteList['land'].sort = newEditor.sort + newEditor.exchangeList = exchangeList + newEditor.whiteList = whiteList + newEditor.couponList = couponList; + newEditor.couponWhiteList = couponWhiteList; if (template == 1) { //1-白名单 2-兑换码 this.setState({ model: newEditor.whiteList.land, @@ -362,7 +373,7 @@ export default class edittemplate extends React.Component { this.setState({ pagedisable: true }) } } else {//新增数据 - let obj = {}, whiteList = {}, exchangeList = {}, couponList = {} + let obj = {}, whiteList = {}, exchangeList = {}, couponList = {},couponWhiteList={} let sourceObj = {//模板数据结构 land: model, product_list, @@ -376,9 +387,11 @@ export default class edittemplate extends React.Component { whiteList = _.cloneDeep(sourceObj); exchangeList = _.cloneDeep(sourceObj); couponList = _.cloneDeep(sourcecouponObj); + couponWhiteList = _.cloneDeep(sourcecouponObj); obj.exchangeList = exchangeList obj.whiteList = whiteList obj.couponList = couponList + obj.couponWhiteList = couponWhiteList sessionStorage.setItem('editorConfig', JSON.stringify(obj)) } } @@ -656,6 +669,12 @@ export default class edittemplate extends React.Component { let couponData = editorData.couponList let { land, product_list, product_detail } = couponData; this.setState({ model: land, product_list, product_detail }) + Bus.emit('refreshcoupon', 'couponList') + }else if (e.target.value == 4) { + let couponData = editorData.couponWhiteList + let { land, product_list, product_detail } = couponData; + this.setState({ model: land, product_list, product_detail }) + Bus.emit('refreshcoupon', 'couponWhiteList') } } onPreview() { @@ -1242,6 +1261,7 @@ export default class edittemplate extends React.Component { landbgcolor={(c) => this.getlandbgcolor(c)} landftcolor={(c) => this.getlandftcolor(c)} setbanner={(e) => this.getLandingdata(e)} + templateType={this.state.showType} /> ) : this.state.activeNavStatus == 2 ? ( Date: Wed, 14 Sep 2022 13:58:37 +0800 Subject: [PATCH 3/8] =?UTF-8?q?=E7=BC=96=E8=BE=91=E5=99=A8=E4=BC=98?= =?UTF-8?q?=E6=83=A0=E5=88=B8=E7=99=BD=E5=90=8D=E5=8D=95=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/exchangepage/couponTemplate/landingPage/config/main.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/pages/exchangepage/couponTemplate/landingPage/config/main.js b/src/pages/exchangepage/couponTemplate/landingPage/config/main.js index 96662aea..249a67e7 100644 --- a/src/pages/exchangepage/couponTemplate/landingPage/config/main.js +++ b/src/pages/exchangepage/couponTemplate/landingPage/config/main.js @@ -259,7 +259,6 @@ export default class edittemplate extends React.Component { render() { - console.log(262,this.state); return (
From d2b65933fd4d77cea90aed19bc0c233a486555d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AE=B8=E7=BA=A2=E6=A2=85?= <1924913374@qq.com> Date: Thu, 15 Sep 2022 16:17:09 +0800 Subject: [PATCH 4/8] =?UTF-8?q?=E4=BC=98=E5=8C=96=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E5=99=A8=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../couponTemplate/goodsPage/preview/main.js | 0 .../couponTemplate/landingPage/config/main.js | 54 +-- .../landingPage/config/main.less | 0 .../landingPage/config/whitemain.js | 375 ++++++++++++++++++ src/pages/exchangepage/edittemplate/main.js | 43 +- 5 files changed, 410 insertions(+), 62 deletions(-) delete mode 100644 src/pages/exchangepage/couponTemplate/goodsPage/preview/main.js delete mode 100644 src/pages/exchangepage/couponTemplate/landingPage/config/main.less create mode 100644 src/pages/exchangepage/couponTemplate/landingPage/config/whitemain.js diff --git a/src/pages/exchangepage/couponTemplate/goodsPage/preview/main.js b/src/pages/exchangepage/couponTemplate/goodsPage/preview/main.js deleted file mode 100644 index e69de29b..00000000 diff --git a/src/pages/exchangepage/couponTemplate/landingPage/config/main.js b/src/pages/exchangepage/couponTemplate/landingPage/config/main.js index 249a67e7..71bff61e 100644 --- a/src/pages/exchangepage/couponTemplate/landingPage/config/main.js +++ b/src/pages/exchangepage/couponTemplate/landingPage/config/main.js @@ -1,6 +1,5 @@ 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" @@ -29,34 +28,25 @@ export default class edittemplate extends React.Component { } componentWillMount(e) { - console.log(6666,'组件初始化啦'); + 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 (this.props.templateType == 4) { - let data = config.couponWhiteList.land; - this.setState({ model: data }); - } else { - let data = config.couponList.land; - this.setState({ model: data }); - } - Bus.addListener('refreshcoupon', (prop) => { - console.log(46, config); - if (config && config.couponList && config.couponList.land) { - let data = config[prop].land; - this.setState({ model: data }); - } - console.log(52,prop); - if(prop=='couponList'){ - config.couponWhiteList.land = this.state.model; - }else{ - config.couponList.land = this.state.model; - } - sessionStorage.setItem('editorConfig', JSON.stringify(config)); - }) + let data = config.couponList.land; + console.log(111,data); + this.setState({ model: data }); + // Bus.addListener('refreshcoupon', (prop) => { + // console.log(46, config); + // if (config && config.couponList && config.couponList.land) { + // let data = config.couponList.land; + // this.setState({ model: data }); + // } + // config.couponList.land = this.state.model; + // sessionStorage.setItem('editorConfig', JSON.stringify(config)); + // }) getThemeType().then(res => { handelResponse(res, (req, msg) => { let typeListSource = res.data.map(it => { @@ -240,22 +230,14 @@ export default class edittemplate extends React.Component { //组件将要销毁阶段 componentWillUnmount() { + console.log(2,'jieshu'); let oldobj = JSON.parse(sessionStorage.getItem('editorConfig')); - let couponList; - if (this.props.templateType == 4) { - couponList = oldobj.couponWhiteList - couponList.land = this.state.model; - oldobj.couponWhiteList = couponList; - } else { - couponList = oldobj.couponList - couponList.land = this.state.model; - oldobj.couponList = couponList; - } + let couponList= oldobj.couponList + couponList.land = this.state.model; + oldobj.couponList = couponList; sessionStorage.setItem('editorConfig', JSON.stringify(oldobj)); } - componentWillReceiveProps(val) { - console.log(123, val); - } + render() { diff --git a/src/pages/exchangepage/couponTemplate/landingPage/config/main.less b/src/pages/exchangepage/couponTemplate/landingPage/config/main.less deleted file mode 100644 index e69de29b..00000000 diff --git a/src/pages/exchangepage/couponTemplate/landingPage/config/whitemain.js b/src/pages/exchangepage/couponTemplate/landingPage/config/whitemain.js new file mode 100644 index 00000000..d92179ee --- /dev/null +++ b/src/pages/exchangepage/couponTemplate/landingPage/config/whitemain.js @@ -0,0 +1,375 @@ +import React from 'react'; +import { Button, Select, ImageUpload, ColorPicker, NumberInput } from 'zent'; +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 { + constructor(props) { + super(props) + this.state = { + isSystemModel: false, + mouldWay: [], + model: { + title: "落地页标题12", + top_image: "", + middle_image: "", + describe: { type: "", content: "", bg_image: '' }, + bg_color: "#EEEEEE", + font_color: "#000000", + sort: 1, + type_id: { key: 1, text: '通用' } + }, + } + } + + componentDidMount(e) { + let self = this; + let config = JSON.parse(sessionStorage.getItem('editorConfig')); + let moudTyle = sessionStorage.getItem('mouldType'); + if (moudTyle && moudTyle == 0) { + this.setState({ isSystemModel: true }); + } + let data = config.couponList.land; + console.log(111,config); + this.setState({ model: data }); + // Bus.addListener('refreshcoupon', (prop) => { + // console.log(46, config); + // if (config && config.couponList && config.couponList.land) { + // let data = config.couponList.land; + // this.setState({ model: data }); + // } + // config.couponList.land = this.state.model; + // sessionStorage.setItem('editorConfig', JSON.stringify(config)); + // }) + getThemeType().then(res => { + handelResponse(res, (req, msg) => { + let typeListSource = res.data.map(it => { + return { key: it.id, text: it.name } + }); + self.setState({ mouldWay: typeListSource }); + }, (err) => { + + }) + }).catch(err => { + }); + } + handleChange = (color) => { + let model1 = this.state.model; + model1.bg_color = color; + this.setState({ + model: model1 + }); + this.props.landbgcolor(color); + + } + handleChange1 = (color) => { + let model1 = this.state.model; + model1.font_color = color; + this.setState({ + model: model1 + }); + this.props.landftcolor(color); + } + onactivityChange(e) { + let active = this.state.model; + active.describe.type = e.target.value; + if (active.describe.bg_image) { + active.describe.bg_image = ""; + } + this.setState({ model: active }) + + this.props.setbanner(this.state.model); + } + hasItemFn(c) { + let model1 = this.state.model; + if (c == model1.describe.type) { + model1.describe.type = ''; + model1.describe.type = 0; + this.setState({ model: model1 }); + this.props.setbanner(this.state.model); + } + } + onmouldChange(c) { + + let model1 = this.state.model; + model1.type_id = c; + this.setState({ model: model1 }); + this.props.setbanner(model1); + } + //上传顶部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(model); + } else { + let model = this.state.model; + model.top_image = ''; + this.setState({ model: model }) + this.props.setbanner(model); + } + }; + + //上传输入框 + onUploadChange1(files) { + if (files.length > 0 && files[0].status == "success") { + let model = this.state.model; + model.middle_image = files[0].src; + this.setState({ model: model }) + this.props.setbanner(model); + } else { + let model = this.state.model; + model.middle_image = ''; + this.setState({ model: model }) + this.props.setbanner(model); + } + }; + + //上传使用说明 + onUploadChange2(files) { + if (files.length > 0 && files[0].status == "success") { + let model = this.state.model; + model.describe.bg_image = files[0].src; + this.setState({ model: model }) + this.props.setbanner(model); + } else { + let model = this.state.model; + model.describe.bg_image = ""; + this.setState({ model: model }) + this.props.setbanner(model); + } + + }; + onUploadError = (type, data) => { + if (type === 'overMaxAmount') { + Notify.error(`最多可上传 ${data.maxAmount} 张图片`); + } else if (type === 'overMaxSize') { + Notify.error(`图片大小不能超过 ${data.formattedMaxSize}`); + } + }; + sortFn(c) { + let model1 = this.state.model; + model1.sort = c; + this.setState({ model: model1 }); + this.props.setbanner(model1); + } + getEditext(c) { + let model1 = this.state.model; + model1.describe.content = c; + this.setState({ model: model1 }); + this.props.setbanner(model1); + } + + + // 字体颜色 + fontcolor(cor) { + let model1 = this.state.model; + model1.font_color = cor; + this.setState({ model: model1 }); + this.props.landftcolor(cor); + } + // 背景颜色 + bgcolor(cor) { + let model1 = this.state.model; + model1.bg_color = cor; + this.setState({ model: model1 }); + this.props.landbgcolor(cor); + } + onUpload = (file, report) => { + let self = this; + 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 + couponList.land = this.state.model; + oldobj.couponList = couponList; + sessionStorage.setItem('editorConfig', JSON.stringify(oldobj)); + } + + + + render() { + return ( +
+
+

落地页设置1234

+
+ +
+
基础设置
+ +
+ + { + let model2 = this.state.model; + model2.title = e; + this.setState({ model: model2 }) + this.props.settitle(e) + }} + 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'} /> + + { + this.state.isSystemModel ? ( + + this.sortFn(c)} value={this.state.model.sort} placeholder="请输入数字" integer={true} max={999} /> + ) : null + } + { + this.state.isSystemModel ? ( + + { this.onmouldChange(e) }} placeholder="选择一项" width={300} value={this.state.model.type_id} /> - - ) : null - } -
样式
- -
- { this.bgcolor('#ffffff') }}> - { this.bgcolor('#EEEEEE') }}> - { this.bgcolor('#000000') }}> -
- -
-
-
- -
- { this.fontcolor('#ffffff') }}> - { this.fontcolor('#04C160') }}> - { this.fontcolor('#AE99D3') }}> - { this.fontcolor('#FACD6A') }}> - { this.fontcolor('#FE7962') }}> -
- -
-
-
-
基础图层
- - { this.onUploadChange(e) }} - onUpload={this.onUpload} - defaultFileList={this.state.model.top_image ? [{ 'src': this.state.model.top_image }] : null} - onError={this.onUploadError} - /> - - - { this.onUploadChange1(e) }} - defaultFileList={this.state.model.middle_image ? [{ 'src': this.state.model.middle_image }] : null} - onUpload={this.onUpload} - onError={this.onUploadError} - /> - - - { this.onactivityChange(e) }} value={this.state.model.describe.type}> - this.hasItemFn(1)}>图片 - this.hasItemFn(2)}>富文本 - - - { - this.state.model.describe.type == 1 ? - { this.onUploadChange2(e) }} - onUpload={this.onUpload} - onError={this.onUploadError} - defaultFileList={this.state.model.describe.bg_image ? [{ 'src': this.state.model.describe.bg_image }] : null} - /> - : null - } - { - this.state.model.describe.type == 2 ? - { this.onUploadChange2(e) }} - onUpload={this.onUpload} - onError={this.onUploadError} - defaultFileList={this.state.model.describe.bg_image ? [{ 'src': this.state.model.describe.bg_image }] : null} - /> - : null - } - {this.state.model.describe.type == 2 ? this.getEditext(c)} /> : null} - -
-
- ) - } -} \ No newline at end of file diff --git a/src/pages/exchangepage/edittemplate/couponReduceDetail.js b/src/pages/exchangepage/edittemplate/couponReduceDetail.js index 680fb84a..ceec2e7e 100644 --- a/src/pages/exchangepage/edittemplate/couponReduceDetail.js +++ b/src/pages/exchangepage/edittemplate/couponReduceDetail.js @@ -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() { diff --git a/src/pages/exchangepage/edittemplate/couponconfig.js b/src/pages/exchangepage/edittemplate/couponconfig.js index e58a0e04..cf4e9f8f 100644 --- a/src/pages/exchangepage/edittemplate/couponconfig.js +++ b/src/pages/exchangepage/edittemplate/couponconfig.js @@ -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)); } diff --git a/src/pages/exchangepage/edittemplate/main.js b/src/pages/exchangepage/edittemplate/main.js index 443a6604..af7d6b4f 100644 --- a/src/pages/exchangepage/edittemplate/main.js +++ b/src/pages/exchangepage/edittemplate/main.js @@ -25,9 +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 CouponWhiteLandingForm from '../couponTemplate/landingPage/config/whitemain' //优惠券落地页表单 import _ from 'lodash' //落地页 let model = { @@ -334,19 +331,19 @@ 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 + coupon['land'].title = newEditor.title + coupon['land'].sort = newEditor.sort newEditor.exchangeList = exchangeList newEditor.whiteList = whiteList - newEditor.couponList = couponList; + newEditor.coupon = coupon; if (template == 1) { //1-白名单 3-兑换码 this.setState({ model: newEditor.whiteList.land, @@ -361,9 +358,9 @@ export default class edittemplate extends React.Component { }) }else{ this.setState({ - model: newEditor.couponList.land, - product_list: newEditor.couponList.product_list, - product_detail: newEditor.couponList.product_detail + model: newEditor.coupon.land, + product_list: newEditor.coupon.product_list, + product_detail: newEditor.coupon.product_detail }) } sessionStorage.setItem('editorConfig', JSON.stringify(newEditor)) @@ -372,7 +369,7 @@ export default class edittemplate extends React.Component { } } else {//新增数据 console.log(369,sessionStorage.getItem('editorConfig')); - let obj = {}, whiteList = {}, exchangeList = {}, couponList = {} + let obj = {}, whiteList = {}, exchangeList = {}, coupon = {} let sourceObj = {//模板数据结构 land: model, product_list, @@ -385,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)) } } @@ -506,10 +503,10 @@ export default class edittemplate extends React.Component { formdata.access_conf = infoExchange break; case 4://优惠券 - formdata.couponList = infoExchange; + formdata.coupon = infoExchange; break; case 8://优惠券白名单 - formdata.couponList = infoExchange; + formdata.coupon = infoExchange; break; default: break; @@ -673,8 +670,7 @@ export default class edittemplate extends React.Component { let { land, product_list, product_detail } = exchangeData; this.setState({ model: land, product_list, product_detail }) } else{//优惠券+优惠券白名单 - console.log(659,editorData); - let couponData = editorData.couponList + 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 }) @@ -963,12 +959,12 @@ export default class edittemplate extends React.Component {
{/* 组件库 */} { - [2,4].includes(this.state.showType) && this.state.activeNavStatus == 2 ? this.componentName(c)} /> : null + [4,8].includes(this.state.showType) && this.state.activeNavStatus == 2 ? this.componentName(c)} /> : null }
-
+
{this.state.activeNavStatus == 1 ? (
this.getdetailfont_color(c)} /> ) : : this.state.activeNavStatus == 1 ? (//优惠券 - this.state.showType==2? this.getTitle(c)} landbgcolor={(c) => this.getlandbgcolor(c)} landftcolor={(c) => this.getlandftcolor(c)} setbanner={(e) => this.getLandingdata(e)} - />: this.getTitle(c)} - landbgcolor={(c) => this.getlandbgcolor(c)} - landftcolor={(c) => this.getlandftcolor(c)} - setbanner={(e) => this.getLandingdata(e)}/> + /> ) : this.state.activeNavStatus == 2 ? ( this.getactiveTypeFn(c)}