| | |
| | | inputSubmit: PropTypes.func // input回车提交 |
| | | } |
| | | |
| | | state = {typename: 'mob', adapters: []} |
| | | state = {typename: 'mob', adapters: [], exts: []} |
| | | |
| | | UNSAFE_componentWillMount() { |
| | | const { card } = this.props |
| | | let adapters = [] |
| | | let exts = [] |
| | | let typename = 'mob' |
| | | |
| | | if (card) { |
| | | typename = card.typename || 'mob' |
| | | adapters = card.adapter ? card.adapter.split(',') : [] |
| | | |
| | | if (typename !== 'pc') { |
| | | if (card.user_binding === 'true') { |
| | | exts.push('user_binding') |
| | | } |
| | | if (card.share === 'true') { |
| | | exts.push('share') |
| | | } |
| | | } |
| | | } |
| | | |
| | | this.setState({typename, adapters}) |
| | | this.setState({typename, adapters, exts}) |
| | | } |
| | | |
| | | /** |
| | |
| | | return new Promise(resolve => { |
| | | this.props.form.validateFieldsAndScroll((err, values) => { |
| | | if (!err) { |
| | | // values.user_binding = values.user_binding ? values.user_binding.join(',') : '' |
| | | values.adapter = values.adapter ? values.adapter.join(',') : '' |
| | | // if (values.user_binding.indexOf('sms_vcode') > -1 && !values.sms_id) { |
| | | // notification.warning({ |
| | | // top: 92, |
| | | // message: '手机号绑定时,需要短信模板!', |
| | | // duration: 5 |
| | | // }) |
| | | // return |
| | | // } |
| | | |
| | | if (values.exts) { |
| | | values.user_binding = values.exts.includes('user_binding') ? 'true' : 'false' |
| | | values.share = values.exts.includes('share') ? 'true' : 'false' |
| | | delete values.exts |
| | | } |
| | | |
| | | resolve(values) |
| | | } |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | // onChange = (vals) => { |
| | | // this.setState({user_binding: vals}) |
| | | // } |
| | | |
| | | onAdapterChange = (vals) => { |
| | | if (!vals.includes('weixin') && !vals.includes('wxmini')) { |
| | | this.setState({exts: []}) |
| | | } |
| | | this.setState({adapters: vals}) |
| | | // if (!vals.includes('weixin') && !vals.includes('wxmini')) { |
| | | // this.setState({user_binding: []}) |
| | | // } |
| | | } |
| | | |
| | | /** |
| | |
| | | render() { |
| | | const { card, type } = this.props |
| | | const { getFieldDecorator } = this.props.form |
| | | const { typename, adapters } = this.state |
| | | const { typename, adapters, exts } = this.state |
| | | const formItemLayout = { |
| | | labelCol: { |
| | | xs: { span: 24 }, |
| | |
| | | </Form.Item> |
| | | </Col> : null} |
| | | {typename !== 'pc' && (adapters.includes('weixin') || adapters.includes('wxmini')) ? <Col span={12}> |
| | | <Form.Item label={ |
| | | <Tooltip placement="topLeft" title="在公众号或小程序中,可添加绑定系统用户、自定义分享等功能,自定义分享设置后,当前子应用将默认使用此分享链接。"> |
| | | <QuestionCircleOutlined className="mk-form-tip" /> |
| | | 扩展功能 |
| | | </Tooltip> |
| | | }> |
| | | {getFieldDecorator('exts', { |
| | | initialValue: exts |
| | | })( |
| | | <Checkbox.Group onChange={(vals) => this.setState({exts: vals})}> |
| | | <Checkbox value="user_binding">用户绑定</Checkbox> |
| | | <Checkbox value="share">分享</Checkbox> |
| | | </Checkbox.Group> |
| | | )} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | {/* {typename !== 'pc' && (adapters.includes('weixin') || adapters.includes('wxmini')) ? <Col span={12}> |
| | | <Form.Item label="用户绑定"> |
| | | {getFieldDecorator('user_binding', { |
| | | initialValue: card ? card.user_binding : 'false' |
| | |
| | | <Radio value="true">需要</Radio> |
| | | <Radio value="false">不需要</Radio> |
| | | </Radio.Group> |
| | | // <Checkbox.Group onChange={this.onChange}> |
| | | // <Checkbox value="uname_pwd">账号</Checkbox> |
| | | // <Checkbox value="sms_vcode">手机短信</Checkbox> |
| | | // </Checkbox.Group> |
| | | )} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | {/* {typename !== 'pc' && user_binding.includes('sms_vcode') ? <Col span={12}> |
| | | <Form.Item label={ |
| | | <Tooltip placement="topLeft" title="短信模板可在 云系统->应用服务->开发者中心->短信模板 处添加。"> |
| | | <QuestionCircleOutlined className="mk-form-tip" /> |
| | | 短信模板 |
| | | </Tooltip> |
| | | }> |
| | | {getFieldDecorator('sms_id', { |
| | | initialValue: card ? card.sms_id || '' : '', |
| | | rules: [{ |
| | | required: true, |
| | | message: '使用手机短信时请选择短信模板!' |
| | | }] |
| | | })( |
| | | <Select allowClear> |
| | | {msgs.map(option => |
| | | <Select.Option key={option.ID} value={option.ID}>{option.SignName + ' - ' + option.TemplateCode}</Select.Option> |
| | | )} |
| | | </Select> |
| | | )} |
| | | </Form.Item> |
| | | </Col> : null} */} |
| | | <Col span={12}> |
| | | <Form.Item label="标题"> |
| | | <Form.Item label={ |
| | | exts.includes('share') ? |
| | | <Tooltip placement="topLeft" title="子应用及分享时的标题。"> |
| | | <QuestionCircleOutlined className="mk-form-tip" /> |
| | | 标题 |
| | | </Tooltip> : '标题' |
| | | }> |
| | | {getFieldDecorator('title', { |
| | | initialValue: card ? card.title || '' : '' |
| | | initialValue: card ? card.title || '' : '', |
| | | rules: exts.includes('share') ? [{ |
| | | required: true, |
| | | message: '请填写标题!' |
| | | }] : [] |
| | | })(<Input placeholder="" autoComplete="off" onPressEnter={this.handleSubmit} />)} |
| | | </Form.Item> |
| | | </Col> |
| | | {exts.includes('share') ? <Col span={12}> |
| | | <Form.Item label={ |
| | | <Tooltip placement="topLeft" title="分享时的描述信息。"> |
| | | <QuestionCircleOutlined className="mk-form-tip" /> |
| | | 分享描述 |
| | | </Tooltip> |
| | | }> |
| | | {getFieldDecorator('share_des', { |
| | | initialValue: card ? card.share_des || '' : '' |
| | | })(<Input placeholder="" autoComplete="off" onPressEnter={this.handleSubmit} />)} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | {exts.includes('share') ? <Col span={12}> |
| | | <Form.Item label="分享图片"> |
| | | {getFieldDecorator('share_url', { |
| | | initialValue: card ? card.share_url : '' |
| | | })( |
| | | <SourceComponent type="picture" placement="right"/> |
| | | )} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | {exts.includes('share') ? <Col span={12}> |
| | | <Form.Item label="分享链接"> |
| | | {getFieldDecorator('share_link', { |
| | | initialValue: card ? card.share_link || 'main' : 'main' |
| | | })( |
| | | <Radio.Group> |
| | | <Radio value="main">应用入口</Radio> |
| | | <Radio value="view">页面链接</Radio> |
| | | </Radio.Group> |
| | | )} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | <Col span={12}> |
| | | <Form.Item label="网站头像"> |
| | | {getFieldDecorator('favicon', { |
| | |
| | | )} |
| | | </Form.Item> |
| | | </Col> |
| | | {/* {typename !== 'pc' && user_binding.length > 0 ? <Col span={12}> |
| | | <Form.Item label={ |
| | | <Tooltip placement="topLeft" title="使用微信授权登录时,绑定用户页面的版权声明,注:可添加html标签。"> |
| | | <QuestionCircleOutlined className="mk-form-tip" /> |
| | | 版权 |
| | | </Tooltip> |
| | | }> |
| | | {getFieldDecorator('copyright', { |
| | | initialValue: card ? card.copyright || '' : '' |
| | | })(<Input placeholder="" autoComplete="off" onPressEnter={this.handleSubmit} />)} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | {typename !== 'pc' && user_binding.length > 0 ? <Col span={12}> |
| | | <Form.Item label={ |
| | | <Tooltip placement="topLeft" title="使用微信授权登录时,绑定用户页面的LOGO。"> |
| | | <QuestionCircleOutlined className="mk-form-tip" /> |
| | | LOGO |
| | | </Tooltip> |
| | | }> |
| | | {getFieldDecorator('logo', { |
| | | initialValue: card ? card.logo : '' |
| | | })( |
| | | <SourceComponent type="picture" placement="right"/> |
| | | )} |
| | | </Form.Item> |
| | | </Col> : null} */} |
| | | {typename !== 'pc' && adapters.includes('app') ? <Col span={12}> |
| | | <Form.Item label={ |
| | | <Tooltip placement="topLeft" title="在使用明科云APP时,页面的切换模式"> |
| | | <Tooltip placement="topLeft" title="在使用明科云APP时,页面的切换模式。注:苹果APP暂不支持H5模式。"> |
| | | <QuestionCircleOutlined className="mk-form-tip" /> |
| | | 应用模式 |
| | | </Tooltip> |