|
@@ -1,5 +1,5 @@
|
1
|
1
|
import React, { useState, useEffect } from 'react';
|
2
|
|
-import { Input, Menu, Dropdown, Button, Icon, message, Table, Divider, Tag, Select } from 'antd';
|
|
2
|
+import { Input, Menu, Dropdown, Button, Icon, message, Table, Divider, Tag, Select, Pagination } from 'antd';
|
3
|
3
|
import { FormattedMessage } from 'umi-plugin-react/locale';
|
4
|
4
|
import channels from './channelList.less';
|
5
|
5
|
import router from 'umi/router';
|
|
@@ -81,12 +81,12 @@ const columns = [
|
81
|
81
|
dataIndex: '',
|
82
|
82
|
key: '',
|
83
|
83
|
align: 'center',
|
84
|
|
- render: () => <a style={ { color: '#66B3FF' } }>编辑</a>,
|
|
84
|
+ render: (text, record) => <a style={ { color: '#66B3FF' } } onClick= {() => toedit(record.channelId)} >编辑</a>,
|
85
|
85
|
},
|
86
|
86
|
];
|
87
|
87
|
|
88
|
|
-// 跳转到编辑商品
|
89
|
|
-function toEditGoods() {
|
|
88
|
+// 跳转到添加页面
|
|
89
|
+function toAdd() {
|
90
|
90
|
router.push({
|
91
|
91
|
pathname: '/channel/addChannel',
|
92
|
92
|
query: {
|
|
@@ -94,14 +94,21 @@ function toEditGoods() {
|
94
|
94
|
},
|
95
|
95
|
});
|
96
|
96
|
}
|
|
97
|
+ // 跳编辑页面
|
|
98
|
+ function toedit(channelId) {
|
|
99
|
+ // alert(channelId)
|
|
100
|
+ router.push({
|
|
101
|
+ pathname: '/channel/editChannel',
|
|
102
|
+ query: {
|
|
103
|
+ id: channelId,
|
|
104
|
+ },
|
|
105
|
+ });
|
|
106
|
+ }
|
97
|
107
|
|
98
|
108
|
const header = props => {
|
99
|
109
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
100
|
110
|
const [data, setData] = useState({ channelNmae: [], result: [] })
|
101
|
111
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
102
|
|
- // const [queryData, setQueryData] = useState({ pageNum: 1, pageSize: 10 })
|
103
|
|
- // const [page, changePage] = useState({})
|
104
|
|
- // eslint-disable-next-line react-hooks/rules-of-hooks
|
105
|
112
|
useEffect(() => {
|
106
|
113
|
getList({ pageNum: 1, pageSize: 10 })
|
107
|
114
|
}, [])
|
|
@@ -130,6 +137,23 @@ const header = props => {
|
130
|
137
|
function reset() {
|
131
|
138
|
getList({ pageNum: 1, pageSize: 10 })
|
132
|
139
|
}
|
|
140
|
+
|
|
141
|
+ // 跳编辑页
|
|
142
|
+ function toEdit() {
|
|
143
|
+ router.push({
|
|
144
|
+ pathname: '/integralMall/editGoods',
|
|
145
|
+ query: {
|
|
146
|
+ a: 'b',
|
|
147
|
+ },
|
|
148
|
+ });
|
|
149
|
+}
|
|
150
|
+
|
|
151
|
+ // 分页
|
|
152
|
+ function onChange(pageNumber) {
|
|
153
|
+ // eslint-disable-next-line react-hooks/rules-of-hooks
|
|
154
|
+ getList({ pageNum: pageNumber, pageSize: 9 })
|
|
155
|
+ }
|
|
156
|
+
|
133
|
157
|
return (
|
134
|
158
|
<>
|
135
|
159
|
<div className={channels.searchBox}>
|
|
@@ -142,15 +166,14 @@ const header = props => {
|
142
|
166
|
)}
|
143
|
167
|
{/* {listItems} */}
|
144
|
168
|
</Select>
|
145
|
|
-
|
146
|
169
|
</dvi>
|
147
|
170
|
<div >
|
148
|
171
|
<Button style ={{ backgroundColor: '#00bfff' } } onClick={() => queryList() }>查询</Button>
|
149
|
172
|
<Button onClick={() => reset() }>重置</Button>
|
150
|
173
|
</div>
|
151
|
174
|
</div>
|
152
|
|
- <Button className={channels.addBtn} onClick={toEditGoods}>新增</Button>
|
153
|
|
- <Table dataSource={data.result.records} columns={columns} />
|
|
175
|
+ <Button className={channels.addBtn} onClick={toAdd}>新增</Button>
|
|
176
|
+ <Table dataSource={data.result.records} columns={columns} pagination={{ pageSize: 10, total: data.result.total, onChange }} />
|
154
|
177
|
</>
|
155
|
178
|
)
|
156
|
179
|
}
|