diff --git a/src/pages/exchangepage/couponTemplate/goodsPage/config/searchBar.js b/src/pages/exchangepage/couponTemplate/goodsPage/config/searchBar.js index b8ced255..6739a7c5 100644 --- a/src/pages/exchangepage/couponTemplate/goodsPage/config/searchBar.js +++ b/src/pages/exchangepage/couponTemplate/goodsPage/config/searchBar.js @@ -13,10 +13,10 @@ export default class Searchbar extends React.Component { this.state = { switch:false, shape: 'circular', - textAlign: 'left', + textAlign: 'center', borderColor: '#333', bgColor:'#a00', - fontColor:'#333', + fontColor:'#fff', placeholder: '请输入关键字搜索' } } diff --git a/src/pages/exchangepage/couponTemplate/goodsPage/config/title.js b/src/pages/exchangepage/couponTemplate/goodsPage/config/title.js index 6e3c52fe..f7828b4e 100644 --- a/src/pages/exchangepage/couponTemplate/goodsPage/config/title.js +++ b/src/pages/exchangepage/couponTemplate/goodsPage/config/title.js @@ -1,5 +1,5 @@ import React from 'react'; -import { ColorPicker, Notify, RadioGroup, RadioButton } from 'zent'; +import { ColorPicker,ImageUpload, Notify, RadioGroup, RadioButton } from 'zent'; import "@/assets/comm.css" import Form from "@/components/form/main" import FormItem from "@/components/form-item/main" @@ -12,10 +12,12 @@ export default class Title extends React.Component { super(props) this.state = { switch:false, - text: '', + text: '商品标题', textAlign: 'left', fontColor: '#333', - fontSize: 1 + fontSize: 1, + comstyle:1, + pic:'' } } componentWillMount(e) { @@ -50,6 +52,73 @@ export default class Title extends React.Component { this.setState({ fontSize: e.target.value }) Bus.emit('fontSize', e.target.value) } + styleChange(e){ + this.setState({ comstyle: e.target.value }) + Bus.emit('comstyle', e.target.value) + } + onUploadChange(files) { + if (files.length > 0 && files[0].status == "success") { + this.setState({ pic: files[0].src }) + Bus.emit('titlePic', files[0].src) + } else { + this.setState({ pic: ''}) + Bus.emit('titlePic','') + } + }; + + onUploadError = (type, data) => { + if (type === 'overMaxAmount') { + Notify.error(`最多可上传 ${data.maxAmount} 张图片`); + } else if (type === 'overMaxSize') { + Notify.error(`图片大小不能超过 ${data.formattedMaxSize}`); + } + }; + 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')); @@ -60,14 +129,21 @@ export default class Title extends React.Component { } render() { return ( -
确认删除该模块?
, - 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 ( -