/* *发布商品的布局(表单内容) 一行多列 左侧label 右侧内容 * */ import React, { PureComponent, Fragment } from 'react'; import { Form, Select, Icon, Row, Col, Input, InputNumber, DatePicker, TreeSelect, Cascader, Checkbox, Radio, Upload, Button, Tooltip, } from 'antd'; import global from '@/global.less'; import styles from './index.less'; import { sldInputAfterAddons, sldBeforeUpload, getSldComImg, sldComLanguage, getLocalStorageStingVal } from '@/utils/utils'; const FormItem = Form.Item; const { RangePicker } = DatePicker; const InputGroup = Input.Group; const RadioGroup = Radio.Group; const CheckboxGroup = Checkbox.Group; const Option = Select.Option; const { TextArea } = Input; export default class SldTableRowTwo extends PureComponent { constructor(props) { super(props); this.state = { props_data: props, }; } componentWillReceiveProps(props) { this.setState({ props_data: props, }); } //处理input内容变化事件 handleInputOnchange = (e, item) => { if (item.handleChange) { item.handleChange(e); } }; //处理复选框变化事件 handleSingleCheckboxOnchange = (e, item) => { if (item.onChange) { item.onChange(e); } }; //多选事件 sldCheckShop = (items, value) => { if (items.sldCheckShop) { items.sldCheckShop(value); } }; redioOnChange = (e, val) => { if (val.onChange) { val.onChange(e.target.value); } }; //图品的点击预览 sldShowImgPre = (val,item) => { if (val.preView) { val.preView(true, item); } }; radio_select = (e, item) => { if (item.callback) { item.callback(e); } }; commonCon = (val, index) => { let { form: { getFieldDecorator }, item_width, } = this.props; //普通输入框 item_width = item_width != undefined ? item_width : 'auto'; const uploadButton = (
{sldComLanguage('上传图片')}
); if (val.type == 'input') { return ( {getFieldDecorator(val.name, { initialValue: val.initialValue, rules: val.rules })( , )} ); }else if (val.type == 'show_text') { //内容展示,目前用于商品详情页 return (
{val.text.length>84 ? {val.text.substring(0,83)}... :val.text }
); }else if (val.type == 'show_text1') { //内容展示,目前用于商品详情页 return (
{val.text.length > 30 ? val.text.substring(0,30) + '...' : val.text}
); }else if (val.type == 'show_goods_img_more') { //展示商品图片(多图),目前用于商品详情页 return (
{val.data.length > 0 && val.data.map((item,index)=>{ return
this.sldShowImgPre(val,item.imageUrl)} style={{flexDirection:'row',justifyContent:'center',alignItems:'center',overFlow:'hidden',width:100,height:100,display:'inline-flex',backgroundColor:'#F8F8F8',marginRight:10}}>
; })}
); } else if (val.type == 'inputnum') { //数字搜索框 return ( {getFieldDecorator(val.name, { initialValue: val.initialValue, rules: val.rules })( this.handleInputOnchange(e, val)}/>)} ); } else if (val.type == 'select') { //下拉选择框 return ( {getFieldDecorator(val.name, val.initialValue ? { initialValue: val.initialValue, rules: val.rules, } : { rules: val.rules, })( , )} ); } else if (val.type == 'multiple_select') { //下拉多选框 return ( {getFieldDecorator(val.name, val.initialValue ? { initialValue: val.initialValue, rules: val.rules, } : { rules: val.rules, })( , )} ); } else if (val.type == 'textarea') { return ( {getFieldDecorator(val.name, { initialValue: val.initialValue, rules: val.rules })(