From ab98bd7872c70eacd3209a3d525413b0f301f772 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:11:40 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90=E6=A0=87=E9=A2=98=E6=96=87?= =?UTF-8?q?=E5=AD=97Tab=E5=88=87=E6=8D=A2=EF=BC=8C=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E6=A0=8F=E6=96=B0=E5=A2=9E=E4=BC=A0=E5=9B=BE=EF=BC=8C=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E9=A2=84=E8=A7=88=E5=8C=BA=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../goodsPage/config/searchBar.js | 4 +- .../couponTemplate/goodsPage/config/title.js | 104 +++++++++++++++++- .../edittemplate/goodstemplate.js | 83 +++++++------- .../edittemplate/goodstemplate.less | 3 + src/pages/exchangepage/edittemplate/main.js | 21 +++- 5 files changed, 164 insertions(+), 51 deletions(-) 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 ( -