| | |
| | | } |
| | | |
| | | getCards = () => { |
| | | const { display, width, options, fields, ratio, multiple } = this.props.card |
| | | const { display, width, options, fields, ratio, multiple, backgroundColor, borderColor } = this.props.card |
| | | const { selectKeys } = this.state |
| | | |
| | | let paddingTop = '100%' |
| | |
| | | paddingTop = '56.25%' |
| | | } |
| | | |
| | | let style = {} |
| | | |
| | | if (borderColor) { |
| | | style.borderColor = borderColor |
| | | } |
| | | |
| | | if (!options || options.length === 0) { |
| | | return null |
| | | } else if (display !== 'picture') { |
| | | if (!fields || fields.length === 0) { |
| | | return null |
| | | } |
| | | if (backgroundColor) { |
| | | style.backgroundColor = backgroundColor |
| | | } |
| | | return options.map(item => { |
| | | let _active = false |
| | |
| | | } |
| | | |
| | | return <Col span={width} key={item.key}> |
| | | <div className={'card-cell ' + (_active ? 'active' : '')} onClick={() => this.changeCard(item)}> |
| | | <div className={'card-cell ' + (_active ? 'active' : '')} style={style} onClick={() => this.changeCard(item)}> |
| | | {fields.map(col => { |
| | | return <span key={col.key} style={{color: col.color, fontSize: col.fontSize + 'px', height: col.fontSize * 1.5 + 'px', textAlign: col.align}}>{item[col.field]}</span> |
| | | })} |
| | |
| | | } |
| | | |
| | | return <Col span={width} key={item.key}> |
| | | <div className={'card-pic-cell ' + (_active ? 'active' : '')} onClick={() => this.changeCard(item)} style={{paddingTop, backgroundImage: `url(${item.$url})`}}> |
| | | <div className={'card-pic-cell ' + (_active ? 'active' : '')} onClick={() => this.changeCard(item)} style={{...style, paddingTop, backgroundImage: `url(${item.$url})`}}> |
| | | </div> |
| | | </Col> |
| | | }) |