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/mobdesign/menuform/index.jsx |  188 ++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 178 insertions(+), 10 deletions(-)

diff --git a/src/views/mobdesign/menuform/index.jsx b/src/views/mobdesign/menuform/index.jsx
index 2335bcf..38fb28c 100644
--- a/src/views/mobdesign/menuform/index.jsx
+++ b/src/views/mobdesign/menuform/index.jsx
@@ -1,14 +1,21 @@
 import React, {Component} from 'react'
 import PropTypes from 'prop-types'
-import { Form, Row, Col, Input, Radio, Icon, Tooltip, InputNumber } from 'antd'
+import { Form, Row, Col, Input, Radio, Tooltip, InputNumber } from 'antd'
+import { QuestionCircleOutlined } from '@ant-design/icons'
 
+import asyncComponent from '@/utils/asyncComponent'
 import './index.scss'
+
+const { TextArea } = Input
+const ColorSketch = asyncComponent(() => import('@/mob/colorsketch'))
+const SourceComponent = asyncComponent(() => import('@/menu/components/share/sourcecomponent'))
 
 class CustomMenuForm extends Component {
   static propTpyes = {
     dict: PropTypes.object, // 瀛楀吀椤�
     config: PropTypes.object,
     MenuId: PropTypes.string,
+    adapters: PropTypes.array,
     updateConfig: PropTypes.func
   }
 
@@ -18,11 +25,24 @@
   selectChange = (key, value) => {
     const { config } = this.props
 
-    if (key === 'cacheUseful') {
-      this.props.updateConfig({...config, cacheUseful: value})
-    } else if (key === 'timeUnit') {
-      this.props.updateConfig({...config, timeUnit: value})
-    }
+    this.props.updateConfig({...config, [key]: value})
+    // if (key === 'cacheUseful') {
+    //   this.props.updateConfig({...config, cacheUseful: value})
+    // } else if (key === 'timeUnit') {
+    //   this.props.updateConfig({...config, timeUnit: value})
+    // } else if (key === 'advertUrl') {
+    //   this.props.updateConfig({...config, advertUrl: value})
+    // } else if (key === 'advertTime') {
+    //   this.props.updateConfig({...config, advertTime: value})
+    // } else if (key === 'pullRefresh') {
+    //   this.props.updateConfig({...config, pullRefresh: value})
+    // } else if (key === 'statusBarbgColor') {
+    //   this.props.updateConfig({...config, statusBarbgColor: value})
+    // } else if (key === 'permission') {
+    //   this.props.updateConfig({...config, permission: value})
+    // } else if (key === 'share') {
+    //   this.props.updateConfig({...config, share: value})
+    // }
   }
 
   // 鑿滃崟鍚嶇О
@@ -35,6 +55,10 @@
     this.props.updateConfig({...this.props.config, MenuNo: e.target.value})
   }
 
+  changeRemark = (e) => {
+    this.props.updateConfig({...this.props.config, Remark: e.target.value})
+  }
+
   changeCacheDay = (val) => {
     if (typeof(val) !== 'number') {
       val = ''
@@ -43,7 +67,7 @@
   }
 
   render() {
-    const { dict, config } = this.props
+    const { dict, config, adapters } = this.props
     const { getFieldDecorator } = this.props.form
     const formItemLayout = {
       labelCol: {
@@ -69,7 +93,7 @@
                     message: dict['mob.required.input'] + dict['mob.menu'] + dict['mob.name'] + '!'
                   }
                 ]
-              })(<Input placeholder="" disabled={!!(config.fixed && config.MenuName)} autoComplete="off" onChange={this.changeName}/>)}
+              })(<Input placeholder="" autoComplete="off" onChange={this.changeName}/>)}
             </Form.Item>
           </Col>
           <Col span={24}>
@@ -82,13 +106,13 @@
                     message: dict['mob.required.input'] + dict['mob.menu'] + dict['mob.param'] + '!'
                   }
                 ]
-              })(<Input placeholder="" disabled={!!(config.fixed && config.MenuName)} autoComplete="off" onChange={this.changeNo}/>)}
+              })(<Input placeholder="" autoComplete="off" onChange={this.changeNo}/>)}
             </Form.Item>
           </Col>
           <Col span={24}>
             <Form.Item label={
               <Tooltip placement="topLeft" title="瀵逛簬涓嶇粡甯告�у彉鍔ㄧ殑淇℃伅锛岀紦瀛樻暟鎹湁鍔╀簬鎻愰珮鏌ヨ鏁堢巼銆�">
-                <Icon type="question-circle" />
+                <QuestionCircleOutlined className="mk-form-tip" />
                 缂撳瓨鏁版嵁
               </Tooltip>
             }>
@@ -96,6 +120,40 @@
                 initialValue: config.cacheUseful || 'false'
               })(
                 <Radio.Group onChange={(e) => {this.selectChange('cacheUseful', e.target.value)}}>
+                  <Radio value="true">浣跨敤</Radio>
+                  <Radio value="false">涓嶄娇鐢�</Radio>
+                </Radio.Group>
+              )}
+            </Form.Item>
+          </Col>
+          <Col span={24}>
+            <Form.Item label={
+              <Tooltip placement="topLeft" title="璺宠繃鏉冮檺楠岃瘉鏃讹紝椤甸潰涓粍浠跺強鎸夐挳涓嶅湪杩涜鏉冮檺鎺у埗銆�">
+                <QuestionCircleOutlined className="mk-form-tip" />
+                鏉冮檺楠岃瘉
+              </Tooltip>
+            }>
+              {getFieldDecorator('permission', {
+                initialValue: config.permission || 'false'
+              })(
+                <Radio.Group onChange={(e) => {this.selectChange('permission', e.target.value)}}>
+                  <Radio value="true">浣跨敤</Radio>
+                  <Radio value="false">涓嶄娇鐢�</Radio>
+                </Radio.Group>
+              )}
+            </Form.Item>
+          </Col>
+          <Col span={24}>
+            <Form.Item label={
+              <Tooltip placement="topLeft" title="浣跨敤鐧诲綍楠岃瘉鍚庯紝鐢ㄦ埛蹇呴』鐧诲綍绯荤粺鍚庢墠鍙互璁块棶锛屾敞锛氬惈鏈夌櫥褰曠粍浠剁殑椤甸潰涓棤鏁堛��">
+                <QuestionCircleOutlined className="mk-form-tip" />
+                鐧诲綍楠岃瘉
+              </Tooltip>
+            }>
+              {getFieldDecorator('logincheck', {
+                initialValue: config.logincheck || 'false'
+              })(
+                <Radio.Group onChange={(e) => {this.selectChange('logincheck', e.target.value)}}>
                   <Radio value="true">浣跨敤</Radio>
                   <Radio value="false">涓嶄娇鐢�</Radio>
                 </Radio.Group>
@@ -129,6 +187,116 @@
               )}
             </Form.Item>
           </Col> : null}
+          <Col span={24}>
+            <Form.Item label="涓嬫媺鍒锋柊">
+              {getFieldDecorator('pullRefresh', {
+                initialValue: config.pullRefresh || 'false'
+              })(
+                <Radio.Group onChange={(e) => {this.selectChange('pullRefresh', e.target.value)}}>
+                  <Radio value="false">鍏抽棴</Radio>
+                  <Radio value="true">寮�鍚�</Radio>
+                </Radio.Group>
+              )}
+            </Form.Item>
+          </Col>
+          {adapters.includes('app') || adapters.includes('wxmini') ? <Col span={24}>
+            <Form.Item className="status-bar" label={
+              <Tooltip placement="topLeft" title="鍦ㄦ槑绉戜簯APP鎴栧皬绋嬪簭涓紝鐘舵�佹爮鐨勮儗鏅壊銆�">
+                <QuestionCircleOutlined className="mk-form-tip" />
+                鐘舵�佹爮
+              </Tooltip>
+            }>
+              <ColorSketch value={config.statusBarbgColor || '#ffffff'} onChange={(val) => {this.selectChange('statusBarbgColor', val)}} />
+            </Form.Item>
+          </Col> : null}
+          {adapters.includes('app') ? <Col span={24}>
+            <Form.Item label={
+              <Tooltip placement="topLeft" title="鍦ㄦ槑绉戜簯APP涓湁鏁堛��">
+                <QuestionCircleOutlined className="mk-form-tip" />
+                骞垮憡椤�
+              </Tooltip>
+            }>
+              {getFieldDecorator('advertUrl', {
+                initialValue: config.advertUrl || ''
+              })(
+                <SourceComponent type="picture" placement="right" onChange={(val) => {this.selectChange('advertUrl', val)}}/>
+              )}
+            </Form.Item>
+          </Col> : null}
+          {adapters.includes('app') && config.advertUrl ? <Col span={24}>
+            <Form.Item label={
+              <Tooltip placement="topLeft" title="骞垮憡椤电殑鍋滅暀鏃堕棿銆�">
+                <QuestionCircleOutlined className="mk-form-tip" />
+                鍋滅暀(s)
+              </Tooltip>
+            }>
+              {getFieldDecorator('advertTime', {
+                initialValue: config.advertTime || 3,
+                rules: [
+                  {
+                    required: true,
+                    message: dict['mob.required.input'] + '鍋滅暀鏃堕棿!'
+                  }
+                ]
+              })(
+                <InputNumber min={1} max={10} precision={0} onChange={(val) => {this.selectChange('advertTime', val)}}/>
+              )}
+            </Form.Item>
+          </Col> : null}
+          {adapters.includes('weixin') || adapters.includes('wxmini') ? <Col span={24}>
+            <Form.Item label="鍒嗕韩">
+              {getFieldDecorator('share', {
+                initialValue: config.share || 'default'
+              })(
+                <Radio.Group onChange={(e) => {this.selectChange('share', e.target.value)}}>
+                  <Radio value="default">榛樿</Radio>
+                  <Radio value="custom">鑷畾涔�</Radio>
+                </Radio.Group>
+              )}
+            </Form.Item>
+          </Col> : null}
+          {config.share === 'custom' && (adapters.includes('weixin') || adapters.includes('wxmini')) ? <Col span={24}>
+            <Form.Item label="鍒嗕韩鏍囬">
+              {getFieldDecorator('share_title', {
+                initialValue: config.share_title || '',
+                rules: [
+                  {
+                    required: true,
+                    message: '璇疯緭鍏ュ垎浜爣棰�!'
+                  }
+                ]
+              })(<Input placeholder="" autoComplete="off" onChange={(e) => {this.selectChange('share_title', e.target.value)}}/>)}
+            </Form.Item>
+          </Col> : null}
+          {config.share === 'custom' && (adapters.includes('weixin') || adapters.includes('wxmini')) ? <Col span={24}>
+            <Form.Item label="鍒嗕韩鎻忚堪">
+              {getFieldDecorator('share_des', {
+                initialValue: config.share_des || ''
+              })(<Input placeholder="" autoComplete="off" onChange={(e) => {this.selectChange('share_des', e.target.value)}}/>)}
+            </Form.Item>
+          </Col> : null}
+          {config.share === 'custom' && (adapters.includes('weixin') || adapters.includes('wxmini')) ? <Col span={24}>
+            <Form.Item label="鍒嗕韩鍥剧墖">
+              {getFieldDecorator('share_url', {
+                initialValue: config.share_url || ''
+              })(
+                <SourceComponent type="picture" placement="right" onChange={(val) => {this.selectChange('share_url', val)}}/>
+              )}
+            </Form.Item>
+          </Col> : null}
+          <Col span={24}>
+            <Form.Item label="澶囨敞">
+              {getFieldDecorator('Remark', {
+                initialValue: config.Remark || '',
+                rules: [
+                  {
+                    max: 512,
+                    message: '澶囨敞鏈�澶�512涓瓧绗︼紒'
+                  }
+                ]
+              })(<TextArea rows={2} placeholder={''} onChange={this.changeRemark} />)}
+            </Form.Item>
+          </Col>
         </Row>
       </Form>
     )

--
Gitblit v1.8.0