weichaochao 5 år sedan
förälder
incheckning
f0e963530f

+ 69
- 82
src/pages/house/add/index.jsx Visa fil

@@ -7,6 +7,7 @@ import moment from 'moment';
7 7
 import styles from '../../style/GoodsList.less';
8 8
 import SelectCity from '../../../components/SelectButton/CitySelect'
9 9
 import BuildSelect from '../../../components/SelectButton/BuildSelect'
10
+import ImageUpload from '../../../components/XForm/ImageUpload'
10 11
 import apis from '../../../services/apis';
11 12
 import request from '../../../utils/request';
12 13
 import AuthButton from '@/components/AuthButton';
@@ -15,6 +16,8 @@ const { Option } = Select;
15 16
 const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
16 17
 
17 18
 
19
+
20
+
18 21
 const header = props => {
19 22
   const { salesBatchId } = props.location.query
20 23
   console.log(salesBatchId)
@@ -26,11 +29,11 @@ const header = props => {
26 29
 
27 30
   // 查询列表
28 31
   const getSaleBatchData = (salesBatchId) => {
29
-    request({ ...apis.system.taPolicy, urlData: {id: salesBatchId} }).then((data) => {
30
-        console.log(data)
31
-        setSaleBatchData(data)
32
-    })
33
-  }
32
+      request({ ...apis.system.taPolicy, urlData: {id: salesBatchId} }).then((data) => {
33
+          console.log(data)
34
+          setSaleBatchData(data)
35
+      })
36
+    }
34 37
   }
35 38
 
36 39
   const cancelPage = () =>{
@@ -38,79 +41,11 @@ const header = props => {
38 41
       pathname: '/house/list',
39 42
     });
40 43
   }
41
-    const fields = [
42
-      {
43
-        label: '销售批次名',
44
-        name: 'salesBatchName',
45
-        type: FieldTypes.Text,
46
-        value: saleBatchData.salesBatchName,
47
-        rules: [
48
-          {
49
-            required: true,
50
-            message: '销售批次名',
51
-          },
52
-        ],
53
-      },
54
-      {
55
-        label: '销售楼盘',
56
-        name: 'buildingId',
57
-        render: <BuildSelect />,
58
-        value: saleBatchData.buildingId,
59
-        rules: [
60
-          {
61
-            required: true,
62
-            message: '请选择销售楼盘',
63
-          },
64
-        ],
65
-      },
66
-      {
67
-        label: '备注',
68
-        name: 'remark',
69
-        type: FieldTypes.Text,
70
-        value: saleBatchData.remark,
71
-      },
72
-      {
73
-        label: '发布状态',
74
-        name: 'status',
75
-        type: FieldTypes.Select,
76
-        dict: [{label:"否",value:0},{label:"是",value:1}],
77
-        value: saleBatchData.status != null ? saleBatchData.status : 1,
78
-        rules: [
79
-          {
80
-            required: true,
81
-            message: '请选择发布状态',
82
-          },
83
-        ],
84
-      },
85
-      {
86
-        label: '预选时间',
87
-        name: 'preSelectTime',
88
-        type: FieldTypes.RangePicker,       
89
-        value: saleBatchData.preselectionStartTime != null ? [moment(saleBatchData.preselectionStartTime, 'YYYY-MM-DD HH:mm:ss'), moment(saleBatchData.preselectionEndTime, 'YYYY-MM-DD HH:mm')] : null,
90
-        props: { showTime: { format: 'HH:mm:ss' }},
91
-        rules: [
92
-          { required: true, message: '请选择预选时间' },
93
-        ],
94
-      },
95
-      {
96
-        label: '分栋鸟瞰图',
97
-        name: 'aerialViewImg',
98
-        type: FieldTypes.ImageUploader,
99
-        value: saleBatchData.aerialViewImg,
100
-        help: '建议图片尺寸:220*176px,比例5:4,格式:jpg,文件小于300KB。分栋鸟瞰图会显示在楼盘详情页面。用户点击进入查看全部发布房源。可以适当在图中添加引导语。',
101
-        rules: [
102
-          {
103
-            required: true,
104
-            message: '请选择分栋鸟瞰图',
105
-          },
106
-        ],
107
-      },
108
-    ]
109
-  
110
-    const handleSubmit = values => { 
111
-     console.log('submit data --->', values)
112
-      
113
-     let {preSelectTime, ...submitValue} = values
44
+
45
+
46
+  function handleSubmit (e) {
47
+    props.form.validateFields((err, values) => {
48
+      let {preSelectTime, ...submitValue} = values
114 49
         if(null != preSelectTime && preSelectTime.length > 0){
115 50
           const [preselectionStartTime, preselectionEndTime] = preSelectTime
116 51
           submitValue.preselectionStartTime = moment(preselectionStartTime).format('YYYY-MM-DD HH:mm:ss');
@@ -127,12 +62,64 @@ const header = props => {
127 62
       }).catch((err) => {
128 63
         message.info(err.msg || err.message)
129 64
       })
130
-    }
131
-     
65
+    });
66
+  }
67
+
68
+  const { getFieldDecorator } = props.form;
132 69
 
133 70
   return (
134
-    <XForm onSubmit={handleSubmit} onCancel={cancelPage} fields={fields}></XForm>
135
-  );
71
+    <>
72
+      <Form labelCol={{ span: 7 }} wrapperCol={{ span: 12 }} onSubmit={handleSubmit}>
73
+        <Form.Item label="销售批次名">
74
+          {getFieldDecorator('salesBatchName', {
75
+            rules: [{ required: true, message: '请输入销售批次名' }],
76
+          })(<Input maxLength={20} />)}
77
+        </Form.Item>
78
+        <Form.Item label="销售楼盘">
79
+          {getFieldDecorator('buildingId', {
80
+            rules: [{ required: true, message: ' 请输入销售楼盘' }],
81
+          })(<BuildSelect />)}
82
+        </Form.Item>
83
+        <Form.Item label="备注">
84
+          {getFieldDecorator('remark')
85
+            (<Input maxLength={20}/>)}
86
+        </Form.Item>
87
+        <Form.Item label="发布状态">
88
+          {getFieldDecorator('status', {
89
+              rules: [{ required: true, message: '请选择发布状态' }],
90
+            })(<Select placeholder="发布状态" style={{ width: '300px' }}>
91
+            <Option value="0">否</Option>
92
+            <Option value="1">是</Option>
93
+          </Select>)}
94
+        </Form.Item>
95
+        <Form.Item label="预选时间">
96
+            {getFieldDecorator('preSelectTime', {
97
+              rules: [
98
+                {
99
+                  required: true,
100
+                  message: '请选择预选时间',
101
+                },
102
+              ],
103
+            })(<RangePicker style={{ width: '500px' }}format="YYYY-MM-DD HH:mm:ss" showTime={{ format: 'HH:mm:ss' }}/>)}
104
+        </Form.Item>
105
+        <Form.Item label="分栋鸟瞰图" help="建议尺寸:690*388px,比例16::9,格式:jpg,文件小于300KB。分栋鸟瞰图会显示在楼盘详情页面。用户点击进入查看全部发布房源。可以适当在图中添加引导语。">
106
+              {getFieldDecorator('aerialViewImg', {
107
+                  rules: [{ required: true, message: '请上传分栋鸟瞰图' }],
108
+              })(
109
+                <ImageUpload />,
110
+              )}
111
+        </Form.Item>  
112
+        <Form.Item wrapperCol={{ span: 15, offset: 7 }}>
113
+          <Button type="primary" htmlType="submit"style={{marginRight:'20px'}}>
114
+            下一步
115
+          </Button>
116
+          <Button onClick={() => router.go(-1)}>
117
+            取消
118
+          </Button>
119
+        </Form.Item>
120
+      </Form>
121
+    </>
122
+  )
136 123
 }
137 124
 
138 125
 const WrappedHeader = Form.create({ name: 'header' })(header);

+ 9
- 2
src/pages/house/edit/components/base.jsx Visa fil

@@ -45,7 +45,8 @@ const Base = props => {
45 45
       rules: [
46 46
         {
47 47
           required: true,
48
-          message: '销售批次名',
48
+          message: '销售批次名不合法',
49
+          max:20,
49 50
         },
50 51
       ],
51 52
     },
@@ -66,6 +67,12 @@ const Base = props => {
66 67
       name: 'remark',
67 68
       type: FieldTypes.Text,
68 69
       value: saleBatchData.remark,
70
+      rules: [
71
+        {
72
+          message: '最多20字',
73
+          max:20
74
+        }
75
+      ],
69 76
     },
70 77
     {
71 78
       label: '发布状态',
@@ -94,7 +101,7 @@ const Base = props => {
94 101
       name: 'aerialViewImg',
95 102
       type: FieldTypes.ImageUploader,
96 103
       value: saleBatchData.aerialViewImg,
97
-      help: '建议图片尺寸:220*176px,比例5:4,格式:jpg,文件小于300KB。分栋鸟瞰图会显示在楼盘详情页面。用户点击进入查看全部发布房源。可以适当在图中添加引导语。',
104
+      help: '建议图片尺寸:690*388px,比例16::9,格式:jpg,文件小于300KB。分栋鸟瞰图会显示在楼盘详情页面。用户点击进入查看全部发布房源。可以适当在图中添加引导语。',
98 105
       rules: [
99 106
         {
100 107
           required: true,

+ 14
- 2
src/pages/house/edit/components/share.jsx Visa fil

@@ -35,9 +35,21 @@ const Share = props => {
35 35
       }).catch(err => {
36 36
         message.info(err.msg || err.message)
37 37
       })
38
+      getMiniappName();
38 39
     }, [])
39 40
   }
40 41
 
42
+  // 获取小程序名称
43
+  const [miniappName, setMiniappName] = useState('')
44
+  function getMiniappName() {
45
+
46
+    request({ ...apis.building.getMiniappName }).then(res => {
47
+    
48
+      setMiniappName(res)
49
+     
50
+    })
51
+  }
52
+
41 53
   const submitShare = () => {
42 54
     if (salesBatchId) {
43 55
       if (shareContentId) {
@@ -72,9 +84,9 @@ const Share = props => {
72 84
       <div>
73 85
         <p style={{ display: 'flex', alignItems: 'center', fontSize: '14px', color: '#999', margin: '0', lineHeight: '0' }}>
74 86
           <img src={logo} style={{ width: '22px', marginRight: '10px' }} />
75
-          知与行互动
87
+            {miniappName}
76 88
         </p>
77
-        <p style={{ fontSize: '16px', color: '#222', fontWeight: '600', margin: '0' }}>{inputValue ? inputValue : '置业V客厅 精准获客平台'}</p>
89
+        <p style={{ fontSize: '16px', color: '#222', fontWeight: '600', margin: '0' }}>{miniappName ? miniappName : '置业V客厅 精准获客平台'}</p>
78 90
         <img style={{ width: '200px', height: '160px' }} src={imgValue ? imgValue : poster2} alt="" />
79 91
       </div>
80 92
     </div>

+ 0
- 1
src/pages/house/edit/components/shareRecord.jsx Visa fil

@@ -121,7 +121,6 @@ const handleSubmit = (e, props) => {
121 121
             <Select style={{ width: '180px' }} placeholder="身份">
122 122
               <Option value="Realty Consultant">置业顾问</Option>
123 123
               <Option value="customer">用户</Option>
124
-              <Option value="drift">游客</Option>
125 124
             </Select>,
126 125
           )}
127 126
         </Form.Item>