| | |
| | | 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: [], |
| | | WXApps: null |
| | | } |
| | | |
| | | 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}) |
| | | let apps = null |
| | | if (window.GLOB.WXApps) { |
| | | apps = window.GLOB.WXApps.filter(app => app.appType === 'public') |
| | | |
| | | if (apps.length === 0) { |
| | | apps = null |
| | | } |
| | | } |
| | | |
| | | this.setState({typename, adapters, exts, langs: _langs, WXApps: apps}) |
| | | } |
| | | |
| | | /** |
| | |
| | | values.user_binding = values.exts.includes('user_binding') ? 'true' : 'false' |
| | | values.share = values.exts.includes('share') ? 'true' : 'false' |
| | | delete values.exts |
| | | } |
| | | if (values.wxAppId) { |
| | | let app = window.GLOB.WXApps.filter(app => app.appType === 'public' && values.wxAppId === app.appId)[0] |
| | | values.wxAppName = app ? app.appName : values.wxAppId |
| | | } |
| | | |
| | | resolve(values) |
| | |
| | | render() { |
| | | const { card, type } = this.props |
| | | const { getFieldDecorator } = this.props.form |
| | | const { typename, adapters, exts } = this.state |
| | | const { typename, adapters, exts, langs, WXApps } = 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> |
| | |
| | | <Checkbox value="weixin">公众号</Checkbox> |
| | | <Checkbox value="wxmini">小程序</Checkbox> |
| | | </Checkbox.Group> |
| | | )} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | {WXApps ? <Col span={12}> |
| | | <Form.Item label={ |
| | | <Tooltip placement="topLeft" title="用户可通过此公众号进行支付及退款。"> |
| | | <QuestionCircleOutlined className="mk-form-tip" /> |
| | | 关联公众号 |
| | | </Tooltip> |
| | | }> |
| | | {getFieldDecorator('wxAppId', { |
| | | initialValue: card ? card.wxAppId : '' |
| | | })( |
| | | <Select allowClear> |
| | | {WXApps.map(item => <Select.Option key={item.appId} value={item.appId}>{item.appName}</Select.Option>)} |
| | | </Select> |
| | | )} |
| | | </Form.Item> |
| | | </Col> : null} |
| | |
| | | <Form.Item label={ |
| | | <Tooltip placement="topLeft" title="在使用明科云APP时,状态栏的字体颜色。"> |
| | | <QuestionCircleOutlined className="mk-form-tip" /> |
| | | 状态栏 |
| | | 状态栏文字 |
| | | </Tooltip> |
| | | }> |
| | | {getFieldDecorator('statusBarColor', { |
| | |
| | | )} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | {typename === 'pad' && adapters.includes('app') ? <Col span={12}> |
| | | <Form.Item label={ |
| | | <Tooltip placement="topLeft" title="在明科云APP中,状态栏的最大高度,空值时使用APP获取到的状态栏高度。"> |
| | | <QuestionCircleOutlined className="mk-form-tip" /> |
| | | 状态栏高度 |
| | | </Tooltip> |
| | | }> |
| | | {getFieldDecorator('topHeight', { |
| | | initialValue: card ? card.topHeight || '' : '' |
| | | })(<InputNumber min={0} max={5000} precision={0} onPressEnter={this.handleSubmit}/>)} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | <Col span={12}> |
| | | <Form.Item className="sys-bgcolor" label={ |
| | | <Tooltip placement="topLeft" title="子应用通用的背景色,子应用页面创建时会默认添加此背景色。"> |