import {
  WeaInput,
  WeaFormItem,
} from 'ecCom'

import {
  Row,
  Col,
} from 'antd'
import {addContentPath} from '../../util/index.js'

export default class BriefInfo extends React.Component {
  constructor(props) {
    super(props);
  }

  getInfo() {
    const {
      datas
    } = this.props;

    let arr = [];
    datas.map((data, index) => {
      arr.push(
        <WeaFormItem ecId={`${this && this.props && this.props.ecId || ''}_WeaFormItem@d54gf2@${index}`}
           label={data.label}
           labelCol={{span: 6}}
           wrapperCol={{span: 18}}
           underline
        >
            {data.link ? <div style={{paddingTop:17}}><a href={ addContentPath(data.link) } target='_blank'>{data.value}</a></div> : <WeaInput ecId={`${this && this.props && this.props.ecId || ''}_WeaInput@zr9yq1@${index}`} value={data.value} viewAttr={1}/>} 
        </WeaFormItem>
      );
    });
    return arr;
  }

  render() {
    return (
      <Row ecId={`${this && this.props && this.props.ecId || ''}_Row@xz6a0h`}>
          <Col ecId={`${this && this.props && this.props.ecId || ''}_Col@thcs6p`} span={14} offset={5}>
              {this.getInfo()}
          </Col>
      </Row>
    )
  }
}