Pārlūkot izejas kodu

Merge branch 'v3-5-30' of http://git.ycjcjy.com/estateagents/pc-channel into v3-5-30

Yansen 5 gadus atpakaļ
vecāks
revīzija
7919b535ff

+ 36
- 3
config/routes.js Parādīt failu

@@ -210,16 +210,49 @@ export default [
210 210
               },
211 211
             ],
212 212
           },
213
-
214 213
           {
215 214
             path: '/officenews',
216 215
             name: '资讯管理',
217 216
             component: '../layouts/BlankLayout',
218 217
             routes: [
219 218
               {
220
-                path: '/officenews',
219
+                path: '/officenews/index',
221 220
                 name: '资讯管理',
222
-                component: './resource/openScreen',
221
+                component: './officenews/index',
222
+              },
223
+              {
224
+                path: '/officenews/edit',
225
+                name: '资讯编辑',
226
+                hideInMenu: true,
227
+                component: './officenews/edit',
228
+              },
229
+              {
230
+                path: '/officenews/detail',
231
+                name: '资讯查看',
232
+                hideInMenu: true,
233
+                component: './officenews/detail',
234
+              },
235
+            ],
236
+          },
237
+          {
238
+            path: '/promote',
239
+            name: '推广表单',
240
+            component: '../layouts/BlankLayout',
241
+            routes: [
242
+              {
243
+                path: '/promote/index',
244
+                name: '推广表单',
245
+                component: './promote/index',
246
+              },
247
+              {
248
+                path: '/promote/contact',
249
+                name: '联系人列表',
250
+                component: './promote/contact',
251
+              },
252
+              {
253
+                path: '/promote/detail',
254
+                name: '查看详情',
255
+                component: './promote/detail',
223 256
               },
224 257
             ],
225 258
           },

+ 34
- 0
src/components/Navigate/index.jsx Parādīt failu

@@ -0,0 +1,34 @@
1
+import React from 'react';
2
+import Link from 'umi/link';
3
+
4
+import styles from './style.less';
5
+
6
+const Navigate = ({ children, to, onClick }) => {
7
+    // to 包含协议 用 a
8
+    const useA = (to || '').indexOf('://') > -1 ? 'a' : '';
9
+    // 否则用 Link
10
+    const useLink = to && to.indexOf('://') === -1 ? Link : '';
11
+    // 没有 to 则使用 span
12
+    const element = useA || useLink || 'span';
13
+
14
+    const events = onClick ? { onClick } : {};
15
+    const style = { color: '#1D74D9', cursor: 'pointer' };
16
+
17
+    let redirect = {};
18
+    if (useA) {
19
+        redirect = { href: to }
20
+    } else if (useLink) {
21
+        redirect = { to }
22
+    }
23
+
24
+    const props = {
25
+        className: 'cust-navi',
26
+        style,
27
+        ...redirect,
28
+        ...events,
29
+    }
30
+
31
+    return React.createElement(element, props, children);
32
+};
33
+
34
+export default Navigate;

+ 11
- 0
src/components/Navigate/style.less Parādīt failu

@@ -0,0 +1,11 @@
1
+
2
+:global {
3
+  .cust-navi {
4
+    color: #1D74D9;
5
+    cursor: pointer;
6
+  
7
+    * {
8
+      color: #1D74D9 !important;
9
+    }
10
+  }
11
+}

+ 97
- 0
src/pages/officenews/detail.jsx Parādīt failu

@@ -0,0 +1,97 @@
1
+import React, { useState, useEffect } from 'react';
2
+import { Input, Menu, Dropdown, Button, Icon, message, Table, Divider, Tag, Select, Form, Alert } from 'antd';
3
+import { FormattedMessage } from 'umi-plugin-react/locale';
4
+import XForm, { FieldTypes } from '../../components/XForm';
5
+import router from 'umi/router';
6
+import apis from '../../services/apis';
7
+import request from '../../utils/request';
8
+import Wangedit from '../../components/Wangedit/Wangedit'
9
+import moment from 'moment';
10
+
11
+
12
+const header = props => {
13
+    const newsId = props.location.query.id
14
+  
15
+    const [ data, setData ] = useState({})
16
+    if(newsId){
17
+      useEffect(() => {
18
+        getNewData(newsId);
19
+      },[])
20
+  
21
+    // 查询列表
22
+    const getNewData = (newsId) => {
23
+      request({
24
+          ...apis.officenews.get,
25
+          urlData: { id: newsId }
26
+      }).then((data) => {
27
+        setData(data)
28
+      }).catch((err) => {
29
+        message.error(err.msg || err.message)
30
+      })
31
+    }
32
+    }
33
+  
34
+    const fields = [
35
+      {
36
+        label: '资讯封面',
37
+        name: 'thumb',
38
+        type: FieldTypes.ImageUploader,
39
+        value: data.thumb,
40
+        rules: [
41
+            { required: true, message: '请选择资讯封面' },
42
+        ],
43
+        help: '建议尺寸:500px*400px,比例5:4,格式:jpg,用于:橙蕉官网新闻资讯列表',
44
+      },    
45
+      {
46
+        label: '资讯标题',
47
+        name: 'title',
48
+        type: FieldTypes.Text,
49
+        value: data.title
50
+      },
51
+      {
52
+        label: '资讯详情',
53
+        name: 'content',
54
+        value: data.content,
55
+        render: <Wangedit />
56
+      },
57
+      {
58
+        label: '状态',
59
+        name: 'status',
60
+        value: data.status,
61
+        render: <Select style={{ width: '180px' }} placeholder="发布状态">
62
+                    <Option value={0}>已发布</Option>
63
+                    <Option value={1}>未发布</Option>
64
+                </Select>,
65
+      },
66
+    ]
67
+  
68
+     
69
+    const handleSubmit = (values) => {
70
+      if(newsId){
71
+          request({ ...apis.officenews.update, urlData: { id: newsId }, data: { ...values }}).then((data) => {
72
+            cancelPage();
73
+          }).catch((err) => {
74
+            message.error(err.msg || err.message)
75
+          })
76
+        }else{
77
+          request({ ...apis.officenews.save, data: { ...values }}).then((data) => {
78
+            cancelPage();
79
+          }).catch((err) => {
80
+            message.error(err.msg || err.message)
81
+          })
82
+        }
83
+    }
84
+  
85
+    const cancelPage = () => {
86
+      router.push({
87
+        pathname: '/officenews/index',
88
+      });
89
+    }
90
+  
91
+    return (
92
+      <XForm onSubmit={handleSubmit} onCancel={cancelPage} fields={fields}></XForm>
93
+    )
94
+  }
95
+  
96
+  const WrappedNormalLoginForm = Form.create({ name: 'header' })(header);
97
+  export default WrappedNormalLoginForm

+ 97
- 0
src/pages/officenews/edit.jsx Parādīt failu

@@ -0,0 +1,97 @@
1
+import React, { useState, useEffect } from 'react';
2
+import { Input, Menu, Dropdown, Button, Icon, message, Table, Divider, Tag, Select, Form, Alert } from 'antd';
3
+import { FormattedMessage } from 'umi-plugin-react/locale';
4
+import XForm, { FieldTypes } from '../../components/XForm';
5
+import router from 'umi/router';
6
+import apis from '../../services/apis';
7
+import request from '../../utils/request';
8
+import Wangedit from '../../components/Wangedit/Wangedit'
9
+import moment from 'moment';
10
+
11
+
12
+const header = props => {
13
+    const newsId = props.location.query.id
14
+  
15
+    const [ data, setData ] = useState({})
16
+    if(newsId){
17
+      useEffect(() => {
18
+        getNewData(newsId);
19
+      },[])
20
+  
21
+    // 查询列表
22
+    const getNewData = (newsId) => {
23
+      request({
24
+          ...apis.officenews.get,
25
+          urlData: { id: newsId }
26
+      }).then((data) => {
27
+        setData(data)
28
+      }).catch((err) => {
29
+        message.error(err.msg || err.message)
30
+      })
31
+    }
32
+    }
33
+  
34
+    const fields = [
35
+      {
36
+        label: '资讯封面',
37
+        name: 'thumb',
38
+        type: FieldTypes.ImageUploader,
39
+        value: data.thumb,
40
+        rules: [
41
+            { required: true, message: '请选择资讯封面' },
42
+        ],
43
+        help: '建议尺寸:500px*400px,比例5:4,格式:jpg,用于:橙蕉官网新闻资讯列表',
44
+      },    
45
+      {
46
+        label: '资讯标题',
47
+        name: 'title',
48
+        type: FieldTypes.Text,
49
+        value: data.title
50
+      },
51
+      {
52
+        label: '资讯详情',
53
+        name: 'content',
54
+        value: data.content,
55
+        render: <Wangedit />
56
+      },
57
+      {
58
+        label: '状态',
59
+        name: 'status',
60
+        value: data.status,
61
+        render: <Select style={{ width: '180px' }} placeholder="发布状态">
62
+                    <Option value={0}>已发布</Option>
63
+                    <Option value={1}>未发布</Option>
64
+                </Select>,
65
+      },
66
+    ]
67
+  
68
+     
69
+    const handleSubmit = (values) => {
70
+      if(newsId){
71
+          request({ ...apis.officenews.update, urlData: { id: newsId }, data: { ...values }}).then((data) => {
72
+            cancelPage();
73
+          }).catch((err) => {
74
+            message.error(err.msg || err.message)
75
+          })
76
+        }else{
77
+          request({ ...apis.officenews.save, data: { ...values }}).then((data) => {
78
+            cancelPage();
79
+          }).catch((err) => {
80
+            message.error(err.msg || err.message)
81
+          })
82
+        }
83
+    }
84
+  
85
+    const cancelPage = () => {
86
+      router.push({
87
+        pathname: '/officenews/index',
88
+      });
89
+    }
90
+  
91
+    return (
92
+      <XForm onSubmit={handleSubmit} onCancel={cancelPage} fields={fields}></XForm>
93
+    )
94
+  }
95
+  
96
+  const WrappedNormalLoginForm = Form.create({ name: 'header' })(header);
97
+  export default WrappedNormalLoginForm

+ 211
- 0
src/pages/officenews/index.jsx Parādīt failu

@@ -0,0 +1,211 @@
1
+import React, { useState, useEffect } from 'react';
2
+import { PageHeaderWrapper } from '@ant-design/pro-layout';
3
+import { Form, Input, Button, Icon, Select, message, Table, Divider, Tag, Pagination, Modal, Breadcrumb } from 'antd';
4
+import router from 'umi/router';
5
+import moment from 'moment';
6
+import styles from './style.less';
7
+import { fetch, apis } from '../../utils/request';
8
+import request from '../../utils/request';
9
+import AuthButton from '@/components/AuthButton';
10
+import Navigate from '@/components/Navigate';
11
+
12
+function header(props) {
13
+    
14
+    const [taNoticeList, setTaNoticeList] = useState([])
15
+    const [ data, setData ] = useState({})
16
+
17
+    useEffect(() => {
18
+        getList({ pageNum: 1, pageSize: 10 });
19
+    }, [])
20
+    // 查询列表
21
+
22
+    const getList = params => {
23
+        request({ ...apis.officenews.list, params: { ...params } }).then(data => {
24
+            setData(data)
25
+        })
26
+    }
27
+
28
+    const toEditResource = (id) => () => {
29
+        router.push({
30
+            pathname: '/officenews/edit',
31
+              query: {
32
+                id
33
+              },
34
+        });
35
+    }
36
+
37
+    const publishNew = (row) => () => {
38
+        row.status = row.status === 1 ? 0 : 1
39
+        editNewsById(row)
40
+    }
41
+
42
+    const topNew = (row) => () => {
43
+        row.weight = row.weight === 1 ? 0 : 1
44
+        editNewsById(row)
45
+    }
46
+
47
+    const deleteRow = (row) => () =>{
48
+        row.status = -1
49
+        editNewsById(row)
50
+    }
51
+
52
+    //编辑资讯
53
+    const editNewsById = values => {
54
+        request({ ...apis.officenews.update, urlData: { id: values.newsId }, data: { ...values }}).then((data) => {
55
+            getList({ pageNum: 1, pageSize: 10 });
56
+          }).catch((err) => {
57
+            message.error(err.msg || err.message)
58
+          })
59
+    }
60
+
61
+    const handleSubmit = (e, props) => {
62
+        e.preventDefault();
63
+        getList({ pageNum: 1, pageSize: 10, ...props.form.getFieldsValue() });
64
+    }
65
+
66
+    function handleReset() {
67
+        props.form.resetFields();
68
+        getList({ pageNum: 1, pageSize: 10 });
69
+    }
70
+
71
+    const toDelBatch = rowData => () => {
72
+        console.log(taNoticeList, 'taNoticeList')
73
+        if (taNoticeList.length < 1) {
74
+            message.error('请至少选择一条数据')
75
+            return
76
+        }
77
+
78
+        Modal.confirm({
79
+            title: '确认将所选数据删除?',
80
+            okText: '确定',
81
+            cancelText: '取消',
82
+            onOk() {
83
+                request({ ...apis.openScreen.delete, data: taNoticeList, }).then((data) => {
84
+                  message.info("操作成功")
85
+                  getList({ pageNum: 1, pageSize: 10 });
86
+                  setTaNoticeList([])
87
+                }).catch((err) => {
88
+                })
89
+            },
90
+        });
91
+    }
92
+
93
+    const changePageNum = pageNumber => {
94
+        getList({ pageNum: pageNumber, pageSize: 10, ...props.form.getFieldsValue() })
95
+    }
96
+
97
+
98
+    const columns = [
99
+        {
100
+            title: '资讯主图',
101
+            dataIndex: 'thumb',
102
+            key: 'thumb',
103
+            align: 'center',
104
+            render: (text, record) => <img style={{width:'140px',height:'92px'}} src={record.thumb} className={styles.touxiang} />,
105
+        },
106
+        {
107
+            title: '资讯标题',
108
+            dataIndex: 'title',
109
+            key: 'title',
110
+            align: 'center',
111
+            render:  (x, row) => <Navigate to={`/officenews/detail?id=${row.newsId}`}>{row.title}</Navigate>,
112
+        },
113
+        {
114
+            title: '发布状态',
115
+            dataIndex: 'status',
116
+            key: 'status',
117
+            align: 'center',
118
+            render: (x, row) => <><span>{row.status === 1 ? '是' :'否'}</span></>
119
+        },
120
+        {
121
+            title: '创建时间',
122
+            dataIndex: 'createDate',
123
+            key: 'createDate',
124
+            align: 'center',
125
+            render: (x, row) => <><span>{row.createDate?`${moment(row.createDate).format('YYYY-MM-DD HH:mm:ss')}`:''}</span></>,
126
+        },
127
+        {
128
+            title: '操作',
129
+            dataIndex: 'handle',
130
+            key: 'handle',
131
+            align: 'center',
132
+            render: (x, row) => (
133
+                <>
134
+                    <span style={{ color: '#FF925C', cursor: 'pointer' }} onClick={publishNew(row)}>
135
+                        {row.status === 1 ? '取消发布' :'发布'}<Icon type="form" className={styles.edit} />
136
+                    </span>
137
+                    <span style={{ color: '#FF925C', cursor: 'pointer', marginLeft: '20px' }} onClick={toEditResource(row.newsId)}>
138
+                        编辑<Icon type="form" className={styles.edit} />
139
+                    </span>
140
+                    <span style={{ color: '#FF925C', cursor: 'pointer', marginLeft: '20px' }} onClick={deleteRow(row)}>
141
+                        删除<Icon type="form" className={styles.edit} />
142
+                    </span>
143
+                    <span style={{ color: '#FF925C', cursor: 'pointer', marginLeft: '20px' }} onClick={topNew(row)}>
144
+                        {row.weight === 1 ? '取消置顶' :'置顶'}<Icon type="form" className={styles.edit} />
145
+                    </span>
146
+                </>
147
+            ),
148
+        },
149
+    ];
150
+
151
+    const { getFieldDecorator } = props.form
152
+
153
+    const rowSelection = {
154
+        onChange: (selectedRowKeys, selectedRows) => {
155
+          console.log('selectedRowKeys:', selectedRowKeys, 'selectedRows: ', selectedRows);
156
+          setTaNoticeList(selectedRows)
157
+        },
158
+      };
159
+ 
160
+    return (
161
+
162
+        <>
163
+            <div>
164
+                <Form layout="inline" onSubmit={e => handleSubmit(e, props)}>
165
+                    <Form.Item>
166
+                        {getFieldDecorator('title')(
167
+                            <Input
168
+                                prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
169
+                                placeholder="标题名称"
170
+                            />,
171
+                        )}
172
+                    </Form.Item>
173
+                    <Form.Item>
174
+                        {getFieldDecorator('status')(
175
+
176
+                            <Select style={{ width: '180px' }} placeholder="发布状态">
177
+                                 <Option value="">全部</Option>
178
+                                <Option value="0">已发布</Option>
179
+                                <Option value="1">未发布</Option>
180
+
181
+                            </Select>,
182
+
183
+                        )}
184
+                    </Form.Item>
185
+                    <Form.Item>
186
+
187
+                        <Button type="primary" htmlType="submit" className={styles.searchBtn}>
188
+                            搜索
189
+              </Button> 
190
+                        {/*  */}
191
+                        <Button style={{ marginLeft: 8 }} onClick={handleReset}>
192
+                            重置
193
+            </Button>
194
+                    </Form.Item>
195
+                </Form>
196
+
197
+                <Button type="danger" className={styles.addBtn} onClick={toEditResource()}>新增</Button>
198
+
199
+                <Table id='noticeTable' rowKey={r => r.newsId} dataSource={data.records} columns={columns} pagination={false} />
200
+
201
+                <div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
202
+                    <Pagination showQuickJumper defaultCurrent={1} total={data.total} onChange={e => changePageNum(e)} current={data.current} />
203
+                </div>
204
+            </div>
205
+        </>
206
+    )
207
+}
208
+
209
+const WrappedHeader = Form.create({ name: 'header' })(header);
210
+
211
+export default WrappedHeader

+ 48
- 0
src/pages/officenews/style.less Parādīt failu

@@ -0,0 +1,48 @@
1
+.addBtn {
2
+    padding: 0 40px;
3
+    height: 36px;
4
+    margin: 30px 0;
5
+  }
6
+  
7
+  .touxiang {
8
+    width: 93px;
9
+    height: 93px;
10
+  }
11
+  
12
+  .imgPerfect {
13
+    width: 120px;
14
+    height: 40px;
15
+  }
16
+  
17
+  .imgIndex {
18
+    width: 150px;
19
+    height: 92.7px;
20
+  }
21
+  
22
+  .imgSmall {
23
+    width: 128px;
24
+    height: 192px;
25
+  }
26
+  
27
+  .propaganda {
28
+    width: 240px;
29
+    height: 60px;
30
+  }
31
+  
32
+  .ant-table-column-title {
33
+    font-weight: 600;
34
+  }
35
+  
36
+  .shoppingCart {
37
+    // color: #dcdcdc;
38
+    color: #bebebe;
39
+    margin-left: 6px;
40
+    font-size: 16px;
41
+  }
42
+  
43
+  .edit {
44
+    // color: #dcdcdc;
45
+    color: #bebebe;
46
+    margin-left: 6px;
47
+    font-size: 15px;
48
+  }

+ 218
- 0
src/pages/promote/contact.jsx Parādīt failu

@@ -0,0 +1,218 @@
1
+import React, { useState, useEffect } from 'react';
2
+import { PageHeaderWrapper } from '@ant-design/pro-layout';
3
+import { Form, Input, Button, Icon, Select, message, Table, Divider, Tag, Pagination, Modal, Breadcrumb } from 'antd';
4
+import router from 'umi/router';
5
+import moment from 'moment';
6
+import styles from './style.less';
7
+import { fetch, apis } from '../../utils/request';
8
+import request from '../../utils/request';
9
+import AuthButton from '@/components/AuthButton';
10
+
11
+function header(props) {
12
+
13
+    const [data, setData] = useState([])
14
+    const [contactList, setContactList] = useState([])
15
+    useEffect(() => {
16
+        getList({ pageNum: 1, pageSize: 10 });
17
+    }, [])
18
+    // 查询列表
19
+    const getList = params => {
20
+        request({ ...apis.contact.list, params: { ...params } }).then(data => {
21
+            console.log(data)
22
+            setData(data)
23
+        })
24
+    }
25
+
26
+    const toAdd = (id) => () => {
27
+        router.push({
28
+            pathname: '/contact/contact/add',
29
+            //   query: {
30
+            //     id
31
+            //   },
32
+        });
33
+    }
34
+
35
+    const toEdit = (id) => () => {
36
+        router.push({
37
+            pathname: '/contact/contact/detail',
38
+            query: {
39
+                id
40
+            },
41
+        });
42
+    }
43
+
44
+    const handleSubmit = (e, props) => {
45
+        console.log(e)
46
+        e.preventDefault();
47
+        props.form.validateFields((err, values) => {
48
+            if (!err) {
49
+                getList({ pageNum: 1, pageSize: 10, ...values })
50
+            }
51
+        });
52
+    }
53
+
54
+    function handleReset() {
55
+        props.form.resetFields();
56
+        getList({ pageNum: 1, pageSize: 10 });
57
+    }
58
+
59
+    const toDel = rowData => () => {
60
+        if (contactList.length < 1) {
61
+            message.info('请至少选择一条数据')
62
+            return
63
+        }
64
+
65
+        Modal.confirm({
66
+            title: '确定删除联系人信息吗',
67
+            okText: '确定',
68
+            cancelText: '取消',
69
+            onOk() {
70
+                request({ ...apis.contact.batchDeleteContact, data: contactList, }).then((data) => {
71
+                    message.info("操作成功")
72
+                    getList({ pageNum: 1, pageSize: 10 });
73
+                }).catch((err) => {
74
+
75
+                })
76
+            },
77
+            onCancel() { },
78
+        });
79
+    }
80
+
81
+    const rowSelection = {
82
+        onChange: (selectedRowKeys, selectedRows) => {
83
+            console.log('selectedRowKeys:', selectedRowKeys, 'selectedRows: ', selectedRows);
84
+            setContactList(selectedRows)
85
+        },
86
+    };
87
+
88
+    const changePageNum = pageNumber => {
89
+        getList({ pageNum: pageNumber, pageSize: 10, ...props.form.getFieldsValue() })
90
+    }
91
+
92
+    const columns = [
93
+        {
94
+            title: '姓名',
95
+            dataIndex: 'contactName',
96
+            key: 'contactName',
97
+            align: 'center',
98
+
99
+        },
100
+        {
101
+            title: '性别',
102
+            dataIndex: 'sex',
103
+            key: 'sex',
104
+            align: 'center',
105
+            render: (sex) => <span>{sex != null ? (sex === 1 ? '男' : '女') : ""}</span>,
106
+        },
107
+        {
108
+            title: '头像',
109
+            dataIndex: 'avatar',
110
+            key: 'avatar',
111
+            align: 'center',
112
+            render: (text, record) => <img src={record.avatar} className={styles.touxiang} />,
113
+        },
114
+        {
115
+            title: '固话',
116
+            dataIndex: 'telephone',
117
+            key: 'telephone',
118
+            align: 'center',
119
+        },
120
+        {
121
+            title: '手机号',
122
+            dataIndex: 'phone',
123
+            key: 'phone',
124
+            align: 'center',
125
+        },
126
+        {
127
+            title: '内部岗位',
128
+            dataIndex: 'job',
129
+            key: 'job',
130
+            align: 'center',
131
+
132
+        },
133
+        {
134
+            title: '权重',
135
+            dataIndex: 'orderNo',
136
+            key: 'orderNo',
137
+            align: 'center',
138
+        },
139
+        {
140
+            title: '操作',
141
+            dataIndex: 'handle',
142
+            key: 'handle',
143
+            align: 'center',
144
+            render: (x, row) => (
145
+                <>
146
+                    <span style={{ color: '#FF925C', cursor: 'pointer' }} onClick={toEdit(row.contactId)}>
147
+                        删除 
148
+                    </span>
149
+                </>
150
+            ),
151
+        },
152
+    ];
153
+
154
+    const { getFieldDecorator } = props.form
155
+    return (
156
+
157
+        <>
158
+            <div>
159
+                <Form layout="inline" onSubmit={e => handleSubmit(e, props)}>
160
+                    <Form.Item>
161
+                        {getFieldDecorator('contactName')(
162
+                            <Input
163
+                                prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
164
+                                placeholder="姓名"
165
+                            />,
166
+                        )}
167
+                    </Form.Item>
168
+                    <Form.Item>
169
+                        {getFieldDecorator('telephone')(
170
+                            <Input style={{ width: '180px' }} placeholder="固话">
171
+
172
+                            </Input>,
173
+                        )}
174
+                    </Form.Item>
175
+
176
+                    <Form.Item>
177
+                        {getFieldDecorator('phone')(
178
+                            <Input
179
+                                prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
180
+                                placeholder="手机号"
181
+                            />,
182
+                        )}
183
+                    </Form.Item>
184
+                    <Form.Item>
185
+                        {getFieldDecorator('job')(
186
+                            <Input
187
+                                prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
188
+                                placeholder="内部岗位"
189
+                            />,
190
+                        )}
191
+                    </Form.Item>
192
+                    <Form.Item>
193
+
194
+                        <Button type="primary" htmlType="submit" className={styles.searchBtn}>
195
+                            搜索
196
+              </Button>
197
+                        {/*  */}
198
+                        <Button style={{ marginLeft: 8 }} onClick={handleReset}>
199
+                            重置
200
+            </Button>
201
+                    </Form.Item>
202
+                </Form>
203
+
204
+                <Button type="danger" className={styles.addBtn} onClick={toAdd()}>选择联系人</Button>
205
+
206
+                <Table rowSelection={rowSelection} rowKey={r => r.contactId} dataSource={data.records} columns={columns} pagination={false} />
207
+
208
+                <div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
209
+                    {<Pagination showQuickJumper defaultCurrent={1} total={data.total} onChange={e => changePageNum(e)} current={data.current} />}
210
+                </div>
211
+            </div>
212
+        </>
213
+    )
214
+}
215
+
216
+const WrappedHeader = Form.create({ name: 'header' })(header);
217
+
218
+export default WrappedHeader

+ 236
- 0
src/pages/promote/index.jsx Parādīt failu

@@ -0,0 +1,236 @@
1
+import React, { useState, useEffect } from 'react';
2
+import { PageHeaderWrapper } from '@ant-design/pro-layout';
3
+import { Form, Input, Button, Icon, Select, message, Table, Divider, Tag, Pagination, Modal, Breadcrumb } from 'antd';
4
+import router from 'umi/router';
5
+import moment from 'moment';
6
+import styles from './style.less';
7
+import { fetch, apis } from '../../utils/request';
8
+import request from '../../utils/request';
9
+import AuthButton from '@/components/AuthButton';
10
+import Navigate from '@/components/Navigate';
11
+
12
+function header(props) {
13
+    
14
+    const [taNoticeList, setTaNoticeList] = useState([])
15
+    const [ data, setData ] = useState({})
16
+
17
+    useEffect(() => {
18
+        getList({ pageNum: 1, pageSize: 10 });
19
+    }, [])
20
+    // 查询列表
21
+
22
+    const getList = params => {
23
+        request({ ...apis.promote.list, params: { ...params } }).then(data => {
24
+            setData(data)
25
+        })
26
+    }
27
+
28
+    const toEditResource = (id) => () => {
29
+        router.push({
30
+            pathname: '/officenews/edit',
31
+              query: {
32
+                id
33
+              },
34
+        });
35
+    }
36
+
37
+    const publishNew = (row) => () => {
38
+        row.status = row.status === 1 ? 0 : 1
39
+        editNewsById(row)
40
+    }
41
+
42
+    const topNew = (row) => () => {
43
+        row.weight = row.weight === 1 ? 0 : 1
44
+        editNewsById(row)
45
+    }
46
+
47
+    const deleteRow = (row) => () =>{
48
+        row.status = -1
49
+        editNewsById(row)
50
+    }
51
+
52
+    //编辑资讯
53
+    const editNewsById = values => {
54
+        request({ ...apis.officenews.update, urlData: { id: values.newsId }, data: { ...values }}).then((data) => {
55
+            getList({ pageNum: 1, pageSize: 10 });
56
+          }).catch((err) => {
57
+            message.error(err.msg || err.message)
58
+          })
59
+    }
60
+
61
+    const handleSubmit = (e, props) => {
62
+        e.preventDefault();
63
+        getList({ pageNum: 1, pageSize: 10, ...props.form.getFieldsValue() });
64
+    }
65
+
66
+    function handleReset() {
67
+        props.form.resetFields();
68
+        getList({ pageNum: 1, pageSize: 10 });
69
+    }
70
+
71
+    const toDelBatch = rowData => () => {
72
+        console.log(taNoticeList, 'taNoticeList')
73
+        if (taNoticeList.length < 1) {
74
+            message.error('请至少选择一条数据')
75
+            return
76
+        }
77
+
78
+        Modal.confirm({
79
+            title: '确认将所选数据删除?',
80
+            okText: '确定',
81
+            cancelText: '取消',
82
+            onOk() {
83
+                request({ ...apis.openScreen.delete, data: taNoticeList, }).then((data) => {
84
+                  message.info("操作成功")
85
+                  getList({ pageNum: 1, pageSize: 10 });
86
+                  setTaNoticeList([])
87
+                }).catch((err) => {
88
+                })
89
+            },
90
+        });
91
+    }
92
+
93
+    const changePageNum = pageNumber => {
94
+        getList({ pageNum: pageNumber, pageSize: 10, ...props.form.getFieldsValue() })
95
+    }
96
+
97
+
98
+    const columns = [
99
+        {
100
+            title: '表单编号',
101
+            dataIndex: 'serialNo',
102
+            key: 'serialNo',
103
+            align: 'center',
104
+            render:  (x, row) => <Navigate to={`/promote/detail?id=${row.serialNo}`}>{row.serialNo}</Navigate>,
105
+        },
106
+        {
107
+            title: '公司名称',
108
+            dataIndex: 'company',
109
+            key: 'company',
110
+            align: 'center',
111
+        },
112
+        {
113
+            title: '联系人',
114
+            dataIndex: 'name',
115
+            key: 'name',
116
+            align: 'center',
117
+        },
118
+        {
119
+            title: '手机号',
120
+            dataIndex: 'phone',
121
+            key: 'phone',
122
+            align: 'center',
123
+        },
124
+        {
125
+            title: '邮箱',
126
+            dataIndex: 'email',
127
+            key: 'email',
128
+            align: 'center',
129
+        },
130
+        {
131
+            title: '提交时间',
132
+            dataIndex: 'createDate',
133
+            key: 'createDate',
134
+            align: 'center',
135
+            render: (x, row) => <><span>{row.createDate?`${moment(row.createDate).format('YYYY-MM-DD HH:mm:ss')}`:''}</span></>,
136
+        },
137
+        {
138
+            title: '状态',
139
+            dataIndex: 'status',
140
+            key: 'status',
141
+            align: 'center',
142
+            render: (x, row) => <><span>{row.status === 1 ? '有效' : row.status === 2 ? "待跟进" : '无效'}</span></>
143
+        },
144
+        {
145
+            title: '操作',
146
+            dataIndex: 'handle',
147
+            key: 'handle',
148
+            align: 'center',
149
+            render: (x, row) => (
150
+                <>
151
+                    <span style={{ color: '#FF925C', cursor: 'pointer' }} onClick={publishNew(row)}>
152
+                        {row.status === 2 ? "立即跟进" : '添加备注'}<Icon type="form" className={styles.edit} />
153
+                    </span>
154
+                    <span style={{ color: '#FF925C', cursor: 'pointer', marginLeft: '20px'  }} onClick={publishNew(row)}>
155
+                        {row.status === 0 ? "删除" : ''}<Icon type="form" className={styles.edit} />
156
+                    </span>
157
+                </>
158
+            ),
159
+        },
160
+    ];
161
+
162
+    const { getFieldDecorator } = props.form
163
+
164
+    const rowSelection = {
165
+        onChange: (selectedRowKeys, selectedRows) => {
166
+          console.log('selectedRowKeys:', selectedRowKeys, 'selectedRows: ', selectedRows);
167
+          setTaNoticeList(selectedRows)
168
+        },
169
+      };
170
+ 
171
+    return (
172
+
173
+        <>
174
+            <div>
175
+                <Form layout="inline" onSubmit={e => handleSubmit(e, props)}>
176
+                    <Form.Item>
177
+                        {getFieldDecorator('company')(
178
+                            <Input
179
+                                prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
180
+                                placeholder="公司名称"
181
+                            />,
182
+                        )}
183
+                    </Form.Item>
184
+                    <Form.Item>
185
+                        {getFieldDecorator('name')(
186
+                            <Input
187
+                                prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
188
+                                placeholder="联系人"
189
+                            />,
190
+                        )}
191
+                    </Form.Item>
192
+                    <Form.Item>
193
+                        {getFieldDecorator('phone')(
194
+                            <Input
195
+                                prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
196
+                                placeholder="手机号"
197
+                            />,
198
+                        )}
199
+                    </Form.Item>
200
+                    <Form.Item>
201
+                        {getFieldDecorator('status')(
202
+
203
+                            <Select style={{ width: '180px' }} placeholder="表单状态">
204
+                                <Option value="">全部</Option>
205
+                                <Option value="2">待跟进</Option>
206
+                                <Option value="1">有效</Option>
207
+                                <Option value="0">无效</Option>
208
+                            </Select>,
209
+
210
+                        )}
211
+                    </Form.Item>
212
+                    <Form.Item>
213
+
214
+                        <Button type="primary" htmlType="submit" className={styles.searchBtn}>
215
+                            搜索
216
+              </Button> 
217
+                        {/*  */}
218
+                        <Button style={{ marginLeft: 8 }} onClick={handleReset}>
219
+                            重置
220
+            </Button>
221
+                    </Form.Item>
222
+                </Form>
223
+
224
+                <Table id='noticeTable' rowKey={r => r.newsId} dataSource={data.records} columns={columns} pagination={false} />
225
+
226
+                <div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
227
+                    <Pagination showQuickJumper defaultCurrent={1} total={data.total} onChange={e => changePageNum(e)} current={data.current} />
228
+                </div>
229
+            </div>
230
+        </>
231
+    )
232
+}
233
+
234
+const WrappedHeader = Form.create({ name: 'header' })(header);
235
+
236
+export default WrappedHeader

+ 48
- 0
src/pages/promote/style.less Parādīt failu

@@ -0,0 +1,48 @@
1
+.addBtn {
2
+    padding: 0 40px;
3
+    height: 36px;
4
+    margin: 30px 0;
5
+  }
6
+  
7
+  .touxiang {
8
+    width: 93px;
9
+    height: 93px;
10
+  }
11
+  
12
+  .imgPerfect {
13
+    width: 120px;
14
+    height: 40px;
15
+  }
16
+  
17
+  .imgIndex {
18
+    width: 150px;
19
+    height: 92.7px;
20
+  }
21
+  
22
+  .imgSmall {
23
+    width: 128px;
24
+    height: 192px;
25
+  }
26
+  
27
+  .propaganda {
28
+    width: 240px;
29
+    height: 60px;
30
+  }
31
+  
32
+  .ant-table-column-title {
33
+    font-weight: 600;
34
+  }
35
+  
36
+  .shoppingCart {
37
+    // color: #dcdcdc;
38
+    color: #bebebe;
39
+    margin-left: 6px;
40
+    font-size: 16px;
41
+  }
42
+  
43
+  .edit {
44
+    // color: #dcdcdc;
45
+    color: #bebebe;
46
+    margin-left: 6px;
47
+    font-size: 15px;
48
+  }

+ 30
- 1
src/services/apis.js Parādīt failu

@@ -415,7 +415,36 @@ const apis = {
415 415
       method: 'POST',
416 416
       action: 'channel',
417 417
     }
418
-  }
418
+  },
419
+  officenews: {
420
+    list: {
421
+      url: `${prefix}/taOfficeNews`,
422
+      method: 'GET',
423
+      action: 'channel',
424
+    },
425
+    get: {
426
+      url: `${prefix}/taOfficeNews/:id`,
427
+      method: 'GET',
428
+      action: 'channel',
429
+    },
430
+    update: {
431
+      url: `${prefix}/taOfficeNews/:id`,
432
+      method: 'PUT',
433
+      action: 'channel',
434
+    },
435
+    save: {
436
+      url: `${prefix}/taOfficeNews`,
437
+      method: 'POST',
438
+      action: 'channel',
439
+    },
440
+  },
441
+  promote: {
442
+    list: {
443
+      url: `${prefix}/taOfficeContact`,
444
+      method: 'GET',
445
+      action: 'channel',
446
+    },
447
+  },
419 448
 }
420 449
 
421 450
 export default apis;