import React, { useState, useEffect } from 'react';
import { Form, Icon, Input, Button, DatePicker, Select, Card, Row, Col, Pagination, Alert, Radio, Tag, Tooltip, Tabs } from 'antd';
import moment from 'moment';
import request from '../../../../utils/request';
import apis from '../../../../services/apis';
import Styles from './style.less';
import { router } from 'umi';


import ImageUpload from '../../../../components/XForm/ImageUpload'
import Wangedit from '../../../../components/Wangedit/Wangedit'
import TagGroup from './components/tags'
import Base from './components/base'
import ImageSet from './components/imageSet'


const { Option } = Select
const { TabPane } = Tabs;

const formItemLayout = {
  labelCol: {
    xs: { span: 24 },
    sm: { span: 2 },
  },
  wrapperCol: {
    xs: { span: 24 },
    sm: { span: 16 },
  },
};

function AddBuilding(props) {
  function tabsCallback(key) {
    console.log(key);
  }

  console.log(props.location)

  return (
    <Tabs defaultActiveKey="1" onChange={tabsCallback}>
      <TabPane tab="基本信息" key="1">
        <Base building={{ buildingId: props.location.query && props.location.query.id }} />
      </TabPane>
      {
        props.location.query.id &&
        <TabPane tab="图片" key="2">
          {/* '159fd19bb973b6972c10fbebf07ddeb1' */}
          <ImageSet building={{ buildingId: props.location.query && props.location.query.id }} />
        </TabPane>
      }
    </Tabs>
  )
}

const WrappedAddBuildingForm = Form.create({ name: 'addBuilding' })(AddBuilding);

export default WrappedAddBuildingForm
