Преглед изворни кода

Merge branch 'dev' of http://git.ycjcjy.com/zhiyuxing/estateagents-admin-manager into dev

zhoulisen пре 5 година
родитељ
комит
37b1a5ce06

+ 1
- 1
src/components/ActionList/index.jsx Прегледај датотеку

@@ -6,7 +6,7 @@ import './style.less';
6 6
 export default function withActions(actionsRender) {
7 7
   return function ActionList(text, record) {
8 8
     const actions = actionsRender(text, record);
9
-    const [Act1, Act2, Act3, ...leftActs] = actions || [];
9
+    const [Act1, Act2, Act3, ...leftActs] = (actions || []).filter(Boolean);
10 10
 
11 11
     const menus = (
12 12
       <Menu className="actlist-menu">

+ 1
- 3
src/components/ActionList/style.less Прегледај датотеку

@@ -1,8 +1,6 @@
1 1
 
2 2
 :global{
3
-  .action-list {
4
-    display: inline-block;
5
-  
3
+  .action-list {  
6 4
     span {
7 5
       display: inline-block;
8 6
       & + span {

+ 3
- 4
src/components/EditIcon/index.jsx Прегледај датотеку

@@ -85,9 +85,8 @@ const spriteInfo = [
85 85
 function noop() {}
86 86
 
87 87
 const EditIcon = ({ text, type, color, position, onClick }) => {
88
-
89
-    const icon = spriteInfo.filter(x => x.type === type)[0];
90
-    const color2 = color || icon.color;
88
+    const icon = spriteInfo.filter(x => x.type === type)[0] || {};
89
+    const color2 = color || icon.color || '#ff925c';
91 90
     const position2 = position || icon.pos;
92 91
 
93 92
     const wrappedStyle = useMemo(() => ({ color: `${color2}`, display: 'flex', alignItems: 'center', cursor: 'pointer' }), [color]);
@@ -96,7 +95,7 @@ const EditIcon = ({ text, type, color, position, onClick }) => {
96 95
     return (
97 96
         <span style={wrappedStyle} onClick={onClick || noop} >
98 97
             {text}
99
-            <span style={iconStyle}></span>
98
+            {type && <span style={iconStyle}></span>}
100 99
         </span>
101 100
     )
102 101
 };

+ 26
- 34
src/pages/activity/drainage/DrainageList.jsx Прегледај датотеку

@@ -1,16 +1,16 @@
1 1
 import React, { useState, useEffect } from 'react';
2
-import { Form, Input, Button, Icon, Select, message, Table, Divider, Tag, Pagination, Modal, DatePicker, Radio } from 'antd';
2
+import { Form, Input, Button, Select, message, Table, Pagination, Modal, DatePicker, Radio } from 'antd';
3 3
 import router from 'umi/router';
4
-import { FormattedMessage } from 'umi-plugin-react/locale';
4
+import moment from 'moment';
5
+import Prompt from 'umi/prompt';
6
+import withActions from '@/components/ActionList';
7
+import EditIcon from '@/components/EditIcon';
5 8
 import styles from '../../style/GoodsList.less';
6 9
 import apis from '../../../services/apis';
7 10
 import request from '../../../utils/request';
8
-import XForm, { FieldTypes } from '../../../components/XForm';
9
-import moment from 'moment';
10 11
 import AuthButton from '../../../components/AuthButton';
11 12
 import ImageUploader from '../../../components/XForm/ImageUpload';
12 13
 import BuildSelect from '../../../components/SelectButton/BuildSelect2'
13
-import Prompt from 'umi/prompt';
14 14
 
15 15
 const toEditList = (row) => () => {
16 16
   router.push({
@@ -220,39 +220,31 @@ const header = (props) => {
220 220
       title: '操作',
221 221
       key: 'action',
222 222
       align: 'center',
223
-      render: (text, datas) => (
224
-        <>
223
+      width: 300,
224
+      render: withActions((text, datas) => [
225 225
         <AuthButton name="admin.taDrainage.put" noRight={null}>
226
-          <span style={{ right: '20px', bottom: ' 10px', fontSize: ' 0.106rem', color: '#FF7E48', cursor: 'pointer'}} onClick={() => addshowModal(datas)}>
227
-            编辑
228
-          </span>
229
-        </AuthButton>
230
-          <AuthButton name="admin.taDrainage.id.delete" noRight={null}>
231
-            <span style={{ right: '20px', bottom: ' 10px', fontSize: ' 0.106rem', color: '#FF7E48', cursor: 'pointer', marginLeft: 20 }} onClick={deleteDrainage(datas.drainageId)}>
232
-              删除
233
-            </span>
234
-          </AuthButton >
226
+          <EditIcon type="edit" text="编辑" onClick={() => addshowModal(datas)} />
227
+        </AuthButton>,
228
+
229
+        <AuthButton name="admin.taDrainage.id.delete" noRight={null}>
230
+          <EditIcon type="delete" text="删除" onClick={deleteDrainage(datas.drainageId)} />
231
+        </AuthButton >,
232
+
235 233
           <AuthButton name="admin.taDrainage.publish" noRight={null}>
236
-          <span style={{ right: '20px', bottom: ' 10px', fontSize: ' 0.106rem', color: '#FF7E48', cursor: 'pointer', marginLeft: 20 }} onClick={exchangeDrainage(datas)}>
237
-            {datas.status === 1 ? '下架' : '上架'}
238
-          </span>
239
-          </AuthButton>
234
+            <EditIcon type={datas.status === 1 ? 'cancel' : 'publish'} text={datas.status === 1 ? '下架' : '上架'} onClick={exchangeDrainage(datas)} />
235
+          </AuthButton>,
236
+
240 237
           <AuthButton name="admin.taDrainage.data" noRight={null}>
241
-            <span style={{ right: '20px', top: '20px', fontSize: ' 0.106rem', zIndex: 1, color: '#FF7E48', cursor: 'pointer', marginLeft: 20  }} onClick={toEditList(datas)}>
242
-              数据
243
-            </span>
244
-          </AuthButton>
245
-          <span style={{ right: '20px', top: '20px', fontSize: ' 0.106rem', zIndex: 1, color: '#FF7E48', cursor: 'pointer', marginLeft: 20  }} onClick={toDataReacord(datas)}>
246
-              数据记录
247
-            </span>
238
+            <EditIcon color="#666" text="数据" onClick={toEditList(datas.drainageId)} />
239
+          </AuthButton>,
240
+
241
+          
242
+          <EditIcon color="#666" type="record" text="数据记录" onClick={toDataReacord(datas)} />,
243
+
248 244
           <AuthButton name="admin.taDrainage.id.delete" noRight={null}>
249
-            <span>{datas.isMiniapp === false ? "" : <span style={{ right: '20px', bottom: ' 10px', fontSize: ' 0.106rem', color: '#FF7E48', cursor: 'pointer', marginLeft: 20 }} onClick={newQrcode.bind(this, datas)}>
250
-              下载二维码
251
-            </span>}</span>
252
-            
253
-          </AuthButton >
254
-        </>
255
-      ),
245
+            <EditIcon color="#666" text="下载二维码" onClick={newQrcode.bind(this, datas)} />
246
+          </AuthButton >,
247
+      ]),
256 248
     },
257 249
   ];
258 250
   const Forms = props => {

+ 32
- 31
src/pages/activity/groupActivity/list.jsx Прегледај датотеку

@@ -1,19 +1,19 @@
1 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';
2
+import { Form, Input, Button, Icon, Select, message, Table, Pagination, Modal } from 'antd';
5 3
 import router from 'umi/router';
6 4
 import moment from 'moment';
5
+import AuthButton from '@/components/AuthButton';
6
+import withActions from '@/components/ActionList';
7
+import EditIcon from '@/components/EditIcon';
8
+import Navigate from '@/components/Navigate';
9
+import Prompt from 'umi/prompt';
7 10
 import SelectCity from '../../../components/SelectButton/CitySelect'
8 11
 import BuildSelect from '../../../components/SelectButton/BuildSelect'
9 12
 import apis from '../../../services/apis';
10 13
 import request from '../../../utils/request';
11
-import AuthButton from '@/components/AuthButton';
12
-import Prompt from 'umi/prompt';
13
-import Navigate from '@/components/Navigate';
14
+import styles from '../../style/GoodsList.less';
14 15
 
15 16
 const { Option } = Select;
16
-const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
17 17
 
18 18
 const header = props => {
19 19
   const [data, setData] = useState({})
@@ -145,31 +145,32 @@ const header = props => {
145 145
       dataIndex: 'handle',
146 146
       key: 'handle',
147 147
       align: 'center',
148
-      render: (x, row) => (
149
-        <>
150
-          {row.activityStatus === 0 &&
151
-            <AuthButton name="admin.taShareActivity.finish.put" noRight={null}><span style={{ color: '#1990FF', marginRight: '20px', cursor: 'pointer' }} onClick={endGroupActivity(row)}>结束活动<Icon type="poweroff" className={styles.edit} /></span></AuthButton>
152
-          }
153
-          {
154
-            <AuthButton name="admin.taShareActivity.publish" noRight={null}>
155
-              <span style={{ color: '#1990FF', marginRight: '20px', cursor: 'pointer' }} onClick={sendOrPublicDynamic.bind(this, row)}>{row.status === 1 ? '取消发布' : '发布'}<Icon type="close-circle" className={styles.edit} /></span>
156
-            </AuthButton>
157
-          }
158
-          {
159
-            <AuthButton name="admin.taShareActivity.tag" noRight={null}>
160
-              <span style={{ color: '#1990FF', marginRight: '20px', cursor: 'pointer' }} onClick={topGroupActivity(row, row.weight)}>{row.weight === 1 ? '取消标签' : '添加标签'}<Icon type="vertical-align-top" className={styles.edit} /></span>
161
-            </AuthButton>}{
162
-            <AuthButton name="admin.taShareActivity.top" noRight={null}>
163
-              <span style={{ color: '#1990FF', marginRight: '20px', cursor: 'pointer' }} onClick={recommendGroupActivity(row)}>{row.sort === true ? '取消推荐首页' : '推荐首页'}<Icon type="vertical-align-top" className={styles.edit} /></span>
164
-            </AuthButton>}
165
-          {<span style={{ color: '#1990FF', marginRight: '20px', cursor: 'pointer' }} onClick={() => toDataReacord(row.groupActivityId)}>数据记录<Icon type="form" className={styles.edit} /></span>}
166
-          {(row.activityStatus === 0 || row.activityStatus === 1) &&
148
+      width: 400,
149
+      render: withActions((x, row) => [
150
+        row.activityStatus === 0 ?
151
+          <AuthButton name="admin.taShareActivity.finish.put" noRight={null}>
152
+            <EditIcon type="end" text="结束活动" onClick={endGroupActivity(row)} />
153
+          </AuthButton> : null,
154
+
155
+          <AuthButton name="admin.taShareActivity.publish" noRight={null}>
156
+            <EditIcon type={row.status === 1 ? 'cancel' : 'publish'} text={row.status === 1 ? '取消发布' : '发布'} onClick={sendOrPublicDynamic.bind(this, row)} />
157
+          </AuthButton>,
158
+
159
+          <AuthButton name="admin.taShareActivity.tag" noRight={null}>
160
+            <EditIcon type={row.weight === 1 ? 'cancel' : 'add'} text={row.weight === 1 ? '取消标签' : '添加标签'} onClick={topGroupActivity(row, row.weight)} />
161
+          </AuthButton>,
162
+            
163
+          <AuthButton name="admin.taShareActivity.top" noRight={null}>
164
+            <EditIcon color={row.activityStatus === 0 ? '#666' : undefined} type={row.sort === 1 ? 'cancel' : 'add'} text={row.sort === 1 ? '取消推荐首页' : '推荐首页'} onClick={recommendGroupActivity(row)} />
165
+          </AuthButton>,
166
+
167
+          <EditIcon color="#666" type="record" text="数据记录" onClick={() => toDataReacord(row.groupActivityId)} />,
168
+
169
+          (row.activityStatus === 0 || row.activityStatus === 1) ?
167 170
             <AuthButton name="admin.taShareActivity.update.put" noRight={null}>
168
-              <span style={{ color: '#FF925C', marginRight: '20px', cursor: 'pointer' }} onClick={toEditActivity(row.groupActivityId)}>编辑<Icon type="form" className={styles.edit} /></span>
169
-            </AuthButton>
170
-          }
171
-        </>
172
-      ),
171
+              <EditIcon color="#666" type="edit" text="编辑" onClick={toEditActivity(row.groupActivityId)} />
172
+            </AuthButton> : null,
173
+      ]),
173 174
     },
174 175
   ];
175 176
 

+ 11
- 14
src/pages/activity/liveActivity/list/index.jsx Прегледај датотеку

@@ -1,19 +1,19 @@
1 1
 import React, { useState, useEffect } from 'react';
2
-import { Form, Input, Button, Icon, Select, message, Table, Divider, Tag, Pagination, Modal, DatePicker, notification } from 'antd';
3
-import { FormattedMessage } from 'umi-plugin-react/locale';
2
+import { Form, Input, Button, Icon, Select, message, Table, Pagination, Modal, DatePicker, notification } from 'antd';
4 3
 import router from 'umi/router';
5 4
 import moment from 'moment';
5
+import AuthButton from '@/components/AuthButton';
6
+import Prompt from 'umi/prompt';
7
+import withActions from '@/components/ActionList';
8
+import EditIcon from '@/components/EditIcon';
6 9
 import styles from '../../../style/GoodsList.less';
7 10
 import SelectCity from '../../../../components/SelectButton/CitySelect'
8 11
 import BuildSelect from '../../../../components/SelectButton/BuildSelect'
9 12
 import apis from '../../../../services/apis';
10 13
 import request from '../../../../utils/request';
11
-import AuthButton from '@/components/AuthButton';
12
-import Prompt from 'umi/prompt';
13 14
 // import SaleBatchListHelpDoc from '../edit/components/SalesBatchListHelpDoc';
14 15
 
15 16
 const { Option } = Select;
16
-const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
17 17
 
18 18
 const header = props => {
19 19
   // eslint-disable-next-line react-hooks/rules-of-hooks
@@ -186,18 +186,15 @@ const header = props => {
186 186
     },
187 187
     {
188 188
       title: '操作',
189
-      dataIndex: '',
190
-      key: '',
191 189
       align: 'center',
192
-      render: (text, record) => (<>
193
-     
194
-        <a style={{ color: '#66B3FF' ,marginRight:20}} onClick={toDataReacord(record)} >数据记录</a>
190
+      width: 240,
191
+      render: withActions((text, record) => [     
192
+        <EditIcon type="record" text="数据记录" onClick={toDataReacord(record)} />,
195 193
  
196 194
         <AuthButton name="admin.live.detail.get" noRight={null}>
197
-          <a style={{ color: '#66B3FF' }} onClick={toAddLive(record)} >查看详情</a>
198
-        </AuthButton>
199
-        </>
200
-      ),
195
+          <EditIcon type="look" text="查看详情" onClick={toAddLive(record)} />,
196
+        </AuthButton>,
197
+      ]),
201 198
     },
202 199
   ];
203 200
   const getSignList = dynamicId => {

+ 13
- 25
src/pages/building/type/index.jsx Прегледај датотеку

@@ -2,14 +2,14 @@ import React, { useState, useEffect } from 'react';
2 2
 import { Button, Table, Pagination, Alert, Icon, Tag, notification, Modal } from 'antd'
3 3
 import router from 'umi/router';
4 4
 import moment from 'moment';
5
-import Styles from './style.less'
5
+import withActions from '@/components/ActionList';
6
+import EditIcon from '@/components/EditIcon';
7
+import AuthButton from '@/components/AuthButton';
8
+
6 9
 import request from '../../../utils/request';
7 10
 import apis from '../../../services/apis';
8
-import AuthButton from '@/components/AuthButton';
9
-import { debuglog } from 'util';
10
-import EditIcon from '@/components/EditIcon';
11 11
 
12
-function body() {
12
+export default function BuildType() {
13 13
   // eslint-disable-next-line react-hooks/rules-of-hooks
14 14
   const [data, setData] = useState([{ records: [] }])
15 15
 
@@ -36,24 +36,14 @@ function body() {
36 36
       title: '操作',
37 37
       dataIndex: 'row',
38 38
       key: 'row',
39
-      render: (_, record) => (
40
-        <span >
41
-          <AuthButton name="admin.tdBuildingType.delete" noRight={null}>
42
-            <Button type="link" style={{
43
-              color: '#FF4A4A', right: '0',
44
-            }} onClick={() => deleteType(record)}>
45
-              <EditIcon text="删除" color='#FF4A4A' type="delete"></EditIcon>
46
-            </Button>
47
-          </AuthButton>
48
-          <AuthButton name="admin.tdBuildingType.update" noRight={null}>
49
-            <Button type="link" style={{
50
-              color: '#FF4A4A', right: '0',
51
-            }} onClick={() => toEdi(record.buildingTypeId)}>
52
-              <EditIcon text="编辑" color='#ff925c' type="edit"></EditIcon>
53
-            </Button>
54
-          </AuthButton>
55
-        </span>
56
-      ),
39
+      render: withActions((_, record) => [
40
+        <AuthButton name="admin.tdBuildingType.delete" noRight={null}>
41
+          <EditIcon text="删除" type="delete" onClick={() => deleteType(record)} />
42
+        </AuthButton>,
43
+        <AuthButton name="admin.tdBuildingType.update" noRight={null}>
44
+          <EditIcon text="编辑" type="edit" onClick={() => toEdi(record.buildingTypeId)} />
45
+        </AuthButton>,
46
+      ]),
57 47
     },
58 48
   ];
59 49
 
@@ -133,5 +123,3 @@ function body() {
133 123
     </>
134 124
   )
135 125
 }
136
-
137
-export default body

+ 16
- 20
src/pages/carouselFigure/advertisingList.jsx Прегледај датотеку

@@ -1,15 +1,15 @@
1 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';
2
+import { Form, Button, Select, message, Table, Pagination, Modal, DatePicker } from 'antd';
5 3
 import router from 'umi/router';
6 4
 import moment from 'moment';
5
+import AuthButton from '@/components/AuthButton';
6
+import withActions from '@/components/ActionList';
7
+import EditIcon from '@/components/EditIcon';
7 8
 import SelectCity from '../../components/SelectButton/CitySelect'
8 9
 import BuildSelect from '../../components/SelectButton/BuildSelect'
9 10
 import apis from '../../services/apis';
10 11
 import request from '../../utils/request';
11
-import AuthButton from '@/components/AuthButton';
12
-import EditIcon from '@/components/EditIcon';
12
+import styles from '../style/GoodsList.less';
13 13
 
14 14
 const { Option } = Select;
15 15
 const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
@@ -96,21 +96,17 @@ const header = (props) => {
96 96
       dataIndex: 'handle',
97 97
       key: 'handle',
98 98
       align: 'center',
99
-      render: (x, row) => (
100
-        <>
101
-          <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
102
-            <AuthButton name="admin.advert.publish" noRight={null}>
103
-              <span style={{ color: '#1990FF', marginRight: '20px', cursor: 'pointer' }} onClick={changeStatus(row)}>{row.status === 1 ? <EditIcon text="下架" color='#FF4A4A' type="down"></EditIcon> : <EditIcon text="上架" color='#ff925c' type="up"></EditIcon>}</span>
104
-            </AuthButton>
105
-            <AuthButton name="admin.advert.put" noRight={null}>
106
-              <span style={{ color: '#FF925C', marginRight: '20px', cursor: 'pointer' }} onClick={toEdit(row.contentId)}><EditIcon text="编辑" color='#ff925c' type="edit"></EditIcon></span>
107
-            </AuthButton>
108
-            <AuthButton name="admin.advert.delete" noRight={null}>
109
-              <span style={{ color: '#1990FF', cursor: 'pointer' }} onClick={deleteCarouse(row.contentId)}><EditIcon text="删除" color='#FF4A4A' type="delete"></EditIcon></span>
110
-            </AuthButton>
111
-          </div>
112
-        </>
113
-      )
99
+      render: withActions((x, row) => [
100
+        <AuthButton name="admin.advert.publish" noRight={null}>
101
+          <EditIcon text={row.status === 1 ? '下架' : '上架'} type={row.status === 1 ? 'down' : 'up'}  onClick={changeStatus(row)} />
102
+        </AuthButton>,
103
+        <AuthButton name="admin.advert.put" noRight={null}>
104
+          <EditIcon text="编辑" type="edit" onClick={toEdit(row.contentId)} />
105
+        </AuthButton>,
106
+        <AuthButton name="admin.advert.delete" noRight={null}>
107
+          <EditIcon text="删除" type="delete" onClick={deleteCarouse(row.contentId)}/>
108
+        </AuthButton>,
109
+      ])
114 110
     },
115 111
   ];
116 112
 

+ 18
- 20
src/pages/carouselFigure/carouselFigureList.jsx Прегледај датотеку

@@ -1,15 +1,15 @@
1 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';
2
+import { Form, Button, Select, message, Table, Pagination, Modal, DatePicker } from 'antd';
5 3
 import router from 'umi/router';
6 4
 import moment from 'moment';
5
+import AuthButton from '@/components/AuthButton';
6
+import withActions from '@/components/ActionList';
7
+import EditIcon from '@/components/EditIcon';
7 8
 import SelectCity from '../../components/SelectButton/CitySelect'
8 9
 import BuildSelect from '../../components/SelectButton/BuildSelect'
9 10
 import apis from '../../services/apis';
10 11
 import request from '../../utils/request';
11
-import AuthButton from '@/components/AuthButton';
12
-import EditIcon from '@/components/EditIcon';
12
+import styles from '../style/GoodsList.less';
13 13
 
14 14
 const { Option } = Select;
15 15
 const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
@@ -96,21 +96,19 @@ const header = (props) => {
96 96
       dataIndex: 'handle',
97 97
       key: 'handle',
98 98
       align: 'center',
99
-      render: (x, row) => (
100
-        <>
101
-          <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
102
-            <AuthButton name="admin.extendContent.publish" noRight={null}>
103
-              <span style={{ color: '#1990FF', marginRight: '20px', cursor: 'pointer' }} onClick={changeStatus(row)}>{row.status === 1 ? <EditIcon text="下架" color='#FF4A4A' type="down"></EditIcon> : <EditIcon text="上架" color='#ff925c' type="up"></EditIcon>}</span>
104
-            </AuthButton>
105
-            <AuthButton name="admin.extendContent.id.put" noRight={null}>
106
-              <span style={{ color: '#FF925C', marginRight: '20px', cursor: 'pointer' }} onClick={toEditCarouse(row.contentId)}><EditIcon text="编辑" color='#ff925c' type="edit"></EditIcon></span>
107
-            </AuthButton>
108
-            <AuthButton name="admin.extendContent.delete" noRight={null}>
109
-              <span style={{ color: '#1990FF', cursor: 'pointer' }} onClick={deleteCarouse(row.contentId)}><EditIcon text="删除" color='#FF4A4A' type="delete"></EditIcon></span>
110
-            </AuthButton>
111
-          </div>
112
-        </>
113
-      )
99
+      render: withActions((x, row) => [
100
+        <AuthButton name="admin.extendContent.publish" noRight={null}>
101
+          <EditIcon type={row.status === 1 ? 'cancel' : 'publish'} text={row.status === 1 ? '下架' : '上架'} onClick={changeStatus(row)} />
102
+        </AuthButton>,
103
+
104
+        <AuthButton name="admin.extendContent.id.put" noRight={null}>
105
+          <EditIcon text="编辑" type="edit" onClick={toEditCarouse(row.contentId)} />
106
+        </AuthButton>,
107
+
108
+        <AuthButton name="admin.extendContent.delete" noRight={null}>
109
+          <EditIcon text="删除" type="delete" onClick={deleteCarouse(row.contentId)} />
110
+        </AuthButton>,
111
+      ])
114 112
     },
115 113
   ];
116 114
 

+ 9
- 13
src/pages/carouselFigure/customImg/list.jsx Прегледај датотеку

@@ -1,15 +1,12 @@
1 1
 import React, { useState, useEffect } from 'react';
2
-import { Form, Input, Button, Icon, Select, message, Table, Divider, Tag, Pagination, Modal, Breadcrumb } from 'antd';
3
-import { FormattedMessage } from 'umi-plugin-react/locale';
4
-import styles from '../../style/GoodsList.less';
2
+import { Form, Table } from 'antd';
3
+import AuthButton from '@/components/AuthButton';
4
+import withActions from '@/components/ActionList';
5
+import EditIcon from '@/components/EditIcon';
5 6
 import router from 'umi/router';
6
-import BuildSelect from '../../../components/SelectButton/BuildSelect'
7 7
 import apis from '../../../services/apis';
8 8
 import request from '../../../utils/request'
9
-import AuthButton from '@/components/AuthButton';
10
-import EditIcon from '@/components/EditIcon';
11 9
 
12
-const { Option } = Select;
13 10
 const { Column } = Table;
14 11
 
15 12
 function header(props) {
@@ -68,13 +65,12 @@ function header(props) {
68 65
         <Column title="操作"
69 66
           dataIndex="handle"
70 67
           key="handle"
71
-          render={(text, record) => (
68
+          render={withActions((text, record) => [
72 69
             <AuthButton name="admin.custom.put" noRight={null}>
73
-              <span style={{ color: '#FF925C', cursor: 'pointer' }} onClick={toEditCustom(record.imgId, record.imgType)}>
74
-                <EditIcon text="编辑" color='#ff925c' type="edit"></EditIcon>
75
-              </span>
76
-            </AuthButton>
77
-          )} />/>
70
+              <EditIcon text="编辑" type="edit" onClick={toEditCustom(record.imgId, record.imgType)}></EditIcon>
71
+            </AuthButton>,
72
+          ])}
73
+        />
78 74
       </Table>,
79 75
     </>
80 76
   )

+ 16
- 20
src/pages/carouselFigure/propagandaList.jsx Прегледај датотеку

@@ -1,15 +1,15 @@
1 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';
2
+import { Form, Button, Select, message, Table, Pagination, Modal, DatePicker } from 'antd';
5 3
 import router from 'umi/router';
6 4
 import moment from 'moment';
5
+import AuthButton from '@/components/AuthButton';
6
+import EditIcon from '@/components/EditIcon';
7
+import withActions from '@/components/ActionList';
7 8
 import SelectCity from '../../components/SelectButton/CitySelect'
8 9
 import BuildSelect from '../../components/SelectButton/BuildSelect'
9 10
 import apis from '../../services/apis';
10 11
 import request from '../../utils/request';
11
-import AuthButton from '@/components/AuthButton';
12
-import EditIcon from '@/components/EditIcon';
12
+import styles from '../style/GoodsList.less';
13 13
 
14 14
 const { Option } = Select;
15 15
 const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
@@ -96,21 +96,17 @@ const header = (props) => {
96 96
       dataIndex: 'handle',
97 97
       key: 'handle',
98 98
       align: 'center',
99
-      render: (x, row) => (
100
-        <>
101
-          <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
102
-            <AuthButton name="admin.propaganda.publish" noRight={null}>
103
-              <span style={{ color: '#1990FF', marginRight: '20px', cursor: 'pointer' }} onClick={changeStatus(row)}>{row.status === 1 ? <EditIcon text="下架" color='#FF4A4A' type="down"></EditIcon> : <EditIcon text="上架" color='#ff925c' type="up"></EditIcon>}</span>
104
-            </AuthButton>
105
-            <AuthButton name="admin.propaganda.put" noRight={null}>
106
-              <span style={{ color: '#FF925C', marginRight: '20px', cursor: 'pointer' }} onClick={toEdit(row.contentId)}><EditIcon text="编辑" color='#ff925c' type="edit"></EditIcon></span>
107
-            </AuthButton>
108
-            <AuthButton name="admin.propaganda.delete" noRight={null}>
109
-              <span style={{ color: '#1990FF', cursor: 'pointer' }} onClick={deleteCarouse(row.contentId)}><EditIcon text="删除" color='#FF4A4A' type="delete"></EditIcon></span>
110
-            </AuthButton>
111
-          </div>
112
-        </>
113
-      )
99
+      render: withActions((x, row) => [
100
+        <AuthButton name="admin.propaganda.publish" noRight={null}>
101
+          <EditIcon text={row.status === 1 ? '下架': '上架'} type={row.status === 1 ? 'down': 'up'} onClick={changeStatus(row)} />
102
+        </AuthButton>,
103
+        <AuthButton name="admin.propaganda.put" noRight={null}>
104
+          <EditIcon text="编辑" type="edit" onClick={toEdit(row.contentId)} />
105
+        </AuthButton>,
106
+        <AuthButton name="admin.propaganda.delete" noRight={null}>
107
+          <EditIcon text="删除" type="delete" onClick={deleteCarouse(row.contentId)} />
108
+        </AuthButton>,
109
+      ])
114 110
     },
115 111
   ];
116 112
 

+ 10
- 33
src/pages/channel/channelList.jsx Прегледај датотеку

@@ -1,31 +1,13 @@
1 1
 import React, { useState, useEffect } from 'react';
2
-import { Input, Menu, Dropdown, Button, Icon, message, Table, Divider, Tag, Select, Pagination } from 'antd';
3
-import { FormattedMessage } from 'umi-plugin-react/locale';
4
-import channels from './channelList.less';
2
+import { Button, message, Table } from 'antd';
5 3
 import router from 'umi/router';
6
-import apis from '../../services/apis';
7
-import request from '../../utils/request';
8 4
 import AuthButton from '@/components/AuthButton';
9 5
 import ChannelSelect from '@/components/SelectButton/channelSelect';
6
+import withActions from '@/components/ActionList';
10 7
 import EditIcon from '@/components/EditIcon';
11
-
12
-const { Option } = Select;
13
-
14
-// const dataSource = [
15
-//   {
16
-//     key: '1',
17
-//     img: 'http://img0.imgtn.bdimg.com/it/u=4246326797,2657995307&fm=26&gp=0.jpg',
18
-//     name: '123',
19
-//     age: 32,
20
-//     address: '西湖区湖底公园1号',
21
-//   },
22
-//   {
23
-//     key: '2',
24
-//     img: '',
25
-//     age: 42,
26
-//     address: '西湖区湖底公园1号',
27
-//   },
28
-// ];
8
+import apis from '../../services/apis';
9
+import request from '../../utils/request';
10
+import channels from './channelList.less';
29 11
 
30 12
 const columns = [
31 13
   // {
@@ -79,13 +61,11 @@ const columns = [
79 61
     dataIndex: '',
80 62
     key: '',
81 63
     align: 'center',
82
-    render: (text, record) => (
64
+    render: withActions((text, record) => [
83 65
       <AuthButton name="admin.channel.id.put" noRight={null}>
84
-        <a style={{ display: 'flex', justifyContent: 'center' }} onClick={() => toedit(record.channelId)} >
85
-          <EditIcon text="编辑" color='#ff925c' type="edit"></EditIcon>
86
-        </a>
87
-      </AuthButton>
88
-    ),
66
+        <EditIcon text="编辑" type="edit" onClick={() => toedit(record.channelId)} />
67
+      </AuthButton>,
68
+    ]),
89 69
   },
90 70
 ];
91 71
 
@@ -122,7 +102,7 @@ function toBroker(record) {
122 102
   });
123 103
 }
124 104
 
125
-const header = props => {
105
+export default function ChannelList (props) {
126 106
   // eslint-disable-next-line react-hooks/rules-of-hooks
127 107
   const [data, setData] = useState({ channelNmae: [], result: [] })
128 108
   const [channelNmae, setChannelNmae] = useState()
@@ -210,6 +190,3 @@ const header = props => {
210 190
     </>
211 191
   )
212 192
 }
213
-
214
-
215
-export default header

+ 35
- 45
src/pages/integralMall/achieve.jsx Прегледај датотеку

@@ -1,44 +1,41 @@
1 1
 import React, { useState, useEffect } from 'react';
2
-import { Form, Input, Button, Icon, Tabs, Row, Col, Table, Pagination, Alert, message, Modal } from 'antd';
3
-import { FormattedMessage } from 'umi-plugin-react/locale';
4
-import styles from '../style/GoodsList.less';
2
+import { Form, Icon, Tabs, Table, Pagination, message, Modal } from 'antd';
5 3
 import router from 'umi/router';
6 4
 import moment from 'moment';
7
-import BuildSelect from '../../components/SelectButton/BuildSelect'
5
+import AuthButton from '@/components/AuthButton';
6
+import withActions from '@/components/ActionList';
7
+import EditIcon from '@/components/EditIcon';
8 8
 import apis from '../../services/apis';
9 9
 import request from '../../utils/request';
10
-import AuthButton from '@/components/AuthButton';
10
+import styles from '../style/GoodsList.less';
11 11
 
12 12
 const { TabPane } = Tabs;
13 13
 
14
-
15
-
16
-
17 14
 function header(props) {
18 15
   const [ carType, setCarType ] = useState({})
19 16
   const callback = (key) => {
20 17
     setCarType(key)
21 18
     getList({ pageNum: 1, pageSize: 10 , type: key});
22 19
   }
23
-  
24
-// 获取初始化数据
25
-const [ data, setData ] = useState({})
26
-
27
-useEffect(() => {
28
-  getList({ pageNum: 1, pageSize: 10 , type: 'platform'});
29
-},[])
30
-
31
-// 查询列表
32
-const getList = (params) => {
33
-  request({ ...apis.integralMall.tdPointsRules, params: { ...params },}).then((data) => {
34
-      console.log(data)
35
-      setData(data)
36
-  })
37
-}
20
+    
21
+  // 获取初始化数据
22
+  const [ data, setData ] = useState({})
23
+
24
+  useEffect(() => {
25
+    getList({ pageNum: 1, pageSize: 10 , type: 'platform'});
26
+  },[])
27
+
28
+  // 查询列表
29
+  const getList = (params) => {
30
+    request({ ...apis.integralMall.tdPointsRules, params: { ...params },}).then((data) => {
31
+        console.log(data)
32
+        setData(data)
33
+    })
34
+  }
38 35
 
39
-const changePageNum = (pageNumber) => {
40
-  getList({ pageNum: pageNumber, pageSize: 10, type: carType })
41
-}
36
+  const changePageNum = (pageNumber) => {
37
+    getList({ pageNum: pageNumber, pageSize: 10, type: carType })
38
+  }
42 39
 
43 40
 
44 41
   // 提交事件
@@ -51,19 +48,19 @@ const changePageNum = (pageNumber) => {
51 48
     });
52 49
   }
53 50
 
54
-  const changeStatus = (row) => () => {
51
+  const changeStatus = row => () => {
55 52
     const title = row.status === 1 ? '停用后用户操作将不再发放积分,请确认相关免责声明等文案已修订说明?':'启用后用户操作将发放积分'
56 53
 
57 54
     Modal.confirm({
58
-      title: title,
55
+      title,
59 56
       okText: '确认',
60 57
       cancelText: '取消',
61 58
       onOk() {
62
-        request({ ...apis.integralMall.change, data: { ...row },}).then((data) => {
59
+        request({ ...apis.integralMall.change, data: { ...row }}).then(data => {
63 60
           message.info('操作成功!')
64 61
           getList({ pageNum: 1, pageSize: 10, type: carType})
65 62
         })
66
-      }
63
+      },
67 64
     });
68 65
   }
69 66
 
@@ -114,24 +111,17 @@ const columns = [
114 111
       dataIndex: 'handle',
115 112
       key: 'handle',
116 113
       align: 'center',
117
-      render: (x,row) => (
118
-        <>
119
-          <AuthButton name="admin.tdPointsRules.change.put" noRight={null}>
120
-            <span style={{ color: '#EF273A', marginRight: '20px',cursor: 'pointer' }} onClick={changeStatus(row)}>
121
-              {row.status == 1?'停用':'启用'}<Icon type="stop" className={styles.shoppingCart} />
122
-            </span>
123
-          </AuthButton>
124
-          <AuthButton name="admin.tdPointsRules.put" noRight={null}>
125
-            <span style={{ color: '#FF925C',cursor: 'pointer' }} onClick={updateRules(row)}>
126
-                编辑{<Icon type="form" className={styles.edit} />} 
127
-            </span>
128
-          </AuthButton>
129
-        </>
130
-      ),
114
+      render: withActions((x,row) => [
115
+        <AuthButton name="admin.tdPointsRules.change.put" noRight={null}>
116
+          <EditIcon type={row.status === 1 ? 'stop' : 'start'} text={row.status === 1 ? '停用' : '启用'} onClick={changeStatus(row)} />
117
+        </AuthButton>,
118
+        <AuthButton name="admin.tdPointsRules.put" noRight={null}>
119
+          <EditIcon type="edit" text="编辑" onClick={updateRules(row)} />
120
+        </AuthButton>,
121
+      ]),
131 122
     },
132 123
   ];
133 124
 
134
-  const { getFieldDecorator } = props.form
135 125
   return (
136 126
     <>
137 127
       <Tabs onChange={callback} type="card">

+ 17
- 27
src/pages/news/type/NewsType.jsx Прегледај датотеку

@@ -1,18 +1,15 @@
1 1
 import React, { useState, useEffect } from 'react';
2
-import { Form, Input, Button, Icon, Select, message, Table, Divider, Tag, Pagination, Modal, Breadcrumb } from 'antd';
3
-import { FormattedMessage } from 'umi-plugin-react/locale';
4
-import styles from '../../style/GoodsList.less';
2
+import { Form, Button, message, Table, Pagination, Modal } from 'antd';
5 3
 import router from 'umi/router';
6
-import BuildSelect from '../../../components/SelectButton/BuildSelect';
7 4
 import AuthButton from '@/components/AuthButton';
5
+import withActions from '@/components/ActionList';
6
+import EditIcon from '@/components/EditIcon';
8 7
 import apis from '../../../services/apis';
9 8
 import request from '../../../utils/request'
10
-import EditIcon from '@/components/EditIcon';
11
-
12
-const { Option } = Select;
13
-
9
+import BuildSelect from '../../../components/SelectButton/BuildSelect';
10
+import styles from '../../style/GoodsList.less';
14 11
 
15
-function header(props) {
12
+function NewsType(props) {
16 13
   // 获取初始化数据
17 14
   const [data, setData] = useState({})
18 15
 
@@ -65,7 +62,6 @@ function header(props) {
65 62
       okText: '确认',
66 63
       cancelText: '取消',
67 64
       onOk() {
68
-
69 65
         request({ ...apis.newsType.put, urlData: { id: newsId }, data: { ...row, status: -1 } }).then((data) => {
70 66
           message.info('操作成功!')
71 67
           getList({ pageNum: 1, pageSize: 10 });
@@ -103,24 +99,17 @@ function header(props) {
103 99
       dataIndex: 'handle',
104 100
       key: 'handle',
105 101
       align: 'center',
106
-      render: (x, row) => (
107
-        <>
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' type="delete"></EditIcon> : <EditIcon text="上架" color='#ff925c' type="up"></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' type="edit"></EditIcon>
117
-              </span>
118
-            </AuthButton>
119
-          </div>
120
-        </>
121
-      ),
102
+      render: withActions((x, row) => [
103
+        <AuthButton name="admin.taNewsType.id.delete" noRight={null}>
104
+          <EditIcon text={row.status === 1 ? '删除' : '上架'} type={row.status === 1 ? 'delete' : 'up'} onClick={changeNewsStatus(row, row.newsTypeId)} />
105
+        </AuthButton>,
106
+        <AuthButton name="admin.taNewsType.id.put" noRight={null}>
107
+          <EditIcon text="编辑" type="edit" onClick={toEditNews(row.newsTypeId)} />
108
+        </AuthButton>,
109
+      ]),
122 110
     },
123 111
   ];
112
+  
124 113
   function handleReset() {
125 114
     props.form.resetFields();
126 115
     getList({ pageNum: 1, pageSize: 10 })
@@ -157,6 +146,7 @@ function header(props) {
157 146
     </>
158 147
   )
159 148
 }
160
-const WrappedHeader = Form.create({ name: 'header' })(header);
149
+
150
+const WrappedHeader = Form.create({ name: 'header' })(NewsType);
161 151
 
162 152
 export default WrappedHeader

+ 17
- 24
src/pages/staff/list/RoleList.jsx Прегледај датотеку

@@ -1,15 +1,14 @@
1 1
 
2 2
 import React, { useState, useEffect } from 'react';
3
-import { Form, Input, Button, Icon, Select, message, Table, Divider, Row, Col, Tag, Pagination, Modal, DatePicker } from 'antd';
4
-import { FormattedMessage } from 'umi-plugin-react/locale';
5
-import styles from '../../style/GoodsList.less';
3
+import { Button, message, Table, Modal } from 'antd';
4
+import withActions from '@/components/ActionList';
5
+import EditIcon from '@/components/EditIcon';
6 6
 import router from 'umi/router';
7
-import { Card, Avatar } from 'antd';
8 7
 import request from '../../../utils/request'
9 8
 import Styles from './style.less';
10 9
 import apis from '../../../services/apis';
11 10
 import AuthButton from '../../../components/AuthButton';
12
-import EditIcon from '@/components/EditIcon';
11
+import styles from '../../style/GoodsList.less';
13 12
 
14 13
 const header = props => {
15 14
   // function confirm(id) {
@@ -117,25 +116,19 @@ const header = props => {
117 116
       key: 'status',
118 117
       align: 'center',
119 118
 
120
-      render: (text, record) => <>
121
-        {record.isAdmin ? "" :
122
-          <>
123
-            <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
124
-              <AuthButton name="admin.role.publish" noRight={null}>
125
-                <span style={{ marginRight: '20px', cursor: 'pointer' }} onClick={() => stop(record.roleId, record.status)}>{record.status === 1 ? <EditIcon text="删除" color='#FF4A4A' type="delete"></EditIcon> : ''}
126
-                </span>
127
-              </AuthButton>
128
-              <AuthButton name="admin.role.put" noRight={null}>
129
-                <span style={{ cursor: 'pointer' }} onClick={() => toEditRole(record.roleId)} >
130
-                  <EditIcon text="编辑" color='#ff925c' type="edit"></EditIcon>
131
-                </span>
132
-              </AuthButton>
133
-            </div>
134
-          </>
135
-        }
136
-
137
-      </>,
138
-
119
+      render: withActions((text, record) => {
120
+        return record.isAdmin ? [] :
121
+          [
122
+            record.status === 1 ?
123
+            <AuthButton name="admin.role.publish" noRight={null}>
124
+              <EditIcon type="delete" text="删除" onClick={() => stop(record.roleId, record.status)} />
125
+            </AuthButton> : null,
126
+
127
+            <AuthButton name="admin.role.put" noRight={null}>
128
+              <EditIcon text="编辑" type="edit" onClick={() => toEditRole(record.roleId)} />
129
+            </AuthButton>,
130
+          ]
131
+      }),
139 132
     },
140 133
   ];
141 134