| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { Form, Row, Col, Select, Radio } from 'antd' |
| | | import { Form, Row, Col, Select, Radio, Input } from 'antd' |
| | | |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | import './index.scss' |
| | | |
| | | const FileUpload = asyncComponent(() => import('@/tabviews/zshare/fileupload')) |
| | | |
| | | class MainSearch extends Component { |
| | | static propTpyes = { |
| | |
| | | return new Promise(resolve => { |
| | | this.props.form.validateFieldsAndScroll((err, values) => { |
| | | if (!err) { |
| | | if (values.favicon && values.favicon.length > 0 && values.favicon[0].status === 'done') { |
| | | values.favicon = values.favicon[0].response || values.favicon[0].url || '' |
| | | } else { |
| | | values.favicon = '' |
| | | } |
| | | resolve(values) |
| | | } |
| | | }) |
| | |
| | | }, |
| | | wrapperCol: { |
| | | xs: { span: 24 }, |
| | | sm: { span: 12 } |
| | | sm: { span: 16 } |
| | | } |
| | | } |
| | | |
| | | let filelist = [] |
| | | |
| | | if (type === 'edit' && card && card.favicon) { |
| | | filelist = [{ |
| | | uid: `favicon`, |
| | | name: card.favicon.slice(card.favicon.lastIndexOf('/') + 1), |
| | | status: 'done', |
| | | url: card.favicon, |
| | | origin: true |
| | | }] |
| | | } |
| | | |
| | | return ( |
| | | <Form {...formItemLayout} className="mob-card-edit-form"> |
| | | <Row gutter={24}> |
| | | <Col span={24}> |
| | | <Col span={12}> |
| | | <Form.Item label="应用类型"> |
| | | {getFieldDecorator('typename', { |
| | | initialValue: card ? card.typename : 'mob' |
| | |
| | | )} |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={24}> |
| | | <Col span={12}> |
| | | <Form.Item label="语言"> |
| | | {getFieldDecorator('lang', { |
| | | initialValue: card ? card.lang || 'zh-CN' : 'zh-CN' |
| | |
| | | )} |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={24}> |
| | | <Col span={12}> |
| | | <Form.Item label="登录"> |
| | | {getFieldDecorator('login_types', { |
| | | initialValue: card ? card.login_types || 'true' : 'true' |
| | |
| | | )} |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={24}> |
| | | <Col span={12}> |
| | | <Form.Item label="权限管理"> |
| | | {getFieldDecorator('role_type', { |
| | | initialValue: card ? card.role_type || 'true' : 'true' |
| | |
| | | )} |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={24}> |
| | | <Col span={12}> |
| | | <Form.Item label="短连接"> |
| | | {getFieldDecorator('link_type', { |
| | | initialValue: card ? card.link_type || 'true' : 'true' |
| | |
| | | )} |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={24}> |
| | | <Col span={12}> |
| | | <Form.Item label="皮肤"> |
| | | {getFieldDecorator('css', { |
| | | initialValue: card ? card.css : 'bg_black_style_blue' |
| | |
| | | )} |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={12}> |
| | | <Form.Item label="标题"> |
| | | {getFieldDecorator('title', { |
| | | initialValue: card ? card.title || '' : '' |
| | | })(<Input placeholder="" autoComplete="off" onPressEnter={this.handleSubmit} />)} |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={12}> |
| | | <Form.Item label="图标"> |
| | | {getFieldDecorator('favicon', { |
| | | initialValue: filelist |
| | | })(<FileUpload accept=".jpg,.png,.gif,.pjp,.pjpeg,.jpeg,.jfif,.webp,.ico" maxFile={1} fileType={'text'} />)} |
| | | </Form.Item> |
| | | </Col> |
| | | </Row> |
| | | </Form> |
| | | ) |