|
@@ -1,5 +1,5 @@
|
1
|
1
|
import React, { useState, useEffect } from 'react';
|
2
|
|
-import { Form, Input, Button, Icon, Select, message, Table, Divider, Tag, Pagination, Modal,Breadcrumb } from 'antd';
|
|
2
|
+import { Form, Input, Button, Icon, Select, message, Table, Divider, Tag, Pagination, Modal, Breadcrumb } from 'antd';
|
3
|
3
|
import { FormattedMessage } from 'umi-plugin-react/locale';
|
4
|
4
|
import styles from '../../style/GoodsList.less';
|
5
|
5
|
import router from 'umi/router';
|
|
@@ -7,27 +7,28 @@ import BuildSelect from '../../../components/SelectButton/BuildSelect';
|
7
|
7
|
import AuthButton from '@/components/AuthButton';
|
8
|
8
|
import apis from '../../../services/apis';
|
9
|
9
|
import request from '../../../utils/request'
|
|
10
|
+import EditIcon from '@/components/EditIcon';
|
10
|
11
|
|
11
|
12
|
const { Option } = Select;
|
12
|
13
|
|
13
|
14
|
|
14
|
15
|
function header(props) {
|
15
|
16
|
// 获取初始化数据
|
16
|
|
- const [ data, setData ] = useState({})
|
|
17
|
+ const [data, setData] = useState({})
|
17
|
18
|
|
18
|
19
|
useEffect(() => {
|
19
|
20
|
getList({ pageNum: 1, pageSize: 10 });
|
20
|
|
- },[])
|
|
21
|
+ }, [])
|
21
|
22
|
|
22
|
23
|
// 查询列表
|
23
|
24
|
const getList = (params) => {
|
24
|
25
|
request({ ...apis.newsType.list, params: { ...params } }).then((data) => {
|
25
|
|
- console.log(data)
|
26
|
|
- setData(data)
|
|
26
|
+ console.log(data)
|
|
27
|
+ setData(data)
|
27
|
28
|
})
|
28
|
29
|
}
|
29
|
30
|
|
30
|
|
-
|
|
31
|
+
|
31
|
32
|
// 提交事件
|
32
|
33
|
const handleSubmit = (e, props) => {
|
33
|
34
|
e.preventDefault();
|
|
@@ -57,7 +58,7 @@ function header(props) {
|
57
|
58
|
});
|
58
|
59
|
}
|
59
|
60
|
|
60
|
|
-
|
|
61
|
+
|
61
|
62
|
const changeNewsStatus = (row, newsId) => () => {
|
62
|
63
|
Modal.confirm({
|
63
|
64
|
title: '确认删除?',
|
|
@@ -88,7 +89,7 @@ function header(props) {
|
88
|
89
|
dataIndex: 'newsTypeImg',
|
89
|
90
|
key: 'newsTypeImg',
|
90
|
91
|
align: 'center',
|
91
|
|
- render: (text, record) => <img src={record.newsTypeImg} style={{ width: '165px',height: '104px' }} className={styles.touxiang} />,
|
|
92
|
+ render: (text, record) => <img src={record.newsTypeImg} style={{ width: '165px', height: '104px' }} className={styles.touxiang} />,
|
92
|
93
|
},
|
93
|
94
|
{
|
94
|
95
|
title: '名称',
|
|
@@ -104,16 +105,18 @@ function header(props) {
|
104
|
105
|
align: 'center',
|
105
|
106
|
render: (x, row) => (
|
106
|
107
|
<>
|
107
|
|
- <AuthButton name="admin.taNewsType.id.delete" noRight={null}>
|
108
|
|
- <span style={{ color: '#EF273A', marginRight: '20px', cursor: 'pointer' }} onClick={changeNewsStatus(row, row.newsTypeId)}>
|
109
|
|
- {row.status == 1 ? '删除' : '上架'}<Icon type="shopping-cart" className={styles.shoppingCart} />
|
110
|
|
- </span>
|
111
|
|
- </AuthButton>
|
112
|
|
- <AuthButton name="admin.taNewsType.id.put" noRight={null}>
|
113
|
|
- <span style={{ color: '#FF925C', cursor: 'pointer' }} onClick={toEditNews(row.newsTypeId)}>
|
114
|
|
- 编辑<Icon type="form" className={styles.edit} />
|
115
|
|
- </span>
|
116
|
|
- </AuthButton>
|
|
108
|
+ <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
|
|
109
|
+ <AuthButton name="admin.taNewsType.id.delete" noRight={null}>
|
|
110
|
+ <span style={{ color: '#EF273A', marginRight: '20px', cursor: 'pointer' }} onClick={changeNewsStatus(row, row.newsTypeId)}>
|
|
111
|
+ {row.status == 1 ? <EditIcon text="删除" color='#FF4A4A' position="-180"></EditIcon> : <EditIcon text="上架" color='#ff925c' position="-18"></EditIcon>}
|
|
112
|
+ </span>
|
|
113
|
+ </AuthButton>
|
|
114
|
+ <AuthButton name="admin.taNewsType.id.put" noRight={null}>
|
|
115
|
+ <span style={{ color: '#FF925C', cursor: 'pointer' }} onClick={toEditNews(row.newsTypeId)}>
|
|
116
|
+ <EditIcon text="编辑" color='#ff925c' position="-144"></EditIcon>
|
|
117
|
+ </span>
|
|
118
|
+ </AuthButton>
|
|
119
|
+ </div>
|
117
|
120
|
</>
|
118
|
121
|
),
|
119
|
122
|
},
|
|
@@ -134,13 +137,13 @@ function header(props) {
|
134
|
137
|
)}
|
135
|
138
|
</Form.Item>
|
136
|
139
|
<Form.Item>
|
137
|
|
- <AuthButton name="admin.taNewsType.search" noRight={null}>
|
138
|
|
- <Button type="primary" htmlType="submit" >
|
139
|
|
- 搜索
|
|
140
|
+ <AuthButton name="admin.taNewsType.search" noRight={null}>
|
|
141
|
+ <Button type="primary" htmlType="submit" >
|
|
142
|
+ 搜索
|
140
|
143
|
</Button>
|
141
|
|
- </AuthButton>
|
142
|
|
- <Button style={{ marginLeft: 8 }} onClick={handleReset}>
|
143
|
|
- 重置
|
|
144
|
+ </AuthButton>
|
|
145
|
+ <Button style={{ marginLeft: 8 }} onClick={handleReset}>
|
|
146
|
+ 重置
|
144
|
147
|
</Button>
|
145
|
148
|
</Form.Item>
|
146
|
149
|
</Form>
|
|
@@ -149,7 +152,7 @@ function header(props) {
|
149
|
152
|
</AuthButton>
|
150
|
153
|
<Table rowKey="newsType" dataSource={data.records} columns={columns} pagination={false} />
|
151
|
154
|
<div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
|
152
|
|
- <Pagination showQuickJumper defaultCurrent={1} total={data.total} onChange={changePageNum} current={data.current}/>
|
|
155
|
+ <Pagination showQuickJumper defaultCurrent={1} total={data.total} onChange={changePageNum} current={data.current} />
|
153
|
156
|
</div>
|
154
|
157
|
</>
|
155
|
158
|
)
|