dingxin 5 年前
父节点
当前提交
74d8ac9f48

+ 17
- 7
config/config.js 查看文件

127
                   name: '项目类型',
127
                   name: '项目类型',
128
                   component: './building/type/index',
128
                   component: './building/type/index',
129
                 },
129
                 },
130
+                {
131
+                  path: '/building/type/edi',
132
+                  name: '',
133
+                  component: './building/type/edi',
134
+                },
130
               ],
135
               ],
131
             },
136
             },
132
             {
137
             {
189
               component: '../layouts/BlankLayout',
194
               component: '../layouts/BlankLayout',
190
               routes: [
195
               routes: [
191
                 {
196
                 {
192
-                  path: '/news/NewTypeList',
193
-                  name: '资讯列表',
194
-                  component: './news/NewTypeList',
197
+                  path: '/news/NewsType',
198
+                  name: '资讯类型',
199
+                  component: './news/type/NewsType',
195
                 },
200
                 },
196
                 {
201
                 {
197
-                  path: '/activity/editActivity',
198
-                  name: '',
199
-                  component: './activity/editActivity',
202
+                  path: '/news/NewsList',
203
+                  name: '咨询列表',
204
+                  component: './news/list/NewsList',
200
                 },
205
                 },
201
               ],
206
               ],
202
             },
207
             },
215
                   name: '',
220
                   name: '',
216
                   component: './activity/editActivity',
221
                   component: './activity/editActivity',
217
                 },
222
                 },
223
+                {
224
+                  path: '/activity/SignList',
225
+                  name: '报名列表',
226
+                  component: './activity/SignList',
227
+                },
218
               ],
228
               ],
219
             },
229
             },
220
             {
230
             {
276
   
286
   
277
   proxy: {
287
   proxy: {
278
     '/api/': {
288
     '/api/': {
279
-      target: 'http://192.168.0.84:8080/',
289
+      target: 'http://localhost:8080/',
280
       changeOrigin: true,
290
       changeOrigin: true,
281
       // pathRewrite: { '^/server': '' },
291
       // pathRewrite: { '^/server': '' },
282
     },
292
     },

+ 40
- 0
src/components/SelectButton/CitySelect.jsx 查看文件

1
+import React, { useState, useEffect } from 'react';
2
+import { Select } from 'antd';
3
+
4
+import request from '../../utils/request'
5
+
6
+const { Option } = Select;
7
+
8
+/**
9
+ *
10
+ *
11
+ * @param {*} props
12
+ * @returns
13
+ */
14
+const CitySelect = (props) => {
15
+  const [ data, setData ] = useState([])
16
+
17
+  useEffect(() => {
18
+    getCityList();
19
+  },[])
20
+
21
+  const getCityList = (e) => {
22
+    request({
23
+        url: '/api/admin/buildinglist/select',
24
+        method: 'GET',
25
+        params: {pageNum: 1,pageSize: 999},
26
+    }).then((data) => {
27
+        setData(data.records)
28
+    })
29
+  }
30
+
31
+  return (
32
+      <Select value={props.value} style={{ width: '180px' }} placeholder="请选择城市" onChange={props.onChange}>
33
+          {data.map(city => (
34
+            <Option key={city.buildingId}>{city.buildingName}</Option>
35
+          ))}
36
+      </Select>
37
+  )
38
+}
39
+export default CitySelect
40
+

+ 116
- 50
src/pages/activity/ActivityList.jsx 查看文件

3
 import { FormattedMessage } from 'umi-plugin-react/locale';
3
 import { FormattedMessage } from 'umi-plugin-react/locale';
4
 import styles from '../style/GoodsList.less';
4
 import styles from '../style/GoodsList.less';
5
 import router from 'umi/router';
5
 import router from 'umi/router';
6
+import moment from 'moment';
7
+import SelectCity from '../../components/SelectButton/CitySelect'
6
 
8
 
7
 import request from '../../utils/request'
9
 import request from '../../utils/request'
8
 
10
 
52
   },
54
   },
53
   {
55
   {
54
     title: '活动时间',
56
     title: '活动时间',
55
-    dataIndex: 'name',
56
-    key: 'name',
57
+    dataIndex: 'startDate',
58
+    key: 'startDate',
57
     align: 'center',
59
     align: 'center',
60
+    render: (x, row) => <><span>{`${moment(row.startDate).format('YYYY-MM-DD')} —— ${moment(row.endDate).format('YYYY-MM-DD')}`}</span></>
58
   },
61
   },
59
   {
62
   {
60
     title: '已参加人数',
63
     title: '已参加人数',
61
-    dataIndex: 'integral',
62
-    key: 'integral',
64
+    dataIndex: 'count',
65
+    key: 'count',
63
     align: 'center',
66
     align: 'center',
64
   },
67
   },
65
   {
68
   {
66
     title: '阅读量',
69
     title: '阅读量',
67
-    dataIndex: 'total',
68
-    key: 'total',
70
+    dataIndex: 'pvNum',
71
+    key: 'pvNum',
69
     align: 'center',
72
     align: 'center',
70
   },
73
   },
71
   {
74
   {
72
     title: '转发量',
75
     title: '转发量',
73
-    dataIndex: 'exchanged',
74
-    key: 'exchanged',
76
+    dataIndex: 'shareNum',
77
+    key: 'shareNum',
75
     align: 'center',
78
     align: 'center',
76
   },
79
   },
77
   {
80
   {
78
     title: '收藏数',
81
     title: '收藏数',
79
-    dataIndex: 'rest',
80
-    key: 'rest',
82
+    dataIndex: 'saveNum',
83
+    key: 'saveNum',
81
     align: 'center',
84
     align: 'center',
82
   },
85
   },
83
   {
86
   {
84
     title: '状态',
87
     title: '状态',
85
-    dataIndex: 'state',
86
-    key: 'state',
88
+    dataIndex: 'isEnlist',
89
+    key: 'isEnlist',
87
     align: 'center',
90
     align: 'center',
91
+    render: (isEnlist)=> <><span>{isEnlist == 0 ?"未开始" : isEnlist==1 ? "进行中" : "已结束"}</span></>
88
   },
92
   },
89
   {
93
   {
90
     title: '操作',
94
     title: '操作',
91
     dataIndex: 'handle',
95
     dataIndex: 'handle',
92
     key: 'handle',
96
     key: 'handle',
93
     align: 'center',
97
     align: 'center',
94
-    render: () => <><span style={{ color: '#1990FF', marginRight: '20px' }} onClick={confirm}>下架<Icon type="shopping-cart" className={styles.shoppingCart} /></span><span style={{ color: '#FF925C' }}>编辑<Icon type="form" className={styles.edit} /></span></>,
98
+    render: (x,row) => <><span style={{ color: '#1990FF'}} onClick={getSignList.bind(this, row.dynamicId)}>{row.isEnlist == '1' || row.isEnlist == '2' ? "报名记录" : ""}<Icon type="snippets" className={styles.shoppingCart} /></span>
99
+                         <span style={{ color: '#1990FF' }} onClick={sendOrPublicDynamic.bind(this,row)}>{ row.status === 1 ? '取消发布' : '发布' }<Icon type="close-circle" className={styles.edit} /></span>
100
+                         <span style={{ color: '#1990FF' }} onClick={finishDynamic.bind(this,row)}>结束活动<Icon type="poweroff" className={styles.edit} /></span>
101
+                         <span style={{ color: '#1990FF', marginRight: '20px' }} onClick={topDynamic.bind(this,row)}>{ row.weight === 1 ? '取消置顶' : '置顶' }<Icon type="vertical-align-top" className={styles.edit} /></span>
102
+                         <span style={{ color: '#FF925C' }}>编辑<Icon type="form" className={styles.edit} /></span>
103
+                       </>
95
   },
104
   },
96
 ];
105
 ];
97
-const confirm = () => {
98
-  Modal.confirm({
99
-    title: '确认下架该商品?',
100
-    okText: '确认',
101
-    cancelText: '取消',
102
-    onOk() {
103
-      console.log('OK');
104
-    },
105
-    onCancel() {
106
-      console.log('Cancel');
107
-    },
108
-  });
109
 
106
 
107
+const getSignList = (dynamicId) => {
108
+    router.push({
109
+        pathname: '/activity/SignList',
110
+        query: {
111
+            dynamicId
112
+        },
113
+      });
110
 }
114
 }
111
 
115
 
112
-const header = (props) => {
113
-  const [ data, setData ] = useState({})
114
-//   const [page, changePage] = useState({})
116
+const finishDynamic = (row) => {
117
+    Modal.confirm({
118
+        title: '结束以后将无法编辑, 是否继续?',
119
+        okText: '确定',
120
+        cancelText: '取消',
121
+        onOk() {
122
+            request({
123
+                url: '/api/admin/buildingDynamic/finish',
124
+                method: 'PUT',
125
+                data: {dynamicId: row.dynamicId, top: ""},
126
+            }).then((data) => {
127
+                console.log(data)
128
+                message.info('操作成功!')
129
+                // getList()
130
+            }).catch((err) => {
131
+                console.log(err)
132
+                message.info(err.msg || err.message)
133
+            })
134
+        },
135
+      });
136
+}
115
 
137
 
116
-  useEffect(() => {
138
+const topDynamic = (row) => {
139
+    const weight = Math.abs(row.weight - 1)
117
     request({
140
     request({
118
-        url: '/api/admin/iBuildingDynamicList',
119
-        method: 'GET',
120
-        params: {pageNum: 1,pageSize: 10},
141
+        url: '/api/admin/buildingDynamic/weight',
142
+        method: 'PUT',
143
+        params: {dynamicId: row.dynamicId, weight},
121
     }).then((data) => {
144
     }).then((data) => {
122
         console.log(data)
145
         console.log(data)
123
-        setData(data)
146
+        message.info('操作成功!')
147
+        // getList()
148
+    }).catch((err) => {
149
+        console.log(err)
150
+        message.info(err.msg || err.message)
151
+    })
152
+}
153
+
154
+const sendOrPublicDynamic = (row) => {
155
+    if (row.status === 1) {
156
+        cancelDynamic(row)
157
+    } else {
158
+        sendDynamic(row)
159
+    }
160
+}
161
+
162
+// 取消活动
163
+const cancelDynamic = (row) => {
164
+    request({
165
+        url: '/api/admin/buildingDynamic/cancel/'+row.dynamicId,
166
+        method: 'PUT',
167
+    }).then((data) => {
168
+        message.info('操作成功!')
169
+        // getList()
170
+    }).catch((err) => {
171
+        console.log(err)
172
+        message.info(err.msg || err.message)
173
+    })
174
+}
175
+
176
+//发布活动
177
+const sendDynamic = (row) => {
178
+    request({
179
+        url: '/api/admin/buildingDynamic/send/'+row.dynamicId,
180
+        method: 'PUT',
181
+    }).then((data) => {
182
+        message.info('操作成功!')
183
+        // getList()
184
+    }).catch((err) => {
185
+        console.log(err)
186
+        message.info(err.msg || err.message)
124
     })
187
     })
188
+}
189
+
190
+const header = (props) => {
191
+  const [ data, setData ] = useState({})
192
+//   const [page, changePage] = useState({})
193
+
194
+  useEffect(() => {
195
+    getList();
125
   },[])
196
   },[])
126
 
197
 
198
+  // 查询列表
127
   const getList = (e) => {
199
   const getList = (e) => {
128
     request({
200
     request({
129
-        url: '/api/xxx',
201
+        url: '/api/admin/iBuildingDynamicList',
130
         method: 'GET',
202
         method: 'GET',
131
-        params: {},
203
+        params: {pageNum: 1,pageSize: 10},
132
     }).then((data) => {
204
     }).then((data) => {
205
+        console.log(data)
133
         setData(data)
206
         setData(data)
134
     })
207
     })
135
   }
208
   }
141
       <Form layout="inline" onSubmit={e => handleSubmit(e, props)}>
214
       <Form layout="inline" onSubmit={e => handleSubmit(e, props)}>
142
         <Form.Item>
215
         <Form.Item>
143
           {getFieldDecorator('goodState')(
216
           {getFieldDecorator('goodState')(
144
-            <Select style={{ width: '180px' }} placeholder="请选择城市" onChange={handleSelectChange}>
145
-              <Option value="1">上架</Option>
146
-              <Option value="0">下架</Option>
147
-            </Select>,
217
+            <SelectCity />,
148
           )}
218
           )}
149
         </Form.Item>
219
         </Form.Item>
150
         <Form.Item>
220
         <Form.Item>
164
           )}
234
           )}
165
         </Form.Item>
235
         </Form.Item>
166
         <Form.Item>
236
         <Form.Item>
167
-          {getFieldDecorator('goodState')(
168
-            <Select style={{ width: '180px' }} placeholder="是否报名" onChange={handleSelectChange}>
169
-              <Option value="1">上架</Option>
170
-              <Option value="0">下架</Option>
171
-            </Select>,
237
+          {getFieldDecorator('min')(
238
+            <DatePicker />
172
           )}
239
           )}
173
         </Form.Item>
240
         </Form.Item>
174
         <Form.Item>
241
         <Form.Item>
175
-          {getFieldDecorator('min')(
176
-            <DatePicker />
242
+          {getFieldDecorator('goodState')(
243
+            <Select style={{ width: '180px' }} placeholder="是否报名" onChange={handleSelectChange}>
244
+              <Option value="1">已报名</Option>
245
+              <Option value="0">未报名</Option>
246
+            </Select>,
177
           )}
247
           )}
178
         </Form.Item>
248
         </Form.Item>
179
         <Form.Item>
249
         <Form.Item>
184
       </Form>
254
       </Form>
185
       <Button type="primary" className={styles.addBtn} onClick={toEditGoods}>新增</Button>
255
       <Button type="primary" className={styles.addBtn} onClick={toEditGoods}>新增</Button>
186
       <Table dataSource={data.list} columns={columns} />
256
       <Table dataSource={data.list} columns={columns} />
187
-      {/* 分页 */
188
-      /* <div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
189
-        <Pagination showQuickJumper defaultCurrent={1} total={500} onChange={onChange} />
190
-      </div> */}
191
     </>
257
     </>
192
   )
258
   )
193
 }
259
 }

+ 80
- 0
src/pages/activity/SignList.jsx 查看文件

1
+import React, { useState, useEffect } from 'react';
2
+import { Form, Input, Button, Icon, Select, message, Table, Divider, Tag, Pagination, Modal, DatePicker } from 'antd';
3
+import { FormattedMessage } from 'umi-plugin-react/locale';
4
+import styles from '../style/GoodsList.less';
5
+import router from 'umi/router';
6
+import moment from 'moment';
7
+
8
+import request from '../../utils/request'
9
+
10
+const { Option } = Select;
11
+const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
12
+
13
+
14
+
15
+// 分页
16
+function onChange(pageNumber) {
17
+  console.log('Page: ', pageNumber);
18
+}
19
+
20
+
21
+/**
22
+ *
23
+ *
24
+ * @param {*} props
25
+ * @returns
26
+ */
27
+
28
+const columns = [
29
+  {
30
+    title: '活动标题',
31
+    dataIndex: 'title',
32
+    key: 'title',
33
+    align: 'center',
34
+  },
35
+  {
36
+    title: '活动时间',
37
+    dataIndex: 'startDate',
38
+    key: 'startDate',
39
+    align: 'center',
40
+    render: (x, row) => <><span>{`${moment(row.startDate).format('YYYY-MM-DD')} —— ${moment(row.endDate).format('YYYY-MM-DD')}`}</span></>
41
+  },
42
+  {
43
+    title: '已参加人数',
44
+    dataIndex: 'count',
45
+    key: 'count',
46
+    align: 'center',
47
+  }
48
+];
49
+
50
+
51
+
52
+const header = (props) => {
53
+  const [ data, setData ] = useState({})
54
+//   const [page, changePage] = useState({})
55
+  useEffect(() => {
56
+    getSignList();
57
+  },[])
58
+
59
+  // 查询列表
60
+  const getSignList = (e) => {
61
+    request({
62
+        url: '/api/admin/SignList',
63
+        method: 'GET',
64
+        params: {pageNum: 1,pageSize: 10, dynamicId: props.location.query.dynamicId },
65
+    }).then((data) => {
66
+        console.log(data)
67
+        setData(data)
68
+    })
69
+  }
70
+
71
+  return (
72
+    <>
73
+      <Button type="primary" className={styles.addBtn}>返回</Button>
74
+      <Table dataSource={data} columns={columns} />
75
+    </>
76
+  )
77
+}
78
+const WrappedHeader = Form.create({ name: 'header' })(header);
79
+
80
+export default WrappedHeader

+ 69
- 76
src/pages/building/list/index.jsx 查看文件

1
-import React from 'react';
2
-import { Form, Icon, Input, Button, DatePicker, Select, Card, Row, Col, Pagination } from 'antd';
3
-import { connect } from 'dva';
1
+import React, { useState, useEffect } from 'react';
2
+import { Form, Icon, Input, Button, DatePicker, Select, Card, Row, Col, Pagination, Alert } from 'antd';
3
+import moment from 'moment';
4
+import request from '../../../utils/request';
5
+import apis from '../../../services/apis';
4
 import Styles from './style.less';
6
 import Styles from './style.less';
5
 
7
 
6
 
8
 
8
 // eslint-disable-next-line @typescript-eslint/no-unused-vars
10
 // eslint-disable-next-line @typescript-eslint/no-unused-vars
9
 const { Meta } = Card;
11
 const { Meta } = Card;
10
 
12
 
11
-// 假数据
12
-const tempData = [
13
-  {
14
-    code: 'S101',
15
-    name: '城开花园',
16
-    price: '111',
17
-    address: '顾戴路1801弄',
18
-    status: '1', // 已发布
19
-    createDate: '2019-08-28 17',
20
-  },
21
-  {
22
-    code: 'S102',
23
-    name: '星河天街',
24
-    price: '111',
25
-    address: '长征路1801弄',
26
-    status: '1', // 已发布
27
-    createDate: '2019-08-29 17',
28
-  },
29
-  {
30
-    code: 'S103',
31
-    name: '喜洋洋别墅',
32
-    price: '111',
33
-    address: '阳杨路1801弄',
34
-    status: '1', // 已发布
35
-    createDate: '2019-08-29 17',
36
-  },
37
-  {
38
-    code: 'S104',
39
-    name: '武大郎洋房',
40
-    price: '111',
41
-    address: '太郎路1801弄',
42
-    status: '1', // 已发布
43
-    createDate: '2019-08-29 17',
44
-  },
45
-]
46
-
47
-
48
-// 网路数据请求
49
-connect(({ getList, loading }) => ({
50
-  getList,
51
-  submitting: loading.effects['building/getList'],
52
-}))
53
-
54
-// 提交事件
55
-function handleSubmit(e, props) {
56
-  e.preventDefault();
57
-  props.form.validateFields((err, values) => {
58
-    if (!err) {
59
-      // eslint-disable-next-line no-console
60
-      console.log('提交数据: ', values)
61
-    }
62
-  });
63
-}
64
-
65
-// Change 事件
66
-function handleSelectChange(props) {
67
-  // eslint-disable-next-line no-console
68
-  console.log(props)
69
-}
70
-
71
-// 分页
72
-function onChange(pageNumber) {
73
-  // eslint-disable-next-line no-console
74
-  console.log('Page: ', pageNumber);
75
-}
13
+const tempDate = [{ code: 's101' }]
76
 
14
 
77
 /**
15
 /**
78
  *卡片
16
  *卡片
86
           <Card
24
           <Card
87
             hoverable
25
             hoverable
88
             style={{ minWidth: '400px', borderRadius: '12px', margin: '10px', boxShadow: '0px 0px 16px 2px rgba(0,0,0,0.12)' }}
26
             style={{ minWidth: '400px', borderRadius: '12px', margin: '10px', boxShadow: '0px 0px 16px 2px rgba(0,0,0,0.12)' }}
89
-            cover={<img alt="example" src="https://os.alipayobjects.com/rmsportal/QBnOOoLaAfKPirc.png" style={{ borderRadius: '12px 12px 0 0', width: '100%', height: '14vw' }}></img>}
27
+            cover={<img alt="example" src={ data.poster } style={{ borderRadius: '12px 12px 0 0', width: '100%', height: '14vw' }}></img>}
90
             bodyStyle={{ padding: '10px 20px' }}
28
             bodyStyle={{ padding: '10px 20px' }}
91
           >
29
           >
92
             <p className={Styles.cardText}>
30
             <p className={Styles.cardText}>
109
             </p>
47
             </p>
110
             <p className={Styles.cardItem}>
48
             <p className={Styles.cardItem}>
111
               <span className={Styles.title}>项目地址</span>
49
               <span className={Styles.title}>项目地址</span>
112
-              <span >:{ data.address }</span>
50
+              <span className={ Styles.address }>:{ data.address }</span>
113
             </p>
51
             </p>
114
             <p className={Styles.cardItem}>
52
             <p className={Styles.cardItem}>
115
               <span className={Styles.title}>发布状态</span>
53
               <span className={Styles.title}>发布状态</span>
117
             </p>
55
             </p>
118
             <p className={Styles.cardItem}>
56
             <p className={Styles.cardItem}>
119
               <span className={Styles.title}>录入时间</span>
57
               <span className={Styles.title}>录入时间</span>
120
-              <span >:2019-08-28 17</span>
58
+              <span >:{ data.createDate }</span>
121
             </p>
59
             </p>
122
             <p style={{ margin: '15px 0', position: 'relative', fontSize: '18px' }}>
60
             <p style={{ margin: '15px 0', position: 'relative', fontSize: '18px' }}>
123
               <span style={{ color: '#1990FF' }}>
61
               <span style={{ color: '#1990FF' }}>
143
  */
81
  */
144
 function body(props) {
82
 function body(props) {
145
   const { getFieldDecorator } = props.form
83
   const { getFieldDecorator } = props.form
146
-  connect()
84
+
85
+  // eslint-disable-next-line react-hooks/rules-of-hooks
86
+  const [dataSource, setDataSource] = useState({ records: [] })
87
+
88
+  // eslint-disable-next-line react-hooks/rules-of-hooks
89
+  useEffect(() => {
90
+    getList({ pageNum: 1, pageSize: 9 })
91
+  }, [])
92
+
93
+  function getList(params) {
94
+    // 网路请求
95
+    request({ ...apis.building.getList, params: { ...params } }).then(res => {
96
+      setDataSource(res)
97
+    }).catch(err => {
98
+      // eslint-disable-next-line no-unused-expressions
99
+      <Alert
100
+        style={{
101
+          marginBottom: 24,
102
+        }}
103
+        message={err}
104
+        type="error"
105
+        showIcon
106
+      />
107
+    })
108
+  }
109
+
110
+  // 提交事件
111
+  function handleSubmit(e) {
112
+    e.preventDefault();
113
+    props.form.validateFields((err, values) => {
114
+      if (!err) {
115
+        // eslint-disable-next-line no-console
116
+        console.log('提交数据: ', values)
117
+        const { startDate } = values
118
+        getList({ pageNum: 1, pageSize: 9, ...values })
119
+      }
120
+    });
121
+  }
122
+
123
+  // Change 事件
124
+  function handleSelectChange(e) {
125
+    // eslint-disable-next-line no-console
126
+    console.log(e)
127
+  }
128
+
129
+  // 分页
130
+  function onChange(pageNumber) {
131
+    // eslint-disable-next-line react-hooks/rules-of-hooks
132
+      getList({ pageNum: pageNumber, pageSize: 9 })
133
+  }
134
+
135
+  function getDate(value, dateString) {
136
+    // moment(value).format('YYYY-MM-DD HH:mm:ss')
137
+    console.log(value, dateString)
138
+  }
139
+
147
   return (
140
   return (
148
     <>
141
     <>
149
       <Form layout="inline" onSubmit={e => handleSubmit(e, props)}>
142
       <Form layout="inline" onSubmit={e => handleSubmit(e, props)}>
166
         </Form.Item>
159
         </Form.Item>
167
         <Form.Item>
160
         <Form.Item>
168
           {getFieldDecorator('startDate')(
161
           {getFieldDecorator('startDate')(
169
-            <DatePicker placeholder="开盘时间" />,
162
+            <DatePicker placeholder="开盘时间" format="YYYY-MM-DD" onChange={getDate} />,
170
           )}
163
           )}
171
         </Form.Item>
164
         </Form.Item>
172
         <Form.Item>
165
         <Form.Item>
214
       {/* 卡片内容,显示楼盘项目  */}
207
       {/* 卡片内容,显示楼盘项目  */}
215
       <Row style={{ padding: ' 0 10px' }}>
208
       <Row style={{ padding: ' 0 10px' }}>
216
         {
209
         {
217
-          tempData.map((item, index) => (
210
+          dataSource.records.map((item, index) => (
218
               <Col span={8}>
211
               <Col span={8}>
219
-                <CartBody data={item} />
212
+                <CartBody data={item} key={item.buildingId}/>
220
               </Col>
213
               </Col>
221
             ))
214
             ))
222
         }
215
         }
223
       </Row>
216
       </Row>
224
       {/* 分页 */}
217
       {/* 分页 */}
225
       <div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
218
       <div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
226
-        <Pagination showQuickJumper defaultCurrent={1} total={500} onChange={onChange} />
219
+        <Pagination showQuickJumper defaultCurrent={1} total={dataSource.total} onChange={onChange} />
227
       </div>
220
       </div>
228
     </>
221
     </>
229
   );
222
   );

+ 54
- 0
src/pages/building/list/style.css 查看文件

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
+  background: #50be00;
14
+  border-radius: 4px;
15
+  border: 0px;
16
+  margin: 10px 0px;
17
+}
18
+.cardText {
19
+  font-size: 18px;
20
+  color: #333;
21
+  line-height: 24px;
22
+  display: flex;
23
+  align-items: center;
24
+  position: relative;
25
+}
26
+.cardItem {
27
+  font-size: 18px;
28
+  font-weight: 400;
29
+  color: #666;
30
+  line-height: 24px;
31
+  display: flex;
32
+  align-items: center;
33
+}
34
+.ediText {
35
+  font-size: 18px;
36
+  color: #ff925c;
37
+  line-height: 24px;
38
+  position: absolute;
39
+  right: 0;
40
+}
41
+.title {
42
+  display: inline-block;
43
+  width: 84px;
44
+  justify-content: space-between;
45
+  text-align: justify;
46
+  text-align-last: justify;
47
+}
48
+.address {
49
+  width: 400px;
50
+  height: 24px;
51
+  text-overflow: ellipsis;
52
+  white-space: nowrap;
53
+  overflow: hidden;
54
+}

+ 10
- 1
src/pages/building/list/style.less 查看文件

45
   justify-content: space-between;
45
   justify-content: space-between;
46
   text-align: justify;
46
   text-align: justify;
47
   text-align-last:justify
47
   text-align-last:justify
48
-}
48
+}
49
+
50
+.address { 
51
+  width: 400px;
52
+  height: 24px; 
53
+  text-overflow: ellipsis; 
54
+  white-space: nowrap;
55
+  overflow: hidden;
56
+}
57
+

+ 54
- 0
src/pages/building/list/style.wxss 查看文件

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
+  background: #50be00;
14
+  border-radius: 4px;
15
+  border: 0px;
16
+  margin: 10px 0px;
17
+}
18
+.cardText {
19
+  font-size: 18px;
20
+  color: #333;
21
+  line-height: 24px;
22
+  display: flex;
23
+  align-items: center;
24
+  position: relative;
25
+}
26
+.cardItem {
27
+  font-size: 18px;
28
+  font-weight: 400;
29
+  color: #666;
30
+  line-height: 24px;
31
+  display: flex;
32
+  align-items: center;
33
+}
34
+.ediText {
35
+  font-size: 18px;
36
+  color: #ff925c;
37
+  line-height: 24px;
38
+  position: absolute;
39
+  right: 0;
40
+}
41
+.title {
42
+  display: inline-block;
43
+  width: 84px;
44
+  justify-content: space-between;
45
+  text-align: justify;
46
+  text-align-last: justify;
47
+}
48
+.address {
49
+  width: 400px;
50
+  height: 24px;
51
+  text-overflow: ellipsis;
52
+  white-space: nowrap;
53
+  overflow: hidden;
54
+}

+ 78
- 0
src/pages/building/type/edi.jsx 查看文件

1
+import React from 'react';
2
+import { Input, Button, Row, Col, Form, Alert } from 'antd';
3
+import router from 'umi/router';
4
+import Styles from './style.less';
5
+import request from '../../../utils/request';
6
+import apis from '../../../services/apis';
7
+
8
+function body(props) {
9
+  const { getFieldDecorator } = props.form;
10
+
11
+  console.log('id: ', props.location.query.id)
12
+
13
+  function handleSubmit(e) {
14
+    e.preventDefault();
15
+    props.form.validateFields((err, values) => {
16
+      if (!err) {
17
+        // 提交数据
18
+        values.status = 1
19
+        values.createDate = new Date()
20
+        submitData(values)
21
+      }
22
+    });
23
+  }
24
+
25
+  function submitData(data) {
26
+    request({ ...apis.buildingType.add, data: { ...data } }).then(() => {
27
+      // eslint-disable-next-line no-unused-expressions
28
+      <Alert
29
+        style={{
30
+          marginBottom: 24,
31
+        }}
32
+        message="操作成功"
33
+        type="success"
34
+        showIcon
35
+      />
36
+      router.go(-1)
37
+    }).catch(err => {
38
+      // eslint-disable-next-line no-unused-expressions
39
+      <Alert
40
+        style={{
41
+          marginBottom: 24,
42
+        }}
43
+        message={ err }
44
+        type="err"
45
+        showIcon
46
+      />
47
+    })
48
+  }
49
+
50
+  return (
51
+    <>
52
+        <Form onSubmit={handleSubmit} style={{ width: '500px', margin: 'auto' }}>
53
+          <Form.Item>
54
+            {getFieldDecorator('buildingTypeName', {
55
+              rules: [{ required: true, message: '请输入名称' }],
56
+            })(
57
+              <Input
58
+                placeholder="名称"
59
+              />,
60
+            )}
61
+          </Form.Item>
62
+          <Form.Item style={{ display: 'flex', justifyContent: 'space-between' }}>
63
+            <Button type="primary" htmlType="submit" className={ Styles.addButton } style={{ margin: '0' }}>
64
+              确定
65
+            </Button>
66
+            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
67
+            <Button onClick={() => router.go(-1)}>
68
+              取消
69
+            </Button>
70
+          </Form.Item>
71
+        </Form>
72
+    </>
73
+  )
74
+}
75
+
76
+const WrappedBuidingTypeForm = Form.create({ name: 'body' })(body);
77
+
78
+export default WrappedBuidingTypeForm

+ 88
- 55
src/pages/building/type/index.jsx 查看文件

1
-import React, { useState } from 'react';
2
-import { Button, Table, Pagination } from 'antd'
1
+import React, { useState, useEffect } from 'react';
2
+import { Button, Table, Pagination, Alert, Icon, Tag } from 'antd'
3
+import router from 'umi/router';
4
+import moment from 'moment';
3
 import Styles from './style.less'
5
 import Styles from './style.less'
6
+import request from '../../../utils/request';
7
+import apis from '../../../services/apis';
4
 
8
 
5
-const dataSource = [
6
-  {
7
-    key: '1',
8
-    name: '胡彦斌',
9
-    age: 32,
10
-    address: '西湖区湖底公园1号',
11
-  },
12
-  {
13
-    key: '2',
14
-    name: '胡彦祖',
15
-    age: 42,
16
-    address: '西湖区湖底公园1号',
17
-  },
18
-];
19
-
20
-const columns = [
21
-  {
22
-    title: '姓名',
23
-    dataIndex: 'name',
24
-    key: 'name',
25
-  },
26
-  {
27
-    title: '年龄',
28
-    dataIndex: 'age',
29
-    key: 'age',
30
-  },
31
-  {
32
-    title: '住址',
33
-    dataIndex: 'address',
34
-    key: 'address',
35
-  },
36
-];
9
+function body() {
10
+  // eslint-disable-next-line react-hooks/rules-of-hooks
11
+  const [data, setData] = useState([{ records: [] }])
37
 
12
 
38
-// 分页
39
-function onChange(pageNumber, set) {
40
-  // eslint-disable-next-line no-console
41
-  console.log('Page: ', pageNumber);
42
-  const data = [
13
+  const columns = [
14
+    {
15
+      title: '编号',
16
+      dataIndex: 'buildingTypeId',
17
+      key: 'buildingTypeId',
18
+    },
19
+    {
20
+      title: '类型名称',
21
+      dataIndex: 'buildingTypeName',
22
+      key: 'buildingTypeName',
23
+      render: (_, record) => <Tag color="blue" onClick={() => toEdi(record.buildingTypeId)}>{ record.buildingTypeName }</Tag>,
24
+    },
43
     {
25
     {
44
-      key: '1',
45
-      name: '一号',
46
-      age: 32,
47
-      address: '西湖区湖底公园1号',
26
+      title: '创建时间',
27
+      dataIndex: 'createDate',
28
+      key: 'createDate',
29
+      render: (_, record) => <sapn>{moment(record.createDate).format('YYYY-MM-DD')}</sapn>,
48
     },
30
     },
49
     {
31
     {
50
-      key: '2',
51
-      name: '二号',
52
-      age: 42,
53
-      address: '西湖区湖底公园1号',
32
+      title: '操作',
33
+      dataIndex: 'row',
34
+      key: 'row',
35
+      render: (_, record) => (
36
+        <span onClick={() => deleteType(record)}>
37
+          <span style={{
38
+              color: '#FF4A4A', right: '0',
39
+          }} >
40
+              删除
41
+          <Icon type="rest" style={{ color: '#C0C4CC', marginLeft: '8px' }} />
42
+          </span>
43
+        </span>
44
+      ),
54
     },
45
     },
55
   ];
46
   ];
56
 
47
 
57
-  set(data)
58
-}
59
-
60
-function body() {
61
   // eslint-disable-next-line react-hooks/rules-of-hooks
48
   // eslint-disable-next-line react-hooks/rules-of-hooks
62
-  const [data, setData] = useState(dataSource || [])
49
+  useEffect(() => {
50
+    getList({ pageNum: 1, pageSize: 10 })
51
+  }, [])
52
+
53
+  function getList(params) {
54
+    request({ ...apis.buildingType.getList, params: { ...params } }).then(res => {
55
+      setData(res)
56
+    }).catch(err => {
57
+      // eslint-disable-next-line no-unused-expressions
58
+      <Alert
59
+        style={{
60
+          marginBottom: 24,
61
+        }}
62
+        message={err}
63
+        type="error"
64
+        showIcon
65
+      />
66
+    })
67
+  }
68
+
69
+  // 分页
70
+  function onChange(pageNumber) {
71
+    // eslint-disable-next-line no-console
72
+    console.log('Page: ', pageNumber);
73
+    getList({ pageNum: pageNumber, pageSize: 10 })
74
+  }
75
+
76
+  // 删除
77
+  function deleteType(row) {
78
+    const { url, method } = apis.buildingType.update
79
+    const tempUrl = url.substring(0, url.lastIndexOf('id')).concat(row.buildingTypeId)
80
+
81
+    row.status = -1
82
+    request({ url: tempUrl, method, data: { ...row } }).then(() => {
83
+      getList({ pageNum: data.current, pageSize: 10 })
84
+    })
85
+  }
86
+
87
+  // 跳转修改页
88
+  function toEdi(id) {
89
+    router.push({
90
+      pathname: '/building/type/edi',
91
+      query: {
92
+        id,
93
+      },
94
+    });
95
+  }
63
 
96
 
64
   return (
97
   return (
65
     <>
98
     <>
66
-      <Button type="primary" className={Styles.addButton}>新增类型</Button>
67
-      <Table dataSource={data} columns={columns} pagination={false}/>
99
+      <Button type="primary" className={Styles.addButton} onClick={toEdi}>新增类型</Button>
100
+      <Table dataSource={data.records} columns={columns} pagination={false}/>
68
       {/* 分页 */}
101
       {/* 分页 */}
69
       <div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
102
       <div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
70
-        <Pagination showQuickJumper defaultCurrent={1} total={500} onChange={e => onChange(e, setData)} />
103
+        <Pagination showQuickJumper defaultCurrent={1} total={data.total} onChange={onChange} />
71
       </div>
104
       </div>
72
     </>
105
     </>
73
   )
106
   )

+ 0
- 0
src/pages/news/list/NewsList.jsx 查看文件


src/pages/news/NewTypeList.jsx → src/pages/news/type/NewsType.jsx 查看文件

1
 import React from 'react';
1
 import React from 'react';
2
-import { Form, Input, Button, Icon, Select, message, Table, Divider, Tag, Pagination, Modal } from 'antd';
2
+import { Form, Input, Button, Icon, Select, message, Table, Divider, Tag, Pagination, Modal,Breadcrumb } from 'antd';
3
 import { FormattedMessage } from 'umi-plugin-react/locale';
3
 import { FormattedMessage } from 'umi-plugin-react/locale';
4
-import styles from '../style/GoodsList.less';
4
+import styles from './style.less';
5
 import router from 'umi/router';
5
 import router from 'umi/router';
6
 
6
 
7
 const { Option } = Select;
7
 const { Option } = Select;
23
 function onChange(pageNumber) {
23
 function onChange(pageNumber) {
24
   console.log('Page: ', pageNumber);
24
   console.log('Page: ', pageNumber);
25
 }
25
 }
26
+
26
 // 跳转到编辑商品
27
 // 跳转到编辑商品
27
 function toEditGoods() {
28
 function toEditGoods() {
28
   router.push({
29
   router.push({
29
-    pathname: '/activity/editActivity',
30
+    pathname: '/integralMall/editGoods',
30
     query: {
31
     query: {
31
       a: 'b',
32
       a: 'b',
32
     },
33
     },
55
 
56
 
56
 const columns = [
57
 const columns = [
57
   {
58
   {
58
-    title: '类型图',
59
+    title: '类型图',
59
     dataIndex: 'img',
60
     dataIndex: 'img',
60
     key: 'img',
61
     key: 'img',
61
     align: 'center',
62
     align: 'center',
68
     align: 'center',
69
     align: 'center',
69
 
70
 
70
   },
71
   },
71
-
72
   {
72
   {
73
     title: '操作',
73
     title: '操作',
74
     dataIndex: 'handle',
74
     dataIndex: 'handle',
76
     align: 'center',
76
     align: 'center',
77
     render: () => <>
77
     render: () => <>
78
     <span style={{ color: '#1990FF', marginRight: '20px' }} onClick={confirm}>删除<Icon type="shopping-cart" className={styles.shoppingCart} /></span>
78
     <span style={{ color: '#1990FF', marginRight: '20px' }} onClick={confirm}>删除<Icon type="shopping-cart" className={styles.shoppingCart} /></span>
79
-    <span style={{ color: '#FF925C' }}>编辑<Icon type="form" className={styles.edit} /></span></>,
79
+    <span style={{ color: '#FF925C' }} onClick={toEditGoods}>编辑<Icon type="form" className={styles.edit} /></span></>,
80
   },
80
   },
81
 ];
81
 ];
82
-const confirm = () => {
82
+function confirm() {
83
   Modal.confirm({
83
   Modal.confirm({
84
-    title: '确认删除该商品?',
84
+    title: '确认删除该类型?',
85
     okText: '确认',
85
     okText: '确认',
86
     cancelText: '取消',
86
     cancelText: '取消',
87
     onOk() {
87
     onOk() {
93
   });
93
   });
94
 
94
 
95
 }
95
 }
96
-
97
-const header = (props) => {
96
+function header(props) {
98
   const { getFieldDecorator } = props.form
97
   const { getFieldDecorator } = props.form
99
   return (
98
   return (
100
 
99
 

src/pages/style/News.less → src/pages/news/type/style.less 查看文件


+ 26
- 2
src/services/apis.js 查看文件

10
       method: 'POST',
10
       method: 'POST',
11
       url: `${prefix}/taUser/signin`,
11
       url: `${prefix}/taUser/signin`,
12
     },
12
     },
13
-  }
14
-}
13
+  },
14
+  building: {
15
+    getList: {
16
+      method: 'GET',
17
+      url: `${prefix}/buildinglist`,
18
+    },
19
+  },
20
+  buildingType: {
21
+    getList: {
22
+      method: 'GET',
23
+      url: `${prefix}/tdBuildingType`,
24
+    },
25
+    delete: {
26
+      method: 'DELETE',
27
+      url: `${prefix}/tdBuildingType/id`,
28
+    },
29
+    update: {
30
+      method: 'PUT',
31
+      url: `${prefix}/tdBuildingType/id`,
32
+    },
33
+    add: {
34
+      method: 'POST',
35
+      url: `${prefix}/tdBuildingType`,
36
+    },
37
+  },
38
+}

+ 1
- 1
src/utils/request.js 查看文件

78
         throw new Error(message);
78
         throw new Error(message);
79
       }
79
       }
80
 
80
 
81
-      if (data.token) {
81
+      if (data && data.token) {
82
         window.localStorage.setItem('x-token', data.token)
82
         window.localStorage.setItem('x-token', data.token)
83
       }
83
       }
84
 
84