diff --git a/src/pages/exchangepage/edittemplate/goodstemplate.js b/src/pages/exchangepage/edittemplate/goodstemplate.js
index a6f8828d..99f95c5c 100644
--- a/src/pages/exchangepage/edittemplate/goodstemplate.js
+++ b/src/pages/exchangepage/edittemplate/goodstemplate.js
@@ -1,72 +1,78 @@
-import React from 'react';
+import React from 'react';
import "./main.less"
import "../../../assets/comm.css"
import './goodstemplate.less'
import SearchBarView from './couponConfig/searchBar' //商品详情搜索栏
import BottomBarView from './couponConfig/bottomBar' //底部栏
-import {Sweetalert} from 'zent'
+import { Sweetalert } from 'zent'
import Bus from '@/assets/eventBus.js'
export default class edittemplate extends React.Component {
constructor(props) {
super(props)
- this.state={
- clientY:0,
- selectDom:'',
- icon:''
+ this.state = {
+ clientY: 0,
+ selectDom: '',
+ icon: ''
}
}
opendescFn() {
this.props.opendesc(true)
}
- customComponent(e,name,icon){
+ customComponent(e, name, icon) {
//getBoundingClientRect().top ;获取div最顶边距离浏览器的位置
- let b=this.refs[name];
- let offset_top=this.refs[name].getBoundingClientRect().top;
- this.setState({clientY:(offset_top-125),selectDom:name,icon:icon});
- if(name=='searchBar'){
- this.setState({clientY:0});
+ let b = this.refs[name];
+ let offset_top = this.refs[name].getBoundingClientRect().top;
+ this.setState({ clientY: (offset_top - 125), selectDom: name, icon: icon });
+ if (name == 'searchBar') {
+ this.setState({ clientY: 0 });
}
- if(name=='bottomBar'){
- this.setState({clientY:600});
+ if (name == 'bottomBar') {
+ this.setState({ clientY: 600 });
}
}
- deleteFn(){
- let selectDom=this.state.selectDom;//需删除组件名称
+ deleteFn() {
+ let selectDom = this.state.selectDom;//需删除组件名称
Sweetalert.confirm({
- title:'确认信息',
+ title: '确认信息',
content:
,
- onConfirm:()=>{
- this.setState({selectDom:''});
- Bus.emit('componentLibClose',selectDom)
+ onConfirm: () => {
+ this.setState({ selectDom: '' });
+ Bus.emit('componentLibClose', selectDom)
},
- onCancel:()=>{
-
+ onCancel: () => {
+
},
parentComponent: this
});
}
render() {
- let goodsConfig=this.props.goodsdata;
- console.log(48,goodsConfig);
+ let goodsConfig = this.props.goodsdata;
+ let {backgroundImg,search,picture,title,bottomBar}=goodsConfig;
return (
-
+
{
- goodsConfig.search&&goodsConfig.search.iswitch?
-
this.customComponent(e,'search','marketing-sousuolan-')} className={this.state.selectDom=='search'?'selectBorder':''} ref="search">
:null
+ search && search.iswitch ?
+
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,'picture','marketing-tupian')} ref="picture" className={this.state.selectDom=='picture'?'selectBorder':''}>
:null
+ {
+ picture && 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
+ title && title.iswitch && title.comstyle == 1 ?
this.customComponent(e, 'title', 'marketing-fuwenbenkuang')} ref="title" className={this.state.selectDom == 'title' ? 'selectBorder' : ''}>
+
{title.text}
: null
}
{
- goodsConfig.title&&goodsConfig.title.iswitch&&goodsConfig.title.text||goodsConfig.picture&&goodsConfig.picture.iswitch&&goodsConfig.picture.img?
:null
+ title && title.iswitch && title.comstyle == 2 ?
this.customComponent(e, 'title', 'marketing-fuwenbenkuang')} ref="title" className={this.state.selectDom == 'title' ? 'selectBorder' : ''}>
+
+
: null
+ }
+ {
+ (title && title.iswitch && title.text||title.pic) || picture && picture.iswitch && picture.img ?
: null
}
{
goodsConfig.list == 2 ?
: goodsConfig.list == 3 ?
:
@@ -81,17 +87,16 @@ export default class edittemplate extends React.Component {
goodsConfig.describe.type == 2 ?
: null
}
{
- goodsConfig.bottomBar&&goodsConfig.bottomBar.iswitch?
this.customComponent(e,'bottomBar','marketing-list')} className={this.state.selectDom=='bottomBar'?'selectBottomBorder':''}>
:null
-
+ bottomBar && bottomBar.iswitch ?
this.customComponent(e, 'bottomBar', 'marketing-list')} className={this.state.selectDom == 'bottomBar' ? 'selectBottomBorder' : ''}>
: null
+
}
{
- this.state.selectDom?
-
- |
- 删除
-
:null
+ this.state.selectDom ?
+
+ |
+ 删除
+
: null
}
-
)
}
diff --git a/src/pages/exchangepage/edittemplate/goodstemplate.less b/src/pages/exchangepage/edittemplate/goodstemplate.less
index 814628d7..fec19c6a 100644
--- a/src/pages/exchangepage/edittemplate/goodstemplate.less
+++ b/src/pages/exchangepage/edittemplate/goodstemplate.less
@@ -129,6 +129,9 @@
background: rgba(25,133,255,.2);
content: "";
}
+.title-pic{
+ height:40px;
+}
.selectBottomBorder {
position: absolute;
left: 0;
diff --git a/src/pages/exchangepage/edittemplate/main.js b/src/pages/exchangepage/edittemplate/main.js
index 04bf0d15..aad13b2b 100644
--- a/src/pages/exchangepage/edittemplate/main.js
+++ b/src/pages/exchangepage/edittemplate/main.js
@@ -85,18 +85,20 @@ let couponProduct_list = {
search: {
iswitch: false,
shape: 'circular',
- textAlign: 'left',
+ textAlign: 'center',
borderColor: '#333',
bgColor:'#a00',
- fontColor:'#333',
+ fontColor:'#fff',
placeholder: '请输入关键字搜索'
},
title: {
iswitch: false,
- text: 'circular',
+ text: '商品标题',
textAlign: 'left',
fontColor: '#333',
- fontSize: 1
+ fontSize: 1,
+ comstyle:1,
+ pic:''
},
bottomBar: {
iswitch:false,
@@ -225,6 +227,17 @@ export default class edittemplate extends React.Component {
this.setState({ product_list: searchConfig })
})
//标题设置
+ Bus.addListener('comstyle', (prop) => {
+ let titleConfig = this.state.product_list
+ titleConfig.title.comstyle = prop
+ this.setState({ product_list: titleConfig })
+ })
+ Bus.addListener('titlePic', (prop) => {
+ let titleConfig = this.state.product_list
+ titleConfig.title.pic = prop
+ this.setState({ product_list: titleConfig })
+ })
+
Bus.addListener('title', (prop) => {
let titleConfig = this.state.product_list
titleConfig.title.text = prop
From 5d052825ea2c8f72066c8877e156ca0a0b109297 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E8=AE=B8=E7=BA=A2=E6=A2=85?= <1924913374@qq.com>
Date: Fri, 9 Sep 2022 11:30:53 +0800
Subject: [PATCH 4/5] =?UTF-8?q?=E5=AE=8C=E6=88=90=E7=BC=96=E8=BE=91?=
=?UTF-8?q?=E5=99=A8=E8=83=8C=E6=99=AF=E5=9B=BE=E6=96=B0=E5=A2=9E=E8=83=8C?=
=?UTF-8?q?=E6=99=AF=E9=A2=9C=E8=89=B2=E9=85=8D=E7=BD=AE=EF=BC=8C=E6=B8=B2?=
=?UTF-8?q?=E6=9F=93=E5=A4=84=E7=90=86?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../goodsPage/componentLib/main.js | 1 +
.../goodsPage/config/backPicture.js | 39 ++++++++++++++-----
.../goodsPage/config/searchBar.js | 2 +-
.../edittemplate/goodstemplate.js | 2 +-
.../edittemplate/goodstemplate.less | 1 -
src/pages/exchangepage/edittemplate/main.js | 11 +++++-
6 files changed, 41 insertions(+), 15 deletions(-)
diff --git a/src/pages/exchangepage/couponTemplate/goodsPage/componentLib/main.js b/src/pages/exchangepage/couponTemplate/goodsPage/componentLib/main.js
index 76103274..bd23a85e 100644
--- a/src/pages/exchangepage/couponTemplate/goodsPage/componentLib/main.js
+++ b/src/pages/exchangepage/couponTemplate/goodsPage/componentLib/main.js
@@ -36,6 +36,7 @@ export default class componentLib extends React.Component {
//组件将要销毁阶段
componentWillUnmount() {}
propcomponentName(item){
+ console.log(39,item);
this.props.componentName(item.name);
if(item.name){
Bus.emit('componentLib',item)
diff --git a/src/pages/exchangepage/couponTemplate/goodsPage/config/backPicture.js b/src/pages/exchangepage/couponTemplate/goodsPage/config/backPicture.js
index 8e9e6ed8..ab305ac3 100644
--- a/src/pages/exchangepage/couponTemplate/goodsPage/config/backPicture.js
+++ b/src/pages/exchangepage/couponTemplate/goodsPage/config/backPicture.js
@@ -1,5 +1,5 @@
import React from 'react';
-import { ImageUpload, Notify, RadioGroup, RadioButton } from 'zent';
+import { ImageUpload, ColorPicker, Notify, RadioGroup, RadioButton } from 'zent';
import "@/assets/comm.css"
import Form from "@/components/form/main"
import FormItem from "@/components/form-item/main"
@@ -11,25 +11,32 @@ export default class edittemplate extends React.Component {
constructor(props) {
super(props)
this.state = {
- bgimg:''
+ bgimg: '',
+ bgColor: '#f2f3f4'
}
}
componentWillMount(e) {
let config = JSON.parse(sessionStorage.getItem('editorConfig'));
if (config && config.couponList && config.couponList.product_list) {
- let {bgimg}=config.couponList.product_list.backgroundImg;
- this.setState({ bgimg});
+ let { bgimg } = config.couponList.product_list.backgroundImg;
+ this.setState({ bgimg });
}
}
+ handleChange1 = (color) => {
+ this.setState({
+ bgColor: color
+ });
+ Bus.emit('globalColor',color)
+ }
//顶部banner
onUploadChange(files) {
if (files.length > 0 && files[0].status == "success") {
this.setState({ bgimg: files[0].src })
Bus.emit('bgImg', files[0].src)
} else {
- this.setState({ bgimg: ''})
- Bus.emit('bgImg','')
+ this.setState({ bgimg: '' })
+ Bus.emit('bgImg', '')
}
};
@@ -89,9 +96,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 couponList = oldobj.couponList;
+ couponList.product_list.backgroundImg = _.cloneDeep(this.state);
+ oldobj.couponList = couponList;
sessionStorage.setItem('editorConfig', JSON.stringify(oldobj));
}
render() {
@@ -102,7 +109,7 @@ export default class edittemplate extends React.Component {