zlisen 3 vuotta sitten
vanhempi
commit
a6ba000d4e

+ 1
- 1
config/proxy.js Näytä tiedosto

17
   },
17
   },
18
   test: {
18
   test: {
19
     '/api/': {
19
     '/api/': {
20
-      target: 'https://preview.pro.ant.design',
20
+      target: 'https://xlk.njyz.tech',
21
       changeOrigin: true,
21
       changeOrigin: true,
22
       pathRewrite: {
22
       pathRewrite: {
23
         '^': '',
23
         '^': '',

+ 161
- 93
src/pages/carouselFigure/carouselFigureList.jsx Näytä tiedosto

6
 import withActions from '@/components/ActionList';
6
 import withActions from '@/components/ActionList';
7
 import EditIcon from '@/components/EditIcon';
7
 import EditIcon from '@/components/EditIcon';
8
 import Navigate from '@/components/Navigate';
8
 import Navigate from '@/components/Navigate';
9
-import SelectCity from '../../components/SelectButton/CitySelect'
10
-import BuildSelect from '../../components/SelectButton/BuildSelect'
9
+import SelectCity from '../../components/SelectButton/CitySelect';
10
+import BuildSelect from '../../components/SelectButton/BuildSelect';
11
 import apis from '../../services/apis';
11
 import apis from '../../services/apis';
12
 import request from '../../utils/request';
12
 import request from '../../utils/request';
13
 import styles from '../style/GoodsList.less';
13
 import styles from '../style/GoodsList.less';
14
+import {getImgURL} from '../../utils/image';
14
 
15
 
15
 const { Option } = Select;
16
 const { Option } = Select;
16
 
17
 
17
-const header = (props) => {
18
-  const [data, setData] = useState({})
18
+const header = props => {
19
+  const [data, setData] = useState({});
19
 
20
 
20
   useEffect(() => {
21
   useEffect(() => {
21
     getList({ pageNum: 1, pageSize: 10, showType: 'banner' });
22
     getList({ pageNum: 1, pageSize: 10, showType: 'banner' });
22
-  }, [])
23
+  }, []);
23
 
24
 
24
   // 查询列表
25
   // 查询列表
25
-  const getList = (params) => {
26
-    request({ ...apis.carsuseFigure.extendContent, params: { ...params }, }).then((data) => {
27
-      console.log(data)
28
-      setData(data)
29
-    })
30
-  }
31
-
26
+  const getList = params => {
27
+    request({ ...apis.carsuseFigure.extendContent, params: { ...params } }).then(data => {
28
+      console.log(data);
29
+      setData(data);
30
+    });
31
+  };
32
 
32
 
33
   // 跳转到编辑页面
33
   // 跳转到编辑页面
34
-  const toEditCarouse = (contentId) => () => {
34
+  const toEditCarouse = contentId => () => {
35
     router.push({
35
     router.push({
36
       pathname: '/carouselFigure/editCarousel',
36
       pathname: '/carouselFigure/editCarousel',
37
       query: {
37
       query: {
38
-        contentId
38
+        contentId,
39
       },
39
       },
40
     });
40
     });
41
-  }
41
+  };
42
 
42
 
43
   const columns = [
43
   const columns = [
44
     {
44
     {
46
       dataIndex: 'image',
46
       dataIndex: 'image',
47
       key: 'image',
47
       key: 'image',
48
       align: 'center',
48
       align: 'center',
49
-      render: (x, row) => <Navigate onClick={toEditCarouse(row.contentId)} ><img src={row.image} className={row.showPosition === 'index' ? styles.imgIndex : row.showPosition === 'mall' ? styles.imgPerfect : ''} /></Navigate>,
49
+      render: (x, row) => (
50
+        <Navigate onClick={toEditCarouse(row.contentId)}>
51
+          <img
52
+            src={getImgURL(row.image)}
53
+            className={
54
+              row.showPosition === 'index'
55
+                ? styles.imgIndex
56
+                : row.showPosition === 'mall'
57
+                ? styles.imgPerfect
58
+                : ''
59
+            }
60
+          />
61
+        </Navigate>
62
+      ),
50
     },
63
     },
51
     {
64
     {
52
       title: '发布城市',
65
       title: '发布城市',
59
       dataIndex: 'buildingName',
72
       dataIndex: 'buildingName',
60
       key: 'buildingName',
73
       key: 'buildingName',
61
       align: 'center',
74
       align: 'center',
62
-      render: (buildingName) => <span>{buildingName === null ? '无' : buildingName}</span>
75
+      render: buildingName => <span>{buildingName === null ? '无' : buildingName}</span>,
63
     },
76
     },
64
     {
77
     {
65
       title: '关联内容类型',
78
       title: '关联内容类型',
66
       dataIndex: 'contentType',
79
       dataIndex: 'contentType',
67
       key: 'contentType',
80
       key: 'contentType',
68
       align: 'center',
81
       align: 'center',
69
-      render: (contentType) => <span>{contentType === 'project' ? '项目' : contentType === 'activity' ? '活动' : contentType === 'news' ? '资讯' : contentType === 'other' ? '其他' :
70
-        contentType === 'help' ? '助力' : contentType === 'group' ? '拼团' : contentType === 'h5' ? 'H5活动' : contentType === 'salesBatch' ? '销售批次详情' : contentType === 'live' ? '直播活动详情' : '无'}</span>
82
+      render: contentType => (
83
+        <span>
84
+          {contentType === 'project'
85
+            ? '项目'
86
+            : contentType === 'activity'
87
+            ? '活动'
88
+            : contentType === 'news'
89
+            ? '资讯'
90
+            : contentType === 'other'
91
+            ? '其他'
92
+            : contentType === 'help'
93
+            ? '助力'
94
+            : contentType === 'group'
95
+            ? '拼团'
96
+            : contentType === 'h5'
97
+            ? 'H5活动'
98
+            : contentType === 'salesBatch'
99
+            ? '销售批次详情'
100
+            : contentType === 'live'
101
+            ? '直播活动详情'
102
+            : '无'}
103
+        </span>
104
+      ),
71
     },
105
     },
72
     {
106
     {
73
       title: '发布位置',
107
       title: '发布位置',
74
       dataIndex: 'showPosition',
108
       dataIndex: 'showPosition',
75
       key: 'showPosition',
109
       key: 'showPosition',
76
       align: 'center',
110
       align: 'center',
77
-      render: (showPosition) => <span>{showPosition === 'index' ? '首页' : showPosition === 'mall' ? '商城' : ''}</span>
111
+      render: showPosition => (
112
+        <span>{showPosition === 'index' ? '首页' : showPosition === 'mall' ? '商城' : ''}</span>
113
+      ),
78
     },
114
     },
79
     {
115
     {
80
       title: '发布时间',
116
       title: '发布时间',
81
       dataIndex: 'createDate',
117
       dataIndex: 'createDate',
82
       key: 'createDate',
118
       key: 'createDate',
83
       align: 'center',
119
       align: 'center',
84
-      render: (x, row) => <><span>{moment(row.createDate).format('YYYY-MM-DD')}</span></>
120
+      render: (x, row) => (
121
+        <>
122
+          <span>{moment(row.createDate).format('YYYY-MM-DD')}</span>
123
+        </>
124
+      ),
85
     },
125
     },
86
     {
126
     {
87
       title: '状态',
127
       title: '状态',
88
       dataIndex: 'status',
128
       dataIndex: 'status',
89
       key: 'status',
129
       key: 'status',
90
       align: 'center',
130
       align: 'center',
91
-      render: (status) => <><span>{status == 1 ? '已上架' : '已下架'}</span></>
131
+      render: status => (
132
+        <>
133
+          <span>{status == 1 ? '已上架' : '已下架'}</span>
134
+        </>
135
+      ),
92
     },
136
     },
93
     {
137
     {
94
       title: '操作',
138
       title: '操作',
97
       align: 'center',
141
       align: 'center',
98
       render: withActions((x, row) => [
142
       render: withActions((x, row) => [
99
         <AuthButton name="admin.extendContent.publish" noRight={null}>
143
         <AuthButton name="admin.extendContent.publish" noRight={null}>
100
-          <EditIcon type={row.status === 1 ? 'down' : 'up'} text={row.status === 1 ? '下架' : '上架'} onClick={changeStatus(row)} />
144
+          <EditIcon
145
+            type={row.status === 1 ? 'down' : 'up'}
146
+            text={row.status === 1 ? '下架' : '上架'}
147
+            onClick={changeStatus(row)}
148
+          />
101
         </AuthButton>,
149
         </AuthButton>,
102
 
150
 
103
         <AuthButton name="admin.extendContent.id.put" noRight={null}>
151
         <AuthButton name="admin.extendContent.id.put" noRight={null}>
107
         <AuthButton name="admin.extendContent.delete" noRight={null}>
155
         <AuthButton name="admin.extendContent.delete" noRight={null}>
108
           <EditIcon text="删除" type="delete" onClick={deleteCarouse(row.contentId)} />
156
           <EditIcon text="删除" type="delete" onClick={deleteCarouse(row.contentId)} />
109
         </AuthButton>,
157
         </AuthButton>,
110
-      ])
158
+      ]),
111
     },
159
     },
112
   ];
160
   ];
113
 
161
 
114
-  const finishDynamic = (row) => {
162
+  const finishDynamic = row => {
115
     Modal.confirm({
163
     Modal.confirm({
116
       title: '结束以后将无法编辑, 是否继续?',
164
       title: '结束以后将无法编辑, 是否继续?',
117
       okText: '确定',
165
       okText: '确定',
118
       cancelText: '取消',
166
       cancelText: '取消',
119
       onOk() {
167
       onOk() {
120
-        request({ ...apis.carsuseFigure.finish, data: { dynamicId: row.dynamicId, top: "" }, }).then((data) => {
121
-          console.log(data)
122
-          message.info('操作成功!')
123
-          getList({ pageNum: 1, pageSize: 10, showType: 'banner' })
124
-        }).catch((err) => {
125
-          console.log(err)
126
-          message.info(err.msg || err.message)
127
-        })
168
+        request({ ...apis.carsuseFigure.finish, data: { dynamicId: row.dynamicId, top: '' } })
169
+          .then(data => {
170
+            console.log(data);
171
+            message.info('操作成功!');
172
+            getList({ pageNum: 1, pageSize: 10, showType: 'banner' });
173
+          })
174
+          .catch(err => {
175
+            console.log(err);
176
+            message.info(err.msg || err.message);
177
+          });
128
       },
178
       },
129
     });
179
     });
130
-  }
180
+  };
131
 
181
 
132
   //删除
182
   //删除
133
-  const deleteCarouse = (contentId) => () => {
183
+  const deleteCarouse = contentId => () => {
134
     Modal.confirm({
184
     Modal.confirm({
135
       title: '确认删除此数据?',
185
       title: '确认删除此数据?',
136
       okText: '确定',
186
       okText: '确定',
137
       cancelText: '取消',
187
       cancelText: '取消',
138
       onOk() {
188
       onOk() {
139
-        request({ ...apis.carsuseFigure.deleteExtendContent, urlData: { id: contentId } }).then((data) => {
140
-          message.info('操作成功!')
141
-          getList({ pageNum: 1, pageSize: 10, showType: 'banner' })
142
-        }).catch((err) => {
143
-          console.log(err)
144
-          message.info(err.msg || err.message)
145
-        })
189
+        request({ ...apis.carsuseFigure.deleteExtendContent, urlData: { id: contentId } })
190
+          .then(data => {
191
+            message.info('操作成功!');
192
+            getList({ pageNum: 1, pageSize: 10, showType: 'banner' });
193
+          })
194
+          .catch(err => {
195
+            console.log(err);
196
+            message.info(err.msg || err.message);
197
+          });
146
       },
198
       },
147
     });
199
     });
148
-  }
200
+  };
149
 
201
 
150
   //   停用启用
202
   //   停用启用
151
-  const changeStatus = (row) => () => {
152
-    console.log(row)
203
+  const changeStatus = row => () => {
204
+    console.log(row);
153
     if (row.status === 0) {
205
     if (row.status === 0) {
154
-
155
       Modal.confirm({
206
       Modal.confirm({
156
         title: '确认发布此数据?',
207
         title: '确认发布此数据?',
157
         okText: '确定',
208
         okText: '确定',
158
         cancelText: '取消',
209
         cancelText: '取消',
159
         onOk() {
210
         onOk() {
160
-          row.status = 1
161
-          request({ ...apis.carsuseFigure.updataExtendContent, urlData: { id: row.contentId }, data: row, }).then((data) => {
162
-            message.info('操作成功!')
163
-            getList({ pageNum: 1, pageSize: 10, showType: 'banner' })
164
-          }).catch((err) => {
165
-            console.log(err)
166
-            row.status = 0
167
-            message.info(err.msg || err.message)
211
+          row.status = 1;
212
+          request({
213
+            ...apis.carsuseFigure.updataExtendContent,
214
+            urlData: { id: row.contentId },
215
+            data: row,
168
           })
216
           })
217
+            .then(data => {
218
+              message.info('操作成功!');
219
+              getList({ pageNum: 1, pageSize: 10, showType: 'banner' });
220
+            })
221
+            .catch(err => {
222
+              console.log(err);
223
+              row.status = 0;
224
+              message.info(err.msg || err.message);
225
+            });
169
         },
226
         },
170
       });
227
       });
171
     } else if (row.status === 1) {
228
     } else if (row.status === 1) {
172
-
173
       Modal.confirm({
229
       Modal.confirm({
174
         title: '停用后不会再显示在小程序端',
230
         title: '停用后不会再显示在小程序端',
175
         okText: '确定',
231
         okText: '确定',
176
         cancelText: '取消',
232
         cancelText: '取消',
177
         onOk() {
233
         onOk() {
178
-          row.status = 0
179
-          request({ ...apis.carsuseFigure.updataExtendContent, urlData: { id: row.contentId }, data: row, }).then((data) => {
180
-            message.info('操作成功!')
181
-            getList({ pageNum: 1, pageSize: 10, showType: 'banner' })
182
-          }).catch((err) => {
183
-            console.log(err)
184
-            row.status = 1
185
-            message.info(err.msg || err.message)
234
+          row.status = 0;
235
+          request({
236
+            ...apis.carsuseFigure.updataExtendContent,
237
+            urlData: { id: row.contentId },
238
+            data: row,
186
           })
239
           })
240
+            .then(data => {
241
+              message.info('操作成功!');
242
+              getList({ pageNum: 1, pageSize: 10, showType: 'banner' });
243
+            })
244
+            .catch(err => {
245
+              console.log(err);
246
+              row.status = 1;
247
+              message.info(err.msg || err.message);
248
+            });
187
         },
249
         },
188
       });
250
       });
189
     }
251
     }
252
+  };
190
 
253
 
191
-  }
192
-
193
-  const changePageNum = (pageNumber) => {
194
-    getList({ pageNum: pageNumber, pageSize: 10, showType: 'banner', ...props.form.getFieldsValue() })
195
-  }
254
+  const changePageNum = pageNumber => {
255
+    getList({
256
+      pageNum: pageNumber,
257
+      pageSize: 10,
258
+      showType: 'banner',
259
+      ...props.form.getFieldsValue(),
260
+    });
261
+  };
196
 
262
 
197
   // 提交事件
263
   // 提交事件
198
   const handleSubmit = (e, props) => {
264
   const handleSubmit = (e, props) => {
199
     e.preventDefault();
265
     e.preventDefault();
200
     props.form.validateFields((err, values) => {
266
     props.form.validateFields((err, values) => {
201
       if (!err) {
267
       if (!err) {
202
-        console.log('提交数据: ', values)
203
-        getList({ pageNum: 1, pageSize: 10, ...values, showType: 'banner' })
268
+        console.log('提交数据: ', values);
269
+        getList({ pageNum: 1, pageSize: 10, ...values, showType: 'banner' });
204
       }
270
       }
205
     });
271
     });
206
-  }
272
+  };
207
 
273
 
208
   //重置搜索
274
   //重置搜索
209
   function handleReset() {
275
   function handleReset() {
211
     getList({ pageNum: 1, pageSize: 10, showType: 'banner' });
277
     getList({ pageNum: 1, pageSize: 10, showType: 'banner' });
212
   }
278
   }
213
 
279
 
214
-  const { getFieldDecorator } = props.form
280
+  const { getFieldDecorator } = props.form;
215
   return (
281
   return (
216
-
217
     <Card>
282
     <Card>
218
       <Form layout="inline" onSubmit={e => handleSubmit(e, props)}>
283
       <Form layout="inline" onSubmit={e => handleSubmit(e, props)}>
219
-        <Form.Item>
220
-          {getFieldDecorator('cityId')(
221
-            <SelectCity />,
222
-          )}
223
-        </Form.Item>
224
-        <Form.Item>
225
-          {getFieldDecorator('buildingId')(
226
-            <BuildSelect />,
227
-          )}
228
-        </Form.Item>
284
+        <Form.Item>{getFieldDecorator('cityId')(<SelectCity />)}</Form.Item>
285
+        <Form.Item>{getFieldDecorator('buildingId')(<BuildSelect />)}</Form.Item>
229
         <Form.Item>
286
         <Form.Item>
230
           {getFieldDecorator('contentType')(
287
           {getFieldDecorator('contentType')(
231
             <Select style={{ width: '180px' }} placeholder="类型">
288
             <Select style={{ width: '180px' }} placeholder="类型">
258
         </Form.Item>
315
         </Form.Item>
259
         <Form.Item>
316
         <Form.Item>
260
           <AuthButton name="admin.extendContent.search" noRight={null}>
317
           <AuthButton name="admin.extendContent.search" noRight={null}>
261
-            <Button type="primary" htmlType="submit" className={styles.searchBtn}>
318
+            <Button type="primary" htmlType="submit" >
262
               搜索
319
               搜索
263
-          </Button>
320
+            </Button>
264
           </AuthButton>
321
           </AuthButton>
265
           <Button style={{ marginLeft: 8 }} onClick={handleReset}>
322
           <Button style={{ marginLeft: 8 }} onClick={handleReset}>
266
             重置
323
             重置
267
-            </Button>
324
+          </Button>
268
         </Form.Item>
325
         </Form.Item>
269
       </Form>
326
       </Form>
270
-      <AuthButton name="admin.extendContent.post" noRight={null}>
271
-        <Button type='primary' onClick={toEditCarouse()} style={{margin:'20px 0'}}>新增</Button>
272
-      </AuthButton>
327
+      <div style={{textAlign:'right'}}>
328
+        <AuthButton name="admin.extendContent.post" noRight={null}>
329
+          <Button type="primary" onClick={toEditCarouse()} style={{ margin: '20px 0' }}>
330
+            新增
331
+          </Button>
332
+        </AuthButton>
333
+      </div>
334
+
273
       <Table dataSource={data.records} columns={columns} pagination={false} rowKey="contentId" />
335
       <Table dataSource={data.records} columns={columns} pagination={false} rowKey="contentId" />
274
       <div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
336
       <div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
275
-        <Pagination showQuickJumper defaultCurrent={1} total={data.total} onChange={changePageNum} current={data.current} />
337
+        <Pagination
338
+          showQuickJumper
339
+          defaultCurrent={1}
340
+          total={data.total}
341
+          onChange={changePageNum}
342
+          current={data.current}
343
+        />
276
       </div>
344
       </div>
277
     </Card>
345
     </Card>
278
-  )
279
-}
346
+  );
347
+};
280
 const WrappedHeader = Form.create({ name: 'header' })(header);
348
 const WrappedHeader = Form.create({ name: 'header' })(header);
281
 
349
 
282
-export default WrappedHeader
350
+export default WrappedHeader;

+ 20
- 19
src/pages/carouselFigure/editCarousel.jsx Näytä tiedosto

94
   const XForm = createForm({ onValuesChange: handleFormValueChange });
94
   const XForm = createForm({ onValuesChange: handleFormValueChange });
95
 
95
 
96
   return props => {
96
   return props => {
97
-    const [tab, changeTab] = useState('basic');
98
     const { contentId } = props.location.query;
97
     const { contentId } = props.location.query;
99
     const [data, setData] = useState({});
98
     const [data, setData] = useState({});
99
+    useEffect(() => {
100
+      if (contentId) {
101
+        isCanChoose = false;
102
+        // eslint-disable-next-line react-hooks/rules-of-hooks
100
 
103
 
101
-    if (contentId) {
102
-      isCanChoose = false;
103
-      // eslint-disable-next-line react-hooks/rules-of-hooks
104
-      useEffect(() => {
105
         getDetail(contentId);
104
         getDetail(contentId);
106
-      }, []);
105
+      } else {
106
+        isCanChoose = true;
107
+      }
108
+    }, []);
107
 
109
 
108
-      // 查询列表
109
-      const getDetail = contentId => {
110
-        request({ ...apis.carsuseFigure.getExtendContent, urlData: { id: contentId } }).then(
111
-          data => {
112
-            console.log(data);
113
-            setExtraData1(data);
114
-            setData(data);
115
-          },
116
-        );
117
-      };
118
-    } else {
119
-      isCanChoose = true;
120
-    }
110
+    // 查询列表
111
+    const getDetail = contentId => {
112
+      request({ ...apis.carsuseFigure.getExtendContent, urlData: { id: contentId } }).then(data => {
113
+        console.log(data);
114
+        setExtraData1(data);
115
+        setData(data);
116
+      });
117
+    };
121
 
118
 
122
     const cancelPage = () => {
119
     const cancelPage = () => {
123
       router.push({
120
       router.push({
192
             label: '直播活动详情',
189
             label: '直播活动详情',
193
             value: 'live',
190
             value: 'live',
194
           },
191
           },
192
+          {
193
+            label: '无',
194
+            value: 'nothing',
195
+          },
195
         ],
196
         ],
196
         value: data.contentType,
197
         value: data.contentType,
197
         rules: [{ required: true, message: '请选择类型' }],
198
         rules: [{ required: true, message: '请选择类型' }],