|
@@ -5,29 +5,13 @@ import styles from '../style/GoodsList.less';
|
5
|
5
|
import router from 'umi/router';
|
6
|
6
|
import moment from 'moment';
|
7
|
7
|
import SelectCity from '../../components/SelectButton/CitySelect'
|
|
8
|
+import BuildSelect from '../../components/SelectButton/BuildSelect'
|
8
|
9
|
|
9
|
10
|
import request from '../../utils/request'
|
10
|
11
|
|
11
|
12
|
const { Option } = Select;
|
12
|
13
|
const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
|
13
|
|
-// 提交事件
|
14
|
|
-function handleSubmit(e, props) {
|
15
|
|
- e.preventDefault();
|
16
|
|
- props.form.validateFields((err, values) => {
|
17
|
|
- if (!err) {
|
18
|
|
- console.log('提交数据: ', values)
|
19
|
|
- }
|
20
|
|
- });
|
21
|
|
-}
|
22
|
|
-// Change 事件
|
23
|
|
-function handleSelectChange(props) {
|
24
|
|
- console.log(props)
|
25
|
|
-}
|
26
|
14
|
|
27
|
|
-// 分页
|
28
|
|
-function onChange(pageNumber) {
|
29
|
|
- console.log('Page: ', pageNumber);
|
30
|
|
-}
|
31
|
15
|
// 跳转到编辑商品
|
32
|
16
|
function toEditGoods() {
|
33
|
17
|
router.push({
|
|
@@ -187,46 +171,60 @@ const sendDynamic = (row) => {
|
187
|
171
|
})
|
188
|
172
|
}
|
189
|
173
|
|
|
174
|
+const changePageNum = (pageNumber) => {
|
|
175
|
+ getList({ pageNum: pageNumber, pageSize: 10 })
|
|
176
|
+}
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
|
190
|
180
|
const header = (props) => {
|
191
|
181
|
const [ data, setData ] = useState({})
|
192
|
182
|
// const [page, changePage] = useState({})
|
193
|
183
|
|
194
|
184
|
useEffect(() => {
|
195
|
|
- getList();
|
|
185
|
+ getList({ pageNum: 1, pageSize: 10 });
|
196
|
186
|
},[])
|
197
|
187
|
|
198
|
188
|
// 查询列表
|
199
|
|
- const getList = (e) => {
|
|
189
|
+ const getList = (params) => {
|
200
|
190
|
request({
|
201
|
191
|
url: '/api/admin/iBuildingDynamicList',
|
202
|
192
|
method: 'GET',
|
203
|
|
- params: {pageNum: 1,pageSize: 10},
|
|
193
|
+ params: { ...params },
|
204
|
194
|
}).then((data) => {
|
205
|
195
|
console.log(data)
|
206
|
196
|
setData(data)
|
207
|
197
|
})
|
208
|
198
|
}
|
209
|
199
|
|
|
200
|
+ // 提交事件
|
|
201
|
+const handleSubmit = (e, props) => {
|
|
202
|
+ e.preventDefault();
|
|
203
|
+ props.form.validateFields((err, values) => {
|
|
204
|
+ if (!err) {
|
|
205
|
+ console.log('提交数据: ', values)
|
|
206
|
+ getList({ pageNum: 1, pageSize: 10, ...values })
|
|
207
|
+ }
|
|
208
|
+ });
|
|
209
|
+ }
|
|
210
|
+
|
210
|
211
|
const { getFieldDecorator } = props.form
|
211
|
212
|
return (
|
212
|
213
|
|
213
|
214
|
<>
|
214
|
215
|
<Form layout="inline" onSubmit={e => handleSubmit(e, props)}>
|
215
|
216
|
<Form.Item>
|
216
|
|
- {getFieldDecorator('goodState')(
|
|
217
|
+ {getFieldDecorator('cityId')(
|
217
|
218
|
<SelectCity />,
|
218
|
219
|
)}
|
219
|
220
|
</Form.Item>
|
220
|
221
|
<Form.Item>
|
221
|
|
- {getFieldDecorator('isMain')(
|
222
|
|
- <Select style={{ width: '180px' }} placeholder="请选择项目" onChange={handleSelectChange}>
|
223
|
|
- <Option value="1">首页推荐</Option>
|
224
|
|
- <Option value="0">首页未推荐</Option>
|
225
|
|
- </Select>,
|
|
222
|
+ {getFieldDecorator('buildingId')(
|
|
223
|
+ <BuildSelect />,
|
226
|
224
|
)}
|
227
|
225
|
</Form.Item>
|
228
|
226
|
<Form.Item>
|
229
|
|
- {getFieldDecorator('name')(
|
|
227
|
+ {getFieldDecorator('title')(
|
230
|
228
|
<Input
|
231
|
229
|
prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
|
232
|
230
|
placeholder="请输入标题"
|
|
@@ -234,13 +232,13 @@ const header = (props) => {
|
234
|
232
|
)}
|
235
|
233
|
</Form.Item>
|
236
|
234
|
<Form.Item>
|
237
|
|
- {getFieldDecorator('min')(
|
|
235
|
+ {getFieldDecorator('time')(
|
238
|
236
|
<DatePicker />
|
239
|
237
|
)}
|
240
|
238
|
</Form.Item>
|
241
|
239
|
<Form.Item>
|
242
|
|
- {getFieldDecorator('goodState')(
|
243
|
|
- <Select style={{ width: '180px' }} placeholder="是否报名" onChange={handleSelectChange}>
|
|
240
|
+ {getFieldDecorator('isEnlist')(
|
|
241
|
+ <Select style={{ width: '180px' }} placeholder="是否报名">
|
244
|
242
|
<Option value="1">已报名</Option>
|
245
|
243
|
<Option value="0">未报名</Option>
|
246
|
244
|
</Select>,
|
|
@@ -253,7 +251,10 @@ const header = (props) => {
|
253
|
251
|
</Form.Item>
|
254
|
252
|
</Form>
|
255
|
253
|
<Button type="primary" className={styles.addBtn} onClick={toEditGoods}>新增</Button>
|
256
|
|
- <Table dataSource={data.list} columns={columns} />
|
|
254
|
+ <Table dataSource={data.list} columns={columns} pagination={false}/>
|
|
255
|
+ <div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
|
|
256
|
+ <Pagination showQuickJumper defaultCurrent={1} total={data.total} onChange={changePageNum} />
|
|
257
|
+ </div>
|
257
|
258
|
</>
|
258
|
259
|
)
|
259
|
260
|
}
|