zhoulisen 5 vuotta sitten
vanhempi
commit
6cf82b2a75
3 muutettua tiedostoa jossa 367 lisäystä ja 141 poistoa
  1. 6
    5
      config/routes.js
  2. 206
    0
      src/pages/resource/edit.jsx
  3. 155
    136
      src/pages/resource/index.jsx

+ 6
- 5
config/routes.js Näytä tiedosto

@@ -43,11 +43,12 @@ export default [
43 43
             name: '资源管理',
44 44
             component: './resource',
45 45
           },
46
-          // {
47
-          //   path: '/channel/edit',
48
-          //   name: '渠道列表',
49
-          //   component: './channel/edit',
50
-          // },
46
+          {
47
+            path: '/resource/edit',
48
+            name: '资源管理',
49
+            component: './resource/edit',
50
+          },
51
+         
51 52
           {
52 53
             component: './404',
53 54
           },

+ 206
- 0
src/pages/resource/edit.jsx Näytä tiedosto

@@ -0,0 +1,206 @@
1
+import React, { useState, useEffect } from 'react';
2
+import { Input, Modal, Menu, Dropdown, Button, Icon, message, Table, Divider, Tag, Select, Form, Alert } from 'antd';
3
+import { FormattedMessage } from 'umi-plugin-react/locale';
4
+import XForm, { FieldTypes } from '../../components/XForm';
5
+import router from 'umi/router';
6
+import apis from '../../services/apis';
7
+import request from '../../utils/request';
8
+import moment from 'moment';
9
+
10
+
11
+
12
+const header = props => {
13
+
14
+    const [data, setData] = useState({})
15
+
16
+    const [datas, setDatas] = useState([])//表格数据
17
+    const [visible, setVisible] = useState()
18
+    const [formsdate, setFormsDate] = useState({})
19
+    //   const [page, changePage] = useState({})
20
+    useEffect(() => {
21
+
22
+        setVisible(false)
23
+
24
+    }, [])
25
+    const ModalData = props => {
26
+        
27
+    const data = []
28
+
29
+    const columns = [
30
+        {
31
+            title: '样例名',
32
+            dataIndex: 'title',
33
+            key: 'title',
34
+            align: 'center',
35
+
36
+        },
37
+        {
38
+            title: '权重',
39
+            dataIndex: 'imgUrl',
40
+            key: 'imgUrl',
41
+            align: 'center',
42
+            
43
+        },
44
+        {
45
+            title: '新增人',
46
+            dataIndex: 'pointPrice',
47
+            key: 'pointPrice',
48
+            align: 'center',
49
+        },
50
+        {
51
+            title: '新增时间',
52
+            dataIndex: 'totalNum',
53
+            key: 'totalNum',
54
+            align: 'center',
55
+        },
56
+        {
57
+            title: '修改人',
58
+            dataIndex: 'status',
59
+            key: 'status',
60
+            align: 'center',
61
+            // render: (status) => <><span>{status == 1 ? '是' : '否'}</span></>
62
+        },
63
+        {
64
+            title: '修改时间',
65
+            dataIndex: 'inventory',
66
+            key: 'inventory',
67
+            align: 'center',
68
+        },
69
+    
70
+        {
71
+            title: '操作',
72
+            dataIndex: 'handle',
73
+            key: 'handle',
74
+            align: 'center',
75
+            render: (x, row) => (
76
+                <>
77
+
78
+
79
+                    <span style={{ color: '#FF925C', cursor: 'pointer' }} onClick={toEditGoods(row.goodsId)}>
80
+                        选择<Icon type="form" className={styles.edit} />
81
+                    </span>
82
+
83
+                </>
84
+            ),
85
+        },
86
+    ];
87
+        return (
88
+            <>
89
+                <div>
90
+                <Input placeholder="样例名" style={{ width: 200 }} />
91
+                <Button>搜索</Button><Button>重置</Button>
92
+                <Table  rowKey="goodsList" dataSource={data} columns={columns} pagination={false} />
93
+                </div>
94
+            </>
95
+        )
96
+    }
97
+
98
+    const onSelectBusiness = (e) => {
99
+        console.log('11111')
100
+
101
+    }
102
+
103
+    const fields = [
104
+        {
105
+            label: '通知标题',
106
+            name: 'channelProxyName',
107
+            type: FieldTypes.Text,
108
+            value: data.channelProxyName,
109
+            rules: [
110
+                { required: true, message: '请输入通知标题' },
111
+                { max: 20, message: '通知标题名称不超过20个字符' }
112
+            ]
113
+        },
114
+        {
115
+            label: '通知图',
116
+            name: 'channelImg',
117
+            type: FieldTypes.ImageUploader,
118
+            value: data.channelImg,
119
+            rules: [
120
+                { required: true, message: '请选择通知图' },
121
+            ],
122
+            help: '建议尺寸:N*N px,比例:N:N,格式:jpg,大小:不超过300KB,用于开屏通知主图',
123
+        },
124
+        {
125
+            label: '关联业务类型',
126
+            name: 'channelContactName',
127
+
128
+            value: data.channelContactName,
129
+            type: FieldTypes.Select,
130
+
131
+        },
132
+        {
133
+            label: '关联业务',
134
+            name: 'channelTel',
135
+            value: data.channelTel,
136
+            //   type: FieldTypes.Text,
137
+            render: (text, record) => <div style={{ display:'flex' }}><div onClick={handleShowModel}>选择关联业务</div><div>234</div></div>,
138
+        },
139
+        {
140
+            label: '发布状态',
141
+            name: 'userName',
142
+            type: FieldTypes.Text,
143
+            rules: [
144
+                { required: true, message: '请选择有效发布状态' },
145
+            ],
146
+
147
+        },
148
+        {
149
+            label: '自动下架时间',
150
+            name: 'expireDate',
151
+            type: FieldTypes.DatePicker,
152
+            value: data.expireDate != null ? moment(data.expireDate, 'YYYY-MM-DD') : null,
153
+
154
+            help: '下架时间仅支持未来时间,到达未来时间后系统自动将开屏通知发布状态修改为否'
155
+
156
+        },
157
+        {
158
+            label: '权重',
159
+            name: 'appMaxNum',
160
+            type: FieldTypes.Number,
161
+            value: data.appMaxNum,
162
+
163
+            help: '用于列表排序,越大越靠前'
164
+        },
165
+    ]
166
+
167
+    const handleSubmit = (values) => {
168
+
169
+    }
170
+    //model
171
+    const handleShowModel = val => {
172
+        setVisible(true);
173
+    }
174
+
175
+    const handleCancel = val => {
176
+        setVisible(false);
177
+    }
178
+
179
+    const cancelPage = () => {
180
+        router.push({
181
+            pathname: '/resource',
182
+        });
183
+    }
184
+
185
+    return (
186
+        <>
187
+            <div>
188
+                <XForm onSubmit={handleSubmit} onCancel={cancelPage} fields={fields}></XForm>
189
+                <Modal
190
+                    title="选择关联业务"
191
+                    visible={visible}
192
+                    //  onOk={handleOk}
193
+
194
+                    onCancel={handleCancel}
195
+                    footer={null}
196
+                >
197
+                    <ModalData></ModalData>
198
+                    {/* <Table rowSelection={rowSelection} rowKey="goodsList" dataSource={data} columns={columns} pagination={false} /> */}
199
+                </Modal>
200
+            </div>
201
+        </>
202
+    )
203
+}
204
+
205
+const WrappedNormalLoginForm = Form.create({ name: 'header' })(header);
206
+export default WrappedNormalLoginForm

+ 155
- 136
src/pages/resource/index.jsx Näytä tiedosto

@@ -1,6 +1,6 @@
1 1
 import React, { useState, useEffect } from 'react';
2 2
 import { PageHeaderWrapper } from '@ant-design/pro-layout';
3
-import { Form, Input, Button, Icon, Select, message, Table, Divider, Tag, Pagination, Modal,Breadcrumb } from 'antd';
3
+import { Form, Input, Button, Icon, Select, message, Table, Divider, Tag, Pagination, Modal, Breadcrumb } from 'antd';
4 4
 import router from 'umi/router';
5 5
 import moment from 'moment';
6 6
 import styles from './style.less';
@@ -12,184 +12,203 @@ function header(props) {
12 12
 
13 13
     const [houseIdList, setHouseIdList] = useState([])
14 14
 
15
+    useEffect(() => {
16
+        getList({ pageNum: 1, pageSize: 10 });
17
+    }, [])
18
+    // 查询列表
19
+    const getList = params => {
20
+        // request({ ...apis.house.taSalesBatch, params: { ...params } }).then(data => {
21
+        //     console.log(data)
22
+        //     setData(data)
23
+        // })
24
+    }
25
+
26
+    const toEditResource = (id) => () => {
27
+        router.push({
28
+          pathname: '/resource/edit',
29
+        //   query: {
30
+        //     id
31
+        //   },
32
+        });
33
+      }
34
+
15 35
     const handleSubmit = (e, props) => {
16 36
         e.preventDefault();
17
-       
18
-      }
19 37
 
20
-      function handleReset() {
38
+    }
39
+
40
+    function handleReset() {
21 41
         props.form.resetFields();
22 42
         // getList({ pageNum: 1, pageSize: 10 });
23
-      }
43
+    }
24 44
 
25
-      const toEditGoods = (goodsId) => () => {
26
-        // router.push({
27
-        //   pathname: '/integralMall/editGoods',
28
-        //   query: {
29
-        //     goodsId
30
-        //   },
31
-        // });
32
-      }
33
-
34
-      const toDelBatch = rowData => () =>{
45
+    const toDelBatch = rowData => () => {
35 46
         console.log(houseIdList, 'houseIdListhouseIdList')
36
-        if(houseIdList.length < 1){
37
-          openNotificationWithIcon('error', '请先选择需要删除的批次')
38
-          return
47
+        if (houseIdList.length < 1) {
48
+            openNotificationWithIcon('error', '请先选择需要删除的批次')
49
+            return
39 50
         }
40
-    
51
+
41 52
         Modal.confirm({
42
-          title: '确定删除批次信息吗',
43
-          okText: '确定',
44
-          cancelText: '取消',
45
-          onOk () {
46
-            // request({ ...apis.house.deleteTaSalesBatch, data: houseIdList, }).then((data) => {
47
-            //   message.info("操作成功")
48
-            //   getList({ pageNum: 1, pageSize: 10 });
49
-            // }).catch((err) => {
50
-            // })
51
-          },
53
+            title: '确定删除批次信息吗',
54
+            okText: '确定',
55
+            cancelText: '取消',
56
+            onOk() {
57
+                // request({ ...apis.house.deleteTaSalesBatch, data: houseIdList, }).then((data) => {
58
+                //   message.info("操作成功")
59
+                //   getList({ pageNum: 1, pageSize: 10 });
60
+                // }).catch((err) => {
61
+                // })
62
+            },
52 63
         });
53
-      }
64
+    }
54 65
 
55
-      const rowSelection = {
66
+    const rowSelection = {
56 67
         onChange: (selectedRowKeys, selectedRows) => {
57
-          console.log('selectedRowKeys:', selectedRowKeys, 'selectedRows: ', selectedRows);
58
-          setHouseIdList(selectedRows)
68
+            console.log('selectedRowKeys:', selectedRowKeys, 'selectedRows: ', selectedRows);
69
+            setHouseIdList(selectedRows)
59 70
         },
60
-      };
71
+    };
61 72
 
62
-      const data =[]
73
+    const changePageNum = pageNumber => {
74
+        // getList({ pageNum: pageNumber, pageSize: 10, ...props.form.getFieldsValue() })
75
+    }
63 76
 
64
-      const columns = [
77
+    const data = []
78
+
79
+    const columns = [
65 80
         {
66
-          title: '通知标题',
67
-          dataIndex: 'title',
68
-          key: 'title',
69
-          align: 'center',
70
-          render: (text, record) => <img src={record.imgUrl} className={styles.touxiang} />,
81
+            title: '通知标题',
82
+            dataIndex: 'title',
83
+            key: 'title',
84
+            align: 'center',
85
+
71 86
         },
72 87
         {
73
-          title: '通知图',
74
-          dataIndex: 'imgUrl',
75
-          key: 'imgUrl',
76
-          align: 'center',
77
-    
88
+            title: '通知图',
89
+            dataIndex: 'imgUrl',
90
+            key: 'imgUrl',
91
+            align: 'center',
92
+            render: (text, record) => <img src={record.imgUrl} className={styles.touxiang} />,
78 93
         },
79 94
         {
80
-          title: '关联业务类型',
81
-          dataIndex: 'pointPrice',
82
-          key: 'pointPrice',
83
-          align: 'center',
95
+            title: '关联业务类型',
96
+            dataIndex: 'pointPrice',
97
+            key: 'pointPrice',
98
+            align: 'center',
84 99
         },
85 100
         {
86
-          title: '关联业务',
87
-          dataIndex: 'totalNum',
88
-          key: 'totalNum',
89
-          align: 'center',
101
+            title: '关联业务',
102
+            dataIndex: 'totalNum',
103
+            key: 'totalNum',
104
+            align: 'center',
90 105
         },
91 106
         {
92
-          title: '发布状态',
93
-          dataIndex: 'status',
94
-          key: 'status',
95
-          align: 'center',
96
-        //   render: (status)=> <><span>{status == 1 ? '是' : '否'}</span></>
107
+            title: '发布状态',
108
+            dataIndex: 'status',
109
+            key: 'status',
110
+            align: 'center',
111
+            // render: (status) => <><span>{status == 1 ? '是' : '否'}</span></>
97 112
         },
98 113
         {
99
-          title: '自动下架时间',
100
-          dataIndex: 'inventory',
101
-          key: 'inventory',
102
-          align: 'center',
114
+            title: '自动下架时间',
115
+            dataIndex: 'inventory',
116
+            key: 'inventory',
117
+            align: 'center',
103 118
         },
104 119
         {
105
-          title: '权重',
106
-          dataIndex: 'status',
107
-          key: 'status',
108
-          align: 'center',
109
-         
120
+            title: '权重',
121
+            dataIndex: 'status',
122
+            key: 'status',
123
+            align: 'center',
124
+
110 125
         },
111 126
         {
112 127
             title: '新增时间',
113 128
             dataIndex: 'inventory',
114 129
             key: 'inventory',
115 130
             align: 'center',
116
-          },
131
+        },
117 132
         {
118
-          title: '操作',
119
-          dataIndex: 'handle',
120
-          key: 'handle',
121
-          align: 'center',
122
-          render: (x, row) => (
123
-            <>
124
-              
125
-            
126
-                <span style={{ color: '#FF925C',cursor: 'pointer' }} onClick={toEditGoods(row.goodsId)}>
127
-                  编辑<Icon type="form" className={styles.edit} />
128
-                </span>
129
-              
130
-            </>
131
-          ),
133
+            title: '操作',
134
+            dataIndex: 'handle',
135
+            key: 'handle',
136
+            align: 'center',
137
+            render: (x, row) => (
138
+                <>
139
+
140
+
141
+                    <span style={{ color: '#FF925C', cursor: 'pointer' }} onClick={toEditGoods(row.goodsId)}>
142
+                        编辑<Icon type="form" className={styles.edit} />
143
+                    </span>
144
+
145
+                </>
146
+            ),
132 147
         },
133
-      ];
148
+    ];
134 149
 
135 150
     const { getFieldDecorator } = props.form
136
-  return (
137
-
138
-    <>
139
-   <div>
140
-   <Form layout="inline" onSubmit={e => handleSubmit(e, props)}>
141
-        <Form.Item>
142
-          {getFieldDecorator('goodsName')(
143
-            <Input
144
-              prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
145
-              placeholder="通知标题"
146
-            />,
147
-          )}
148
-        </Form.Item>
149
-        <Form.Item>
150
-          {getFieldDecorator('status')(
151
-            <Select style={{ width: '180px' }} placeholder="关联业务类型">
152
-             
153
-            </Select>,
154
-          )}
155
-        </Form.Item>
156
-       
157
-        <Form.Item>
158
-          {getFieldDecorator('priceLesser')(
159
-            <Input
160
-              prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
161
-              placeholder="关联业务"
162
-            />,
163
-          )}
164
-        </Form.Item>
165
-        <Form.Item>
166
-          {getFieldDecorator('qbc')(
167
-            <Input
168
-              prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
169
-              placeholder="发布状态"
170
-            />,
171
-          )}
172
-           </Form.Item>
173
-        <Form.Item>
174
-          
175
-              <Button type="primary" htmlType="submit" className={styles.searchBtn}>
176
-                搜索
151
+    return (
152
+
153
+        <>
154
+            <div>
155
+                <Form layout="inline" onSubmit={e => handleSubmit(e, props)}>
156
+                    <Form.Item>
157
+                        {getFieldDecorator('goodsName')(
158
+                            <Input
159
+                                prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
160
+                                placeholder="通知标题"
161
+                            />,
162
+                        )}
163
+                    </Form.Item>
164
+                    <Form.Item>
165
+                        {getFieldDecorator('status')(
166
+                            <Select style={{ width: '180px' }} placeholder="关联业务类型">
167
+
168
+                            </Select>,
169
+                        )}
170
+                    </Form.Item>
171
+
172
+                    <Form.Item>
173
+                        {getFieldDecorator('priceLesser')(
174
+                            <Input
175
+                                prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
176
+                                placeholder="关联业务"
177
+                            />,
178
+                        )}
179
+                    </Form.Item>
180
+                    <Form.Item>
181
+                        {getFieldDecorator('qbc')(
182
+                            <Input
183
+                                prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
184
+                                placeholder="发布状态"
185
+                            />,
186
+                        )}
187
+                    </Form.Item>
188
+                    <Form.Item>
189
+
190
+                        <Button type="primary" htmlType="submit" className={styles.searchBtn}>
191
+                            搜索
177 192
               </Button>
178
-         {/*  */}
179
-            <Button style={{ marginLeft: 8 }} onClick={handleReset}>
180
-              重置
193
+                        {/*  */}
194
+                        <Button style={{ marginLeft: 8 }} onClick={handleReset}>
195
+                            重置
181 196
             </Button>
182
-        </Form.Item>
183
-      </Form>
197
+                    </Form.Item>
198
+                </Form>
199
+
200
+                <Button type="danger" className={styles.addBtn} onClick={toEditResource()}>新增</Button>
184 201
 
185
-      <Button type="danger" className={styles.addBtn} onClick={toEditGoods()}>新增</Button>
202
+                <Button type="primary" className={styles.addBtn} onClick={toDelBatch()} style={{ marginLeft: '30px' }} >删除</Button>
186 203
 
187
-      <Button type="danger" className={styles.addBtn} onClick={toDelBatch()} style={{marginLeft:'30px'}} >删除</Button>
204
+                <Table rowSelection={rowSelection} rowKey="goodsList" dataSource={data} columns={columns} pagination={false} />
188 205
 
189
-      <Table rowSelection={rowSelection} rowKey="goodsList" dataSource={data} columns={columns} pagination={false} />
190
-   </div>
191
-    </>
192
-  )
206
+                <div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
207
+                    {/* <Pagination showQuickJumper defaultCurrent={1} total={data.total} onChange={e => changePageNum(e)} current={data.current} /> */}
208
+                </div>
209
+            </div>
210
+        </>
211
+    )
193 212
 }
194 213
 
195 214
 const WrappedHeader = Form.create({ name: 'header' })(header);