| | |
| | | import { Form, Row, Col, Select, Radio, Input, Tooltip, InputNumber, Checkbox } from 'antd' |
| | | import { QuestionCircleOutlined } from '@ant-design/icons' |
| | | |
| | | import { langs } from '@/store/options.js' |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | import './index.scss' |
| | | |
| | |
| | | inputSubmit: PropTypes.func // input回车提交 |
| | | } |
| | | |
| | | state = {typename: 'mob', adapters: [], exts: []} |
| | | state = { |
| | | typename: 'mob', |
| | | adapters: [], |
| | | exts: [] |
| | | } |
| | | |
| | | UNSAFE_componentWillMount() { |
| | | const { card } = this.props |
| | | let adapters = [] |
| | | let exts = [] |
| | | let typename = 'mob' |
| | | let _langs = [] |
| | | Object.keys(langs).forEach(key => { |
| | | _langs.push({value: key, label: langs[key]}) |
| | | }) |
| | | |
| | | if (card) { |
| | | typename = card.typename || 'mob' |
| | |
| | | } |
| | | } |
| | | |
| | | this.setState({typename, adapters, exts}) |
| | | this.setState({typename, adapters, exts, langs: _langs}) |
| | | } |
| | | |
| | | /** |
| | |
| | | render() { |
| | | const { card, type } = this.props |
| | | const { getFieldDecorator } = this.props.form |
| | | const { typename, adapters, exts } = this.state |
| | | const { typename, adapters, exts, langs } = this.state |
| | | const formItemLayout = { |
| | | labelCol: { |
| | | xs: { span: 24 }, |
| | |
| | | {getFieldDecorator('lang', { |
| | | initialValue: card ? card.lang || 'zh-CN' : 'zh-CN' |
| | | })( |
| | | <Radio.Group disabled={type === 'edit'}> |
| | | <Radio value="zh-CN">中文</Radio> |
| | | <Radio value="en-US">英文</Radio> |
| | | </Radio.Group> |
| | | <Select disabled={type === 'edit'}> |
| | | {langs.map(item => <Select.Option key={item.value} value={item.value}>{item.label}</Select.Option>)} |
| | | </Select> |
| | | )} |
| | | </Form.Item> |
| | | </Col> |