Yansen il y a 5 ans
Parent
révision
7dc6e942a4

+ 4
- 4
src/components/ActionList/index.jsx Voir le fichier

1
 import React from 'react';
1
 import React from 'react';
2
 import { Menu, Dropdown, Icon } from 'antd';
2
 import { Menu, Dropdown, Icon } from 'antd';
3
 
3
 
4
-import styles from './style.less';
4
+import './style.less';
5
 
5
 
6
 export default function withActions(actionsRender) {
6
 export default function withActions(actionsRender) {
7
   return function ActionList(text, record) {
7
   return function ActionList(text, record) {
9
     const [Act1, Act2, Act3, ...leftActs] = actions || [];
9
     const [Act1, Act2, Act3, ...leftActs] = actions || [];
10
 
10
 
11
     const menus = (
11
     const menus = (
12
-      <Menu>
12
+      <Menu className="actlist-menu">
13
         {(leftActs || []).map((Act, index) => (<Menu.Item key={`dm-${index}`}>{Act}</Menu.Item>))}
13
         {(leftActs || []).map((Act, index) => (<Menu.Item key={`dm-${index}`}>{Act}</Menu.Item>))}
14
       </Menu>
14
       </Menu>
15
     );
15
     );
16
 
16
 
17
     return (
17
     return (
18
-      <div className={styles['action-list']}>
18
+      <div className="action-list">
19
         {
19
         {
20
           Act1 && <span>{Act1}</span>
20
           Act1 && <span>{Act1}</span>
21
         }
21
         }
31
             <span>
31
             <span>
32
               <Dropdown overlay={menus} trigger={['click']}>
32
               <Dropdown overlay={menus} trigger={['click']}>
33
                 <a onClick={e => e.preventDefault()}>
33
                 <a onClick={e => e.preventDefault()}>
34
-                  更多 <Icon type="down" />
34
+                  <span>更多</span> <Icon type="down" />
35
                 </a>
35
                 </a>
36
               </Dropdown>
36
               </Dropdown>
37
             </span>
37
             </span>

+ 26
- 6
src/components/ActionList/style.less Voir le fichier

1
 
1
 
2
-.action-list {
3
-  display: inline-block;
4
-
5
-  span {
2
+:global{
3
+  .action-list {
6
     display: inline-block;
4
     display: inline-block;
7
-    & + span {
8
-      margin-left: 16px;
5
+  
6
+    span {
7
+      display: inline-block;
8
+      & + span {
9
+        margin-left: 16px;
10
+      }
11
+  
12
+      a {
13
+        color: #666;
14
+  
15
+        span {
16
+          color: #FF4A4A;
17
+        }
18
+      }
19
+    }
20
+  }
21
+  
22
+  .actlist-menu {
23
+    .ant-dropdown-menu-item {
24
+      color: #666 !important;
25
+
26
+      &:hover {
27
+        background-color: rgba(0,0,0, .1);
28
+      }
9
     }
29
     }
10
   }
30
   }
11
 }
31
 }

+ 30
- 32
src/pages/activity/helpActivity/list.jsx Voir le fichier

1
 import React, { useState, useEffect } from 'react';
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, DatePicker } from 'antd';
5
 import router from 'umi/router';
3
 import router from 'umi/router';
6
 import moment from 'moment';
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 Prompt from 'umi/prompt';
7
 import SelectCity from '../../../components/SelectButton/CitySelect'
9
 import SelectCity from '../../../components/SelectButton/CitySelect'
8
 import BuildSelect from '../../../components/SelectButton/BuildSelect'
10
 import BuildSelect from '../../../components/SelectButton/BuildSelect'
9
 import apis from '../../../services/apis';
11
 import apis from '../../../services/apis';
10
 import request from '../../../utils/request';
12
 import request from '../../../utils/request';
11
-import AuthButton from '@/components/AuthButton';
12
-import Prompt from 'umi/prompt';
13
+import styles from '../../style/GoodsList.less';
13
 
14
 
14
 const { Option } = Select;
15
 const { Option } = Select;
15
-const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
16
 
16
 
17
 const header = props => {
17
 const header = props => {
18
   const [data, setData] = useState({})
18
   const [data, setData] = useState({})
19
   //   const [page, changePage] = useState({})
19
   //   const [page, changePage] = useState({})
20
 
20
 
21
   useEffect(() => {
21
   useEffect(() => {
22
-
23
     if (localStorage.getItem("helpActivePageParams")) {
22
     if (localStorage.getItem("helpActivePageParams")) {
24
       props.form.setFieldsValue(JSON.parse(localStorage.getItem("helpActivePageParams")));
23
       props.form.setFieldsValue(JSON.parse(localStorage.getItem("helpActivePageParams")));
25
       // const { getFieldDecorator } = JSON.parse(localStorage.getItem("pageParams"))
24
       // const { getFieldDecorator } = JSON.parse(localStorage.getItem("pageParams"))
128
       dataIndex: 'handle',
127
       dataIndex: 'handle',
129
       key: 'handle',
128
       key: 'handle',
130
       align: 'center',
129
       align: 'center',
131
-      render: (x, row) => (
132
-        <>
133
-          {
134
-            <AuthButton name="admin.help.publish" noRight={null}>
135
-              <span style={{ color: '#1990FF', marginRight: '20px', cursor: 'pointer' }} onClick={sendOrPublicDynamic.bind(this, row)}>{row.status === 1 ? '取消发布' : '发布'}<Icon type="close-circle" className={styles.edit} /></span>
136
-            </AuthButton>
137
-          }
138
-          {row.activityStatus === 0 &&
139
-            <AuthButton name="admin.help.finish" noRight={null}>
140
-              <span style={{ color: '#1990FF', marginRight: '20px', cursor: 'pointer' }} onClick={topDynamic(row, 2)}>结束活动<Icon type="poweroff" style={{ color: '#bebebe' }} className={styles.edit} /></span> </AuthButton>
141
-          }
142
-          {
143
-            <AuthButton name="admin.help.tag" noRight={null}>
144
-              <span style={{ color: '#1990FF', marginRight: '20px', cursor: 'pointer' }} onClick={topDynamic(row, 0)}>{row.weight === 1 ? '取消标签' : '添加标签'}<Icon type="vertical-align-top" style={{ color: '#bebebe' }} className={styles.edit} /></span>
145
-            </AuthButton>}{
146
-            <AuthButton name="admin.help.top" noRight={null}>
147
-              <span style={{ color: '#1990FF', marginRight: '20px', cursor: 'pointer' }} onClick={topDynamic(row, 1)}>{row.isMain === true ? '取消推首页' : '推首页'}<Icon type="vertical-align-top" style={{ color: '#bebebe' }} className={styles.edit} /></span>
148
-            </AuthButton>}
149
-          {<span style={{ color: '#1990FF', marginRight: '20px', cursor: 'pointer' }} onClick={() => toDataReacord(row.helpActivityId)}>数据记录<Icon type="form" className={styles.edit} /></span>}
150
-          {(row.activityStatus === 1 || row.activityStatus === 0) &&
130
+      render: withActions((x, row) => [
131
+        <AuthButton name="admin.help.publish" noRight={null}>
132
+          <EditIcon type={row.status === 1 ? 'cancel' : 'publish'} text={row.status === 1 ? '取消发布' : '发布'} onClick={sendOrPublicDynamic.bind(this, row)} />
133
+        </AuthButton>,
134
+
135
+        row.activityStatus === 0 ?
136
+          <AuthButton name="admin.help.finish" noRight={null}>
137
+            <EditIcon type="end" text="结束活动" onClick={topDynamic(row, 2)} />
138
+          </AuthButton> : null,
139
+
140
+        <AuthButton name="admin.help.tag" noRight={null}>
141
+          <EditIcon type={row.weight === 1 ? 'cancel' : 'add'} text={row.weight === 1 ? '取消标签' : '添加标签'} onClick={topDynamic(row, 0)} />
142
+        </AuthButton>,
143
+
144
+        <AuthButton name="admin.help.top" noRight={null}>
145
+          <EditIcon type={row.isMain === 1 ? 'cancel' : 'add'} color="#666" text={row.isMain === 1 ? '取消推首页' : '推首页'} onClick={topDynamic(row, 1)} />
146
+        </AuthButton>,
147
+
148
+        <EditIcon type="record" text="数据记录" color="#666" onClick={() => toDataReacord(row.helpActivityId)} />,
149
+
150
+        (row.activityStatus === 1 || row.activityStatus === 0) ?
151
             <AuthButton name="admin.helpActivity.update.put" noRight={null}>
151
             <AuthButton name="admin.helpActivity.update.put" noRight={null}>
152
-              <span style={{ color: '#FF925C', marginRight: '20px', cursor: 'pointer' }} onClick={toEditGoods(row.helpActivityId)}>编辑<Icon type="form" style={{ color: '#bebebe' }} className={styles.edit} /></span>
153
-            </AuthButton>
154
-          }
155
-        </>
156
-      ),
152
+              <EditIcon color="#666" type="edit" text="编辑" onClick={toEditGoods(row.helpActivityId)} />
153
+            </AuthButton> : null,
154
+      ]),
157
     },
155
     },
158
   ];
156
   ];
159
 
157