import React, { useState, useEffect } from 'react';
import { Select } from 'antd';

import request from '../../utils/request'

const { Option } = Select;

/**
 *
 *
 * @param {*} props
 * @returns
 */
const NewsTypeSelect = (props) => {
  const [ data, setData ] = useState([])

  useEffect(() => {
    getCityList();
  },[])

  const getCityList = (e) => {
    request({
        url: '/api/admin/taNewsType',
        method: 'GET',
        params: {pageNum: 1,pageSize: 999},
    }).then((data) => {
        setData(data.records)
    })
  }

  return (
      <Select value={props.value} style={{ width: '180px' }} placeholder="请选择讯类型" onChange={props.onChange}>
          {data.map(type => (
            <Option key={type.newsTypeId}>{type.newsTypeName}</Option>
          ))}
      </Select>
  )
}
export default NewsTypeSelect

