Bläddra i källkod

活动类型添加

傅行帆 4 år sedan
förälder
incheckning
fc41e4048b

+ 188
- 177
config/routes.js Visa fil

@@ -65,53 +65,53 @@ export default [
65 65
           //     },
66 66
           //   ],
67 67
           // },
68
-          {
69
-            path: '/customer',
70
-            name: '客户管理',
71
-            component: '../layouts/BlankLayout',
72
-            routes: [
73
-              {
74
-                path: '/customer/customerlist/list',
75
-                name: '客户列表',
76
-                component: './customer/customerlist/index',
77
-              },
78
-              {
79
-                path: '/customer/customerlist/customerDetail',
80
-                name: '私客详情',
81
-                hideInMenu: true,
82
-                component: './customer/customerlist/customerDetail',
83
-              },
84
-              {
85
-                path: '/customer/drift/list',
86
-                name: '游客列表',
87
-                component: './customer/drift/index',
88
-              },
89
-              {
90
-                path: '/customer/customerlist/publicCustomerDetail',
91
-                name: '公客详情',
92
-                hideInMenu: true,
93
-                component: './customer/customerlist/publicCustomerDetail',
94
-              },
95
-            ],
96
-          },
97
-          {
98
-            path: '/recommend',
99
-            name: '推荐客户',
100
-            component: '../layouts/BlankLayout',
101
-            routes: [
102
-              {
103
-                path: '/recommend/recommendCustomer/list',
104
-                name: '推荐记录',
105
-                component: './recommend/recommendCustomer/index',
106
-              },
107
-              {
108
-                path: '/recommend/recommendCustomer/audit',
109
-                name: '客户审核',
110
-                hideInMenu: true,
111
-                component: './recommend/recommendCustomer/audit',
112
-              },
113
-            ],
114
-          },
68
+          // {
69
+          //   path: '/customer',
70
+          //   name: '客户管理',
71
+          //   component: '../layouts/BlankLayout',
72
+          //   routes: [
73
+          //     {
74
+          //       path: '/customer/customerlist/list',
75
+          //       name: '客户列表',
76
+          //       component: './customer/customerlist/index',
77
+          //     },
78
+          //     {
79
+          //       path: '/customer/customerlist/customerDetail',
80
+          //       name: '私客详情',
81
+          //       hideInMenu: true,
82
+          //       component: './customer/customerlist/customerDetail',
83
+          //     },
84
+          //     {
85
+          //       path: '/customer/drift/list',
86
+          //       name: '游客列表',
87
+          //       component: './customer/drift/index',
88
+          //     },
89
+          //     {
90
+          //       path: '/customer/customerlist/publicCustomerDetail',
91
+          //       name: '公客详情',
92
+          //       hideInMenu: true,
93
+          //       component: './customer/customerlist/publicCustomerDetail',
94
+          //     },
95
+          //   ],
96
+          // },
97
+          // {
98
+          //   path: '/recommend',
99
+          //   name: '推荐客户',
100
+          //   component: '../layouts/BlankLayout',
101
+          //   routes: [
102
+          //     {
103
+          //       path: '/recommend/recommendCustomer/list',
104
+          //       name: '推荐记录',
105
+          //       component: './recommend/recommendCustomer/index',
106
+          //     },
107
+          //     {
108
+          //       path: '/recommend/recommendCustomer/audit',
109
+          //       name: '客户审核',
110
+          //       hideInMenu: true,
111
+          //       component: './recommend/recommendCustomer/audit',
112
+          //     },
113
+          //   ],
114
+          // },
115 115
           {
116 116
             path: '/integralMall',
117 117
             name: '积分商城',
@@ -157,40 +157,40 @@ export default [
157 157
               },
158 158
             ],
159 159
           },
160
-          {
161
-            path: '/shop',
162
-            name: '商户管理',
163
-            component: '../layouts/BlankLayout',
164
-            routes: [
165
-              {
166
-                path: '/shop/banner',
167
-                name: '联盟商城banner',
168
-                component: './shop/banner',
169
-              },
170
-              {
171
-                path: '/shop/type',
172
-                name: '分类列表',
173
-                component: './shop/type/index',
174
-              },
175
-              {
176
-                path: '/shop/type/detail',
177
-                name: '分类详情',
178
-                hideInMenu: true,
179
-                component: './shop/type/detail',
180
-              },
181
-              {
182
-                path: '/shop/list',
183
-                name: '商户列表',
184
-                component: './shop/index',
185
-              },
186
-              {
187
-                path: '/shop/detail',
188
-                name: '商户详情',
189
-                hideInMenu: true,
190
-                component: './shop/detail',
191
-              },
192
-            ]
193
-          },
160
+          // {
161
+          //   path: '/shop',
162
+          //   name: '商户管理',
163
+          //   component: '../layouts/BlankLayout',
164
+          //   routes: [
165
+          //     {
166
+          //       path: '/shop/banner',
167
+          //       name: '联盟商城banner',
168
+          //       component: './shop/banner',
169
+          //     },
170
+          //     {
171
+          //       path: '/shop/type',
172
+          //       name: '分类列表',
173
+          //       component: './shop/type/index',
174
+          //     },
175
+          //     {
176
+          //       path: '/shop/type/detail',
177
+          //       name: '分类详情',
178
+          //       hideInMenu: true,
179
+          //       component: './shop/type/detail',
180
+          //     },
181
+          //     {
182
+          //       path: '/shop/list',
183
+          //       name: '商户列表',
184
+          //       component: './shop/index',
185
+          //     },
186
+          //     {
187
+          //       path: '/shop/detail',
188
+          //       name: '商户详情',
189
+          //       hideInMenu: true,
190
+          //       component: './shop/detail',
191
+          //     },
192
+          //   ]
193
+          // },
194 194
           {
195 195
             path: '/channel',
196 196
             name: '渠道管理',
@@ -301,6 +301,17 @@ export default [
301 301
                 name: '报名活动',
302 302
                 component: './activity/ActivityList',
303 303
               },
304
+              {
305
+                path: '/activity/ActivityTypeList',
306
+                name: '活动类型',
307
+                component: './activity/type/ActivityTypeList',
308
+              },
309
+              {
310
+                path: '/activity/editActivityType', 
311
+                name: '编辑活动',
312
+                hideInMenu: true,
313
+                component: './activity/type/editActivityType',
314
+              },
304 315
               {
305 316
                 path: '/activity/editActivity', 
306 317
                 name: '编辑活动',
@@ -325,11 +336,11 @@ export default [
325 336
                 hideInMenu: true,
326 337
                 component: './activity/activityRecord',
327 338
             },
328
-              {
329
-                path: '/activity/helpActivity/list',
330
-                name: '助力活动',
331
-                component: './activity/helpActivity/list',
332
-              },
339
+              // {
340
+              //   path: '/activity/helpActivity/list',
341
+              //   name: '助力活动',
342
+              //   component: './activity/helpActivity/list',
343
+              // },
333 344
               {
334 345
                 path: '/activity/helpActivity/helpRecord',
335 346
                 name: '助力记录',
@@ -354,11 +365,11 @@ export default [
354 365
                 hideInMenu: true,
355 366
                 component: './activity/helpActivity/helpActivityRecord',
356 367
             },
357
-              {
358
-                path: '/activity/groupActivity/list',
359
-                name: '拼团活动',
360
-                component: './activity/groupActivity/list',
361
-              },
368
+              // {
369
+              //   path: '/activity/groupActivity/list',
370
+              //   name: '拼团活动',
371
+              //   component: './activity/groupActivity/list',
372
+              // },
362 373
               {
363 374
                 path: '/activity/groupActivity/helpRecord',
364 375
                 name: '拼团记录',
@@ -383,11 +394,11 @@ export default [
383 394
                 hideInMenu: true,
384 395
                 component: './activity/groupActivity/groupActivityRecord',
385 396
             },
386
-              {
387
-                path: '/activity/drainage/DrainageList',
388
-                name: 'H5活动',
389
-                component: './activity/drainage/DrainageList',
390
-              },
397
+              // {
398
+              //   path: '/activity/drainage/DrainageList',
399
+              //   name: 'H5活动',
400
+              //   component: './activity/drainage/DrainageList',
401
+              // },
391 402
               {
392 403
                 path: '/activity/drainage/Detail',
393 404
                 name: '查看详情',
@@ -501,33 +512,33 @@ export default [
501 512
                 hideInMenu: true,
502 513
                 component: './carouselFigure/editCarousel',
503 514
               },
504
-              {
505
-                path: '/carouselFigure/advertisingList',
506
-                name: '开屏广告',
507
-                component: './carouselFigure/advertisingList',
508
-              },
515
+              // {
516
+              //   path: '/carouselFigure/advertisingList',
517
+              //   name: '开屏广告',
518
+              //   component: './carouselFigure/advertisingList',
519
+              // },
509 520
               {
510 521
                 path: '/carouselFigure/editAdvertising',
511 522
                 name: '开屏广告编辑',
512 523
                 hideInMenu: true,
513 524
                 component: './carouselFigure/editAdvertising',
514 525
               },
515
-              {
516
-                path: '/carouselFigure/propagandaList',
517
-                name: '宣传位',
518
-                component: './carouselFigure/propagandaList',
519
-              },
526
+              // {
527
+              //   path: '/carouselFigure/propagandaList',
528
+              //   name: '宣传位',
529
+              //   component: './carouselFigure/propagandaList',
530
+              // },
520 531
               {
521 532
                 path: '/carouselFigure/propaganda',
522 533
                 name: '宣传位编辑',
523 534
                 hideInMenu: true,
524 535
                 component: './carouselFigure/propaganda',
525 536
               },
526
-              {
527
-                path: '/carouselFigure/customImg/list',
528
-                name: '其他',
529
-                component: './carouselFigure/customImg/list',
530
-              },
537
+              // {
538
+              //   path: '/carouselFigure/customImg/list',
539
+              //   name: '其他',
540
+              //   component: './carouselFigure/customImg/list',
541
+              // },
531 542
               {
532 543
                 path: '/carouselFigure/customImg/edit',
533 544
                 name: '其他编辑',
@@ -536,72 +547,72 @@ export default [
536 547
               },
537 548
             ],
538 549
           },
539
-          {
540
-            path: '/system',
541
-            name: '系统管理',
542
-            component: '../layouts/BlankLayout',
543
-            routes: [
544
-              {
545
-                path: '/system/person-level-setting',
546
-                name: '用户等级',
547
-                component: './system/personLevelSetting'
548
-              },
549
-              {
550
-                path: '/system/person-level-setting/detail',
551
-                name: '等级详情',
552
-                component: './system/personLevelSetting/detail',
553
-                hideInMenu: true,
554
-              },
555
-              {
556
-                path: '/system/messageList',
557
-                name: '客户留言',
558
-                component: './system/messageList',
559
-              },
560
-              {
561
-                path: '/system/report',
562
-                name: '报表数据',
563
-                component: './system/report',
564
-              },
565
-              {
566
-                path: '/system/intention',
567
-                name: '意向值',
568
-                component: './system/intention',
569
-              },
570
-              {
571
-                path: '/system/housingPolicy',
572
-                name: '购房须知',
573
-                component: './system/housingPolicy',
574
-              },
575
-              {
576
-                path: '/system/editPolicy',
577
-                name: '购房政策编辑',
578
-                hideInMenu: true,
579
-                component: './system/editPolicy',
580
-              },
581
-              {
582
-                path: '/system/document/list',
583
-                name: '客户资料',
584
-                component: './system/document/list',
585
-              },
586
-              {
587
-                path: '/system/document/audit',
588
-                name: '客户资料审核',
589
-                hideInMenu: true,
590
-                component: './system/document/audit',
591
-              },
592
-              // {
593
-              //   path: '/system/MiniappTheme',
594
-              //   name: '小程序主题',
595
-              //   component: './system/MiniappTheme',
596
-              // },
597
-              // {
598
-              //   path: '/system/MiniappTheme/Detail',
599
-              //   name: '小程序主题编辑',
600
-              //   component: './system/MiniappTheme/Detail',
601
-              //   hideInMenu: true,
602
-              // },
603
-            ],
604
-          },
550
+          // {
551
+          //   path: '/system',
552
+          //   name: '系统管理',
553
+          //   component: '../layouts/BlankLayout',
554
+          //   routes: [
555
+          //     {
556
+          //       path: '/system/person-level-setting',
557
+          //       name: '用户等级',
558
+          //       component: './system/personLevelSetting'
559
+          //     },
560
+          //     {
561
+          //       path: '/system/person-level-setting/detail',
562
+          //       name: '等级详情',
563
+          //       component: './system/personLevelSetting/detail',
564
+          //       hideInMenu: true,
565
+          //     },
566
+          //     {
567
+          //       path: '/system/messageList',
568
+          //       name: '客户留言',
569
+          //       component: './system/messageList',
570
+          //     },
571
+          //     {
572
+          //       path: '/system/report',
573
+          //       name: '报表数据',
574
+          //       component: './system/report',
575
+          //     },
576
+          //     {
577
+          //       path: '/system/intention',
578
+          //       name: '意向值',
579
+          //       component: './system/intention',
580
+          //     },
581
+          //     {
582
+          //       path: '/system/housingPolicy',
583
+          //       name: '购房须知',
584
+          //       component: './system/housingPolicy',
585
+          //     },
586
+          //     {
587
+          //       path: '/system/editPolicy',
588
+          //       name: '购房政策编辑',
589
+          //       hideInMenu: true,
590
+          //       component: './system/editPolicy',
591
+          //     },
592
+          //     {
593
+          //       path: '/system/document/list',
594
+          //       name: '客户资料',
595
+          //       component: './system/document/list',
596
+          //     },
597
+          //     {
598
+          //       path: '/system/document/audit',
599
+          //       name: '客户资料审核',
600
+          //       hideInMenu: true,
601
+          //       component: './system/document/audit',
602
+          //     },
603
+          //     // {
604
+          //     //   path: '/system/MiniappTheme',
605
+          //     //   name: '小程序主题',
606
+          //     //   component: './system/MiniappTheme',
607
+          //     // },
608
+          //     // {
609
+          //     //   path: '/system/MiniappTheme/Detail',
610
+          //     //   name: '小程序主题编辑',
611
+          //     //   component: './system/MiniappTheme/Detail',
612
+          //     //   hideInMenu: true,
613
+          //     // },
614
+          //   ],
615
+          // },
605 616
           {
606 617
             path: '/record',
607 618
             name: '数据记录',

+ 2
- 2
src/pages/activity/ActivityList.jsx Visa fil

@@ -349,7 +349,7 @@ const header = props => {
349 349
       {/* style={{ display: 'none' }} */}
350 350
       <div id="qrcode"></div>
351 351
       <Form layout="inline" onSubmit={e => handleSubmit(e)}>
352
-        <Form.Item>
352
+        {/* <Form.Item>
353 353
           {getFieldDecorator('cityId')(
354 354
             <SelectCity />,
355 355
           )}
@@ -358,7 +358,7 @@ const header = props => {
358 358
           {getFieldDecorator('buildingId')(
359 359
             <BuildSelect />,
360 360
           )}
361
-        </Form.Item>
361
+        </Form.Item> */}
362 362
         <Form.Item>
363 363
           {getFieldDecorator('title')(
364 364
             <Input

+ 4
- 4
src/pages/activity/detailActivity.jsx Visa fil

@@ -111,13 +111,13 @@ const BasicForm = props => {
111 111
   return (
112 112
     <>
113 113
       <Form {...formItemLayout} onSubmit={handleSubmit}>
114
-        <Form.Item label="所属项目">
114
+        <Form.Item label="活动类型">
115 115
           {getFieldDecorator('buildingId', {
116 116
             initialValue: detailData.buildingId,
117 117
             rules: [
118 118
               {
119 119
                 required: true,
120
-                message: '请选择所属项目',
120
+                message: '请选择活动类型',
121 121
               },
122 122
             ],
123 123
           })(<BuildSelect disabled />)}
@@ -402,13 +402,13 @@ const Edit = props => {
402 402
 
403 403
   return (
404 404
     <div>
405
-      <div>
405
+      {/* <div>
406 406
         <Radio.Group value={tab} buttonStyle="solid" onChange={e => changeTab(e.target.value)}>
407 407
           <Radio.Button value="basic">基本信息</Radio.Button>
408 408
           <Radio.Button value="poster">海报图片</Radio.Button>
409 409
           <Radio.Button value="share">分享设置</Radio.Button>
410 410
         </Radio.Group>
411
-      </div>
411
+      </div> */}
412 412
       <div>
413 413
         {tab === 'basic' && <Basic dynamicId={dynamicId} detailData={detailData} />}
414 414
         {tab === 'poster' && <Poster  dynamicId={dynamicId} />}

+ 11
- 10
src/pages/activity/editActivity.jsx Visa fil

@@ -124,19 +124,20 @@ const BasicForm = props => {
124 124
           values.dynamicId = dynamicId
125 125
           request({ ...apis.activity.update, data: values }).then(data => {
126 126
             message.info('保存成功')
127
-            // router.go(-1)
127
+            cancelPage()
128 128
           }).catch((err) => {
129 129
             message.info(err.msg || err.message)
130 130
           })
131 131
         } else {
132 132
           request({ ...apis.activity.add, data: { ...values } }).then((data) => {
133 133
             message.info('保存成功')
134
-            router.push({
135
-              pathname: '/activity/editActivity',
136
-              query: {
137
-                dynamicId: data.dynamicId,
138
-              },
139
-            });
134
+            cancelPage()
135
+            // router.push({
136
+            //   pathname: '/activity/editActivity',
137
+            //   query: {
138
+            //     dynamicId: data.dynamicId,
139
+            //   },
140
+            // });
140 141
             // router.go(-1)
141 142
           }).catch((err) => {
142 143
             message.info(err.msg || err.message)
@@ -166,7 +167,7 @@ const BasicForm = props => {
166 167
   return (
167 168
     <>
168 169
       <Form {...formItemLayout} onSubmit={handleSubmit}>
169
-        <Form.Item label="所属项目">
170
+        <Form.Item label="活动类型">
170 171
           {getFieldDecorator('buildingId', {
171 172
             rules: [
172 173
               {
@@ -507,13 +508,13 @@ const Edit = props => {
507 508
 
508 509
   return (
509 510
     <div>
510
-      <div>
511
+      {/* <div>
511 512
         <Radio.Group value={tab} buttonStyle="solid" onChange={e => changeTab(e.target.value)}>
512 513
           <Radio.Button value="basic">基本信息</Radio.Button>
513 514
           <Radio.Button value="poster">海报图片</Radio.Button>
514 515
           <Radio.Button value="share">分享设置</Radio.Button>
515 516
         </Radio.Group>
516
-      </div>
517
+      </div> */}
517 518
       <div>
518 519
         {tab === 'basic' && <Basic dynamicId={dynamicId} />}
519 520
         {tab === 'poster' && <Poster dynamicId={dynamicId}/>}

+ 141
- 0
src/pages/activity/type/ActivityTypeList.jsx Visa fil

@@ -0,0 +1,141 @@
1
+import React, { useState, useEffect } from 'react';
2
+import { Form, Button, message, Table, Pagination, Modal } from 'antd';
3
+import router from 'umi/router';
4
+import AuthButton from '@/components/AuthButton';
5
+import withActions from '@/components/ActionList';
6
+import EditIcon from '@/components/EditIcon';
7
+import { ConfirmButton } from '@/components/ModalButton';
8
+import apis from '../../../services/apis';
9
+import request from '../../../utils/request'
10
+import BuildSelect from '../../../components/SelectButton/BuildSelect';
11
+import styles from '../../style/GoodsList.less';
12
+import Navigate from '@/components/Navigate';
13
+
14
+function NewsType(props) {
15
+  // 获取初始化数据
16
+  const [data, setData] = useState({})
17
+
18
+  useEffect(() => {
19
+    getList({ pageNum: 1, pageSize: 10 });
20
+  }, [])
21
+
22
+  // 查询列表
23
+  const getList = (params) => {
24
+    request({ ...apis.dynamicType.list, params: { ...params } }).then((data) => {
25
+      console.log(data)
26
+      setData(data)
27
+    })
28
+  }
29
+
30
+
31
+  // 提交事件
32
+  const handleSubmit = (e, props) => {
33
+    e.preventDefault();
34
+    props.form.validateFields((err, values) => {
35
+      if (!err) {
36
+        getList({ pageNum: 1, pageSize: 10, ...values })
37
+      }
38
+    });
39
+  }
40
+
41
+  const changePageNum = (pageNumber) => {
42
+    props.form.validateFields((err, values) => {
43
+      if (!err) {
44
+        getList({ pageNum: pageNumber, pageSize: 10, ...values })
45
+      }
46
+    });
47
+  }
48
+
49
+
50
+  // 跳转到编辑资讯
51
+  const toEditNews = (id) => () => {
52
+    router.push({
53
+      pathname: '/activity/editActivityType',
54
+      query: {
55
+        id
56
+      },
57
+    });
58
+  }
59
+
60
+
61
+  const changeNewsStatus = (row, newsId) => () => {
62
+    request({ ...apis.dynamicType.put, urlData: { id: newsId }, data: { ...row, status: -1 } }).then((data) => {
63
+      message.info('操作成功!')
64
+      getList({ pageNum: 1, pageSize: 10 });
65
+    }).catch((err) => {
66
+      console.log(err)
67
+      message.info(err.msg || err.message)
68
+    })
69
+  }
70
+  /**
71
+   *
72
+   *
73
+   * @param {*} props
74
+   * @returns
75
+   */
76
+  const columns = [
77
+    {
78
+      title: '名称',
79
+      dataIndex: 'dynamicTypeName',
80
+      key: 'dynamicTypeName',
81
+      align: 'center',
82
+      render: (text, record) => <Navigate to={`/activity/editActivityType?id=${record.dynamicTypeId}`}>{text}</Navigate>
83
+    },
84
+    {
85
+      title: '操作',
86
+      dataIndex: 'handle',
87
+      key: 'handle',
88
+      align: 'center',
89
+      render: withActions((x, row) => [
90
+        <AuthButton name="admin.taNewsType.id.delete" noRight={null}>
91
+          <ConfirmButton type="link" title="确认删除?" onClick={changeNewsStatus(row, row.dynamicTypeId)}>
92
+            <EditIcon text="删除" type="delete" />
93
+          </ConfirmButton>
94
+        </AuthButton>,
95
+        <AuthButton name="admin.taNewsType.id.put" noRight={null}>
96
+          <EditIcon text="编辑" type="edit" onClick={toEditNews(row.dynamicTypeId)} />
97
+        </AuthButton>,
98
+      ]),
99
+    },
100
+  ];
101
+
102
+  function handleReset() {
103
+    props.form.resetFields();
104
+    getList({ pageNum: 1, pageSize: 10 })
105
+  }
106
+
107
+  const { getFieldDecorator } = props.form
108
+  return (
109
+
110
+    <>
111
+      {/* <Form layout="inline" onSubmit={e => handleSubmit(e, props)}>
112
+        <Form.Item>
113
+          {getFieldDecorator('buildingId')(
114
+            <BuildSelect />,
115
+          )}
116
+        </Form.Item>
117
+        <Form.Item>
118
+          <AuthButton name="admin.taNewsType.search" noRight={null}>
119
+            <Button type="primary" htmlType="submit" >
120
+              搜索
121
+              </Button>
122
+          </AuthButton>
123
+          <Button style={{ marginLeft: 8 }} onClick={handleReset}>
124
+            重置
125
+            </Button>
126
+        </Form.Item>
127
+      </Form> */}
128
+      <AuthButton name="admin.taNewsType.post" noRight={null}>
129
+        <Button type="danger" className={styles.addBtn} onClick={toEditNews()}>新增</Button>
130
+      </AuthButton>
131
+      <Table rowKey="newsType" dataSource={data.records} columns={columns} pagination={false} />
132
+      <div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
133
+        <Pagination showQuickJumper defaultCurrent={1} total={data.total} onChange={changePageNum} current={data.current} />
134
+      </div>
135
+    </>
136
+  )
137
+}
138
+
139
+const WrappedHeader = Form.create({ name: 'header' })(NewsType);
140
+
141
+export default WrappedHeader

+ 94
- 0
src/pages/activity/type/editActivityType.jsx Visa fil

@@ -0,0 +1,94 @@
1
+import React, { useState, useEffect } from 'react';
2
+import { Input, Menu, Dropdown, Button, Icon, message, Table, Divider, Tag, Select, Form, Alert } from 'antd';
3
+import { FormattedMessage } from 'umi-plugin-react/locale';
4
+import channels from '../../channel/channelList.less';
5
+import BuildSelect from '../../../components/SelectButton/BuildSelect'
6
+import XForm, { FieldTypes } from '../../../components/XForm';
7
+import router from 'umi/router';
8
+import apis from '../../../services/apis';
9
+import request from '../../../utils/request'
10
+
11
+const { TextArea } = Input;
12
+const { Option } = Select;
13
+
14
+const header = props => {
15
+  const newsId = props.location.query.id
16
+  console.log("newsId" + newsId);
17
+  const [ newsData, setNewsData ] = useState({})
18
+  if(newsId){
19
+    useEffect(() => {
20
+      getNewsData(newsId);
21
+    },[])
22
+
23
+  // 查询列表
24
+  const getNewsData = (newsId) => {
25
+    request({
26
+        ...apis.dynamicType.get,
27
+        urlData: { id: newsId }
28
+    }).then((data) => {
29
+        setNewsData(data)
30
+    }).catch((err) => {
31
+      message.error(err.msg || err.message)
32
+    })
33
+  }
34
+  }
35
+
36
+  const fields = [
37
+    // {
38
+    //   label: '所属项目',
39
+    //   name: 'buildingId',
40
+    //   render: <BuildSelect />,
41
+    //   value: newsData.buildingId,
42
+    //   rules: [
43
+    //     {required: true, message: '请选择所属项目'},
44
+    //   ]
45
+    // },
46
+    // {
47
+    //   label: '类型图',
48
+    //   name: 'newsTypeImg',
49
+    //   type: FieldTypes.ImageUploader,
50
+    //   value: newsData.newsTypeImg,
51
+    //   help: '建议图片尺寸:660px*416px',
52
+    // },
53
+    {
54
+      label: '活动类型名称',
55
+      name: 'dynamicTypeName',
56
+      type: FieldTypes.Text,
57
+      value: newsData.dynamicTypeName,
58
+      rules: [
59
+        {required: true, message: '请输入活动类型名称'},
60
+      ]
61
+    },
62
+  ]
63
+
64
+   
65
+  const handleSubmit = (values) => {
66
+    if(newsId){
67
+        values.newsTypeId = newsId
68
+        request({ ...apis.dynamicType.put, urlData: { id: newsId }, data: { ...values }}).then((data) => {
69
+          cancelPage();
70
+        }).catch((err) => {
71
+          message.error(err.msg || err.message)
72
+        })
73
+      }else{
74
+        request({ ...apis.dynamicType.post, data: { ...values } }).then((data) => {
75
+          cancelPage();
76
+        }).catch((err) => {
77
+          message.error(err.msg || err.message)
78
+        })
79
+      }
80
+  }
81
+
82
+  const cancelPage = () => {
83
+    router.push({
84
+      pathname: '/activity/ActivityTypeList',
85
+    });
86
+  }
87
+
88
+  return (
89
+    <XForm onSubmit={handleSubmit} onCancel={cancelPage} fields={fields}></XForm>
90
+  )
91
+}
92
+
93
+const WrappedNormalLoginForm = Form.create({ name: 'header' })(header);
94
+export default WrappedNormalLoginForm

+ 56
- 0
src/pages/activity/type/style.less Visa fil

@@ -0,0 +1,56 @@
1
+.searchBox {
2
+    font-size: 30px;
3
+    color: red;
4
+    display: flex;
5
+    display: flex;
6
+    justify-items: center;
7
+    align-items: center;
8
+    justify-content: space-between;
9
+    .searchItem {
10
+      min-width: 200px;
11
+      margin-right: 20px;
12
+      text-align: left;
13
+      .anticon-down {
14
+        float: right !important;
15
+      }
16
+    }
17
+  }
18
+  .addBtn {
19
+    padding: 0 30px;
20
+    height: 36px;
21
+    background-color: #50be00;
22
+    color: #fff;
23
+    margin: 30px 0;
24
+    border-color: #50be00;
25
+  }
26
+  .addBtn:focus {
27
+    color: #fff;
28
+    background-color: #50be00;
29
+    border-color: #50be00;
30
+  }
31
+  .searchBtn{
32
+   background-color: #3A91D5;
33
+   border-color: #3A91D5;
34
+  }
35
+  .searchBtn:focus {
36
+    color: #fff;
37
+    background-color: #3A91D5;
38
+    border-color: #3A91D5;
39
+  }
40
+  .touxiang {
41
+    width: 93px;
42
+    height: 93px;
43
+  }
44
+  .ant-table-column-title {
45
+    font-weight: 600;
46
+  }
47
+  .shoppingCart{
48
+    color: #dcdcdc;
49
+    margin-left: 6px;
50
+    font-size: 16px;
51
+  }
52
+  .edit{
53
+    color: #dcdcdc;
54
+    margin-left: 6px;
55
+    font-size: 15px;
56
+  }

+ 27
- 0
src/services/apis.js Visa fil

@@ -606,6 +606,33 @@ export default {
606 606
       action: 'admin.clickCountList.get',
607 607
     },
608 608
   },
609
+  dynamicType: {
610
+      list: {
611
+        method: 'GET',
612
+        url: `${prefix}/taBuildingDynamicType`,
613
+        action: 'admin.taBuildingDynamicType.get',
614
+      },
615
+      delete: {
616
+        method: 'DELETE',
617
+        url: `${prefix}/taBuildingDynamicType/:id`,
618
+        action: 'admin.taBuildingDynamicType.id.delete',
619
+      },
620
+      put: {
621
+        method: 'PUT',
622
+        url: `${prefix}/taBuildingDynamicType/:id`,
623
+        action: 'admin.taBuildingDynamicType.id.delete',
624
+      },
625
+      post: {
626
+        method: 'POST',
627
+        url: `${prefix}/taBuildingDynamicType`,
628
+        action: 'admin.taBuildingDynamicType.post',
629
+      },
630
+      get: {
631
+        method: 'GET',
632
+        url: `${prefix}/taBuildingDynamicType/:id`,
633
+        action: 'admin.taBuildingDynamicType.get',
634
+      }
635
+    },
609 636
   integralMall: {
610 637
     tdPointsRules: {
611 638
       url: `${prefix}/tdPointsRules`,