完成编辑器搜索栏新增背景颜色,输入文字颜色配置

This commit is contained in:
许红梅 2022-09-08 18:09:00 +08:00
parent eff0085d73
commit 3063dc1998
8 changed files with 82 additions and 18 deletions

View File

@ -172,15 +172,15 @@ input {
} }
.center { .center {
text-align: center; justify-content: center!important;;
} }
.left { .left {
text-align: left; justify-content: flex-start!important;;
} }
.right { .right {
text-align: right; justify-content: flex-end!important;;
} }
.square { .square {

View File

@ -37,8 +37,11 @@ export default class componentLib extends React.Component {
componentWillUnmount() {} componentWillUnmount() {}
propcomponentName(item){ propcomponentName(item){
this.props.componentName(item.name); this.props.componentName(item.name);
if(item.name){
Bus.emit('componentLib',item) Bus.emit('componentLib',item)
} }
}
render() { render() {
return ( return (
<div className="componentLib"> <div className="componentLib">

View File

@ -15,6 +15,8 @@ export default class Searchbar extends React.Component {
shape: 'circular', shape: 'circular',
textAlign: 'left', textAlign: 'left',
borderColor: '#333', borderColor: '#333',
bgColor:'#a00',
fontColor:'#333',
placeholder: '请输入关键字搜索' placeholder: '请输入关键字搜索'
} }
} }
@ -43,11 +45,31 @@ export default class Searchbar extends React.Component {
}); });
Bus.emit('borderColor', color) Bus.emit('borderColor', color)
} }
changebgColor = (color) => {
this.setState({
bgColor: color
});
Bus.emit('searchbgColor', color)
}
changefontColor = (color) => {
this.setState({
fontColor: color
});
Bus.emit('searchfontColor', color)
}
borderColorFn(cor) { borderColorFn(cor) {
this.setState({ borderColor: cor }); this.setState({ borderColor: cor });
Bus.emit('borderColor', cor) Bus.emit('borderColor', cor)
} }
bgColorFn(cor) {
this.setState({ bgColor: cor });
Bus.emit('searchbgColor', cor)
}
fontColorFn(cor) {
this.setState({ fontColor: cor });
Bus.emit('searchfontColor', cor)
}
componentWillUnmount() { componentWillUnmount() {
let oldobj = JSON.parse(sessionStorage.getItem('editorConfig')); let oldobj = JSON.parse(sessionStorage.getItem('editorConfig'));
let couponList = oldobj.couponList; let couponList = oldobj.couponList;
@ -56,7 +78,7 @@ export default class Searchbar extends React.Component {
sessionStorage.setItem('editorConfig', JSON.stringify(oldobj)); sessionStorage.setItem('editorConfig', JSON.stringify(oldobj));
} }
render() { render() {
let { shape, textAlign, borderColor, placeholder } = this.state; let { shape, textAlign, borderColor, placeholder,bgColor,fontColor } = this.state;
return ( return (
<div className="assembly"> <div className="assembly">
<div className='control page-title-control'> <div className='control page-title-control'>
@ -80,7 +102,7 @@ export default class Searchbar extends React.Component {
<RadioButton value={"right"}>居右</RadioButton> <RadioButton value={"right"}>居右</RadioButton>
</RadioGroup> </RadioGroup>
</FormItem> </FormItem>
<FormItem labelname="框体颜色:" labelwidth="80px"> <FormItem required={false} labelname="框体颜色:" labelwidth="80px">
<div className="colorItemfont dfleac"> <div className="colorItemfont dfleac">
<span style={{ border: '1px solid #f1f2f3' }} className={borderColor == '#fff' ? "cicle activecicle" : "cicle"} onClick={() => { this.borderColorFn('#fff') }}></span> <span style={{ border: '1px solid #f1f2f3' }} className={borderColor == '#fff' ? "cicle activecicle" : "cicle"} onClick={() => { this.borderColorFn('#fff') }}></span>
<span className={borderColor == '#04C160' ? "activecicle cicle cicle6" : "cicle cicle6"} onClick={() => { this.borderColorFn('#04C160') }}></span> <span className={borderColor == '#04C160' ? "activecicle cicle cicle6" : "cicle cicle6"} onClick={() => { this.borderColorFn('#04C160') }}></span>
@ -92,7 +114,31 @@ export default class Searchbar extends React.Component {
</div> </div>
</div> </div>
</FormItem> </FormItem>
<FormItem labelname="提示文字:" prop="title" id="title" labelwidth="100px"> <FormItem required={false} labelname="背景颜色:" labelwidth="80px">
<div className="colorItemfont dfleac">
<span style={{ border: '1px solid #f1f2f3' }} className={borderColor == '#fff' ? "cicle activecicle" : "cicle"} onClick={() => { this.bgColorFn('#fff') }}></span>
<span className={borderColor == '#04C160' ? "activecicle cicle cicle6" : "cicle cicle6"} onClick={() => { this.bgColorFn('#04C160') }}></span>
<span className={borderColor == '#AE99D3' ? "activecicle cicle cicle3" : "cicle cicle3"} onClick={() => { this.bgColorFn('#AE99D3') }}></span>
<span className={borderColor == '#FACD6A' ? "activecicle cicle cicle4" : "cicle cicle4"} onClick={() => { this.bgColorFn('#FACD6A') }}></span>
<span className={borderColor == '#FE7962' ? "activecicle cicle cicle5" : "cicle cicle5"} onClick={() => { this.bgColorFn('#FE7962') }}></span>
<div className="selfset">
<ColorPicker className="setbgColor" color={bgColor} onChange={this.changebgColor} />
</div>
</div>
</FormItem>
<FormItem required={false} labelname="文字颜色:" labelwidth="80px">
<div className="colorItemfont dfleac">
<span style={{ border: '1px solid #f1f2f3' }} className={borderColor == '#fff' ? "cicle activecicle" : "cicle"} onClick={() => { this.fontColorFn('#fff') }}></span>
<span className={borderColor == '#04C160' ? "activecicle cicle cicle6" : "cicle cicle6"} onClick={() => { this.fontColorFn('#04C160') }}></span>
<span className={borderColor == '#AE99D3' ? "activecicle cicle cicle3" : "cicle cicle3"} onClick={() => { this.fontColorFn('#AE99D3') }}></span>
<span className={borderColor == '#FACD6A' ? "activecicle cicle cicle4" : "cicle cicle4"} onClick={() => { this.fontColorFn('#FACD6A') }}></span>
<span className={borderColor == '#FE7962' ? "activecicle cicle cicle5" : "cicle cicle5"} onClick={() => { this.fontColorFn('#FE7962') }}></span>
<div className="selfset">
<ColorPicker className="setbgColor" color={fontColor} onChange={this.changefontColor} />
</div>
</div>
</FormItem>
<FormItem required={false} labelname="提示文字:" labelwidth="100px">
<Ipt onChange={(e) => { <Ipt onChange={(e) => {
this.setState({ placeholder: e }) this.setState({ placeholder: e })
Bus.emit('placeholder', e) Bus.emit('placeholder', e)

View File

@ -1,14 +1,16 @@
.searchBar-container{
padding: 4px 0;
box-sizing: border-box;
}
.searchBar{ .searchBar{
display: flex; display: flex;
justify-content: flex-end; justify-content: center;
justify-content: space-between; padding:0 10px;
padding:0 15px;
box-sizing: border-box; box-sizing: border-box;
i{ i{
width: 16px; width: 16px;
} }
.placeholder{ .placeholder{
flex: 1;
white-space:nowrap; /* 不换行 */ white-space:nowrap; /* 不换行 */
overflow:hidden; /* 内容超出宽度时隐藏超出部分的内容 */ overflow:hidden; /* 内容超出宽度时隐藏超出部分的内容 */

View File

@ -7,15 +7,16 @@ export default class searchBar extends React.Component {
} }
render() { render() {
let searchConfig=this.props.searchConfig; let searchConfig=this.props.searchConfig;
console.log(10,searchConfig);
return ( return (
<div className={searchConfig.shape +' searchBar'} style={{border:'1px solid '+searchConfig.borderColor}}> <div className="searchBar-container" style={{background:searchConfig.bgColor}}>
<div className={searchConfig.shape +' searchBar '+searchConfig.textAlign} style={{background:searchConfig.borderColor,color:searchConfig.fontColor}}>
<i className='marketing marketing-sousuo' /> <i className='marketing marketing-sousuo' />
<div className={searchConfig.textAlign +' placeholder'}> <div className='placeholder'>
{searchConfig.placeholder} {searchConfig.placeholder}
</div> </div>
</div> </div>
</div>
) )
} }
} }

View File

@ -118,7 +118,7 @@
} }
.goodstemplate { .goodstemplate {
overflow-y: auto; // overflow-y: auto;
.selectBorder { .selectBorder {
z-index: 2; z-index: 2;
-webkit-box-sizing: border-box; -webkit-box-sizing: border-box;
@ -153,12 +153,12 @@
.searchBar { .searchBar {
width: 80%; width: 80%;
margin: 2% 10%; margin: 2% 15%;
height: 40px; height: 40px;
line-height: 40px; line-height: 40px;
padding-left: 15px; padding-left: 15px;
box-sizing: border-box; box-sizing: border-box;
border: 1px solid #333; border:0;
border-radius: 20px; border-radius: 20px;
} }
} }

View File

@ -87,6 +87,8 @@ let couponProduct_list = {
shape: 'circular', shape: 'circular',
textAlign: 'left', textAlign: 'left',
borderColor: '#333', borderColor: '#333',
bgColor:'#a00',
fontColor:'#333',
placeholder: '请输入关键字搜索' placeholder: '请输入关键字搜索'
}, },
title: { title: {
@ -212,6 +214,16 @@ export default class edittemplate extends React.Component {
searchConfig.search.borderColor = prop searchConfig.search.borderColor = prop
this.setState({ product_list: searchConfig }) this.setState({ product_list: searchConfig })
}) })
Bus.addListener('searchbgColor', (prop) => {
let searchConfig = this.state.product_list
searchConfig.search.bgColor = prop
this.setState({ product_list: searchConfig })
})
Bus.addListener('searchfontColor', (prop) => {
let searchConfig = this.state.product_list
searchConfig.search.fontColor = prop
this.setState({ product_list: searchConfig })
})
//标题设置 //标题设置
Bus.addListener('title', (prop) => { Bus.addListener('title', (prop) => {
let titleConfig = this.state.product_list let titleConfig = this.state.product_list

View File

@ -8,7 +8,7 @@
// background-color: #f5f7f8; // background-color: #f5f7f8;
height: 100%; height: 100%;
left: 0; left: 0;
margin: 0 485px 0 250px; margin: 0 430px 0 325px;
overflow-y: scroll; overflow-y: scroll;
position: absolute; position: absolute;
right: 0; right: 0;