瀏覽代碼

客户详情终结版

dingxin 5 年之前
父節點
當前提交
dd2221bb8b

+ 117
- 0
src/components/PaginationWrapper/index.jsx 查看文件

@@ -0,0 +1,117 @@
1
+import React, { useState } from 'react';
2
+import PropTypes from 'prop-types';
3
+import { Pagination } from 'antd';
4
+import classNames from 'classnames'
5
+import { useQuery } from '../../utils/hooks';
6
+import { ObjSpEqual } from '../../utils/utils'
7
+import Styles from './style.less'
8
+
9
+class PaginationWrapper extends React.PureComponent {
10
+
11
+  state = {
12
+    data: {
13
+      current: 1,
14
+      total: 0,
15
+      pages: 0,
16
+    },
17
+    loadding: false,
18
+  }
19
+
20
+  componentDidMount () {
21
+    this.fetchData(1)
22
+  }
23
+
24
+  componentDidUpdate(prevProps) {
25
+    if (!ObjSpEqual(prevProps.params, this.props.params)) {
26
+      this.fetchData(1)
27
+    }
28
+  } 
29
+
30
+  fetchData = (page) => {
31
+    this.setState({ loadding: true })
32
+    
33
+    const requestParams = this.props.params || {}
34
+    this.props.request({
35
+      ...requestParams,
36
+      params: {
37
+        pageNum: page,              // 有的接口是 pageNum
38
+        pageNumber: page,  // 有的接口是 pageNumber
39
+        ...(requestParams.params || {}),
40
+      }
41
+    }).then((res) => {
42
+      this.setState({ loadding: false, data: res })
43
+    })
44
+  }
45
+
46
+  handlePageChange = (page) => {
47
+    this.fetchData(page)
48
+  }
49
+
50
+  render() {
51
+    const { className, style, bodyClass, footerClass, render } = this.props
52
+    const { data } = this.state
53
+
54
+    return (
55
+      <div className={classNames(Styles['pg-wrapper'], className)} style={style}>
56
+        <div className={classNames(Styles.body, bodyClass)}>
57
+          {render(data)}
58
+        </div>
59
+        <div className={classNames(Styles.footer, footerClass)}>
60
+          <Pagination showQuickJumper defaultCurrent={1} total={data.total} onChange={this.handlePageChange} current={data.current}/>
61
+        </div>
62
+      </div>
63
+    )
64
+  }
65
+}
66
+
67
+PaginationWrapper.propTypes = {
68
+  request: PropTypes.func.isRequired,
69
+  render: PropTypes.func.isRequired,
70
+  params: PropTypes.object,
71
+  className: PropTypes.oneOfType([
72
+    PropTypes.string,
73
+    PropTypes.array,
74
+    PropTypes.object,
75
+  ]),
76
+  bodyClass: PropTypes.oneOfType([
77
+    PropTypes.string,
78
+    PropTypes.array,
79
+    PropTypes.object,
80
+  ]),
81
+  footerClass: PropTypes.oneOfType([
82
+    PropTypes.string,
83
+    PropTypes.array,
84
+    PropTypes.object,
85
+  ]),
86
+  style: PropTypes.object,
87
+}
88
+
89
+// /**
90
+//  * 分页封装
91
+//  * @param {page, params, request, render, className, style, bodyClass, footerClass} props 
92
+//  */
93
+// function PaginationWrapper(props) {
94
+//   const defaultPage = props.page || 1
95
+//   const [pageNum, setPage] = useState(defaultPage)
96
+//   const requestParams = props.params || {}
97
+//   const [data = {}, loading, err] = useQuery({ ...requestParams, params: { ...(requestParams.params || {}), pageNum, pageNumber: pageNum }}, props.request)
98
+
99
+//   // if (typeof props.setData === 'function') {
100
+//   //   props.setData(data)
101
+//   // }
102
+
103
+//   console.log('------render PaginationWrapper-------', pageNum, data, loading)
104
+
105
+//   return (
106
+//     <div className={classNames(Styles['pg-wrapper'], props.className)} style={props.style}>
107
+//       <div className={classNames(Styles.body, props.bodyClass)}>
108
+//         {props.render(data)}
109
+//       </div>
110
+//       <div className={classNames(Styles.footer, props.footerClass)}>
111
+//         <Pagination showQuickJumper defaultCurrent={defaultPage} total={data.total} onChange={pg => setPage(pg)} current={data.current}/>
112
+//       </div>
113
+//     </div>
114
+//   )
115
+// }
116
+
117
+export default PaginationWrapper

+ 10
- 0
src/components/PaginationWrapper/style.less 查看文件

@@ -0,0 +1,10 @@
1
+.pg-wrapper {
2
+  .body {}
3
+
4
+  .footer {
5
+    margin-top: 30px;
6
+    display: flex;
7
+    align-items: center;
8
+    flex-direction: row-reverse;
9
+  }
10
+}

+ 81
- 0
src/components/SearchForm/index.jsx 查看文件

@@ -0,0 +1,81 @@
1
+import React from 'react';
2
+import PropTyps from 'prop-types';
3
+import { Form, Button } from 'antd';
4
+
5
+function isFunc(fn) { return typeof fn === 'function' };
6
+
7
+class SearchForm extends React.PureComponent {
8
+  handleSubmit = e => {
9
+    e.preventDefault();
10
+    this.props.form.validateFields((err, values) => {
11
+      if (!err && isFunc(this.props.onSearch)) {
12
+        this.props.onSearch(values)
13
+        return
14
+      }
15
+
16
+      if (err) {
17
+        console.error(err)
18
+        if (isFunc(this.props.onError)) {
19
+          this.props.onError(err)
20
+        }
21
+        return
22
+      }
23
+    });
24
+  };
25
+
26
+  handleReset = e => {
27
+    this.props.form.resetFields()
28
+    if (isFunc(this.props.onReset)) {
29
+      this.props.onReset()
30
+    }
31
+  }
32
+
33
+  render () {
34
+    const { form, hideResetBtn } = this.props;
35
+
36
+    return (
37
+      <Form layout="inline" onSubmit={this.handleSubmit} colon={false}>
38
+        {
39
+          (this.props.fields || []).map((field, index) => {
40
+            const { element, render, name, label, value } = field || {}
41
+
42
+            if (!element && !render) return null;
43
+
44
+            const conifg = value  ? { initialValue: value } : {}
45
+            const Item = isFunc(render) ? render(this.props) : element
46
+
47
+            return <Form.Item label={label} key={`fm-${index}`}>{form.getFieldDecorator(name, conifg)(Item)}</Form.Item>
48
+          })
49
+        }
50
+        <Form.Item>
51
+          <Button type="primary" htmlType="submit">搜索</Button>
52
+        </Form.Item>
53
+        { hideResetBtn && (
54
+          <Form.Item>
55
+            <Button type="default" onClick="handleReset">重置</Button>
56
+          </Form.Item>
57
+        )}
58
+      </Form>
59
+    );
60
+  }
61
+}
62
+
63
+// 提供给父组件 onChange 事件
64
+function onValuesChange(props, changedValues, allValues) {
65
+  if (isFunc(props.onChange)) {
66
+    props.onChange(changedValues, allValues)
67
+  }
68
+}
69
+
70
+const EnhanceForm = Form.create({ onValuesChange })(SearchForm)
71
+
72
+EnhanceForm.propTypes = {
73
+  onSearch: PropTyps.func.isRequired,
74
+  onReset: PropTyps.func,
75
+  onError: PropTyps.func,
76
+  onChange: PropTyps.func,
77
+  fields: PropTyps.arrayOf(PropTyps.object),
78
+  hideResetBtn: PropTyps.bool,
79
+}
80
+
81
+export default EnhanceForm;

+ 19
- 3
src/components/XForm/FileUpload.jsx 查看文件

@@ -2,6 +2,10 @@ import React, { useState, useEffect } from 'react'
2 2
 import { Upload, Button, Icon } from 'antd';
3 3
 import { uploaderProps } from '../../utils/upload';
4 4
 
5
+/**
6
+ * value 数据的接收格式 [{ url: xxxxx.mp4 }]
7
+ * @param {*} props 
8
+ */
5 9
 function fileUpload(props) {
6 10
 
7 11
   const { value } = props
@@ -16,7 +20,9 @@ function fileUpload(props) {
16 20
 
17 21
 
18 22
   function getFileList() {
19
-    return (value || []).map((img, inx) => ({ uid: inx, url: img, name: img.substring(img.lastIndexOf('/') + 1, img.length), status: 'done' }))
23
+    console.log('fileUpload: ', value)
24
+    // value 数据的接收格式 [{ url: xxxxx.mp4 }, { url: xxxxx.jpg }]
25
+    return (value || []).filter(f => f !== undefined).map((img, inx) => ({ uid: inx, url: img, name: img.substring(img.lastIndexOf('/') + 1, img.length), status: 'done' }))
20 26
   }
21 27
 
22 28
   function setDefaultValue() {
@@ -28,13 +34,23 @@ function fileUpload(props) {
28 34
   }
29 35
 
30 36
   function onFileChange({ file, fileList }) {
37
+    console.log(file, fileList)
31 38
     setDefaultFileList(fileList)
32 39
     if (file.status === 'uploading') {
33 40
       return
34 41
     }
35 42
 
36
-    if (file.status === 'done') {
37
-      props.onChange([].concat(file.response))
43
+    if (file.status === 'done' || file.status === 'removed') {
44
+
45
+      // 因为这个控件本身返回的数据格式 [{ ..., response: '服务器返回的数据' }]
46
+      // 但是 我这里自己用的时候 传入的数据是 [ 'xxxx.mp4', 'xxxx.jpg' ], 然后通过 getFileList() 转换成了 [{ url: 'xxx.mp4' }] 这样的格式
47
+
48
+      // 原因是因为 控件返回的数据 和 fileList 展示已经上传的数据 的格式字段不一样
49
+
50
+      const resFileList = fileList.filter(f => f.response !== undefined).map(i => i.response)
51
+      const tempFileList = fileList.filter(f => f.url !== undefined).map(i => i.url)
52
+      const resultList = tempFileList.concat(resFileList || [])
53
+      props.onChange(resultList)
38 54
     }
39 55
   }
40 56
 

+ 1
- 1
src/layouts/BasicLayout.jsx 查看文件

@@ -27,7 +27,7 @@ const footerRender = () => {
27 27
         color: 'rgba(102, 102, 102, 1)',
28 28
       }}
29 29
     >
30
-      copy Right @ 知与行
30
+      Copy Right @ 知与行
31 31
     </div>
32 32
   )
33 33
 }

+ 9
- 10
src/pages/activity/editActivity.jsx 查看文件

@@ -108,27 +108,25 @@ const BasicForm = props => {
108 108
           ],
109 109
         })(<BuildSelect disabled={disable}/>)}
110 110
         </Form.Item>
111
-        <Form.Item label="活动详情图">
112
-          {getFieldDecorator('detailImgUrl', {
111
+        <Form.Item label="活动封面图1" help="建议图片尺寸:750px*420px,比例16:9,格式:jpg,用于活动列表">
112
+          {getFieldDecorator('listImgUrl', {
113 113
           rules: [
114 114
             {
115 115
               required: true,
116
-              message: '请选择活动详情图',
116
+              message: '请选择活动封面图1',
117 117
             },
118 118
           ],
119 119
         })(<ImageUploader />)}
120
-          <span>建议图片尺寸:750px*560px</span>
121 120
         </Form.Item>
122
-        <Form.Item label="活动列表图">
121
+        <Form.Item label="活动详情主图" help="建议图片尺寸:750*600px,比例5:4,格式:jpg,用于普通活动详情">
123 122
           {getFieldDecorator('imgUrl', {
124 123
           rules: [
125 124
             {
126 125
               required: true,
127
-              message: '请选择活动列表图',
126
+              message: '请选择活动详情主图',
128 127
             },
129 128
           ],
130 129
         })(<ImageUploader />)}
131
-          <span>建议图片尺寸:750px*560px</span>
132 130
         </Form.Item>
133 131
         <Form.Item label="活动标题">
134 132
         {getFieldDecorator('title', {
@@ -339,9 +337,10 @@ const Edit = props => {
339 337
 
340 338
         <div >
341 339
           <div style={{ display: 'flex', width: '100%', margin: '60px 0' }}>
342
-            <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>海报图</p>
340
+            <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>活动海报图</p>
343 341
             <ImageUploader value={imgValue} onChange={e => changeImg(e)} />
344 342
           </div>
343
+          <p style={{ fontSize: '0.5vw', color: '#A9A9A9', marginLeft: '230px', marginBottom: '30px'}}>建议图片尺寸:750*600px,比例5:4,格式:jpg,用于普通活动海报</p>
345 344
           <div style={{ display: 'flex', alignItems: 'center', width: '100%', marginBottom: '60px' }}>
346 345
             <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>海报标题</p>
347 346
             <Input style={{ width: '20vw' }} value={inputValue} placeholder="请输入海报标题" onChange={e => changeInput(e.target.value)} />
@@ -416,10 +415,10 @@ const Edit = props => {
416 415
         <Input placeholder="请输入分享标题" value={inputValue} onChange={e => changeInput(e.target.value)} />
417 416
       </div>
418 417
       <div style={{ display: 'flex', width: '100%', marginTop: '40px' }}>
419
-        <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>分享图</p>
418
+        <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>活动分享图</p>
420 419
         <ImageUploader value={imgValue} onChange={e => changeImg(e)} />
421 420
       </div>
422
-      <p style={{ fontSize: '0.5vw', color: '#A9A9A9', marginLeft: '250px' }}>图片比例: 5:4</p>
421
+      <p style={{ fontSize: '0.5vw', color: '#A9A9A9', marginLeft: '230px', marginTop: '20px' }}>建议图片尺寸:750*600px,比例5:4,格式:jpg,用于活动分享好友</p>
423 422
       <Button type="primary" htmlType="submit" onClick={submitShare} style={{ margin: '40px 40px 40px 220px' }}> 确定</Button>
424 423
       <Button onClick={() => router.go(-1)}>取消</Button>
425 424
     </div>

+ 22
- 11
src/pages/activity/groupActivity/editGroupActivity.jsx 查看文件

@@ -86,24 +86,34 @@ const Edit = props => {
86 86
         ]
87 87
       },
88 88
       {
89
-        label: '活动主图',
89
+        label: '拼团详情主图',
90 90
         name: 'mainImg',
91 91
         type: FieldTypes.ImageUploader,
92 92
         value: dynamicData.mainImg,
93 93
         rules: [
94
-          { required: true, message: '请输入活动主图' },
94
+          { required: true, message: '请输入拼团详情主图' },
95 95
         ],
96
-        help: '建议尺寸375*312px',
96
+        help: '建议图片尺寸:750*600px,比例5:4,格式:jpg,用于拼团活动详情',
97 97
       },
98 98
       {
99
-        label: '活动列表图',
100
-        name: 'detailImg',
99
+        label: '拼团封面图1',
100
+        name: 'listImg',
101 101
         type: FieldTypes.ImageUploader,
102
-        value: dynamicData.detailImg,
102
+        value: dynamicData.listImg,
103 103
         rules: [
104
-          { required: true, message: '请输入活动列表图' },
104
+          { required: true, message: '请输入拼团封面图1' },
105 105
         ],
106
-        help: '建议尺寸375*312px',
106
+        help: '建议图片尺寸:750*420px,比例16:9,格式:jpg,用于活动列表',
107
+      },
108
+      {
109
+        label: '拼团封面图2',
110
+        name: 'bannerListImg',
111
+        type: FieldTypes.ImageUploader,
112
+        value: dynamicData.bannerListImg,
113
+        rules: [
114
+          { required: true, message: '请输入拼团封面图2' },
115
+        ],
116
+        help: '建议图片尺寸:670*224px,比例3:1,格式:jpg,用于首页底部活动轮播',
107 117
       },
108 118
       {
109 119
         label: '活动时间',
@@ -282,9 +292,10 @@ const Edit = props => {
282 292
 
283 293
         <div >
284 294
           <div style={{ display: 'flex', width: '100%', margin: '60px 0' }}>
285
-            <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>海报图</p>
295
+            <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>拼团海报图</p>
286 296
             <ImageUploader value={imgValue} onChange={e => changeImg(e)} />
287 297
           </div>
298
+          <p style={{ fontSize: '0.5vw', color: '#A9A9A9', marginLeft: '230px', marginBottom: '30px'}}>建议图片尺寸:750*600px,比例5:4,格式:jpg,用于拼团活动海报</p>
288 299
           <div style={{ display: 'flex', alignItems: 'center', width: '100%', marginBottom: '60px' }}>
289 300
             <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>海报标题</p>
290 301
             <Input style={{ width: '20vw' }} value={inputValue} placeholder="请输入海报标题" onChange={e => changeInput(e.target.value)} />
@@ -359,10 +370,10 @@ const Edit = props => {
359 370
         <Input placeholder="请输入分享标题" value={inputValue} onChange={e => changeInput(e.target.value)} />
360 371
       </div>
361 372
       <div style={{ display: 'flex', width: '100%', marginTop: '40px' }}>
362
-        <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>分享图</p>
373
+        <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>拼团分享图</p>
363 374
         <ImageUploader value={imgValue} onChange={e => changeImg(e)} />
364 375
       </div>
365
-      <p style={{ fontSize: '0.5vw', color: '#A9A9A9', marginLeft: '250px' }}>图片比例: 5:4</p>
376
+      <p style={{ fontSize: '0.5vw', color: '#A9A9A9', marginLeft: '230px', marginBottom: '30px'}}>建议图片尺寸:750*600px,比例5:4,格式:jpg,用于拼团活动分享好友</p>
366 377
       <Button type="primary" htmlType="submit" onClick={submitShare} style={{ margin: '40px 40px 40px 220px' }}> 确定</Button>
367 378
       <Button onClick={() => router.go(-1)}>取消</Button>
368 379
     </div>

+ 28
- 5
src/pages/activity/helpActivity/edithelpActivity.jsx 查看文件

@@ -154,12 +154,34 @@ const header = props => {
154 154
         })(<Input />)}
155 155
         </Form.Item>
156 156
 
157
-        <Form.Item label="活动主图" help="建议尺寸375*312px">
157
+        <Form.Item label="助力详情主图" help="建议图片尺寸:750*600px,比例5:4,格式:jpg,用于助力活动详情">
158 158
           {getFieldDecorator('img', {
159 159
           rules: [
160 160
             {
161 161
               required: true,
162
-              message: '活动主图不能为空',
162
+              message: '助力详情主图不能为空',
163
+            },
164
+          ],
165
+        })(<ImageUploader />)}
166
+        </Form.Item>
167
+
168
+        <Form.Item label="助力封面图1" help="建议图片尺寸:750*420px,比例16:9,格式:jpg,用于活动列表">
169
+          {getFieldDecorator('listImg', {
170
+          rules: [
171
+            {
172
+              required: true,
173
+              message: '助力封面图1不能为空',
174
+            },
175
+          ],
176
+        })(<ImageUploader />)}
177
+        </Form.Item>
178
+
179
+        <Form.Item label="助力封面图2" help="建议图片尺寸:670*224px,比例3:1,格式:jpg,用于首页底部活动轮播">
180
+          {getFieldDecorator('bannerListImg', {
181
+          rules: [
182
+            {
183
+              required: true,
184
+              message: '助力封面图2不能为空',
163 185
             },
164 186
           ],
165 187
         })(<ImageUploader />)}
@@ -374,9 +396,10 @@ const Edit = props => {
374 396
 
375 397
         <div >
376 398
           <div style={{ display: 'flex', width: '100%', margin: '60px 0' }}>
377
-            <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>海报图</p>
399
+            <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>助力海报图</p>
378 400
             <ImageUploader value={imgValue} onChange={e => changeImg(e)} />
379 401
           </div>
402
+          <p style={{ fontSize: '0.5vw', color: '#A9A9A9', marginLeft: '230px', marginBottom: '30px'}}>建议图片尺寸:750*600px,比例5:4,格式:jpg,用于助力活动海报</p>
380 403
           <div style={{ display: 'flex', alignItems: 'center', width: '100%', marginBottom: '60px' }}>
381 404
             <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>海报标题</p>
382 405
             <Input style={{ width: '20vw' }} value={inputValue} placeholder="请输入海报标题" onChange={e => changeInput(e.target.value)} />
@@ -451,10 +474,10 @@ const Edit = props => {
451 474
         <Input placeholder="请输入分享标题" value={inputValue} onChange={e => changeInput(e.target.value)} />
452 475
       </div>
453 476
       <div style={{ display: 'flex', width: '100%', marginTop: '40px' }}>
454
-        <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>分享图</p>
477
+        <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>助力分享图</p>
455 478
         <ImageUploader value={imgValue} onChange={e => changeImg(e)} />
456 479
       </div>
457
-      <p style={{ fontSize: '0.5vw', color: '#A9A9A9', marginLeft: '250px' }}>图片比例: 5:4</p>
480
+      <p style={{ fontSize: '0.5vw', color: '#A9A9A9', marginLeft: '230px', marginBottom: '30px'}}>建议图片尺寸:750*600px,比例5:4,格式:jpg,用于助力活动分享好友</p>
458 481
       <Button type="primary" htmlType="submit" onClick={submitShare} style={{ margin: '40px 40px 40px 220px' }}> 确定</Button>
459 482
       <Button onClick={() => router.go(-1)}>取消</Button>
460 483
     </div>

+ 39
- 9
src/pages/building/list/add/components/base.jsx 查看文件

@@ -45,7 +45,10 @@ function AddBuilding(props) {
45 45
 
46 46
   const [poi, setPoi] = useState([])
47 47
 
48
-  console.log('props.building: ', props.building)
48
+  // 视频上传按钮是否 禁用
49
+  const [fileUploadDisabled, setFileUploadDisabled] = useState(false)
50
+
51
+  // console.log('props.building: ', props.building)
49 52
   if (props.building.buildingId !== undefined) {
50 53
     const { buildingId } = props.building
51 54
      // eslint-disable-next-line react-hooks/rules-of-hooks
@@ -75,7 +78,13 @@ function AddBuilding(props) {
75 78
       res.mapCoordinate = res.coordinate
76 79
       if (res.videoUrl) {
77 80
         res.videoUrl = [].concat(res.videoUrl)
81
+        // 视频上传按钮禁用
82
+        setFileUploadDisabled(true)
83
+      }
84
+      if (res.videoImage) {
85
+        res.videoImage = res.videoImage[0].url
78 86
       }
87
+      setPoi(res.mapJson || [])
79 88
       props.form.setFieldsValue(res)
80 89
       props.onSuccess(res)
81 90
     })
@@ -91,7 +100,7 @@ function AddBuilding(props) {
91 100
   }
92 101
 
93 102
   function addBuilding(data) {
94
-    console.log('poi: ', poi)
103
+    // console.log('poi: ', poi)
95 104
     data.mapJson = poi
96 105
     data.openingDate = moment(data.openingDate, 'yyyy-MM-dd HH:mm:ss')
97 106
     data.receivedDate = moment(data.receivedDate, 'yyyy-MM-dd HH:mm:ss')
@@ -99,11 +108,19 @@ function AddBuilding(props) {
99 108
     data.img = data.avatarImage && data.avatarImage.map((item, index) => ({ imgType: 'banner', url: item, orderNo: index + 1 }))
100 109
     // 列表图
101 110
     data.listImg = data.listImage && data.listImage.map((item, index) => ({ imgType: 'list', url: item, orderNo: index + 1 }))
102
-    data.videoUrl = data.videoUrl[0]
111
+    if (data.videoUrl) {
112
+      // console.log(data.videoUrl[0])
113
+      data.videoUrl = data.videoUrl[0]
114
+    }
115
+    
103 116
     if (data.tag) {
104 117
       data.tag = data.tag.map((item, _) => ({ tagName: item }))
105 118
     }
106 119
 
120
+    if (data.videoImage) {
121
+      data.videoImage = [{ imgType: 'videoImage', url: data.videoImage, orderNo: 1 }]
122
+    }
123
+
107 124
     const api = data.buildingId === undefined ? apis.building.addBuilding : apis.building.updateBuilding
108 125
     request({ ...api, data: { ...data } }).then(res => {
109 126
       openNotificationWithIcon('success', '操作成功')
@@ -116,9 +133,13 @@ function AddBuilding(props) {
116 133
 
117 134
   // 视频文件上传前 回调
118 135
   function fileUploadBeforeUpload(file, fileList) {
119
-    console.log(file, fileList)
136
+    // console.log('视频文件上传前 回调: ', file, fileList)
120 137
     return new Promise((resolve, reject) => {
121
-      if (file.type === 'video/mp4' || file.type === '.mp4') {
138
+      if (fileUploadDisabled) {
139
+        openNotificationWithIcon('error', '项目视频,只允许上传一个')
140
+        reject()
141
+      } else if (file.type === 'video/mp4' || file.type === '.mp4') {
142
+          setFileUploadDisabled(true)
122 143
           resolve(file)
123 144
       } else {
124 145
         openNotificationWithIcon('error', '项目视频,仅支持MP4格式')
@@ -162,7 +183,8 @@ function AddBuilding(props) {
162 183
     // 设置表单值
163 184
     getFormMapScopeName(key, { data: poiArray })
164 185
 
165
-    const newPoi = poi.map(m => {
186
+    const poiData = [].concat(POI_TYPES)
187
+    const newPoi = poiData.map(m => {
166 188
       if (m.key === key) {
167 189
         m.data = poiArray
168 190
       }
@@ -266,17 +288,25 @@ function AddBuilding(props) {
266 288
           </Form.Item>
267 289
           <Form.Item label="项目视频" help="视频仅支持mp4格式,建议尺寸:1920*1080,比例16:9">
268 290
             {getFieldDecorator('videoUrl')(
269
-              <FileUpload accept=".mp4" beforeUpload={fileUploadBeforeUpload} label="上传视频"/>,
291
+              // disabled={fileUploadDisabled}
292
+              <FileUpload accept=".mp4" beforeUpload={fileUploadBeforeUpload} label="上传视频" />,
293
+            )}
294
+          </Form.Item>
295
+          <Form.Item label="视频封面图" help="建议图片尺寸:750*600px,比例5:4,格式:jpg,用于视频封面" >
296
+            {getFieldDecorator('videoImage', {
297
+              rules: [{ required: true, message: '请选择视频封面图' }],
298
+            })(
299
+              <ImageUpload />,
270 300
             )}
271 301
           </Form.Item>
272
-          <Form.Item label="项目主图" help="建议图片尺寸:640px*360px">
302
+          <Form.Item label="楼盘主图" help="建议图片尺寸:750*600px,比例5:4,格式:jpg,用于楼盘详情">
273 303
             {getFieldDecorator('avatarImage', {
274 304
               rules: [{ required: true, message: '请选择项目主图' }],
275 305
             })(
276 306
               <ImageListUpload />,
277 307
             )}
278 308
           </Form.Item>
279
-          <Form.Item label="列表图" help="建议图片尺寸:640px*360px">
309
+          <Form.Item label="楼盘封面图" help="建议图片尺寸:670*377px,比例16:9,格式:jpg,用于楼盘列表">
280 310
             {getFieldDecorator('listImage', {
281 311
               rules: [{ required: true, message: '请选择列表图' }],
282 312
             })(

+ 3
- 2
src/pages/building/list/add/components/poster.jsx 查看文件

@@ -140,10 +140,11 @@ const Poster = props => {
140 140
         <p style={{ textAlign: 'center', fontSize: '19px', color: '#666', marginTop: '30px' }}>海报模板</p>
141 141
       </div>
142 142
       <div >
143
-        <div style={{ display: 'flex', width: '100%', margin: '60px 0' }}>
144
-          <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}><span style={{ color: 'red' }}>*</span> 海报图</p>
143
+        <div style={{ display: 'flex', width: '100%', margin: '30px 0' }}>
144
+          <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}><span style={{ color: 'red' }}>*</span> 楼盘海报图</p>
145 145
           <ImageUploader value={imgValue} onChange={e => changeImg(e)} />
146 146
         </div>
147
+        <p style={{ fontSize: '0.5vw', color: '#A9A9A9', marginLeft: '230px', marginBottom: '30px'}}>建议图片尺寸:750*600px,比例5:4,格式:jpg,用于楼盘海报</p>
147 148
         <div style={{ display: 'flex', alignItems: 'center', width: '100%', marginBottom: '60px' }}>
148 149
           <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>海报标题</p>
149 150
           <Input style={{ width: '20vw' }} value={inputValue} placeholder="请输入海报标题" onChange={e => changeInput(e.target.value)} />

+ 2
- 2
src/pages/building/list/add/components/share.jsx 查看文件

@@ -84,10 +84,10 @@ const Share = props => {
84 84
       <Input placeholder="请输入分享标题" value={inputValue} onChange={e => changeInput(e.target.value)} />
85 85
     </div>
86 86
     <div style={{ display: 'flex', width: '100%', marginTop: '40px' }}>
87
-      <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>分享图</p>
87
+      <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>楼盘分享图</p>
88 88
       <ImageUploader value={imgValue} onChange={e => changeImg(e)} />
89 89
     </div>
90
-    <p style={{ fontSize: '0.5vw', color: '#A9A9A9', marginLeft: '250px' }}>图片比例: 5:4</p>
90
+    <p style={{ fontSize: '0.5vw', color: '#A9A9A9', marginLeft: '230px', marginTop: '20px' }}>建议图片尺寸:750*600px,比例5:4,格式:jpg,用于楼盘分享好友</p>
91 91
     <Button type="primary" htmlType="submit" onClick={submitShare} style={{ margin: '40px 40px 40px 220px' }}> 确定</Button>
92 92
     <Button onClick={() => router.go(-1)}>取消</Button>
93 93
   </div>

+ 2
- 2
src/pages/carouselFigure/editAdvertising.jsx 查看文件

@@ -77,11 +77,11 @@ import SelectGroup from './SelectGroup';
77 77
         value: data.buildingId,
78 78
       },
79 79
       {
80
-        label: '商品图片',
80
+        label: '开屏广告',
81 81
         name: 'image',
82 82
         type: FieldTypes.ImageUploader,
83 83
         value: data.image,
84
-        help: '建议图片尺寸:640px*960px',
84
+        help: '建议图片尺寸:640*960px,比例2:3,格式:jpg,用于开屏广告',
85 85
       },
86 86
       {
87 87
         label: '标题',

+ 7
- 3
src/pages/carouselFigure/editCarousel.jsx 查看文件

@@ -28,15 +28,19 @@ const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
28 28
   let helpVisible = false
29 29
   let groupVisible = false
30 30
   let buildingId = ''
31
+  let locationType = false
31 32
 
32 33
   const setExtraData = data => {
34
+    console.log(data, 'data');
33 35
     contentVisible = data.contentType === 'other';
34 36
     activityVisible = data.contentType === 'activity';
35 37
     newsVisible = data.contentType === 'news';
36 38
     helpVisible = data.contentType === 'help';
37 39
     groupVisible = data.contentType === 'group';
38
-
40
+    
39 41
     buildingId = data.buildingId
42
+    locationType = data.showPosition === 'mall';
43
+    console.log(locationType, 'locationType');
40 44
   }
41 45
 
42 46
     
@@ -81,11 +85,11 @@ const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
81 85
           value: data.buildingId,
82 86
         },
83 87
         {
84
-          label: '商品图片',
88
+          label: locationType ? '积分商城轮播图' : '首页轮播图',
85 89
           name: 'image',
86 90
           type: FieldTypes.ImageUploader,
87 91
           value: data.image,
88
-          help: '建议图片尺寸:640px*330px',
92
+          help: locationType ? '建议图片尺寸:750*420px,比例16:9,格式:jpg,用于积分商城banner轮播':'建议图片尺寸:750*600px,比例5:4,格式:jpg,用于首页顶部banner轮播',
89 93
         },
90 94
         {
91 95
           label: '标题',

+ 9
- 2
src/pages/integralMall/editGoods.jsx 查看文件

@@ -40,11 +40,18 @@ const header = props => {
40 40
       ]
41 41
     },
42 42
     {
43
-      label: '商品图',
43
+      label: '商品封面图',
44 44
       name: 'imgUrl',
45 45
       type: FieldTypes.ImageUploader,
46 46
       value: goodsData.imgUrl,
47
-      help: '建议图片尺寸:164px*164px',
47
+      help: '建议图片尺寸:320*320px,比例1:1,格式:jpg,用于商品封面图',
48
+    },
49
+    {
50
+      label: '商品主图',
51
+      name: 'detailImgUrl',
52
+      type: FieldTypes.ImageUploader,
53
+      value: goodsData.detailImgUrl,
54
+      help: '建议图片尺寸:750*750px,比例1:1,格式:jpg,用于商品主图',
48 55
     },
49 56
     {
50 57
       label: '商品名称',

+ 6
- 5
src/pages/news/list/editNewsList.jsx 查看文件

@@ -64,11 +64,11 @@ const { TextArea } = Input;
64 64
         ]
65 65
       },
66 66
       {
67
-        label: '资讯列表',
67
+        label: '资讯列表',
68 68
         name: 'newsImg',
69 69
         type: FieldTypes.ImageUploader,
70 70
         value: dynamicData.newsImg,
71
-        help: '建议图片尺寸:660px*416px',
71
+        help: '建议图片尺寸:320*256px,比例5:4,格式:jpg,用于资讯列表',
72 72
       },
73 73
       {
74 74
         label: '资讯标题',
@@ -215,9 +215,10 @@ const { TextArea } = Input;
215 215
 
216 216
         <div >
217 217
           <div style={{ display: 'flex', width: '100%', margin: '60px 0' }}>
218
-            <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>海报图</p>
218
+            <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>资讯海报图</p>
219 219
             <ImageUploader value={imgValue} onChange={e => changeImg(e)} />
220 220
           </div>
221
+          <p style={{ fontSize: '0.5vw', color: '#A9A9A9', marginLeft: '230px', marginBottom: '30px'}}>建议图片尺寸:750*600px,比例5:4,格式:jpg,用于资讯海报</p>
221 222
           <div style={{ display: 'flex', alignItems: 'center', width: '100%', marginBottom: '60px' }}>
222 223
             <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>海报标题</p>
223 224
             <Input style={{ width: '20vw' }} value={inputValue} placeholder="请输入海报标题" onChange={e => changeInput(e.target.value)} />
@@ -290,10 +291,10 @@ const { TextArea } = Input;
290 291
         <Input placeholder="请输入分享标题" value={inputValue} onChange={e => changeInput(e.target.value)} />
291 292
       </div>
292 293
       <div style={{ display: 'flex', width: '100%', marginTop: '40px' }}>
293
-        <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>分享图</p>
294
+        <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>资讯分享好友图</p>
294 295
         <ImageUploader value={imgValue} onChange={e => changeImg(e)} />
295 296
       </div>
296
-      <p style={{ fontSize: '0.5vw', color: '#A9A9A9', marginLeft: '250px' }}>图片比例: 5:4</p>
297
+      <p style={{ fontSize: '0.5vw', color: '#A9A9A9', marginLeft: '230px', marginTop: '20px' }}>建议图片尺寸:750*600px,比例5:4,格式:jpg,用于资讯分享好友</p>
297 298
       <Button type="primary" htmlType="submit" onClick={submitShare} style={{ margin: '40px 40px 40px 220px' }}> 确定</Button>
298 299
       <Button onClick={() => router.go(-1)}>取消</Button>
299 300
     </div>

+ 2
- 2
src/pages/staff/list/editStaff.jsx 查看文件

@@ -191,10 +191,10 @@ const Edit = (props) => {
191 191
       value: userData.buildingId
192 192
     },
193 193
     {
194
-      label: '头像',
194
+      label: '置业顾问头像',
195 195
       name: 'photo',
196 196
       type: FieldTypes.ImageUploader,
197
-      extra: '建议图片大小 640 * 640',
197
+      extra: '建议图片尺寸:320*320px,比例1:1,格式:jpg,用于置业顾问头像',
198 198
       value: userData.photo,
199 199
       rules: [
200 200
         { required: true, message: '请选择头像' },

+ 2
- 2
src/pages/system/editPolicy.jsx 查看文件

@@ -48,11 +48,11 @@ const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
48 48
         value: policyData.cityId,
49 49
       },
50 50
       {
51
-        label: '政策图',
51
+        label: '购房政策封面图',
52 52
         name: 'policyImg',
53 53
         type: FieldTypes.ImageUploader,
54 54
         value: policyData.policyImg,
55
-        help: '建议图片尺寸:660px*416px',
55
+        help: '建议图片尺寸:220*176px,比例5:4,格式:jpg,用于购房百科列表',
56 56
       },
57 57
       {
58 58
         label: '政策标题',

+ 66
- 30
src/pages/system/messageList.jsx 查看文件

@@ -1,32 +1,41 @@
1 1
 import React, { useState, useEffect } from 'react';
2 2
 import { Form, Input, Button, Icon, Select, message, Table, Divider, Tag, Pagination, Modal, DatePicker } from 'antd';
3
-import { FormattedMessage } from 'umi-plugin-react/locale';
3
+// import { FormattedMessage } from 'umi-plugin-react/locale';
4 4
 import styles from '../style/GoodsList.less';
5 5
 import router from 'umi/router';
6 6
 import moment from 'moment';
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'
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 { fetch, apis } from '../../utils/request'
12
+// import { useQuery } from '../../utils/hooks'
13
+import PaginationWrapper from '../../components/PaginationWrapper'
14
+import SearchForm from '../../components/SearchForm'
11 15
 
12
-const { Option } = Select;
13
-const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
16
+// const { Option } = Select;
17
+// const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
18
+
19
+const getMessageList = fetch(apis.system.taCustomerMessage)
14 20
 
15 21
 const header = (props) => {
16
-  const [ data, setData ] = useState({})
17
-//   const [page, changePage] = useState({})
22
+  // const [ data, setData ] = useState({})
23
+// //   const [page, changePage] = useState({})
24
+
25
+//   useEffect(() => {
26
+//     getList({ pageNum: 1, pageSize: 10 });
27
+//   },[])
18 28
 
19
-  useEffect(() => {
20
-    getList({ pageNum: 1, pageSize: 10 });
21
-  },[])
29
+//   // 查询列表
30
+//   const getList = (params) => {
31
+//     request({ ...apis.system.taCustomerMessage, params: { ...params },}).then((data) => {
32
+//         console.log(data)
33
+//         setData(data)
34
+//     })
35
+//   }
22 36
 
23
-  // 查询列表
24
-  const getList = (params) => {
25
-    request({ ...apis.system.taCustomerMessage, params: { ...params },}).then((data) => {
26
-        console.log(data)
27
-        setData(data)
28
-    })
29
-  }
37
+  // const [pageNum, setPage] = useState(1)
38
+  // const [data, loading, err] = useQuery({params: { pageNum }}, getMessageList)
30 39
 
31 40
   const columns = [
32 41
     {
@@ -51,22 +60,49 @@ const header = (props) => {
51 60
   ];
52 61
    
53 62
   
54
-  const changePageNum = (pageNumber) => {
55
-      getList({ pageNum: pageNumber, pageSize: 10 })
56
-  }
63
+  // const changePageNum = (pageNumber) => {
64
+  //     getList({ pageNum: pageNumber, pageSize: 10 })
65
+  // }
66
+
67
+  
68
+  console.log('------render messagelist-------')
57 69
  
58 70
 
59
-  const { getFieldDecorator } = props.form
71
+  // const { getFieldDecorator } = props.form
60 72
   return (
61
-
62 73
     <>
63
-      <Table rowKey="messageList" dataSource={data.records} columns={columns} pagination={false}/>
64
-      <div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
65
-        <Pagination showQuickJumper defaultCurrent={1} total={data.total} onChange={changePageNum} current={data.current}/>
66
-      </div>
74
+    <SearchForm
75
+      onSearch={console.log}
76
+      fields={[
77
+        {
78
+          label: 'Foo',
79
+          name: 'foo',
80
+          element: <Input />,
81
+        },
82
+        {
83
+          label: 'Bar',
84
+          name: 'bar',
85
+          element: (<Select style={{ width: '200px' }}>
86
+            <Select.Option value={1}>a</Select.Option>
87
+            <Select.Option value={2}>b</Select.Option>
88
+          </Select>)
89
+        },
90
+      ]}
91
+    ></SearchForm>
92
+    <PaginationWrapper
93
+      request={getMessageList}
94
+      render={data => <Table rowKey={record => record.messageId} dataSource={data.records} columns={columns} pagination={false}/>}
95
+    >
96
+    </PaginationWrapper>
67 97
     </>
98
+    // <>
99
+    //   <Table rowKey="messageList" dataSource={data.records} columns={columns} pagination={false}/>
100
+    //   <div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
101
+    //     <Pagination showQuickJumper defaultCurrent={1} total={data.total} onChange={pg => setPage(pg)} current={data.current}/>
102
+    //   </div>
103
+    // </>
68 104
   )
69 105
 }
70
-const WrappedHeader = Form.create({ name: 'header' })(header);
106
+// const WrappedHeader = Form.create({ name: 'header' })(header);
71 107
 
72
-export default WrappedHeader
108
+export default header

+ 39
- 0
src/utils/hooks.js 查看文件

@@ -0,0 +1,39 @@
1
+import React, { useState, useEffect } from 'react';
2
+
3
+function ObjEqual(a, b) {
4
+  if (typeof(a) !== 'object' || typeof(b) !== 'object') {
5
+    return false
6
+  }
7
+
8
+  return JSON.stringify(a) === JSON.stringify(b)
9
+}
10
+
11
+export function useQuery(params, request) {
12
+  const [preParams, setParams] = useState({})
13
+  const [data, setData] = useState({})
14
+  const [error, setError] = useState()
15
+  const [loading, setLoading] = useState(false)
16
+
17
+  useEffect(() => {
18
+    if (ObjEqual(preParams, params)) {
19
+      return
20
+    }
21
+
22
+    setLoading(true)
23
+    setParams(params)
24
+    request(params).then((res) => {
25
+      setData(res)
26
+      setError(void 0)
27
+      setLoading(false)
28
+    }).catch((err) => {
29
+      setError(err)
30
+      setLoading(false)
31
+    })
32
+  })
33
+
34
+  return [
35
+    data,
36
+    loading,
37
+    error,
38
+  ]
39
+}

+ 4
- 0
src/utils/utils.js 查看文件

@@ -21,3 +21,7 @@ export const isAntDesignProOrDev = () => {
21 21
   return isAntDesignPro();
22 22
 };
23 23
 export const getPageQuery = () => parse(window.location.href.split('?')[1]);
24
+
25
+export function ObjSpEqual(a = {}, b = {}) {
26
+  return JSON.stringify(a) === JSON.stringify(b)
27
+}