Bladeren bron

基础数据

weichaochao 5 jaren geleden
bovenliggende
commit
58b93143b6

+ 17
- 2
config/routes.js Bestand weergeven

@@ -346,8 +346,23 @@ export default [
346 346
                 hideInMenu: true,
347 347
                 component: './activity/helpActivity/detailActivity',
348 348
               },
349
-              
350
-              
349
+              {
350
+                path: '/activity/liveActivity/list/index',
351
+                name: '直播活动',
352
+                component: './activity/liveActivity/list/index',
353
+              },
354
+              {
355
+                path: '/activity/liveActivity/add',
356
+                name: '新增', 
357
+                hideInMenu: true,
358
+                component: './activity/liveActivity/add',
359
+              },
360
+              {
361
+                path: '/activity/liveActivity/edit',
362
+                name: '编辑', 
363
+                hideInMenu: true,
364
+                component: './activity/liveActivity/edit',
365
+              },
351 366
             ],
352 367
           },
353 368
           {

+ 65
- 0
src/components/SelectButton/BuildSelect2.jsx Bestand weergeven

@@ -0,0 +1,65 @@
1
+import React, { useState, useEffect, useRef } from 'react';
2
+import { Select } from 'antd';
3
+import apis from '../../services/apis';
4
+import request from '../../utils/request'
5
+
6
+const { Option } = Select;
7
+
8
+function usePrevious(props) {
9
+  const ref = useRef();
10
+  useEffect(() => {
11
+    ref.current = props;
12
+  });
13
+  return ref.current;
14
+}
15
+
16
+/**
17
+ *
18
+ *
19
+ * @param {*} props
20
+ * @returns
21
+ */
22
+const BuildingSelect2 = props => {
23
+  const [data, setData] = useState([])
24
+  const [value, setValue] = useState([])
25
+  console.log('props', props.value);
26
+  useEffect(() => {
27
+    getBuildList();
28
+  }, [props.value])
29
+
30
+
31
+  const getBuildList = e => {
32
+    request({ ...apis.building.buildingSelect, params: { pageNum: 1, pageSize: 999 } }).then(data => {
33
+        setData(data)
34
+        checkValue(data)
35
+        // 默认选中第一个
36
+    })
37
+  }
38
+
39
+
40
+  const checkValue = (data) => {
41
+    if (props.value) {
42
+      const tempData = data.filter(f => f.buildingId == props.value)
43
+      const va = (tempData.length > 0) ? props.value : '项目已下线,请重新选择项目'
44
+      props.onChange(va)
45
+
46
+    }
47
+  }
48
+
49
+  return (
50
+      <Select
51
+      showSearch
52
+      value={props.value}
53
+      style={{ width: '300px' }}
54
+      placeholder="请选择项目"
55
+      onChange={props.onChange}
56
+      filterOption={(input, option) =>
57
+        option.props.children && option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0
58
+      }>
59
+          {data.map(building => (
60
+            <Option key={building.buildingId} value={building.buildingId}>{building.buildingName}</Option>
61
+          ))}
62
+      </Select>
63
+  )
64
+}
65
+export default BuildingSelect2

+ 203
- 0
src/pages/activity/liveActivity/add/index.jsx Bestand weergeven

@@ -0,0 +1,203 @@
1
+import React, { useState, useEffect } from 'react';
2
+import Zmage from 'react-zmage';
3
+import { Form, Input, Button, Icon, Select, message, Table, Divider, Tag, Pagination, Modal, DatePicker, Radio } from 'antd';
4
+import { FormattedMessage } from 'umi-plugin-react/locale';
5
+import XForm, { FieldTypes } from '../../../../components/XForm';
6
+import router from 'umi/router';
7
+import moment from 'moment';
8
+import styles from '../../../style/GoodsList.less';
9
+import SelectCity from '../../../../components/SelectButton/CitySelect'
10
+import BuildSelect2 from '../../../../components/SelectButton/BuildSelect2'
11
+import CitySelect from '../../../../components/SelectButton/CitySelect'
12
+import ImageUpload from '../../../../components/XForm/ImageUpload'
13
+import Wangedit from '../../../../components/Wangedit/Wangedit'
14
+import apis from '../../../../services/apis';
15
+import request from '../../../../utils/request';
16
+import AuthButton from '@/components/AuthButton';
17
+
18
+const { Option } = Select;
19
+const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
20
+
21
+
22
+
23
+
24
+const header = props => {
25
+  const { salesBatchId } = props.location.query
26
+  console.log(salesBatchId)
27
+  const [ saleBatchData, setSaleBatchData ] = useState({})
28
+  const [showHelp, setShowHelp] = useState(false)
29
+
30
+  const [typeState, setTypeState] = useState("rich")
31
+
32
+  // if(salesBatchId){
33
+  //   useEffect(() => {
34
+  //     getSaleBatchData(salesBatchId);
35
+  //   },[])
36
+
37
+  // // 查询列表
38
+  // const getSaleBatchData = (salesBatchId) => {
39
+  //     request({ ...apis.system.taPolicy, urlData: {id: salesBatchId} }).then((data) => {
40
+  //         console.log(data)
41
+  //         setSaleBatchData(data)
42
+  //     })
43
+  //   }
44
+  // }
45
+
46
+  const cancelPage = () =>{
47
+    router.push({
48
+      pathname: '/activity/liveActivity/list',
49
+    });
50
+  }
51
+
52
+  function highlightsTypeChange(e) {
53
+    console.log(e.target.value,"ee")
54
+    setTypeState(e.target.value)
55
+  }
56
+
57
+  function handleSubmit (e) {
58
+    e.preventDefault();
59
+    props.form.validateFields((err, values) => {
60
+      if (!err){
61
+        let {liviTime, ...submitValue} = values
62
+        if(null != liviTime && liviTime.length > 0){
63
+          const [liveStartTime, livenEndTime] = liviTime
64
+          submitValue.liveStartTime = moment(liveStartTime).format('YYYY-MM-DD HH:mm:ss');
65
+          submitValue.livenEndTime = moment(livenEndTime).format('YYYY-MM-DD HH:mm:ss');
66
+        }else{
67
+          submitValue.liveStartTime = null
68
+          submitValue.livenEndTime = null
69
+        }        
70
+        // getList({ pageNum: pageNumber, pageSize: 10, ...submitValue })
71
+        console.log(submitValue)
72
+        request({ ...apis.house.addTaSalesBatch, data: { ...submitValue },}).then((data) => {
73
+          message.info("保存成功,请上传房源")
74
+          console.log(data,"datattttttt")
75
+          router.push({
76
+            pathname: '/house/batch',
77
+            query: {
78
+              salesBatchId: data.salesBatchId,
79
+              buildingId: data.buildingId,
80
+            },
81
+          });
82
+        }).catch((err) => {
83
+          message.info(err.msg || err.message)
84
+        })
85
+      }
86
+    });
87
+  }
88
+
89
+  const { getFieldDecorator } = props.form;
90
+
91
+  return (
92
+    <>
93
+      <Form labelCol={{ span: 7 }} wrapperCol={{ span: 12 }} onSubmit={handleSubmit}>
94
+        <Form.Item label="所属城市">
95
+          {getFieldDecorator('cityId', {
96
+            rules: [{ required: true, message: ' 请输入所属城市' }],
97
+          })(<CitySelect />)}
98
+        </Form.Item>
99
+        <Form.Item label="所属楼盘">
100
+          {getFieldDecorator('buildingId', {
101
+            rules: [{ required: true, message: ' 请输入所属楼盘' }],
102
+          })(<BuildSelect2 value={getFieldDecorator('cityId')}/>)}
103
+        </Form.Item>
104
+        <Form.Item label="直播活动标题">
105
+          {getFieldDecorator('liveActivityTitle', {
106
+            rules: [{ required: true, message: '请输入直播活动标题' }],
107
+          })(<Input maxLength={20} placeholder="给直播活动起个名字" />)}
108
+        </Form.Item>
109
+        <Form.Item label="直播时间">
110
+            {getFieldDecorator('liveTime', {
111
+              rules: [
112
+                {
113
+                  required: true,
114
+                  message: '请选择直播时间',
115
+                },
116
+              ],
117
+            })(<RangePicker style={{ width: '500px' }}format="YYYY-MM-DD HH:mm:ss" showTime={{ format: 'HH:mm:ss' }}/>)}
118
+        </Form.Item>
119
+        <Form.Item label="直播小程序">
120
+          {getFieldDecorator('liveApp', {
121
+              rules: [{ required: true, message: '请选择直播小程序' }],
122
+            })(<Select placeholder="选择在哪个平台直播" style={{ width: '300px' }}>
123
+            <Option value="1">腾讯NOW直播(推荐)</Option>
124
+            <Option value="2">斗鱼直播</Option>
125
+            <Option value="3">虎牙直播</Option>
126
+            <Option value="4">映客直播</Option>
127
+            <Option value="5">一直播</Option>
128
+          </Select>)}
129
+        </Form.Item>
130
+        <Form.Item label="房间参数">
131
+          {getFieldDecorator('liveRoomParam', {
132
+            rules: [{ required: true, message: '请输入房间参数' }],
133
+          })(<Input maxLength={20} placeholder="请下载文档查看如何获取" />)}<a href="http://njcj.oss-cn-shanghai.aliyuncs.com/%E7%9B%B4%E6%92%AD%E6%88%BF%E9%97%B4%E5%8F%B7%E8%8E%B7%E5%8F%96%E6%95%99%E7%A8%8B(1).docx" style={{ color: 'blue' }}> 不知道怎么填?查看说明</a>
134
+        </Form.Item>
135
+        <Form.Item label="封面图1" help="建议尺寸:750px*420px,比例16:9,格式:jpg,用于:活动列表">
136
+              {getFieldDecorator('listImg', {
137
+                  rules: [{ required: true, message: '请上传封面图1' }],
138
+              })(
139
+                <ImageUpload />,
140
+              )}
141
+        </Form.Item>  
142
+        <Form.Item label="封面图2" help="建议尺寸:750*250,比例3:1,格式:jpg,用于:项目详情页">
143
+              {getFieldDecorator('detailImg', {
144
+                  rules: [{ required: true, message: '请上传封面图2' }],
145
+              })(
146
+                <ImageUpload />,
147
+              )}
148
+        </Form.Item>  
149
+        <Form.Item label="封面图2" help="建议尺寸:750*250,比例3:1,格式:jpg,用于:项目详情页">
150
+              {getFieldDecorator('detailImg', {
151
+                  rules: [{ required: true, message: '请上传封面图2' }],
152
+              })(
153
+                <ImageUpload />,
154
+              )}<Zmage src="http://njcj.oss-cn-shanghai.aliyuncs.com/1561458980339-%E6%9C%AA%E7%9F%A5%E6%96%87%E4%BB%B6.jpg"/><span>查看详情图实例</span>
155
+        </Form.Item>  
156
+        <Form.Item label="详情类型">
157
+            {getFieldDecorator('liveDetailType',{
158
+              initialValue: "rich",
159
+            })(
160
+            <Radio.Group onChange={e => highlightsTypeChange(e)}>
161
+              <Radio value="0">系统模板</Radio>
162
+              <Radio value="1">自定义</Radio>
163
+            </Radio.Group>,
164
+            )}
165
+          </Form.Item>
166
+          {typeState === '0' && <Form.Item label="系统模板" help="可参考系统模板图">
167
+              {getFieldDecorator('detailTypeImg', {
168
+                  rules: [{ required: true, message: '请上传封面图1' }],
169
+              })(
170
+                <ImageUpload />,
171
+              )}
172
+          </Form.Item>}
173
+          {typeState === '1' && <Form.Item label="自定义图" help="自定义上传图片">
174
+              {getFieldDecorator('detailTypeImg', {
175
+                  rules: [{ required: true, message: '请上传封面图1' }],
176
+              })(
177
+                <ImageUpload />,
178
+              )}
179
+          </Form.Item>}       
180
+        <Form.Item label="发布状态">
181
+          {getFieldDecorator('status', {
182
+              rules: [{ required: true, message: '请选择发布状态' }],
183
+            })(<Select placeholder="发布状态" style={{ width: '300px' }}>
184
+            <Option value="0">否</Option>
185
+            <Option value="1">是</Option>
186
+          </Select>)}
187
+        </Form.Item>
188
+        <Form.Item wrapperCol={{ span: 15, offset: 7 }}>
189
+          <Button type="primary" htmlType="submit"style={{marginRight:'20px'}}>
190
+            确定
191
+          </Button>
192
+          <Button onClick={() => router.go(-1)}>
193
+            取消
194
+          </Button>
195
+        </Form.Item>
196
+      </Form>
197
+    </>
198
+  )
199
+}
200
+
201
+const WrappedHeader = Form.create({ name: 'header' })(header);
202
+
203
+export default WrappedHeader

+ 109
- 0
src/pages/activity/liveActivity/edit/components/HelpDoc/index.jsx Bestand weergeven

@@ -0,0 +1,109 @@
1
+import React, { PureComponent } from 'react'
2
+import { Modal, Row, Col } from 'antd'
3
+import EnDash from '../EnDash'
4
+
5
+import Style from './style.less'
6
+import HotBlock from '../HotBlock'
7
+
8
+const dataset = [
9
+  {
10
+    label: '(0)',
11
+    value: 0,
12
+  },
13
+  {
14
+    label: '(1)',
15
+    value: 1,
16
+  },
17
+  {
18
+    label: '(2)',
19
+    value: 2,
20
+  },
21
+  {
22
+    label: '(3)',
23
+    value: 3,
24
+  },
25
+  {
26
+    label: '(4)',
27
+    value: 4,
28
+  },
29
+  {
30
+    label: '(5)',
31
+    value: 5,
32
+  },
33
+  {
34
+    label: '(6~10)',
35
+    value: 8,
36
+  },
37
+  {
38
+    label: '(11~20)',
39
+    value: 15,
40
+  },
41
+  {
42
+    label: '(21~30)',
43
+    value: 25,
44
+  },
45
+  {
46
+    label: '(31~40)',
47
+    value: 35,
48
+  },
49
+  {
50
+    label: '(41~50)',
51
+    value: 45,
52
+  },
53
+  {
54
+    label: '(51~100)',
55
+    value: 80,
56
+  },
57
+  {
58
+    label: '(101~200)',
59
+    value: 150,
60
+  },
61
+  {
62
+    label: '(200以上)',
63
+    value: 201,
64
+  },
65
+]
66
+
67
+function Cell(props) {
68
+  return (
69
+    <Row type="flex" align="middle" gutter={20}>
70
+      <Col span={2}>{props.left}</Col>
71
+      <Col span={12}><EnDash /></Col>
72
+      <Col span={6}>{props.right}</Col>
73
+    </Row>
74
+  )
75
+}
76
+
77
+export default function HelpDoc(props) {
78
+  return (
79
+    <Modal footer={null} title="相关说明" visible={props.visible} onCancel={props.onCancel} width={800}>
80
+      <div className={Style.article}>
81
+        <div className={Style.section}>
82
+          <div className={Style.title}>1.图例解释:</div>
83
+          <div>
84
+            <Cell left="1号楼" right="楼栋/幢" />
85
+            <Cell left="2单元" right="单元" />
86
+            <Cell left="3楼" right="楼层" />
87
+            <Cell left="301" right="房号" />
88
+            <Cell left="1人" right="预选人数" />
89
+            <Cell left="234万" right="价格" />
90
+            <Cell left="A户型" right="户型名" />
91
+          </div>
92
+        </div>
93
+        <div className={Style.section}>
94
+          <div className={Style.title}>2.预选人数(热度):</div>
95
+          <div>每有一位客户预选此房源,热度自动增加1,热度越大说明想购买此房源的用户越多,认筹摇号购买难度越大。</div>
96
+        </div>
97
+        <div className={Style.section}>
98
+          <div className={Style.title}>3.热度指标:</div>
99
+          <div className={Style.subtitle}>颜色越深代表热度越高。黑底白字代表房源未发布,未发布房源用户不会看到。</div>
100
+          <div className={Style.flex}>
101
+            {
102
+              dataset.map((block) => (<div className={Style['flex-item']} key={block.value}><HotBlock number={block.value}>{block.label}</HotBlock></div>))
103
+            }
104
+          </div>
105
+        </div>
106
+      </div>
107
+    </Modal>
108
+  );
109
+}

+ 36
- 0
src/pages/activity/liveActivity/edit/components/HelpDoc/style.less Bestand weergeven

@@ -0,0 +1,36 @@
1
+.article {
2
+    .section {
3
+        font-size: 16px;
4
+        line-height: 1.8em;
5
+        color: #666;
6
+
7
+        & + .section {
8
+            margin-top: 24px;
9
+        }
10
+    }
11
+
12
+    .title {
13
+        font-size: 18px;
14
+        line-height: 2em;
15
+        color: #333;
16
+    }
17
+
18
+    .subtitle {
19
+        font-size: 14px;
20
+        line-height: 1.6em;
21
+        color: #999;
22
+    }
23
+
24
+    .flex {
25
+        display: flex;
26
+        flex-wrap: wrap;
27
+
28
+        .flex-item {
29
+            margin-top: 16px;
30
+            margin-right: 8px;
31
+            flex: none;
32
+            width: 100px;
33
+            text-align: center;
34
+        }
35
+    }
36
+}

+ 236
- 0
src/pages/activity/liveActivity/edit/components/base.jsx Bestand weergeven

@@ -0,0 +1,236 @@
1
+import React, { useState, useEffect } from 'react';
2
+import { Form, Input, Button, Icon, Select, Tabs, Radio, DatePicker, message, Upload } from 'antd';
3
+import { FormattedMessage } from 'umi-plugin-react/locale';
4
+import moment from 'moment';
5
+import router from 'umi/router';
6
+import styles from '../../../../style/GoodsList.less';
7
+import XForm, { FieldTypes } from '../../../../../components/XForm';
8
+import apis from '../../../../../services/apis';
9
+import BuildSelect from '../../../../../components/SelectButton/BuildSelect';
10
+import CitySelect from '../../../../../components/SelectButton/CitySelect';
11
+import request from '../../../../../utils/request';
12
+
13
+const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
14
+const { TextArea } = Input;
15
+
16
+let detailVisible = true;
17
+let urlVisible = false;
18
+
19
+const setExtraData = (data) => {
20
+  detailVisible = data.newsDetailType == '1'
21
+  urlVisible = data.newsDetailType == '0'
22
+}
23
+
24
+const Base = props => {
25
+  const salesBatchId = props.salesBatchId.batchId
26
+  const [ saleBatchData, setSaleBatchData ] = useState({})
27
+  const [showHelp, setShowHelp] = useState(false)
28
+  
29
+  if(salesBatchId){
30
+    useEffect(() => {
31
+      getSaleBatchData(salesBatchId);
32
+    },[])
33
+
34
+  // 查询列表
35
+  const getSaleBatchData = (salesBatchId) => {
36
+    request({ ...apis.house.getTaSalesBatch, urlData: {id: salesBatchId} }).then((data) => {
37
+        console.log(data)
38
+        setSaleBatchData(data)
39
+        if(data.qrCode == 'null'){
40
+          message.error("暂时无法获取二维码")
41
+        }
42
+    })
43
+  }
44
+  }
45
+
46
+  const cancelPage = () =>{
47
+    router.push({
48
+      pathname: '/house/list',
49
+    });
50
+  }
51
+  const fields = [
52
+    {
53
+      label: '所属城市',
54
+      name: 'cityId',
55
+      render: <CitySelect />,
56
+      value: saleBatchData.cityId,
57
+      rules: [
58
+        {
59
+          required: true,
60
+          message: '请选择销售楼盘',
61
+        },
62
+      ],
63
+    },
64
+    {
65
+      label: '所属楼盘',
66
+      name: 'buildingId',
67
+      render: <BuildSelect />,
68
+      value: saleBatchData.buildingId,
69
+      rules: [
70
+        {
71
+          required: true,
72
+          message: '请选择销售楼盘',
73
+        },
74
+      ],
75
+    },
76
+    {
77
+      label: '直播活动标题',
78
+      name: 'liveActivityTitle',
79
+      type: FieldTypes.Text,
80
+      value: saleBatchData.liveActivityTitle,
81
+      rules: [
82
+        {
83
+          required: true,
84
+          message: '销售批次名不合法',
85
+          max:20,
86
+        },
87
+      ],
88
+    },
89
+    {
90
+      label: '直播小程序',
91
+      name: 'liveApp',
92
+      type: FieldTypes.Select,
93
+      dict: [{label:"腾讯NOW直播(推荐)",value:1},{label:"斗鱼直播",value:2},{label:"虎牙直播",value:3},{label:"映客直播",value:4},{label:"一直播",value:5}],
94
+      value: saleBatchData.status != null ? saleBatchData.status : 1,
95
+      rules: [
96
+        {
97
+          required: true,
98
+          message: '请选择直播小程序',
99
+        },
100
+      ],
101
+    },
102
+    {
103
+      label: '房间参数',
104
+      name: 'liveRoomParam',
105
+      type: FieldTypes.Text,
106
+      value: saleBatchData.liveRoomParam,
107
+      rules: [
108
+        {
109
+          required: true,
110
+          message: '最多1000字',
111
+          max:1000
112
+        }
113
+      ],
114
+    },
115
+    {
116
+      label: '封面图1',
117
+      name: 'listImg',
118
+      type: FieldTypes.ImageUploader,
119
+      value: saleBatchData.listImg,
120
+      help: '建议尺寸:750px*420px,比例16:9,格式:jpg,用于:活动列表',
121
+      rules: [
122
+        {
123
+          required: true,
124
+          message: '请选择封面图1',
125
+        },
126
+      ],
127
+    },
128
+    {
129
+      label: '封面图2',
130
+      name: 'detailImg',
131
+      type: FieldTypes.ImageUploader,
132
+      value: saleBatchData.detailImg,
133
+      help: '建议尺寸:750*250,比例3:1,格式:jpg,用于:项目详情页',
134
+      rules: [
135
+        {
136
+          required: true,
137
+          message: '请选择封面图2',
138
+        },
139
+      ],
140
+    },
141
+    {
142
+      label: '详情类型',
143
+      name: 'status',
144
+      render: <Radio.Group> 
145
+              <Radio value={1}>系统模板</Radio>
146
+              <Radio value={0}>自定义</Radio>
147
+              </Radio.Group>,
148
+      value: saleBatchData.status - 0,
149
+      rules: [
150
+        {required: true, message: '请选择详情类型'},
151
+      ]
152
+    },
153
+
154
+    {
155
+      label: '系统模板图',
156
+      name: 'detailImg',
157
+      hidden: () => !detailVisible,
158
+      type: FieldTypes.ImageUploader,
159
+      value: saleBatchData.detailImg,
160
+      help: '建议尺寸:750*250,比例3:1,格式:jpg,用于:项目详情页',
161
+      rules: [
162
+        {
163
+          required: true,
164
+          message: '请选择封面图2',
165
+        },
166
+      ],
167
+    },
168
+    {
169
+      label: '自定义图',
170
+      name: 'detailImg',
171
+      hidden: () => !urlVisible,
172
+      type: FieldTypes.ImageUploader,
173
+      value: saleBatchData.detailImg,
174
+      help: '建议尺寸:750*250,比例3:1,格式:jpg,用于:项目详情页',
175
+      rules: [
176
+        {
177
+          required: true,
178
+          message: '请选择封面图2',
179
+        },
180
+      ],
181
+    },
182
+
183
+    {
184
+      label: '发布状态',
185
+      name: 'status',
186
+      type: FieldTypes.Select,
187
+      dict: [{label:"否",value:0},{label:"是",value:1}],
188
+      value: saleBatchData.status != null ? saleBatchData.status : 1,
189
+      rules: [
190
+        {
191
+          required: true,
192
+          message: '请选择发布状态',
193
+        },
194
+      ],
195
+    },
196
+    {
197
+      label: '扫码查看房源列表',
198
+      name: 'qrCode',
199
+      type: FieldTypes.ImageUploader,
200
+      value: saleBatchData.qrCode,
201
+      props: {disabled: true },
202
+    },
203
+  ]
204
+  
205
+  const handleFormValueChange = (props, changedValues, allValues) => {
206
+    console(allValues, 'allValues')
207
+    setExtraData(allValues)
208
+}
209
+
210
+    const handleSubmit = values => { 
211
+      let {preSelectTime, ...submitValue} = values
212
+        if(null != preSelectTime && preSelectTime.length > 0){
213
+          const [preselectionStartTime, preselectionEndTime] = preSelectTime
214
+          submitValue.preselectionStartTime = moment(preselectionStartTime).format('YYYY-MM-DD HH:mm:ss');
215
+          submitValue.preselectionEndTime = moment(preselectionEndTime).format('YYYY-MM-DD HH:mm:ss');
216
+        }else{
217
+          submitValue.preselectionStartTime = null
218
+          submitValue.preselectionEndTime = null
219
+        }        
220
+        console.log(submitValue)
221
+        request({ ...apis.house.updateTaSalesBatch, urlData: {id: salesBatchId},data: submitValue, }).then((data) => {
222
+          message.info("保存成功")
223
+          cancelPage()
224
+        }).catch((err) => {
225
+        message.info(err.msg || err.message)
226
+      })
227
+    }
228
+    
229
+  return (
230
+    <>
231
+      <XForm onSubmit={handleSubmit} onCancel={cancelPage} fields={fields} onValuesChange={handleFormValueChange}></XForm>
232
+    </>
233
+  );
234
+}
235
+
236
+export default Base

+ 167
- 0
src/pages/activity/liveActivity/edit/components/poster.jsx Bestand weergeven

@@ -0,0 +1,167 @@
1
+import React, { useState, useEffect } from 'react';
2
+import { Form, Input, Button, Icon, Select, Tabs, Radio, DatePicker, message, Upload } from 'antd';
3
+import { FormattedMessage } from 'umi-plugin-react/locale';
4
+import moment from 'moment';
5
+import router from 'umi/router';
6
+import BuildSelect from '../../../../../components/SelectButton/BuildSelect'
7
+import XForm, { FieldTypes } from '../../../../../components/XForm';
8
+import Wangedit from '../../../../../components/Wangedit/Wangedit'
9
+import request from '../../../../../utils/request'
10
+import yinhao from '../../../../../assets/yinhao.png'
11
+import xiaochengxu from '../../../../../assets/xiaochengxu.png'
12
+import ImageUploader from '../../../../../components/XForm/ImageUpload';
13
+import poster1 from '../../../../../assets/poster1.png';
14
+import poster2 from '../../../../../assets/poster2.png';
15
+import Styles from './style.less';
16
+import apis from '../../../../../services/apis';
17
+
18
+const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
19
+const { TextArea } = Input;
20
+
21
+const Poster = props => {
22
+  const [inputValue, changeInput] = useState('')
23
+  const [textAreaValue, changeTextArea] = useState('')
24
+  const [imgValue, changeImg] = useState('')
25
+  const [posterId, setPosterId] = useState('')
26
+
27
+  const [building, setBuilding] = useState({ buildingImg: [{ url: '' }] })
28
+  const salesBatchId = props.salesBatchId.batchId
29
+  if (salesBatchId) {
30
+    // eslint-disable-next-line react-hooks/rules-of-hooks
31
+    useEffect(() => {
32
+      request({
33
+        ...apis.activity.poster,
34
+        params: { targetId: salesBatchId, targetType: 'house' },
35
+      }).then(data => {
36
+        if (data.length > 0) {
37
+          setPosterId(data[0].posterId)
38
+          changeImg(data[0].posterImg)
39
+          changeTextArea(data[0].posterDescription)
40
+          changeInput(data[0].posterTitle)
41
+        }
42
+      }).catch(err => {
43
+        message.info(err.msg || err.message)
44
+      })
45
+
46
+      // getById(salesBatchId)
47
+      getMiniappName()
48
+    }, [])
49
+  }
50
+
51
+  // 获取详情信息
52
+  function getById(currentId) {
53
+
54
+    request({ ...apis.building.buildingGetById, urlData: { id: currentId } }).then(res => {
55
+      setBuilding(res)
56
+      console.log('getById: ', res)
57
+    })
58
+  }
59
+  // 获取小程序名称
60
+  const [miniappName, setMiniappName] = useState('')
61
+  function getMiniappName() {
62
+
63
+    request({ ...apis.building.getMiniappName }).then(res => {
64
+    
65
+      setMiniappName(res)
66
+     
67
+    })
68
+  }
69
+
70
+  const submitPoster = () => {
71
+    if (salesBatchId) {
72
+      if (!imgValue) {
73
+        message.error('请选择海报图片')
74
+        return
75
+      }
76
+
77
+      if (posterId) {
78
+        request({
79
+          ...apis.activity.updatePoster,
80
+          urlData: { id: posterId },
81
+          data: { targetId: salesBatchId, targetType: 'house', posterImg: imgValue, posterTitle: inputValue, posterDescription: textAreaValue },
82
+        }).then(() => {
83
+          message.info('保存成功')
84
+        }).catch(err => {
85
+          message.info(err.msg || err.message)
86
+        })
87
+      } else {
88
+        request({
89
+          ...apis.activity.addPoster,
90
+          data: { targetId: salesBatchId, targetType: 'house', posterImg: imgValue, posterTitle: inputValue, posterDescription: textAreaValue },
91
+        }).then(data => {
92
+          setPosterId(data.posterId)
93
+          message.info('保存成功')
94
+        }).catch(err => {
95
+          message.info(err.msg || err.message)
96
+        })
97
+      }
98
+    } else {
99
+      message.warn('请先保存基本信息数据')
100
+    }
101
+  }
102
+
103
+  return <div>
104
+    <div style={{ display: 'flex' }}>
105
+      <div style={{ width: '420px', height: '900px', display: 'inline-block', marginTop: '30px' }}>
106
+        <div style={{ width: '375px', height: '600px', backgroundColor: '#fff', boxShadow: '0px 0px 16px 6px rgba(0,0,0,0.15)', position: 'relative', margin: '0 auto' }}>
107
+          <img style={{ width: '100%', height: '500px' }} src={imgValue ? imgValue : poster1} alt="" />
108
+
109
+          <p className={Styles.tagLabel}>
110
+            {
111
+              building.buildingTag && building.buildingTag.map(item => <span>{item.tagName}</span>)
112
+            }
113
+          </p>
114
+          {/* <p style={{
115
+            margin: '10px 20px', fontSize: '20px', color: '#222', fontWeight: '600',
116
+            display: '-webkit-box', lineClamp: '3', height: '36px', lineHeight: '36px',
117
+            WebkitLineClamp: '1',
118
+            WebkitBoxOrient: 'vertical',
119
+            overflow: 'hidden',
120
+            textOverflow: 'ellipsis',
121
+          }}>{inputValue || (building.buildingName || '海报标题')}</p>
122
+          <p style={{ color: '#999', padding: ' 0 20px' }}><span style={{ color: '#fd0d0c', fontSize: '24px', marginLeft: '6px' }}>{building.price} </span><span style={{ color: '#fd0d0c', fontSize: '20px' }}></span></p>
123
+          <img src={yinhao} style={{ width: '30px', marginLeft: '22px' }} alt="" />
124
+          <p style={{
125
+            margin: '16px 20px 28px 20px', fontSize: '17px', color: '#999',
126
+            display: '-webkit-box', lineClamp: '3', height: '72px',
127
+            WebkitLineClamp: '3',
128
+            WebkitBoxOrient: 'vertical',
129
+            overflow: 'hidden',
130
+            textOverflow: 'ellipsis',
131
+          }}>{textAreaValue || '海报描述'}</p> */}
132
+          <div style={{ backgroundColor: '#f1f1f1', padding: '22px 30px', boxShadow: '0px 6px 12px -4px #dcdcdc',position:'relative' }}>
133
+            <p style={{margin:'0',fontSize:'18px',color:'#888'}}>长按识别小程序码</p>
134
+            <p style={{margin:'0',fontSize:'18px',color:'#888'}}>进入<span style={{margin:'0 5px',fontSize:'18px',color:'#333',fontWeight:'600'}}>{miniappName||'置业V顾问'}</span>房源列表</p>
135
+            <img style={{ width: '80px',position: 'absolute',right:'30px',top:'10px' }} src={xiaochengxu} alt="" />
136
+          </div>
137
+        </div>
138
+        <p style={{ textAlign: 'center', fontSize: '19px', color: '#666', marginTop: '30px' }}>海报模板</p>
139
+      </div>
140
+      <div >
141
+        <div style={{ display: 'flex', alignItems: 'center', width: '100%' }}>
142
+        <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>
143
+          <span style={{marginLeft:'135px', color: '#999'}}>请上传制作好的海报图片用于置业顾问或用户保存分享到朋友圈,可随时更新</span>
144
+        </p>
145
+        </div>
146
+        <div style={{ display: 'flex', width: '100%', margin: '30px 0' }}>
147
+          <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}><span style={{ color: 'red' }}>*</span> 海报图片</p>
148
+          <ImageUploader value={imgValue} onChange={e => changeImg(e)} />
149
+        </div>
150
+        <p style={{ fontSize: '0.5vw', color: '#A9A9A9', marginLeft: '230px', marginBottom: '30px'}}>建议尺寸:640*960px,比例2::3,格式:jpg,文件小于300KB,用于:吸引用户在线选房</p>
151
+        <div style={{ display: 'flex', alignItems: 'center', width: '100%', marginBottom: '60px' }}>
152
+          {/* <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>海报标题</p>
153
+          <Input style={{ width: '20vw' }} value={inputValue} placeholder="请输入海报标题" onChange={e => changeInput(e.target.value)} /> */}
154
+        </div>
155
+        {/* <div style={{ display: 'flex', margin: '10px 0 40px 0', width: '100%' }}>
156
+          <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>海报描述</p>
157
+          <TextArea rows={5} maxLength={1024} value={textAreaValue} onChange={e => changeTextArea(e.target.value)} />
158
+        </div> */}
159
+
160
+      </div>
161
+    </div>
162
+    <Button type="primary" onClick={submitPoster} style={{ margin: '40px 40px 40px 30vw' }}> 确定</Button>
163
+    <Button onClick={() => router.go(-1)}>取消</Button>
164
+  </div>
165
+}
166
+
167
+export default Poster

+ 117
- 0
src/pages/activity/liveActivity/edit/components/share.jsx Bestand weergeven

@@ -0,0 +1,117 @@
1
+import React, { useState, useEffect } from 'react';
2
+import { Form, Input, Button, Icon, Select, Tabs, Radio, DatePicker, message, Upload } from 'antd';
3
+import { FormattedMessage } from 'umi-plugin-react/locale';
4
+import moment from 'moment';
5
+import router from 'umi/router';
6
+import BuildSelect from '../../../../../components/SelectButton/BuildSelect'
7
+import XForm, { FieldTypes } from '../../../../../components/XForm';
8
+import Wangedit from '../../../../../components/Wangedit/Wangedit'
9
+import request from '../../../../../utils/request'
10
+import yinhao from '../../../../../assets/yinhao.png'
11
+import ImageUploader from '../../../../../components/XForm/ImageUpload';
12
+import logo from '../../../../../assets/logo.png';
13
+import touxiang from '../../../../../assets/touxiang.jpg';
14
+import poster1 from '../../../../../assets/poster1.png';
15
+import poster2 from '../../../../../assets/poster2.png';
16
+import apis from '../../../../../services/apis';
17
+
18
+const Share = props => {
19
+  const [inputValue, changeInput] = useState('')
20
+  const [imgValue, changeImg] = useState('')
21
+  const [shareContentId, setShareContentId] = useState('')
22
+  const salesBatchId = props.salesBatchId.batchId
23
+  if (salesBatchId) {
24
+    // eslint-disable-next-line react-hooks/rules-of-hooks
25
+    useEffect(() => {
26
+      request({
27
+        ...apis.activity.shareContent,
28
+        params: { targetId: salesBatchId, targetType: 'house' },
29
+      }).then(data => {
30
+        if (data.length > 0) {
31
+          setShareContentId(data[0].shareContentId)
32
+          changeImg(data[0].shareContentImg)
33
+          changeInput(data[0].shareContentTitle)
34
+        }else{
35
+          changeInput("诚挚邀您在线选房购房~");
36
+          request({ ...apis.house.getTaSalesBatch, urlData: {id: salesBatchId} }).then((data) => {
37
+            changeImg(data.aerialViewImg);
38
+        })
39
+        }
40
+      }).catch(err => {
41
+        message.info(err.msg || err.message)
42
+      })
43
+      getMiniappName();
44
+    }, [])
45
+  }
46
+
47
+  // 获取小程序名称
48
+  const [miniappName, setMiniappName] = useState('')
49
+  function getMiniappName() {
50
+
51
+    request({ ...apis.building.getMiniappName }).then(res => {
52
+    
53
+      setMiniappName(res)
54
+     
55
+    })
56
+  }
57
+
58
+  const submitShare = () => {
59
+    if (salesBatchId) {
60
+      if (shareContentId) {
61
+        request({
62
+          ...apis.activity.updateShareContent,
63
+          urlData: { id: shareContentId },
64
+          data: { targetId: salesBatchId, shareContentType: 'house', shareContentImg: imgValue,shareContentTitle: inputValue },
65
+        }).then(data => {
66
+          message.info('保存成功')
67
+        }).catch(err => {
68
+          message.info(err.msg || err.message)
69
+        })
70
+       } else {
71
+        request({
72
+          ...apis.activity.addShareContent,
73
+          data: { targetId: salesBatchId, shareContentType: 'house', shareContentImg: imgValue,shareContentTitle: inputValue },
74
+        }).then(data => {
75
+          setShareContentId(data.shareContentId)
76
+          message.info('保存成功')
77
+        }).catch(err => {
78
+          message.info(err.msg || err.message)
79
+        })
80
+       }
81
+     } else {
82
+      message.warn('请先保存基本信息数据')
83
+     }
84
+  }
85
+
86
+  return <div style={{ padding: '20px' }}>
87
+    <div style={{ display: 'flex', alignItems: 'center', width: '100%' }}>
88
+      <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>
89
+        <span style={{marginLeft:'135px', color: '#999'}}>请上传制作好的分享图片用于置业顾问或用户分享房源列表页面到好友或群</span>
90
+      </p>
91
+    </div>
92
+    <div style={{ display: 'flex', margin: '10px 0 40px 0', width: '100%' }}>
93
+      <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>分享模板</p>
94
+      <div>
95
+        <p style={{ display: 'flex', alignItems: 'center', fontSize: '14px', color: '#999', margin: '0', lineHeight: '0' }}>
96
+          <img src={logo} style={{ width: '22px', marginRight: '10px' }} />
97
+            {miniappName}
98
+        </p>
99
+        <p style={{ fontSize: '16px', color: '#222', fontWeight: '600', margin: '0' }}>{miniappName ? miniappName : '置业V客厅 精准获客平台'}</p>
100
+        <img style={{ width: '200px', height: '160px' }} src={imgValue ? imgValue : poster2} alt="" />
101
+      </div>
102
+    </div>
103
+    <div style={{ display: 'flex', alignItems: 'center', width: '100%' }}>
104
+      <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>分享标题</p>
105
+      <Input placeholder="请输入分享标题" value={inputValue}  onChange={e => changeInput(e.target.value)} />
106
+    </div>
107
+    <div style={{ display: 'flex', width: '100%', marginTop: '40px' }}>
108
+      <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>分享图片</p>
109
+      <ImageUploader value={imgValue} onChange={e => changeImg(e)} />
110
+    </div>
111
+    <p style={{ fontSize: '0.5vw', color: '#A9A9A9', marginLeft: '230px', marginTop: '20px' }}>建议尺寸:750*600px,比例5:4,格式:jpg</p>
112
+    <Button type="primary" htmlType="submit" onClick={submitShare} style={{ margin: '40px 40px 40px 220px' }}> 确定</Button>
113
+    <Button onClick={() => router.go(-1)}>取消</Button>
114
+  </div>
115
+}
116
+
117
+export default Share

+ 152
- 0
src/pages/activity/liveActivity/edit/components/shareRecord.jsx Bestand weergeven

@@ -0,0 +1,152 @@
1
+import React, { useState, useEffect } from 'react';
2
+import { Form, Input, Button, Icon, Select, Tabs, Radio, DatePicker, message, Upload, Table, Pagination } from 'antd';
3
+import { FormattedMessage } from 'umi-plugin-react/locale';
4
+import moment from 'moment';
5
+import router from 'umi/router';
6
+import apis from '../../../../../services/apis';
7
+import BuildSelect from '../../../../../components/SelectButton/BuildSelect';
8
+import AuthButton from '@/components/AuthButton';
9
+import styles from './style.less';
10
+import request from '../../../../../utils/request';
11
+
12
+const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
13
+const { TextArea } = Input;
14
+
15
+const header = (props) => {
16
+  const [ data, setData ] = useState({})
17
+  const [page, changePage] = useState({})
18
+  const salesBatchId = props.salesBatchId.batchId
19
+
20
+  useEffect(() => {
21
+    getList({ pageNum: 1, pageSize: 10, salesBatchId : salesBatchId});
22
+  },[])
23
+
24
+  // 查询列表
25
+  const getList = (params) => {
26
+    request({ ...apis.house.taHouseShare, params: { ...params },}).then((data) => {
27
+        console.log(data)
28
+        setData(data)
29
+    })
30
+  }
31
+  
32
+  const columns = [
33
+    {
34
+      title: '头像',
35
+      align: 'center',
36
+      render: (text, records) => <img src={records.photoOravatar} width={50} height={50} />,
37
+    },
38
+    {
39
+      title: '昵称',
40
+      dataIndex: 'nameOrnick',
41
+      key: 'nameOrnick',
42
+      align: 'center',
43
+    },
44
+    {
45
+      title: '姓名',
46
+      dataIndex: 'name',
47
+      key: 'name',
48
+      align: 'center',
49
+    },
50
+    {
51
+      title: '手机号',
52
+      dataIndex: 'phone',
53
+      key: 'phone',
54
+      align: 'center',
55
+    },
56
+    {
57
+      title: '身份',
58
+      dataIndex: 'personType',
59
+      key: 'personType',
60
+      align: 'center',
61
+      render: (personType) => <span>{ personType === 'Realty Consultant' ? '置业顾问' : personType === 'customer' || personType === 'estate agent' ? '用户' : '游客' }</span>
62
+    },
63
+    {
64
+      title: '分享时间',
65
+      dataIndex: 'createDate',
66
+      key: 'createDate',
67
+      align: 'center',
68
+      render: (x, row) => <><span>{moment(row.createDate).format('YYYY-MM-DD hh:mm:ss')}</span></>
69
+    },
70
+    {
71
+      title: '分享方式',
72
+      dataIndex: 'shareType',
73
+      key: 'shareType',
74
+      align: 'center',
75
+      render: (x, row) => <span>{ row.tagertType == 'housePost' ? '海报分享' : '小程序分享' }</span>
76
+    },
77
+    {
78
+      title: '分享内容',
79
+      dataIndex: 'salesBatchName',
80
+      key: 'salesBatchName',
81
+      align: 'center',
82
+      render: (x, row) => <span>{ row.salesBatchName }的房源列表</span>
83
+    },
84
+  ];
85
+  
86
+  const changePageNum = (pageNumber) => {
87
+      getList({ pageNum: pageNumber, pageSize: 10, salesBatchId : salesBatchId, ...props.form.getFieldsValue() })
88
+  }
89
+
90
+  // 提交事件
91
+const handleSubmit = (e, props) => {
92
+    e.preventDefault();
93
+    props.form.validateFields((err, values) => {
94
+      if (!err) {
95
+        console.log('提交数据: ', values)
96
+        getList({ pageNum: 1, pageSize: 10, salesBatchId : salesBatchId,  ...values })
97
+      }
98
+    });
99
+  }
100
+
101
+   //重置搜索
102
+   function handleReset() {
103
+    props.form.resetFields();
104
+  }
105
+
106
+  const { getFieldDecorator } = props.form
107
+  return (
108
+
109
+    <>
110
+      <Form layout="inline" onSubmit={e => handleSubmit(e, props)}>
111
+        <Form.Item>
112
+          {getFieldDecorator('shareType')(
113
+            <Select style={{ width: '180px' }} placeholder="分享方式">
114
+              <Option value="housePost">海报分享</Option>
115
+              <Option value="houseApp">小程序分享</Option>
116
+            </Select>,
117
+          )}
118
+        </Form.Item>
119
+        <Form.Item>
120
+          {getFieldDecorator('personType')(
121
+            <Select style={{ width: '180px' }} placeholder="身份">
122
+              <Option value="Realty Consultant">置业顾问</Option>
123
+              <Option value="customer">用户</Option>
124
+            </Select>,
125
+          )}
126
+        </Form.Item>
127
+        <Form.Item>
128
+          {getFieldDecorator('phone')(
129
+            <Input placeholder="手机号"/>
130
+          )}
131
+        </Form.Item>
132
+        <Form.Item>
133
+        <AuthButton name="admin.extendContent.search" noRight={null}>
134
+          <Button type="primary" htmlType="submit" className={styles.searchBtn}>
135
+            搜索
136
+          </Button>
137
+          </AuthButton>
138
+          <Button style={{ marginLeft: 8 }} onClick={handleReset}>
139
+              重置
140
+            </Button>
141
+        </Form.Item>
142
+      </Form>
143
+      <Table dataSource={data.records} columns={columns} pagination={false} rowKey="carouseFigureList"/>
144
+      <div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
145
+        <Pagination showQuickJumper defaultCurrent={1} total={data.total} onChange={changePageNum} current={data.current}/>
146
+      </div>
147
+    </>
148
+  )
149
+}
150
+const ShareRecord = Form.create({ name: 'header' })(header);
151
+
152
+export default ShareRecord

+ 97
- 0
src/pages/activity/liveActivity/edit/components/style.less Bestand weergeven

@@ -0,0 +1,97 @@
1
+.SubmitButton {
2
+  background: #3a91d5;
3
+  border-radius: 7px;
4
+  border: 0px;
5
+}
6
+.SelectFrom {
7
+  width: 180px;
8
+  background: #ffffff;
9
+  border-radius: 7px;
10
+  border: 1px solid #dbdbdb;
11
+}
12
+.addButton {
13
+  border-radius: 4px;
14
+  border: 0px;
15
+  margin: 10px 0px;
16
+}
17
+.cardText {
18
+  font-size: 0.106rem;
19
+  color: #333;
20
+  display: flex;
21
+  align-items: center;
22
+  position: relative;
23
+  margin-bottom: 0.08rem; 
24
+}
25
+
26
+.recommderTag{
27
+  position: absolute;
28
+  color: #fff;
29
+  line-height: 0.28rem;
30
+  width: 0.54rem;
31
+  background-color: rgba(0,0,0,0.4);
32
+  text-align: center;
33
+  border-radius: 12px 0 12px 0;
34
+  font-size: 0.09rem;
35
+}
36
+.cardItem{
37
+  font-size: 0.106rem;
38
+  font-weight: 400;
39
+  color: #666;
40
+  display: flex;
41
+  align-items: center;  
42
+  margin-bottom: 0.08rem;
43
+  .title{
44
+    display: inline-block;
45
+    width: 0.58rem;
46
+  
47
+    min-width: 0.58rem;
48
+    justify-content: space-between;
49
+    text-align: justify;
50
+    text-align-last:justify
51
+  }
52
+  
53
+}
54
+.cardText{
55
+  font-size: 0.106rem;
56
+  font-weight: 400;
57
+  color: #666;
58
+  display: flex;
59
+  align-items: center;  
60
+  margin-bottom: 0.08rem;
61
+  .title{
62
+    display: inline-block;
63
+    width: 0.58rem;
64
+  
65
+    min-width: 0.58rem;
66
+    justify-content: space-between;
67
+    text-align: justify;
68
+    text-align-last:justify
69
+  }
70
+  
71
+}
72
+.ediText {
73
+  font-size: 0.106rem;
74
+  color: #ff925c;
75
+  position: absolute;
76
+  right: 0;
77
+
78
+}
79
+
80
+
81
+.address { 
82
+  width: 400px;
83
+  height: 24px; 
84
+  text-overflow: ellipsis; 
85
+  white-space: nowrap;
86
+  overflow: hidden;
87
+}
88
+.cover{
89
+  width: 100%;
90
+
91
+  padding-bottom: 56.25%;
92
+  background-size: 100% 100% !important;
93
+ 
94
+  border-radius: 12px 12px 0 0;
95
+  
96
+    // height: '14vw';
97
+}

+ 154
- 0
src/pages/activity/liveActivity/edit/components/visitRecord.jsx Bestand weergeven

@@ -0,0 +1,154 @@
1
+import React, { useState, useEffect } from 'react';
2
+import { Form, Input, Button, Icon, Select, Tabs, Radio, DatePicker, message, Upload, Table, Pagination } from 'antd';
3
+import { FormattedMessage } from 'umi-plugin-react/locale';
4
+import moment from 'moment';
5
+import router from 'umi/router';
6
+import apis from '../../../../../services/apis';
7
+import BuildSelect from '../../../../../components/SelectButton/BuildSelect';
8
+import AuthButton from '@/components/AuthButton';
9
+import styles from './style.less';
10
+import request from '../../../../../utils/request';
11
+
12
+const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
13
+const { TextArea } = Input;
14
+
15
+const header = (props) => {
16
+  const [ data, setData ] = useState({})
17
+  // const [page, changePage] = useState({})
18
+  const salesBatchId = props.salesBatchId.batchId
19
+
20
+  useEffect(() => {
21
+    console.log(salesBatchId, 'salesBatchId')
22
+    getList({ pageNum: 1, pageSize: 10, salesBatchId : salesBatchId});
23
+  },[])
24
+
25
+  // 查询列表
26
+  const getList = (params) => {
27
+    request({ ...apis.house.taHouseVisit, salesBatchId : salesBatchId, params: { ...params },}).then((data) => {
28
+        console.log(data)
29
+        setData(data)
30
+    })
31
+  }
32
+  
33
+  const columns = [
34
+    {
35
+      title: '头像',
36
+      align: 'center',
37
+      render: (text, records) => <img src={records.photoOravatar} width={50} height={50} />,
38
+    },
39
+    {
40
+      title: '昵称',
41
+      dataIndex: 'nameOrnick',
42
+      key: 'nameOrnick',
43
+      align: 'center',
44
+    },
45
+    {
46
+      title: '姓名',
47
+      dataIndex: 'name',
48
+      key: 'name',
49
+      align: 'center',
50
+    },
51
+    {
52
+      title: '手机号',
53
+      dataIndex: 'phone',
54
+      key: 'phone',
55
+      align: 'center',
56
+    },
57
+    {
58
+      title: '身份',
59
+      dataIndex: 'sharePersonType',
60
+      key: 'sharePersonType',
61
+      align: 'center',
62
+      render: (sharePersonType) => <span>{ sharePersonType == 'Realty Consultant' ? '置业顾问' : sharePersonType == 'customer' || sharePersonType === 'estate agent'? '用户' : '游客' }</span>
63
+    },
64
+    {
65
+      title: '访问时间',
66
+      dataIndex: 'createDate',
67
+      key: 'createDate',
68
+      align: 'center',
69
+      render: (x, row) => <><span>{moment(row.createDate).format('YYYY-MM-DD HH:mm:ss')}</span></>
70
+    },
71
+    // {
72
+    //   title: '进入场景',
73
+    //   dataIndex: 'sceneName',
74
+    //   key: 'sceneName',
75
+    //   align: 'center',
76
+    //   render: (x, row) => <span>{ row.sceneName === 'mini_program_code' ? '扫码进入' : row.sceneName === 'search' ? '自主进入' : '小程序分享进入' }</span>
77
+    // },
78
+    {
79
+      title: '访问内容',
80
+      dataIndex: 'salesBatchName',
81
+      key: 'salesBatchName',
82
+      align: 'center',
83
+      render: (x, row) => <span>{ row.salesBatchName }的房源列表</span>
84
+    },
85
+  ];
86
+  
87
+  const changePageNum = (pageNumber) => {
88
+      getList({ pageNum: pageNumber, pageSize: 10, salesBatchId : salesBatchId, ...props.form.getFieldsValue() })
89
+  }
90
+
91
+  // 提交事件
92
+const handleSubmit = (e, props) => {
93
+    e.preventDefault();
94
+    props.form.validateFields((err, values) => {
95
+      if (!err) {
96
+        console.log('提交数据: ', values)
97
+        getList({ pageNum: 1, pageSize: 10, salesBatchId: salesBatchId, ...values})
98
+      }
99
+    });
100
+  }
101
+
102
+   //重置搜索
103
+   function handleReset() {
104
+    props.form.resetFields();
105
+  }
106
+
107
+  const { getFieldDecorator } = props.form
108
+  return (
109
+
110
+    <>
111
+      <Form layout="inline" onSubmit={e => handleSubmit(e, props)}>
112
+        {/* <Form.Item>
113
+          {getFieldDecorator('sceneType')(
114
+            <Select style={{ width: '180px' }} placeholder="进入场景">
115
+              <Option value="mini_program_code">扫码进入</Option>
116
+              <Option value="share">小程序分享进入</Option>
117
+              <Option value="search">自主进入</Option>
118
+            </Select>,
119
+          )}
120
+        </Form.Item> */}
121
+        <Form.Item>
122
+          {getFieldDecorator('personType')(
123
+            <Select style={{ width: '180px' }} placeholder="身份">
124
+              <Option value="Realty Consultant">置业顾问</Option>
125
+              <Option value="customer">用户</Option>
126
+              <Option value="drift">游客</Option>
127
+            </Select>,
128
+          )}
129
+        </Form.Item>
130
+        <Form.Item>
131
+          {getFieldDecorator('phone')(
132
+            <Input placeholder="手机号"/>
133
+          )}
134
+        </Form.Item>
135
+        <Form.Item>
136
+        <AuthButton name="admin.extendContent.search" noRight={null}>
137
+          <Button type="primary" htmlType="submit" className={styles.searchBtn}>
138
+            搜索
139
+          </Button>
140
+          </AuthButton>
141
+          <Button style={{ marginLeft: 8 }} onClick={handleReset}>
142
+              重置
143
+            </Button>
144
+        </Form.Item>
145
+      </Form>
146
+      <Table dataSource={data.records} columns={columns} pagination={false} rowKey="carouseFigureList"/>
147
+      <div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
148
+        <Pagination showQuickJumper defaultCurrent={1} total={data.total} onChange={changePageNum} current={data.current}/>
149
+      </div>
150
+    </>
151
+  )
152
+}
153
+const VisitRecord = Form.create({ name: 'header' })(header);
154
+export default VisitRecord

+ 82
- 0
src/pages/activity/liveActivity/edit/index.jsx Bestand weergeven

@@ -0,0 +1,82 @@
1
+import React, { useState, useEffect } from 'react';
2
+import { Form, Icon, Input, Button, DatePicker, Select, Card, Row, Col, Pagination, Alert, Radio, Tag, Tooltip, Tabs, notification } from 'antd';
3
+import moment from 'moment';
4
+import request from '../../../../utils/request';
5
+import apis from '../../../../services/apis';
6
+import { router } from 'umi';
7
+
8
+import Base from './components/base'
9
+import Poster from './components/poster'
10
+import Share from './components/share'
11
+import ShareRecord from './components/shareRecord'
12
+import VisitRecord from './components/visitRecord'
13
+
14
+
15
+const { Option } = Select
16
+const { TabPane } = Tabs;
17
+
18
+const formItemLayout = {
19
+  labelCol: {
20
+    xs: { span: 24 },
21
+    sm: { span: 2 },
22
+  },
23
+  wrapperCol: {
24
+    xs: { span: 24 },
25
+    sm: { span: 16 },
26
+  },
27
+};
28
+
29
+function openNotificationWithIcon(type, message) {
30
+  notification[type]({
31
+    message,
32
+    description:
33
+      '',
34
+  });
35
+}
36
+
37
+function EditHouse(props) {
38
+  const {salesBatchId} = props.location.query.id;
39
+  console.log(props.location.query.id)
40
+  const [tab, setTab] = useState('base')
41
+  const [salesBatchData, setSalesBatchData] = useState({ salesBatchId: undefined })
42
+  const [houseId, setHouseId] = useState('')
43
+
44
+  function tabsCallback(e) {
45
+    setTab(e.target.value)
46
+  }
47
+
48
+  // building 回调
49
+  function buildingOnSuccess(e) {
50
+    setBuildingData(e)
51
+  }
52
+
53
+  function housTabChange(e) {
54
+    setHouseId(e.houseId)
55
+    setTab('preselectionRecord')
56
+  }
57
+
58
+  const batchId = salesBatchData.salesBatchId || (props.location.query && props.location.query.id)
59
+
60
+  return (
61
+    <>
62
+      <Radio.Group value={ tab } buttonStyle="solid" onChange={e => tabsCallback(e)}>
63
+        <Radio.Button value="base">基本信息</Radio.Button>
64
+        <Radio.Button value="poster">海报设置</Radio.Button>
65
+        <Radio.Button value="share">分享设置</Radio.Button>
66
+        <Radio.Button value="shareRecord">分享记录</Radio.Button>
67
+        <Radio.Button value="visitRecord">访问记录</Radio.Button>
68
+      </Radio.Group>
69
+      <div style={{ marginTop: '20px' }}>
70
+        { (tab === 'base' && <Base salesBatchId={{ batchId }} onSuccess={e => buildingOnSuccess(e)}/>)} 
71
+        { (tab === 'poster' && <Poster salesBatchId={{ batchId }}/>)}
72
+        { (tab === 'share' && <Share salesBatchId={{ batchId }}/>)}
73
+        { (tab === 'shareRecord' && <ShareRecord salesBatchId={{ batchId }}/>)}
74
+        { (tab === 'visitRecord' && <VisitRecord salesBatchId={{ batchId }}/>)}
75
+      </div>
76
+    </>
77
+  )
78
+}
79
+
80
+const WrappedEditHouseForm = Form.create({ name: 'editHouse' })(EditHouse);
81
+
82
+export default WrappedEditHouseForm

+ 272
- 0
src/pages/activity/liveActivity/list/index.jsx Bestand weergeven

@@ -0,0 +1,272 @@
1
+import React, { useState, useEffect } from 'react';
2
+import { Form, Input, Button, Icon, Select, message, Table, Divider, Tag, Pagination, Modal, DatePicker, notification } from 'antd';
3
+import { FormattedMessage } from 'umi-plugin-react/locale';
4
+import router from 'umi/router';
5
+import moment from 'moment';
6
+import styles from '../../../style/GoodsList.less';
7
+import SelectCity from '../../../../components/SelectButton/CitySelect'
8
+import BuildSelect from '../../../../components/SelectButton/BuildSelect'
9
+import apis from '../../../../services/apis';
10
+import request from '../../../../utils/request';
11
+import AuthButton from '@/components/AuthButton';
12
+// import SaleBatchListHelpDoc from '../edit/components/SalesBatchListHelpDoc';
13
+
14
+const { Option } = Select;
15
+const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
16
+
17
+const header = props => {
18
+  // eslint-disable-next-line react-hooks/rules-of-hooks
19
+  const [data, setData] = useState({ list: [], total: 0 })
20
+  //   const [page, changePage] = useState({})
21
+  const [houseIdList, setHouseIdList] = useState([])
22
+  const [time, setTime] = useState('')
23
+  const [showHelp, setShowHelp] = useState(false)
24
+
25
+  // 查询列表
26
+  const getList = params => {
27
+    request({ ...apis.house.taSalesBatch, params: { ...params } }).then(data => {
28
+      console.log(data)
29
+      setData(data)
30
+    })
31
+  }
32
+
33
+  // eslint-disable-next-line react-hooks/rules-of-hooks
34
+  useEffect(() => {
35
+    getList({ pageNum: 1, pageSize: 10 });
36
+  }, [])
37
+
38
+  // 跳转到编辑
39
+  const toAddLive = rowData => () => {
40
+    if(rowData) {
41
+      router.push({
42
+      pathname: '/activity/liveActivity/edit',
43
+      query: {
44
+        id: rowData.salesBatchId,
45
+        buildingId: rowData.buildingId,
46
+      },
47
+    });
48
+      return
49
+    }
50
+    router.push({
51
+      pathname: '/activity/liveActivity/add',
52
+    });
53
+  }
54
+
55
+  function openNotificationWithIcon(type, message) {
56
+    notification[type]({
57
+      message,
58
+      description:
59
+        '',
60
+    });
61
+  }
62
+
63
+  
64
+  const toDelBatch = rowData => () =>{
65
+    console.log(houseIdList, 'houseIdListhouseIdList')
66
+    if(houseIdList.length < 1){
67
+      openNotificationWithIcon('error', '请先选择需要删除的批次')
68
+      return
69
+    }
70
+    console.log(houseIdList,'houseIdListhouseIdList');
71
+    request({ ...apis.house.deleteTaSalesBatch, data: houseIdList, }).then((data) => {
72
+      message.info("操作成功")
73
+      getList({ pageNum: 1, pageSize: 10 });
74
+    }).catch((err) => {
75
+      // message.info(err.msg)
76
+    })
77
+  }
78
+
79
+  /**
80
+   *
81
+   *
82
+   * @param {*} props
83
+   * @returns
84
+   */
85
+  const columns = [
86
+    {
87
+      title: '直播活动标题',
88
+      dataIndex: 'salesBatchName',
89
+      key: 'salesBatchName',
90
+      align: 'center',
91
+      render:  (x, row) => <><span style={{color: 'blue',cursor: 'pointer'}} onClick={toAddLive(row)}>{row.salesBatchName}</span></>,
92
+    },
93
+    {
94
+      title: '所属城市',
95
+      dataIndex: 'cityId',
96
+      key: 'cityId',
97
+      align: 'center',
98
+    },
99
+    {
100
+      title: '所属楼盘',
101
+      dataIndex: 'buildingName',
102
+      key: 'buildingName',
103
+      align: 'center',
104
+    },
105
+    {
106
+      title: '详情类型',
107
+      dataIndex: 'liveDetailType',
108
+      key: 'liveDetailType',
109
+      align: 'center',
110
+      render: (x, row) => <><span>{row.liveDetailType == '0' ? '系统模板' : '自定义'}</span></>,
111
+    },
112
+    {
113
+      title: '访问人数',
114
+      dataIndex: 'liveDetailType',
115
+      key: 'liveDetailType',
116
+      align: 'center',
117
+    },
118
+    {
119
+      title: '发布状态',
120
+      dataIndex: 'status',
121
+      key: 'status',
122
+      align: 'center',
123
+      render: status => <><span>{status == 0 ? '未发布' : '已发布'}</span></>,
124
+    },
125
+    {
126
+      title: '新增人',
127
+      dataIndex: 'createName',
128
+      key: 'createName',
129
+      align: 'center',
130
+    },
131
+    {
132
+      title: '新增时间',
133
+      dataIndex: 'createDate',
134
+      key: 'createDate',
135
+      align: 'center',
136
+      render: (x, row) => <><span>{`${moment(row.createDate).format('YYYY-MM-DD HH:mm:ss')}`}</span></>,
137
+    },
138
+    {
139
+      title: '修改人',
140
+      dataIndex: 'updateName',
141
+      key: 'updateName',
142
+      align: 'center',
143
+    },
144
+    {
145
+      title: '修改时间',
146
+      dataIndex: 'updateDate',
147
+      key: 'updateDate',
148
+      align: 'center',
149
+      render: (x, row) => <><span>{`${moment(row.updateDate).format('YYYY-MM-DD HH:mm:ss')}`}</span></>,
150
+    },
151
+  ];
152
+  const getSignList = dynamicId => {
153
+    router.push({
154
+      pathname: '/activity/SignList',
155
+      query: {
156
+        dynamicId,
157
+      },
158
+    });
159
+  }
160
+
161
+  const changePageNum = pageNumber => {
162
+    getList({ pageNum: pageNumber, pageSize: 10, ...props.form.getFieldsValue() })
163
+  }
164
+
165
+  const rowSelection = {
166
+    onChange: (selectedRowKeys, selectedRows) => {
167
+      console.log('selectedRowKeys:', selectedRowKeys, 'selectedRows: ', selectedRows);
168
+      setHouseIdList(selectedRows)
169
+    },
170
+  };
171
+
172
+  // 提交事件
173
+  const handleSubmit = e => {
174
+    e.preventDefault();
175
+    props.form.validateFields((err, values) => {
176
+      if (!err) {
177
+        console.log('提交数据: ', values)
178
+        if (time) {
179
+          values.time = `${moment(time).format('YYYY-MM-DDT00:00:00.000')}Z`
180
+        } else {
181
+          values.time = null
182
+        }
183
+        
184
+        getList({ pageNum: 1, pageSize: 10, ...values })
185
+      }
186
+    });
187
+  }
188
+
189
+  // 重置搜索
190
+  function handleReset () {
191
+    props.form.resetFields();
192
+    setTime('')
193
+    getList({ pageNum: 1, pageSize: 10 })
194
+  }
195
+
196
+  // 时间回调
197
+  function timeOnChange(date, dateString) {
198
+    console.log(date, dateString)
199
+    setTime(date)
200
+  }
201
+
202
+
203
+  const { getFieldDecorator } = props.form
204
+  return (
205
+
206
+    <>
207
+      {/* style={{ display: 'none' }} */}
208
+      <div id="qrcode"></div>
209
+      <Form layout="inline" onSubmit={e => handleSubmit(e)}>
210
+        <Form.Item>
211
+          {getFieldDecorator('liveActivityTitle')(
212
+             <Input
213
+             prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
214
+             placeholder="直播活动标题"
215
+           />,
216
+          )}
217
+        </Form.Item>
218
+        <Form.Item>
219
+          {getFieldDecorator('cityId')(
220
+            <SelectCity />,
221
+          )}
222
+        </Form.Item>
223
+        <Form.Item>
224
+          {getFieldDecorator('buildingId')(
225
+            <BuildSelect />,
226
+          )}
227
+        </Form.Item>
228
+        <Form.Item>
229
+          {getFieldDecorator('liveDetailType')(
230
+            <Select style={{ width: '180px' }} placeholder="详情类型">
231
+            <Option value="1">自定义</Option>
232
+            <Option value="0">系统模板</Option>
233
+          </Select>,
234
+          )}
235
+        </Form.Item>
236
+        <Form.Item>
237
+          {getFieldDecorator('status')(
238
+            <Select style={{ width: '180px' }} placeholder="发布状态">
239
+            <Option value="1">已发布</Option>
240
+            <Option value="0">未发布</Option>
241
+          </Select>,
242
+          )}
243
+        </Form.Item>
244
+        <Form.Item>
245
+          <AuthButton name="admin.buildingDynamic.search" noRight={null}>
246
+            <Button type="primary" htmlType="submit" className={styles.searchBtn}>
247
+              搜索
248
+            </Button>
249
+          </AuthButton>
250
+          <Button style={{ marginLeft: 8 }} onClick={handleReset}>
251
+            重置
252
+            </Button>
253
+        </Form.Item>
254
+      </Form>
255
+      <AuthButton name="admin.salesBatch.add.post" noRight={null}>
256
+        <Button type="danger" className={styles.addBtn} onClick={toAddLive()}>新增</Button>
257
+      </AuthButton>
258
+      <AuthButton name="admin.salesBatch.del" noRight={null}>
259
+        <Button type="primary" className={styles.addBtn} onClick={toDelBatch()} style={{marginLeft:'30px'}}>删除</Button>
260
+      </AuthButton>
261
+      <Table rowSelection={rowSelection}
262
+       dataSource={data.records} columns={columns} pagination={false} rowKey="activityList" />
263
+      <div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
264
+        <Pagination showQuickJumper defaultCurrent={1} total={data.total} onChange={e => changePageNum(e)} current={data.current}/>
265
+      </div>
266
+      {/* <SaleBatchListHelpDoc visible={showHelp} onCancel={() => setShowHelp(false)} /> */}
267
+    </>
268
+  )
269
+}
270
+const WrappedHeader = Form.create({ name: 'header' })(header);
271
+
272
+export default WrappedHeader