import React, {useState} from 'react'
import { Tabs, Card } from 'antd'
import Poster from '@/components/Poster'
import Share from '@/components/Share'
import Basic from './Basic'
import Apartment from './Apartment'
import AlbumList from './AlbumList'
import Panorama from './Panorama'
import Channel from './Channel'
import News from './News'
import SpecialRoom from './SpecialRoom'
import OnSiteService from './OnSiteService'
import styles from './style.less'

const { TabPane } = Tabs

export default (props) => {
  const { history } = props
  const { query } = history.location
  const { id } = query
  const [marketingCode,setMarketingCode] = useState('')
  const target = { id, type: 'building' }

  return (
    <Card>
      <Tabs defaultActiveKey="1">
        <TabPane tab="基础信息" key="1">
          <div className={styles['tab-wrapper']} style={{maxWidth: 1000}}>
            <Basic {...props}  setMarketingCode={(e)=>setMarketingCode(e)}/>
          </div>
        </TabPane>
        <TabPane tab="户型设置" key="2">
          <div className={styles['tab-wrapper']}>
            <Apartment {...props} />
          </div>
        </TabPane>
        <TabPane tab="项目相册" key="3">
          <div className={styles['tab-wrapper']}>
            <AlbumList {...props} />
          </div>
        </TabPane>
        <TabPane tab="全景照片" key="4">
          <div className={styles['tab-wrapper']}>
            <Panorama {...props} />
          </div>
        </TabPane>
        <TabPane tab="项目动态" key="8">
          <div className={styles['tab-wrapper']}>
            <News {...props} />
          </div>
        </TabPane>
        <TabPane tab="特价房源" key="9">
          <div className={styles['tab-wrapper']}>
            <SpecialRoom {...props} />
          </div>
        </TabPane>
        <TabPane tab="渠道设置" key="7">
          <div className={styles['tab-wrapper']} style={{maxWidth: '800px'}}>
            <Channel {...props} />
          </div>
        </TabPane>
        <TabPane tab="驻场设置" key="10">
          <div className={styles['tab-wrapper']} style={{maxWidth: '1200px'}}>
            <OnSiteService {...props} marketingCode={marketingCode}/>
          </div>
        </TabPane>
        <TabPane tab="海报图片" key="5">
          <Poster target={target} rights="building.poster.save" {...props} />
        </TabPane>
        <TabPane tab="分享设置" key="6">
          <div className={styles['tab-wrapper']} style={{maxWidth: '800px'}}>
            <Share target={target} rights="building.share.save" {...props} />
          </div>
        </TabPane>
      </Tabs>
    </Card>
  )
}
