Yansen 5 gadus atpakaļ
vecāks
revīzija
cc32c92cbf

+ 2
- 2
src/components/ActionList/style.less Parādīt failu

@@ -3,9 +3,9 @@
3 3
   display: inline-block;
4 4
 
5 5
   span {
6
+    display: inline-block;
6 7
     & + span {
7
-      display: inline-block;
8
-      margin-left: 8px;
8
+      margin-left: 16px;
9 9
     }
10 10
   }
11 11
 }

+ 19
- 24
src/components/EditIcon/index.jsx Parādīt failu

@@ -6,104 +6,99 @@ const spriteInfo = [
6 6
         name: '启用',
7 7
         type: 'start',
8 8
         pos: 0,
9
-        color: '#ff925c'
9
+        color: '#ff925c',
10 10
     },
11 11
     {
12 12
         name: '发布',
13 13
         type: 'publish',
14 14
         pos: -126,
15
-        color: '#ff925c'
15
+        color: '#ff925c',
16 16
     },
17 17
     {
18 18
         name: '上架',
19 19
         type: 'up',
20 20
         pos: -18,
21
-        color: '#ff925c'
21
+        color: '#ff925c',
22 22
     },
23 23
     {
24 24
         name: '编辑',
25 25
         type: 'edit',
26 26
         pos: -144,
27
-        color: '#ff925c'
27
+        color: '#ff925c',
28 28
     },
29 29
     {
30 30
         name: '取消',
31 31
         type: 'cancel',
32 32
         pos: -36,
33
-        color: '#FF4A4A'
33
+        color: '#FF4A4A',
34 34
     },
35 35
     {
36 36
         name: '停用',
37 37
         type: 'stop',
38 38
         pos: -162,
39
-        color: '#FF4A4A'
39
+        color: '#FF4A4A',
40 40
     },
41 41
     {
42 42
         name: '结束',
43 43
         type: 'end',
44 44
         pos: -54,
45
-        color: '#FF4A4A'
45
+        color: '#FF4A4A',
46 46
     },
47 47
     {
48 48
         name: '删除',
49 49
         type: 'delete',
50 50
         pos: -180,
51
-        color: '#FF4A4A'
51
+        color: '#FF4A4A',
52 52
     },
53 53
     {
54 54
         name: '查看',
55 55
         type: 'look',
56 56
         pos: -72,
57
-        color: '#FF4A4A'
57
+        color: '#FF4A4A',
58 58
     },
59 59
     {
60 60
         name: '添加',
61 61
         type: 'add',
62 62
         pos: -198,
63
-        color: '#FF4A4A'
63
+        color: '#FF4A4A',
64 64
     },
65 65
     {
66 66
         name: '前置',
67 67
         type: 'top',
68 68
         pos: -90,
69
-        color: '#FF4A4A'
69
+        color: '#FF4A4A',
70 70
     },
71 71
     {
72 72
         name: '下架',
73 73
         type: 'down',
74 74
         pos: -216,
75
-        color: '#FF4A4A'
75
+        color: '#FF4A4A',
76 76
     },
77 77
     {
78 78
         name: '记录',
79 79
         type: 'record',
80 80
         pos: -108,
81
-        color: '#FF4A4A'
81
+        color: '#FF4A4A',
82 82
     },
83
-
84 83
 ]
85 84
 
86
-const EditIcon = ({ text, type, color, position }) => {
85
+function noop() {}
86
+
87
+const EditIcon = ({ text, type, color, position, onClick }) => {
87 88
 
88 89
     const icon = spriteInfo.filter(x => x.type === type)[0];
89 90
     const color2 = color || icon.color;
90 91
     const position2 = position || icon.pos;
91 92
 
92
-    const wrappedStyle = useMemo(() => ({ color: `${color2}`, display: 'flex', alignItems: 'center' }), [color]);
93
+    const wrappedStyle = useMemo(() => ({ color: `${color2}`, display: 'flex', alignItems: 'center', cursor: 'pointer' }), [color]);
93 94
     const iconStyle = useMemo(() => ({ display: 'inline-block', marginLeft: '6px', background: `url(${spriteImg}) 0 ${position2}px / 100% 1300% no-repeat`, width: '18px', height: '18px' }), [position])
94 95
 
95
-
96
-
97 96
     return (
98
-
99
-        <span style={wrappedStyle} >
97
+        <span style={wrappedStyle} onClick={onClick || noop} >
100 98
             {text}
101 99
             <span style={iconStyle}></span>
102 100
         </span>
103
-
104
-
105 101
     )
106
-
107 102
 };
108 103
 
109
-export default EditIcon;
104
+export default EditIcon;

+ 7
- 7
src/pages/integralMall/GoodsList.jsx Parādīt failu

@@ -3,6 +3,7 @@ import { Form, Input, Button, Icon, Select, message, Table, Pagination, Modal }
3 3
 import router from 'umi/router';
4 4
 import AuthButton from '@/components/AuthButton';
5 5
 import withActions from '@/components/ActionList';
6
+import EditIcon from '@/components/EditIcon';
6 7
 import BuildSelect from '../../components/SelectButton/BuildSelect'
7 8
 import apis from '../../services/apis';
8 9
 import request from '../../utils/request'
@@ -136,15 +137,14 @@ function header(props) {
136 137
       align: 'center',
137 138
       render: withActions((x, row) => [
138 139
           <AuthButton name="admin.taGoods.change.put" noRight={null}>
139
-            <span style={{ color: '#EF273A', marginRight: '20px', cursor: 'pointer' }} onClick={changeGoodsStatus(row)}>
140
-              {row.status === 1 ? '下架' : '上架'}
141
-              <Icon type="shopping-cart" className={styles.shoppingCart} />
142
-            </span>
140
+            {
141
+              row.status === 1 ?
142
+              <EditIcon onClick={changeGoodsStatus(row)} type="down" text="下架" /> :
143
+              <EditIcon onClick={changeGoodsStatus(row)} type="up" text="上架" />
144
+            }
143 145
           </AuthButton>,
144 146
           <AuthButton name="admin.taGoods.put" noRight={null}>
145
-            <span style={{ color: '#FF925C', cursor: 'pointer' }} onClick={toEditGoods(row.goodsId)}>
146
-              编辑<Icon type="form" className={styles.edit} />
147
-            </span>
147
+            <EditIcon onClick={toEditGoods(row.goodsId)} type="edit" text="编辑" />
148 148
           </AuthButton>,
149 149
         ]),
150 150
     },