xujing 5 anos atrás
pai
commit
c8ee536e88

+ 18
- 14
src/pages/channel/addChannel.jsx Ver arquivo

@@ -22,22 +22,24 @@ const header = props => {
22 22
     request({ ...apis.channelList.addChannel, data: { ...params } }).then((data) => {
23 23
       setData(data)
24 24
       router.go(-1)
25
-  }).catch((err) => {
25
+    }).catch((err) => {
26 26
       console.log(err)
27 27
       message.info(err.msg || err.message)
28
-  })
28
+    })
29 29
   }
30 30
 
31
-  function handleSubmit (e) {
31
+  function handleSubmit(e) {
32 32
     e.preventDefault();
33 33
     props.form.validateFields((err, values) => {
34 34
       if (!err) {
35 35
         console.log('Received values of form: ', values);
36 36
         // eslint-disable-next-line max-len
37
-        addChannel({ channelName: values.channelName,
38
-                     channelContact: values.channelContact,
39
-                     contactTel: values.contactTel,
40
-                     explain: values.explain })
37
+        addChannel({
38
+          channelName: values.channelName,
39
+          channelContact: values.channelContact,
40
+          contactTel: values.contactTel,
41
+          explain: values.explain
42
+        })
41 43
       }
42 44
     });
43 45
   }
@@ -63,16 +65,18 @@ const header = props => {
63 65
           })(<Input className={channels.inpuit} />)}
64 66
         </Form.Item>
65 67
         <Form.Item label="说明描述">
66
-        {getFieldDecorator('explain', {
67
-        })(<TextArea className={channels.inpuitTxt} rows={8} />)}
68
+          {getFieldDecorator('explain', {
69
+          })(<TextArea className={channels.inpuitTxt} rows={8} />)}
68 70
         </Form.Item>
69
-        <Form.Item wrapperCol={{ span: 15, offset: 7 }}>
70
-          <Button type="primary" htmlType="submit">
71
-            保存
71
+        <Form.Item wrapperCol={{ span: 15, offset: 8 }}>
72
+          <div style={{ width: '190px' }}>
73
+            <Button type="primary" htmlType="submit">
74
+              保存
72 75
           </Button>
73
-          <Button className={channels.formButton} onClick={() => router.go(-1)} type="primary" htmlType="submit">
74
-            取消
76
+            <Button className={channels.formButton} onClick={() => router.go(-1)} htmlType="submit">
77
+              取消
75 78
           </Button>
79
+          </div>
76 80
         </Form.Item>
77 81
       </Form>
78 82
     </>

+ 15
- 12
src/pages/channel/channelList.jsx Ver arquivo

@@ -7,6 +7,7 @@ import apis from '../../services/apis';
7 7
 import request from '../../utils/request';
8 8
 import AuthButton from '@/components/AuthButton';
9 9
 import ChannelSelect from '@/components/SelectButton/channelSelect';
10
+import EditIcon from '@/components/EditIcon';
10 11
 
11 12
 const { Option } = Select;
12 13
 
@@ -65,7 +66,7 @@ const columns = [
65 66
     dataIndex: 'brokerCount',
66 67
     key: 'brokerCount',
67 68
     align: 'center',
68
-      render: (text, record) => <a style={ { color: '#66B3FF' } } onClick= {() => toBroker(record)} >{ record.brokerCount }</a>,
69
+    render: (text, record) => <a style={{ color: '#66B3FF' }} onClick={() => toBroker(record)} >{record.brokerCount}</a>,
69 70
   },
70 71
   {
71 72
     title: '推荐客户有效数',
@@ -80,7 +81,9 @@ const columns = [
80 81
     align: 'center',
81 82
     render: (text, record) => (
82 83
       <AuthButton name="admin.channel.id.put" noRight={null}>
83
-        <a style={{ color: '#66B3FF' }} onClick={() => toedit(record.channelId)} >编辑</a>
84
+        <a style={{ display: 'flex', justifyContent: 'center' }} onClick={() => toedit(record.channelId)} >
85
+          <EditIcon text="编辑" color='#ff925c' position="-144"></EditIcon>
86
+        </a>
84 87
       </AuthButton>
85 88
     ),
86 89
   },
@@ -128,14 +131,14 @@ const header = props => {
128 131
     localStorage.removeItem('value');
129 132
     getList({ pageNum: 1, pageSize: 10 })
130 133
   }, [])
131
- 
134
+
132 135
   function getList(params) {
133 136
     request({ ...apis.channelList.getList, params: { ...params } }).then((data) => {
134 137
       setData(data)
135
-  }).catch((err) => {
138
+    }).catch((err) => {
136 139
       console.log(err)
137 140
       message.info(err.msg || err.message)
138
-  })
141
+    })
139 142
   }
140 143
   // value 的值
141 144
   function handleChange(value) {
@@ -144,7 +147,7 @@ const header = props => {
144 147
   }
145 148
   // 查询
146 149
   function queryList() {
147
-   
150
+
148 151
     getList({ pageNum: 1, pageSize: 10, channelId: channelNmae })
149 152
   }
150 153
   // 重置
@@ -182,22 +185,22 @@ const header = props => {
182 185
     <>
183 186
       <div className={channels.searchBox}>
184 187
         <div>
185
-        <span className={channels.selectName}>渠道名称</span>
186
-        <ChannelSelect value={channelNmae} onChange={onChannelChange}></ChannelSelect>
188
+          <span className={channels.selectName}>渠道名称</span>
189
+          <ChannelSelect value={channelNmae} onChange={onChannelChange}></ChannelSelect>
187 190
           {/* 
188 191
           <Select defaultValue="请选择" style={{ width: 180 }} onChange={handleChange}>
189 192
             <option value="">全部</option>
190 193
             {data.channelNmae.map(Item =>
191 194
               <Option value={Item.channelId}> {Item.channelName} </Option>,
192 195
             )} */}
193
-            {/* {listItems} */}
196
+          {/* {listItems} */}
194 197
           {/* </Select> */}
195 198
         </div>
196 199
         <div >
197
-        <AuthButton name="admin.channel.search" noRight={null}>
198
-          <Button type="primary" onClick={() => queryList()}>查询</Button>
200
+          <AuthButton name="admin.channel.search" noRight={null}>
201
+            <Button type="primary" onClick={() => queryList()}>搜索</Button>
199 202
           </AuthButton>
200
-          <Button onClick={() => reset() } style={{marginLeft:'8px'}}>重置</Button>
203
+          <Button onClick={() => reset()} style={{ marginLeft: '8px' }}>重置</Button>
201 204
         </div>
202 205
       </div>
203 206
       <AuthButton name="admin.channel.post" noRight={null}>

+ 19
- 17
src/pages/channel/editChannel.jsx Ver arquivo

@@ -15,26 +15,26 @@ const header = props => {
15 15
   useEffect(() => {
16 16
     getById()
17 17
   }, [])
18
-  
19
-  
18
+
19
+
20 20
   // 查询当前信息
21 21
   function getById(params) {
22 22
     request({ ...apis.channelList.getById, urlData: { id: props.location.query.id } }).then((data) => {
23 23
       props.form.setFieldsValue(data)
24
-  }).catch((err) => {
24
+    }).catch((err) => {
25 25
       console.log(err)
26 26
       message.info(err.msg || err.message)
27
-  })
27
+    })
28 28
   }
29 29
 
30 30
   // 编辑
31 31
   function editChannel(data) {
32 32
     request({ ...apis.channelList.editChannel, urlData: { id: props.location.query.id }, data: { ...data } }).then((data) => {
33 33
       router.go(-1)
34
-  }).catch((err) => {
34
+    }).catch((err) => {
35 35
       console.log(err)
36 36
       message.info(err.msg || err.message)
37
-  })
37
+    })
38 38
   }
39 39
 
40 40
 
@@ -56,8 +56,8 @@ const header = props => {
56 56
   const { getFieldDecorator } = props.form;
57 57
 
58 58
   return (
59
-  <>
60
-        <Form labelCol={{ span: 6 }} wrapperCol={{ span: 12 }} onSubmit={handleSubmit}>
59
+    <>
60
+      <Form labelCol={{ span: 6 }} wrapperCol={{ span: 12 }} onSubmit={handleSubmit}>
61 61
         <Form.Item label="渠道名称">
62 62
           {getFieldDecorator('channelName', {
63 63
             rules: [{ required: true, message: '请输入渠道名称' }],
@@ -74,20 +74,22 @@ const header = props => {
74 74
           })(<Input className={channels.inpuit} />)}
75 75
         </Form.Item>
76 76
         <Form.Item label="说明描述">
77
-        {getFieldDecorator('explain', {
78
-        })(<TextArea className={channels.inpuitTxt} rows={8} />)}
77
+          {getFieldDecorator('explain', {
78
+          })(<TextArea className={channels.inpuitTxt} rows={8} />)}
79 79
         </Form.Item>
80
-        <Form.Item wrapperCol={{ span: 15, offset: 7 }}>
81
-          <Button type="primary" htmlType="submit">
82
-            保存
80
+        <Form.Item wrapperCol={{ span: 15, offset: 8 }}>
81
+          <div style={{ width: '190px' }}>
82
+            <Button type="primary" htmlType="submit">
83
+              保存
83 84
           </Button>
84
-          <Button className={channels.formButton} onClick = { go } type="primary" htmlType="submit">
85
-            取消
85
+            <Button className={channels.formButton} onClick={go} htmlType="submit">
86
+              取消
86 87
           </Button>
88
+          </div>
87 89
         </Form.Item>
88 90
       </Form>
89
-  </>
90
-)
91
+    </>
92
+  )
91 93
 }
92 94
 const WrappedNormalLoginForm = Form.create({ name: 'header' })(header);
93 95
 export default WrappedNormalLoginForm

+ 28
- 25
src/pages/news/type/NewsType.jsx Ver arquivo

@@ -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
   )