傅行帆 před 5 roky
rodič
revize
9029c07711

+ 10
- 0
config/config.js Zobrazit soubor

@@ -333,11 +333,21 @@ export default {
333 333
                   name: '轮播图列表',
334 334
                   component: './carouselFigure/carouselFigureList',
335 335
                 },
336
+                {
337
+                  path: '/carouselFigure/editCarousel',
338
+                  name: '',
339
+                  component: './carouselFigure/editCarousel',
340
+                },
336 341
                 {
337 342
                   path: '/carouselFigure/advertisingList',
338 343
                   name: '开屏广告',
339 344
                   component: './carouselFigure/advertisingList',
340 345
                 },
346
+                {
347
+                  path: '/carouselFigure/editAdvertising',
348
+                  name: '',
349
+                  component: './carouselFigure/editAdvertising',
350
+                },
341 351
               ],
342 352
             },
343 353
             {

+ 5
- 5
src/pages/carouselFigure/advertisingList.jsx Zobrazit soubor

@@ -34,11 +34,11 @@ const header = (props) => {
34 34
 
35 35
   
36 36
 // 跳转到编辑商品
37
-const toEditGoods = (dynamicId) => () => {
37
+const toEdit = (contentId) => () => {
38 38
     router.push({
39
-      pathname: '/activity/editActivity',
39
+      pathname: '/carouselFigure/editAdvertising',
40 40
       query: {
41
-        dynamicId
41
+        contentId
42 42
       },
43 43
     });
44 44
   }
@@ -86,7 +86,7 @@ const toEditGoods = (dynamicId) => () => {
86 86
       align: 'center',
87 87
       render: (x,row) => <>
88 88
                            <span style={{ color: '#1990FF', marginRight: '20px' }} onClick={changeStatus(row)}>{ row.status === 1 ? '禁用' : '启用' }<Icon type="vertical-align-top" className={styles.edit} /></span>
89
-                           <span style={{ color: '#FF925C' }} onClick={toEditGoods(row.dynamicId)}>编辑<Icon type="form" className={styles.edit} /></span>
89
+                           <span style={{ color: '#FF925C' }} onClick={toEdit(row.contentId)}>编辑<Icon type="form" className={styles.edit} /></span>
90 90
                          </>
91 91
     },
92 92
   ];
@@ -217,7 +217,7 @@ const handleSubmit = (e, props) => {
217 217
           </Button>
218 218
         </Form.Item>
219 219
       </Form>
220
-      <Button type="primary" className={styles.addBtn} onClick={toEditGoods()}>新增</Button>
220
+      <Button type="primary" className={styles.addBtn} onClick={toEdit()}>新增</Button>
221 221
       <Table dataSource={data.records} columns={columns} pagination={false}/>
222 222
       <div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
223 223
         <Pagination showQuickJumper defaultCurrent={1} total={data.total} onChange={changePageNum} />

+ 6
- 6
src/pages/carouselFigure/carouselFigureList.jsx Zobrazit soubor

@@ -33,12 +33,12 @@ const header = (props) => {
33 33
   }
34 34
 
35 35
   
36
-// 跳转到编辑商品
37
-const toEditGoods = (dynamicId) => () => {
36
+// 跳转到编辑页面
37
+const toEditCarouse = (contentId) => () => {
38 38
     router.push({
39
-      pathname: '/activity/editActivity',
39
+      pathname: '/carouselFigure/editCarousel',
40 40
       query: {
41
-        dynamicId
41
+        contentId
42 42
       },
43 43
     });
44 44
   }
@@ -86,7 +86,7 @@ const toEditGoods = (dynamicId) => () => {
86 86
       align: 'center',
87 87
       render: (x,row) => <>
88 88
                            <span style={{ color: '#1990FF', marginRight: '20px' }} onClick={changeStatus(row)}>{ row.status === 1 ? '禁用' : '启用' }<Icon type="vertical-align-top" className={styles.edit} /></span>
89
-                           <span style={{ color: '#FF925C' }} onClick={toEditGoods(row.dynamicId)}>编辑<Icon type="form" className={styles.edit} /></span>
89
+                           <span style={{ color: '#FF925C' }} onClick={toEditCarouse(row.contentId)}>编辑<Icon type="form" className={styles.edit} /></span>
90 90
                          </>
91 91
     },
92 92
   ];
@@ -217,7 +217,7 @@ const handleSubmit = (e, props) => {
217 217
           </Button>
218 218
         </Form.Item>
219 219
       </Form>
220
-      <Button type="primary" className={styles.addBtn} onClick={toEditGoods()}>新增</Button>
220
+      <Button type="primary" className={styles.addBtn} onClick={toEditCarouse()}>新增</Button>
221 221
       <Table dataSource={data.records} columns={columns} pagination={false}/>
222 222
       <div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
223 223
         <Pagination showQuickJumper defaultCurrent={1} total={data.total} onChange={changePageNum} />

+ 155
- 0
src/pages/carouselFigure/editAdvertising.jsx Zobrazit soubor

@@ -0,0 +1,155 @@
1
+import React, { useState, useEffect } from 'react';
2
+import { Form, Input, Button, Icon, Select, Tabs, Radio, DatePicker,message } from 'antd';
3
+import { FormattedMessage } from 'umi-plugin-react/locale';
4
+import styles from '../style/GoodsList.less';
5
+import moment from 'moment';
6
+import router from 'umi/router';
7
+import BuildSelect from '../../components/SelectButton/BuildSelect'
8
+import XForm, { FieldTypes } from '../../components/XForm';
9
+import Wangedit from '../../components/Wangedit/Wangedit'
10
+import request from '../../utils/request'
11
+
12
+const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
13
+/**
14
+ *
15
+ *
16
+ * @param {*} props
17
+ * @returns
18
+ */
19
+ const Edit = (props) => {
20
+  const [ tab, changeTab ] = useState('basic')
21
+  const contentId = props.location.query.contentId
22
+  const [ data, setData ] = useState({})
23
+  if(contentId){
24
+    useEffect(() => {
25
+      getDetail(contentId);
26
+    },[])
27
+
28
+  // 查询列表
29
+  const getDetail = (contentId) => {
30
+    request({
31
+        url: '/api/admin/extendContent/' + contentId,
32
+        method: 'GET',
33
+    }).then((data) => {
34
+        console.log(data)
35
+        setData(data)
36
+    })
37
+  }
38
+  }
39
+
40
+  const cancelPage = () =>{
41
+    router.push({
42
+      pathname: '/carouselFigure/advertisingList',
43
+    });
44
+  }
45
+ 
46
+    const fields = [
47
+      {
48
+        label: '所属项目',
49
+        name: 'buildingId',
50
+        render: <BuildSelect />,
51
+        value: data.buildingId,
52
+      },
53
+      {
54
+        label: '商品图片',
55
+        name: 'image',
56
+        type: FieldTypes.ImageUploader,
57
+        value: data.image,
58
+      },
59
+      {
60
+        label: '标题',
61
+        name: 'title',
62
+        type: FieldTypes.Text,
63
+        value: data.title,
64
+      },
65
+      // {
66
+      //   label: '发布位置',
67
+      //   name: 'showPosition',
68
+      //   type: FieldTypes.Select,
69
+      //   dict: [{
70
+      //     label: '首页',
71
+      //     value: 'index'
72
+      //   },
73
+      //   {
74
+      //     label: '商城',
75
+      //     value: 'mall'
76
+      //   }],
77
+      //   value: data.showPosition,
78
+      // },
79
+      {
80
+        label: '类型',
81
+        name: 'contentType',
82
+        type: FieldTypes.Select,
83
+        dict: [{
84
+          label: '活动',
85
+          value: 'activity'
86
+        },
87
+        {
88
+          label: '项目',
89
+          value: 'project'
90
+        },
91
+        {
92
+          label: '资讯',
93
+          value: 'news'
94
+        },
95
+        {
96
+          label: '其他',
97
+          value: 'other'
98
+        }],
99
+        value: data.contentType,
100
+      },
101
+      // {
102
+      //   label: '发布内容',
103
+      //   name: 'content',
104
+      //   render: <Wangedit />,
105
+      //   value: data.content,
106
+      // },
107
+      {
108
+        label: '状态',
109
+        name: 'status',
110
+        type: FieldTypes.Select,
111
+        dict: [{
112
+          label: "启用",
113
+          value: 1
114
+        },
115
+        {
116
+          label: "停用",
117
+          value: 0
118
+        },],
119
+        value: data.status != null ? data.status : 1,
120
+      },
121
+    ]
122
+  
123
+    const handleSubmit = val => { 
124
+      val.showType = 'screen'
125
+      if(contentId){
126
+        request({
127
+          url: '/api/admin/extendContent/'+contentId,
128
+          method: 'PUT',
129
+          data: val,
130
+        }).then((data) => {
131
+          cancelPage()
132
+        }).catch((err) => {
133
+          message.info(err.msg || err.message)
134
+        })
135
+      }else{
136
+        request({
137
+          url: '/api/admin/extendContent',
138
+          method: 'POST',
139
+          data: val,
140
+        }).then((data) => {
141
+          cancelPage()
142
+        }).catch((err) => {
143
+          message.info(err.msg || err.message)
144
+        })
145
+      }
146
+    }
147
+
148
+  return (
149
+    <XForm onSubmit={handleSubmit} onCancel={cancelPage} fields={fields}></XForm>
150
+  );
151
+ }
152
+
153
+
154
+
155
+export default Edit

+ 155
- 0
src/pages/carouselFigure/editCarousel.jsx Zobrazit soubor

@@ -0,0 +1,155 @@
1
+import React, { useState, useEffect } from 'react';
2
+import { Form, Input, Button, Icon, Select, Tabs, Radio, DatePicker,message } from 'antd';
3
+import { FormattedMessage } from 'umi-plugin-react/locale';
4
+import styles from '../style/GoodsList.less';
5
+import moment from 'moment';
6
+import router from 'umi/router';
7
+import BuildSelect from '../../components/SelectButton/BuildSelect'
8
+import XForm, { FieldTypes } from '../../components/XForm';
9
+import Wangedit from '../../components/Wangedit/Wangedit'
10
+import request from '../../utils/request'
11
+
12
+const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
13
+/**
14
+ *
15
+ *
16
+ * @param {*} props
17
+ * @returns
18
+ */
19
+ const Edit = (props) => {
20
+  const [ tab, changeTab ] = useState('basic')
21
+  const contentId = props.location.query.contentId
22
+  const [ data, setData ] = useState({})
23
+  if(contentId){
24
+    useEffect(() => {
25
+      getDetail(contentId);
26
+    },[])
27
+
28
+  // 查询列表
29
+  const getDetail = (contentId) => {
30
+    request({
31
+        url: '/api/admin/extendContent/' + contentId,
32
+        method: 'GET',
33
+    }).then((data) => {
34
+        console.log(data)
35
+        setData(data)
36
+    })
37
+  }
38
+  }
39
+
40
+  const cancelPage = () =>{
41
+    router.push({
42
+      pathname: '/carouselFigure/carouselFigureList',
43
+    });
44
+  }
45
+ 
46
+    const fields = [
47
+      {
48
+        label: '所属项目',
49
+        name: 'buildingId',
50
+        render: <BuildSelect />,
51
+        value: data.buildingId,
52
+      },
53
+      {
54
+        label: '商品图片',
55
+        name: 'image',
56
+        type: FieldTypes.ImageUploader,
57
+        value: data.image,
58
+      },
59
+      {
60
+        label: '标题',
61
+        name: 'title',
62
+        type: FieldTypes.Text,
63
+        value: data.title,
64
+      },
65
+      {
66
+        label: '发布位置',
67
+        name: 'showPosition',
68
+        type: FieldTypes.Select,
69
+        dict: [{
70
+          label: '首页',
71
+          value: 'index'
72
+        },
73
+        {
74
+          label: '商城',
75
+          value: 'mall'
76
+        }],
77
+        value: data.showPosition,
78
+      },
79
+      {
80
+        label: '类型',
81
+        name: 'contentType',
82
+        type: FieldTypes.Select,
83
+        dict: [{
84
+          label: '活动',
85
+          value: 'activity'
86
+        },
87
+        {
88
+          label: '项目',
89
+          value: 'project'
90
+        },
91
+        {
92
+          label: '资讯',
93
+          value: 'news'
94
+        },
95
+        {
96
+          label: '其他',
97
+          value: 'other'
98
+        }],
99
+        value: data.contentType,
100
+      },
101
+      {
102
+        label: '发布内容',
103
+        name: 'content',
104
+        render: <Wangedit />,
105
+        value: data.content,
106
+      },
107
+      {
108
+        label: '状态',
109
+        name: 'status',
110
+        type: FieldTypes.Select,
111
+        dict: [{
112
+          label: "启用",
113
+          value: 1
114
+        },
115
+        {
116
+          label: "停用",
117
+          value: 0
118
+        },],
119
+        value: data.status != null ? data.status : 1,
120
+      },
121
+    ]
122
+  
123
+    const handleSubmit = val => { 
124
+      val.showType = 'banner'
125
+      if(contentId){
126
+        request({
127
+          url: '/api/admin/extendContent/'+contentId,
128
+          method: 'PUT',
129
+          data: val,
130
+        }).then((data) => {
131
+          cancelPage()
132
+        }).catch((err) => {
133
+          message.info(err.msg || err.message)
134
+        })
135
+      }else{
136
+        request({
137
+          url: '/api/admin/extendContent',
138
+          method: 'POST',
139
+          data: val,
140
+        }).then((data) => {
141
+          cancelPage()
142
+        }).catch((err) => {
143
+          message.info(err.msg || err.message)
144
+        })
145
+      }
146
+    }
147
+
148
+  return (
149
+    <XForm onSubmit={handleSubmit} onCancel={cancelPage} fields={fields}></XForm>
150
+  );
151
+ }
152
+
153
+
154
+
155
+export default Edit