解决优惠券/优惠券白名单Tab切换,输入框图片与上传不一致,组件未及时更新

This commit is contained in:
Apple 2022-09-19 14:34:04 +08:00
parent 3a8fdd7f44
commit c27ebf9bed
2 changed files with 11 additions and 35 deletions

View File

@ -265,9 +265,6 @@ export default class edittemplate extends React.Component {
</div> </div>
</div> </div>
</FormItem> </FormItem>
{
this.props.couponType==4?<div>123</div>:<div>456</div>
}
<div style={{ marginTop: '20px', fontWeight: 'bold' }}>基础图层</div> <div style={{ marginTop: '20px', fontWeight: 'bold' }}>基础图层</div>
<FormItem labelname="顶部banner:" prop="top" id="top" labelwidth="100px"> <FormItem labelname="顶部banner:" prop="top" id="top" labelwidth="100px">
<ImageUpload <ImageUpload
@ -284,7 +281,7 @@ export default class edittemplate extends React.Component {
/> />
</FormItem> </FormItem>
{ {
this.props.couponType==4? <FormItem labelname="输入框1:" labelwidth="100px"> this.props.couponType==4? <FormItem labelname="输入框:" labelwidth="100px" key={1}>
<ImageUpload <ImageUpload
className="zent-image-upload-demo" className="zent-image-upload-demo"
maxSize={5 * 1024 * 1024} maxSize={5 * 1024 * 1024}
@ -293,19 +290,19 @@ export default class edittemplate extends React.Component {
sortable sortable
tips="单张图片不超过 5M" tips="单张图片不超过 5M"
onChange={(e) => { this.onUploadChange1(e,'middle_image') }} onChange={(e) => { this.onUploadChange1(e,'middle_image') }}
defaultFileList={[{ 'src': this.state.model.middle_image }] } defaultFileList={this.state.model.middle_image ? [{ 'src': this.state.model.middle_image }] : null}
onUpload={this.onUpload} onUpload={this.onUpload}
onError={this.onUploadError} onError={this.onUploadError}
/> />
</FormItem>: </FormItem>:
<FormItem labelname="输入框2:" labelwidth="100px"> <FormItem labelname="输入框:" labelwidth="100px" key={2}>
<ImageUpload <ImageUpload
className="zent-image-upload-demo" className="zent-image-upload-demo"
maxSize={5 * 1024 * 1024} maxSize={5 * 1024 * 1024}
maxAmount={1} maxAmount={1}
multiple multiple
sortable sortable
tips="单张图片不超过 54M" tips="单张图片不超过 5M"
onChange={(e) => { this.onUploadChange1(e,'white_image') }} onChange={(e) => { this.onUploadChange1(e,'white_image') }}
defaultFileList={this.state.model.white_image ? [{ 'src': this.state.model.white_image }] : null} defaultFileList={this.state.model.white_image ? [{ 'src': this.state.model.white_image }] : null}
onUpload={this.onUpload} onUpload={this.onUpload}
@ -313,8 +310,6 @@ export default class edittemplate extends React.Component {
/> />
</FormItem> </FormItem>
} }
{this.state.model.white_image}
<FormItem myClassName="activeSet" required={false} labelname="活动说明:" prop="bottom" id="bottom" labelwidth="100px"> <FormItem myClassName="activeSet" required={false} labelname="活动说明:" prop="bottom" id="bottom" labelwidth="100px">
<RadioGroup onChange={(e) => { this.onactivityChange(e) }} value={this.state.model.describe.type}> <RadioGroup onChange={(e) => { this.onactivityChange(e) }} value={this.state.model.describe.type}>
<RadioButton value={"1"} onClick={() => this.hasItemFn(1)}>图片</RadioButton> <RadioButton value={"1"} onClick={() => this.hasItemFn(1)}>图片</RadioButton>

View File

@ -17,8 +17,7 @@ import Whitegoods from './whitegoods' //白名单商品页面
import Whitedetails from './whitedetails' //白名单详情页 import Whitedetails from './whitedetails' //白名单详情页
import Reduce from './reduce' //商品详情页立减金 import Reduce from './reduce' //商品详情页立减金
import ReduceConfig from './reduceConfig' //商品详情立减金页面 import ReduceConfig from './reduceConfig' //商品详情立减金页面
import SearchBarView from './couponConfig/searchBar'
import BottomBarView from './couponConfig/bottomBar'
// 优惠券 // 优惠券
import CouponLandingForm from '../couponTemplate/landingPage/config/main' //优惠券落地页表单 import CouponLandingForm from '../couponTemplate/landingPage/config/main' //优惠券落地页表单
import CouponGoodsListForm from '../couponTemplate/goodsPage/config/main' //优惠券商品列表页 import CouponGoodsListForm from '../couponTemplate/goodsPage/config/main' //优惠券商品列表页
@ -889,16 +888,7 @@ export default class edittemplate extends React.Component {
)} )}
<div className='hascode'> <div className='hascode'>
{!this.state.model.middle_image ? ( <img src={this.state.showType==8?this.state.model.white_image?this.state.model.white_image:'https://lsxd-yunshanfu.oss-cn-hangzhou.aliyuncs.com/common_image/20220105/5dd765e3b46042f7ecd8c576e6fa9568.png':this.state.model.middle_image?this.state.model.middle_image:'https://lsxd-yunshanfu.oss-cn-hangzhou.aliyuncs.com/common_image/20220105/5dd765e3b46042f7ecd8c576e6fa9568.png'} id='top' />
<img
id='top'
src={
'https://lsxd-yunshanfu.oss-cn-hangzhou.aliyuncs.com/common_image/20220105/5dd765e3b46042f7ecd8c576e6fa9568.png'
}
/>
) : (
<img src={this.state.model.middle_image} id='top' />
)}
{[1,4].includes(this.state.showType)? ( {[1,4].includes(this.state.showType)? (
<img <img
src={ src={
@ -1055,20 +1045,11 @@ export default class edittemplate extends React.Component {
)} )}
</div> </div>
<div className='center' id='center'> <div className='center' id='center'>
{!this.state.model.middle_image ? ( <img
<img crossOrigin='anonymous'
id='center-img' id='center-img'
src={ src={this.state.showType==8?this.state.model.white_image?this.state.model.white_image:'https://lsxd-yunshanfu.oss-cn-hangzhou.aliyuncs.com/common_image/20220105/5dd765e3b46042f7ecd8c576e6fa9568.png':this.state.model.middle_image?this.state.model.middle_image:'https://lsxd-yunshanfu.oss-cn-hangzhou.aliyuncs.com/common_image/20220105/5dd765e3b46042f7ecd8c576e6fa9568.png'}
'https://lsxd-yunshanfu.oss-cn-hangzhou.aliyuncs.com/common_image/20220105/5dd765e3b46042f7ecd8c576e6fa9568.png' />
}
/>
) : (
<img
crossOrigin='anonymous'
id='center-img'
src={this.state.model.middle_image}
/>
)}
{[1,4].includes(this.state.showType) ? ( {[1,4].includes(this.state.showType) ? (
<img <img
src={ src={