From 5046d0d13dc6a8563b8e54e31913bc44cfa1072f Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 26 四月 2022 19:23:18 +0800 Subject: [PATCH] 2022-04-26 --- src/views/appmanage/submutilform/index.jsx | 160 ++++++++++++++++++++++++++++------------------------ 1 files changed, 86 insertions(+), 74 deletions(-) diff --git a/src/views/appmanage/submutilform/index.jsx b/src/views/appmanage/submutilform/index.jsx index bc52f1f..8f21434 100644 --- a/src/views/appmanage/submutilform/index.jsx +++ b/src/views/appmanage/submutilform/index.jsx @@ -16,19 +16,29 @@ 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}) } /** @@ -38,31 +48,25 @@ 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: []}) - // } } /** @@ -76,7 +80,7 @@ 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 }, @@ -166,6 +170,23 @@ </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' @@ -174,42 +195,59 @@ <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', { @@ -219,35 +257,9 @@ )} </Form.Item> </Col> - {/* {typename !== 'pc' && user_binding.length > 0 ? <Col span={12}> - <Form.Item label={ - <Tooltip placement="topLeft" title="浣跨敤寰俊鎺堟潈鐧诲綍鏃讹紝缁戝畾鐢ㄦ埛椤甸潰鐨勭増鏉冨0鏄庯紝娉細鍙坊鍔爃tml鏍囩銆�"> - <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="浣跨敤寰俊鎺堟潈鐧诲綍鏃讹紝缁戝畾鐢ㄦ埛椤甸潰鐨凩OGO銆�"> - <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鏃讹紝椤甸潰鐨勫垏鎹㈡ā寮忋�傛敞锛氳嫻鏋淎PP鏆備笉鏀寔H5妯″紡銆�"> <QuestionCircleOutlined className="mk-form-tip" /> 搴旂敤妯″紡 </Tooltip> -- Gitblit v1.8.0