Bläddra i källkod

Merge branch 'master' of http://git.ycjcjy.com/marketing/pc-admin

Your Name 3 år sedan
förälder
incheckning
fb6a42a752

+ 2
- 1
config/proxy.js Visa fil

8
 export default {
8
 export default {
9
   dev: {
9
   dev: {
10
     '/api/': {
10
     '/api/': {
11
-      target: 'https://xlk.njyz.tech/',
11
+      // target: 'https://xlk.njyz.tech/',
12
+      target: 'http://localhost:8081/',
12
       changeOrigin: true,
13
       changeOrigin: true,
13
       pathRewrite: {
14
       pathRewrite: {
14
         '^': '',
15
         '^': '',

+ 18
- 1
config/routes.js Visa fil

86
                 hideInMenu: true,
86
                 hideInMenu: true,
87
                 component: './customer/Customer/PrivateCustomer/CustomerDetail',
87
                 component: './customer/Customer/PrivateCustomer/CustomerDetail',
88
               },
88
               },
89
-
90
               // {
89
               // {
91
               //   path: '/customer/customerlist/list',
90
               //   path: '/customer/customerlist/list',
92
               //   name: '客户列表old',
91
               //   name: '客户列表old',
185
                 hideInMenu: true,
184
                 hideInMenu: true,
186
                 component: './Live/LiveActivity/add',
185
                 component: './Live/LiveActivity/add',
187
               },
186
               },
187
+
188
+              {
189
+                path: '/Live/video/List',
190
+                name: '视频',
191
+                component: './Live/video/List',
192
+              },
193
+              {
194
+                path: '/Live/video/Edit',
195
+                name: '编辑视频',
196
+                hideInMenu: true,
197
+                component: './Live/video/Edit',
198
+              },
199
+              // {
200
+              //   path: '/Live/video/add',
201
+              //   name: '新增活动',
202
+              //   hideInMenu: true,
203
+              //   component: './Live/video/add',
204
+              // },
188
               
205
               
189
               // {
206
               // {
190
               //   path: '/staff/Staff/Edit',
207
               //   path: '/staff/Staff/Edit',

+ 3
- 3
src/components/Share/index.jsx Visa fil

1
 import React, { useState, useEffect } from 'react'
1
 import React, { useState, useEffect } from 'react'
2
-import { Button, Form, Input } from 'antd'
2
+import { Button, Form, Input, message } from 'antd'
3
 import ImageUpload from '@/components/XForm/ImageUpload'
3
 import ImageUpload from '@/components/XForm/ImageUpload'
4
 import { fetch, apis } from '@/utils/request'
4
 import { fetch, apis } from '@/utils/request'
5
 
5
 
33
         return
33
         return
34
       }
34
       }
35
 
35
 
36
-      const request = formData.shareContentId ? updateData : saveData
37
-      const urlData = formData.shareContentId ? { id: formData.shareContentId } : undefined
36
+      const request = formData?.shareContentId ? updateData : saveData
37
+      const urlData = formData?.shareContentId ? { id: formData.shareContentId } : undefined
38
       const data = {
38
       const data = {
39
         targetId,
39
         targetId,
40
         shareContentType: targetType,
40
         shareContentType: targetType,

+ 181
- 0
src/pages/Live/video/Edit/index.jsx Visa fil

1
+import React, { useState, useEffect } from 'react';
2
+import {
3
+  Form,
4
+  Input,
5
+  Button,
6
+  Icon,
7
+  Select,
8
+  Card,
9
+  Radio,
10
+  DatePicker,
11
+  message,
12
+  Upload,
13
+  InputNumber,
14
+} from 'antd';
15
+import { FormattedMessage } from 'umi-plugin-react/locale';
16
+import moment from 'moment';
17
+import router from 'umi/router';
18
+import FileUpload from '@/components/XForm/FileUpload';
19
+import XForm, { FieldTypes, createForm } from '@/components/XForm';
20
+import apis from '@/services/apis';
21
+import BuildSelect2 from '@/components/SelectButton/BuildSelect2';
22
+import LivePlatSelect from '@/components/SelectButton/LivePlatSelect';
23
+import CitySelect3 from '@/components/SelectButton/CitySelect3';
24
+import ImageUpload from '@/components/XForm/ImageUpload';
25
+import request from '@/utils/request';
26
+import Navigate from '@/components/Navigate';
27
+
28
+const { Option } = Select;
29
+const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
30
+
31
+let cityId = '';
32
+
33
+const header = props => {
34
+  console.log(props);
35
+
36
+  const { id } = props.location.query;
37
+
38
+  const [data, setData] = useState({});
39
+
40
+  // 查询详情
41
+  const getData = () => {
42
+    request({ ...apis.video.getDetail, urlData: { id } }).then(data => {
43
+      data.videoUrl = [data.videoUrl];
44
+      setData(data);
45
+    });
46
+  };
47
+
48
+  useEffect(() => {
49
+    if (id) {
50
+      getData(id);
51
+    }
52
+  }, []);
53
+
54
+  const cancelPage = () => {
55
+    router.go('-1');
56
+  };
57
+
58
+
59
+  function handleSubmit(e) {
60
+    e.preventDefault();
61
+    props.form.validateFields((err, values) => {
62
+      console.log(values, 'values');
63
+      if (!err) {
64
+        values.videoUrl = values?.videoUrl[0];
65
+        if (id) {
66
+          request({
67
+            ...apis.video.updata,
68
+            urlData: { id: id },
69
+            data: values,
70
+          })
71
+            .then(data => {
72
+              message.info('保存成功');
73
+              cancelPage();
74
+            })
75
+            .catch(err => {
76
+              message.info(err.msg || err.message);
77
+            });
78
+        } else {
79
+          request({
80
+            ...apis.video.save,
81
+            data: values,
82
+          })
83
+            .then(data => {
84
+              message.info('保存成功');
85
+              cancelPage();
86
+            })
87
+            .catch(err => {
88
+              message.info(err.msg || err.message);
89
+            });
90
+        }
91
+      }
92
+    });
93
+  }
94
+
95
+  // 视频文件上传前 回调
96
+  const fileUploadBeforeUpload = (file, fileList) => {
97
+    return new Promise((resolve, reject) => {
98
+      if (file.type === 'video/mp4' || file.type === '.mp4') {
99
+        // setVideoImage(true)
100
+        resolve(file);
101
+      } else {
102
+        notification.error({ message: '项目视频,仅支持MP4格式' });
103
+        reject();
104
+      }
105
+    });
106
+  };
107
+
108
+  const { getFieldDecorator } = props.form;
109
+
110
+  return (
111
+    <Card>
112
+      <Form labelCol={{ span: 7 }} wrapperCol={{ span: 12 }} onSubmit={handleSubmit}>
113
+        <Form.Item label="所属城市">
114
+          {getFieldDecorator('cityId', {
115
+            initialValue: data.cityId,
116
+            rules: [{ required: true, message: ' 请输入所属城市' }],
117
+          })(<CitySelect3 buildingId={props.form.getFieldValue('buildingId')} />)}
118
+        </Form.Item>
119
+
120
+        <Form.Item label="所属楼盘">
121
+          {getFieldDecorator('buildingId', {
122
+            initialValue: data.buildingId,
123
+          })(<BuildSelect2 cityId={props.form.getFieldValue('cityId')} />)}
124
+        </Form.Item>
125
+
126
+        <Form.Item label="主图" help="建议尺寸:750px*600px,比例5:4,格式:jpg,用于:列表和详情">
127
+          {getFieldDecorator('videImg', {
128
+            initialValue: data.videImg,
129
+            rules: [{ required: true, message: '请上传主图' }],
130
+          })(<ImageUpload />)}
131
+        </Form.Item>
132
+
133
+        <Form.Item label="视频标题">
134
+          {getFieldDecorator('name', {
135
+            initialValue: data.name,
136
+            rules: [{ required: true, message: '请输入视频标题' }],
137
+          })(<Input maxLength={20} placeholder="请输入视频标题" />)}
138
+        </Form.Item>
139
+
140
+        <Form.Item label="简介">
141
+          {getFieldDecorator('remark', {
142
+            initialValue: data.remark,
143
+            rules: [{ required: true, message: '请输入简介' }],
144
+          })(<Input.TextArea row={4} />)}
145
+        </Form.Item>
146
+
147
+        <Form.Item label="视频">
148
+          {getFieldDecorator('videoUrl', {
149
+            initialValue: data.videoUrl || null,
150
+            rules: [{ required: true, message: '请上传视频' }],
151
+          })(
152
+            <FileUpload
153
+              accept=".mp4"
154
+              beforeUpload={fileUploadBeforeUpload}
155
+              //   label="上传视频"
156
+              size={1}
157
+            />,
158
+          )}
159
+        </Form.Item>
160
+
161
+        <Form.Item label="权重">
162
+          {getFieldDecorator('weight', {
163
+            initialValue: data.weight,
164
+            rules: [{ required: true, message: '请设置权重' }],
165
+          })(<InputNumber placeholder="权重越大越靠前" style={{ width: '150px' }} />)}
166
+        </Form.Item>
167
+
168
+        <Form.Item wrapperCol={{ span: 15, offset: 7 }}>
169
+          <Button type="primary" htmlType="submit" style={{ marginRight: '20px' }}>
170
+            确定
171
+          </Button>
172
+          <Button onClick={() => router.go(-1)}>取消</Button>
173
+        </Form.Item>
174
+      </Form>
175
+    </Card>
176
+  );
177
+};
178
+
179
+const VideoEdit = Form.create({ name: 'header' })(header);
180
+
181
+export default VideoEdit;

+ 179
- 0
src/pages/Live/video/List/index.jsx Visa fil

1
+import React, { useState, useEffect, useRef } from 'react';
2
+import {
3
+  Form,
4
+  Input,
5
+  Button,
6
+  Icon,
7
+  Typography,
8
+  message,
9
+  Table,
10
+  Pagination,
11
+  Modal,
12
+  DatePicker,
13
+  Card,
14
+} from 'antd';
15
+import router from 'umi/router';
16
+import moment from 'moment';
17
+import AuthButton from '@/components/AuthButton';
18
+import withActions from '@/components/ActionList';
19
+import EditIcon from '@/components/EditIcon';
20
+import Navigate from '@/components/Navigate';
21
+import apis from '@/services/apis';
22
+import request from '@/utils/request';
23
+import QueryTable from '@/components/QueryTable';
24
+import { getImgURL } from '@/utils/image';
25
+import OperButton from '@/components/OperButton';
26
+
27
+const Video = props => {
28
+  const ref = useRef();
29
+
30
+  // 跳转到编辑
31
+  const toVideoEdit = row => {
32
+    router.push({
33
+      pathname: '/Live/video/Edit',
34
+      query: {
35
+        id: row?.videoId,
36
+      },
37
+    });
38
+  };
39
+
40
+
41
+  const onPublish = row => {
42
+   
43
+    request({ ...apis.video.publish, urlData: { id: row.videoId } })
44
+      .then(() => {
45
+        message.success( '操作成功');
46
+        // setLoading(false);
47
+        ref.current.reload();
48
+      })
49
+      .catch(err => {
50
+        console.error(err);
51
+        message.error( '操作失败');
52
+      });
53
+  };
54
+
55
+  const onDelete = row => {
56
+
57
+    request({ ...apis.video.delete, urlData: { id: row.videoId } })
58
+      .then(() => {
59
+        message.success( '删除成功');
60
+        // setLoading(false);
61
+        ref.current.reload();
62
+      })
63
+      .catch(err => {
64
+        console.error(err);
65
+        message.error( '操作失败');
66
+      });
67
+  };
68
+
69
+  const searchFields = [
70
+    {
71
+      name: 'title',
72
+      label: '视频标题',
73
+      placeholder: '请输入标题',
74
+    },
75
+  ];
76
+
77
+  const columns = [
78
+    {
79
+      title: '视频标题',
80
+      dataIndex: 'name',
81
+      key: 'name',
82
+      align: 'center',
83
+      width: '20%',
84
+      render: (x, row) => (
85
+        <Navigate onClick={() => toVideoEdit(row)}>
86
+          <Typography.Text ellipsis>{x}</Typography.Text>
87
+        </Navigate>
88
+      ),
89
+    },
90
+    {
91
+      title: '视频主图',
92
+      dataIndex: 'videImg',
93
+      key: 'videImg',
94
+      align: 'center',
95
+      render: (x, row) => (
96
+        <img src={getImgURL(x)} width={128} height={72} style={{ borderRadius: '4px' }} alt="" />
97
+      ),
98
+    },
99
+
100
+    {
101
+      title: '阅读人数',
102
+      dataIndex: 'lookNum',
103
+      key: 'lookNum',
104
+      align: 'center',
105
+    },
106
+    {
107
+      title: '归属楼盘',
108
+      dataIndex: 'buildingName',
109
+      key: 'buildingName',
110
+      align: 'center',
111
+    },
112
+
113
+    {
114
+      title: '权重',
115
+      dataIndex: 'weight',
116
+      key: 'weight',
117
+      align: 'center',
118
+    },
119
+    {
120
+      title: '操作',
121
+      dataIndex: 'handle',
122
+      key: 'handle',
123
+      align: 'center',
124
+      render: withActions((x, row) => [
125
+        <AuthButton name="admin.buildingDynamic.update.put" noRight={null}>
126
+          <OperButton onClick={() => toVideoEdit(row)}>编辑</OperButton>
127
+          {/* <EditIcon
128
+        type="edit"
129
+        text="编辑"
130
+        onClick={() => toSignupActivityEdit(row.dynamicId, row.count)}
131
+      /> */}
132
+        </AuthButton>,
133
+
134
+        <AuthButton name="admin.buildingDynamic.send.dynamicId.put" noRight={null}>
135
+          <OperButton onClick={() => onPublish(row)}>
136
+            {row.isPublish ? '取消发布' : '发布'}
137
+          </OperButton>
138
+          {/* <EditIcon
139
+            type={row.isPublish ? 'cancel' : 'publish'}
140
+            text={row.isPublish ? '取消发布' : '发布'}
141
+            onClick={() => sendOrPublicDynamic(row)}
142
+          /> */}
143
+        </AuthButton>,
144
+
145
+        <AuthButton name="admin.building.delete" noRight={null}>
146
+          <OperButton.Confirm
147
+            title="确认删除?"
148
+            content="删除之后不可恢复"
149
+            onClick={() => onDelete(row)}
150
+          >
151
+            删除
152
+          </OperButton.Confirm>
153
+        </AuthButton>,
154
+      ]),
155
+    },
156
+  ];
157
+
158
+  const actionRender = () => {
159
+    return (
160
+      <Button type="primary" icon="plus" onClick={() => toVideoEdit()}>
161
+        新增
162
+      </Button>
163
+    );
164
+  };
165
+
166
+  return (
167
+    <QueryTable
168
+      ref={ref}
169
+      rowKey="videoId"
170
+      api={apis.video.list}
171
+      searchFields={searchFields}
172
+      columns={columns}
173
+      actionRender={actionRender}
174
+      // onPageChange={(pg) => setPage(pg)}
175
+    />
176
+  );
177
+};
178
+
179
+export default Video;

+ 4
- 23
src/pages/activity/SignupActivity/edit/Basic.jsx Visa fil

90
           values.enlistEnd = moment(enlistEnd).format('YYYY-MM-DD HH:mm');
90
           values.enlistEnd = moment(enlistEnd).format('YYYY-MM-DD HH:mm');
91
         }
91
         }
92
 
92
 
93
-        console.log('submit data --->', values);
93
+        values.type = type
94
         if (dynamicId) {
94
         if (dynamicId) {
95
           const checks = checkTime();
95
           const checks = checkTime();
96
           if (checks != true) {
96
           if (checks != true) {
103
             message.info('活动人数必须大于已报名人数');
103
             message.info('活动人数必须大于已报名人数');
104
             return;
104
             return;
105
           }
105
           }
106
-          values.type = type
106
+          
107
           values.dynamicId = dynamicId;
107
           values.dynamicId = dynamicId;
108
           request({ ...apis.activity.update, data: values })
108
           request({ ...apis.activity.update, data: values })
109
             .then(data => {
109
             .then(data => {
110
               message.info('保存成功');
110
               message.info('保存成功');
111
-              // router.go(-1)
111
+              router.go(-1)
112
             })
112
             })
113
             .catch(err => {
113
             .catch(err => {
114
               message.info(err.msg || err.message);
114
               message.info(err.msg || err.message);
117
           request({ ...apis.activity.add, data: { ...values } })
117
           request({ ...apis.activity.add, data: { ...values } })
118
             .then(data => {
118
             .then(data => {
119
               message.info('保存成功');
119
               message.info('保存成功');
120
-              router.push({
121
-                pathname: '/activity/editActivity',
122
-                query: {
123
-                  dynamicId: data.dynamicId,
124
-                },
125
-              });
126
-              // router.go(-1)
120
+              router.go(-1)
127
             })
121
             })
128
             .catch(err => {
122
             .catch(err => {
129
               message.info(err.msg || err.message);
123
               message.info(err.msg || err.message);
133
     });
127
     });
134
   };
128
   };
135
   const changeTime = (value, date) => {
129
   const changeTime = (value, date) => {
136
-    // console.log(value, data, '-----checkTime---------')
137
-    // console.log(props.form.getFieldsValue(), '--------time1-----------')
138
-    // let datas = data
139
-    // console.log(value, date, datas)
140
-    // datas.signupTime = date
141
-
142
-    // //   data.signupTime = [moment(data.enlistStart), moment(data.enlistEnd)]
143
-
144
-    // console.log(datas,'-------datas--------')
145
-    //   props.form.setFieldsValue(data)
146
     setShowSignupTime(date);
130
     setShowSignupTime(date);
147
-    // props.form.setFieldsValue(datas)
148
-    // // form.setFieldsValue
149
-    // console.log('-------1--------')
150
   };
131
   };
151
 
132
 
152
   const { getFieldDecorator } = props.form;
133
   const { getFieldDecorator } = props.form;

+ 0
- 524
src/pages/activity/SignupActivity/edit/ind.jsx Visa fil

1
-import React, { useState, useEffect } from 'react';
2
-import { Form, Input, Button, Icon, Select, Tabs, Radio, DatePicker, message, Upload } from 'antd';
3
-
4
-import router from 'umi/router';
5
-import apis from '@/services/apis';
6
-import moment from 'moment';
7
-import BuildSelect from '@/components/SelectButton/BuildSelect2'
8
-import Wangedit from '@/components/Wangedit/Wangedit'
9
-import request from '@/utils/request'
10
-import yinhao from '@/assets/yinhao.png'
11
-import ImageUploader from '@/components/XForm/ImageUpload';
12
-import logo from '@/assets/logo.svg';
13
-import touxiang from '@/assets/touxiang.jpg';
14
-import poster1 from '@/assets/poster1.png';
15
-import poster2 from '@/assets/poster2.png';
16
-import xiaochengxu from '@/assets/xiaochengxu.png'
17
-
18
-const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
19
-const { TextArea } = Input;
20
-
21
-const formItemLayout = {
22
-  labelCol: { span: 6 },
23
-  wrapperCol: { span: 14 },
24
-};
25
-
26
-const cancelPage = () => {
27
-  router.push({
28
-    pathname: '/activity/ActivityList',
29
-  });
30
-}
31
-
32
-const BasicForm = props => {
33
-  const [isEnlist, setIsEnlist] = useState(1)
34
-  const [activityStatus, setActivityStatus] = useState(1)
35
-  const [disable, setDisable] = useState(false)
36
-  const [data, setData] = useState(1)
37
-  const [showSignupTime, setShowSignupTime] = useState([])
38
-
39
-
40
-  const radioOnChange = e => {
41
-    setIsEnlist(e.target.value)
42
-  }
43
-
44
-  const { dynamicId } = props
45
-
46
-  // 查询详情
47
-  const getDynamicData = dynamicId => {
48
-    request({ ...apis.activity.details, params: { dynamicId } }).then(data => {
49
- 
50
-      data.activityTime = [moment(data.startDate), moment(data.endDate)]
51
-      data.signupTime = [moment(data.enlistStart), moment(data.enlistEnd)]
52
-      // setSignupTime([moment(data.enlistStart), moment(data.enlistEnd)])
53
-      setData(data)
54
-      setIsEnlist(data.isEnlist)
55
-      setActivityStatus(data.activityStatus)
56
-      setDisable(data.activityStatus === 0)
57
-      props.form.setFieldsValue(data)
58
-    })
59
-  }
60
-
61
-  // eslint-disable-next-line react-hooks/rules-of-hooks
62
-  useEffect(() => {
63
-    props.form.setFieldsValue({ isEnlist })
64
-    if (dynamicId) {
65
-      getDynamicData(dynamicId);
66
-    }
67
-  }, [])
68
-  const checkTime = () => {
69
-    function compareDate(dateTime1, dateTime2) {
70
-      return new Date(dateTime1) > new Date(dateTime2)
71
-    }
72
-    // 1)修改后的开始时间不得大于当前时间(会存在已经成功报名的用户)
73
-
74
-    // (2)修改后开始时间<当前时间<修改后结束时间:活动进行中
75
-
76
-    // (3)修改后结束时间<当前时间:活动已结束
77
-    if (showSignupTime[0]) {
78
-      // const date = data.signupTime
79
-      const nowDate = new Date()
80
-      // console.log(compareDate(nowDate, showSignupTime[0]))
81
-      if (compareDate(nowDate, showSignupTime[0])) {
82
-        return true
83
-      } else {
84
-        return '修改后的开始时间不得大于当前时间(会存在已经成功报名的用户)'
85
-      }
86
-    }
87
-    return true
88
-  }
89
-
90
-
91
-  const handleSubmit = e => {
92
-    e.preventDefault();
93
-    props.form.validateFields((err, values) => {
94
-
95
-      if (!err) {
96
-        console.log('Received values of form: ', values);
97
-        const { activityTime, signupTime } = values
98
-        const [startDate, endDate] = activityTime
99
-        values.startDate = moment(startDate).format('YYYY-MM-DD HH:mm');
100
-        values.endDate = moment(endDate).format('YYYY-MM-DD HH:mm');
101
-        if (signupTime) {
102
-          const [enlistStart, enlistEnd] = signupTime
103
-          values.enlistStart = moment(enlistStart).format('YYYY-MM-DD HH:mm');
104
-          values.enlistEnd = moment(enlistEnd).format('YYYY-MM-DD HH:mm');
105
-        }
106
-
107
-        console.log('submit data --->', values)
108
-        if (dynamicId) {
109
-          const checks = checkTime()
110
-          if (checks != true) {
111
-            message.info(checks)
112
-            return
113
-          }
114
-          console.log(data.enlistNum,values.personNum,'143')
115
-
116
-          if (data.enlistNum > values.personNum) {
117
-            message.info('活动人数必须大于已报名人数')
118
-            return
119
-          }
120
-
121
-          values.dynamicId = dynamicId
122
-          request({ ...apis.activity.update, data: values }).then(data => {
123
-            message.info('保存成功')
124
-            // router.go(-1)
125
-          }).catch((err) => {
126
-            message.info(err.msg || err.message)
127
-          })
128
-        } else {
129
-          request({ ...apis.activity.add, data: { ...values } }).then((data) => {
130
-            message.info('保存成功')
131
-            router.push({
132
-              pathname: '/activity/editActivity',
133
-              query: {
134
-                dynamicId: data.dynamicId,
135
-              },
136
-            });
137
-            // router.go(-1)
138
-          }).catch((err) => {
139
-            message.info(err.msg || err.message)
140
-          })
141
-        }
142
-      }
143
-    });
144
-  }
145
-  const changeTime = (value, date) => {
146
-    // console.log(value, data, '-----checkTime---------')
147
-    // console.log(props.form.getFieldsValue(), '--------time1-----------')
148
-    // let datas = data
149
-    // console.log(value, date, datas)
150
-    // datas.signupTime = date
151
-
152
-    // //   data.signupTime = [moment(data.enlistStart), moment(data.enlistEnd)]
153
-
154
-    // console.log(datas,'-------datas--------')
155
-    //   props.form.setFieldsValue(data)
156
-    setShowSignupTime(date)
157
-    // props.form.setFieldsValue(datas)
158
-    // // form.setFieldsValue
159
-    // console.log('-------1--------')
160
-  }
161
-
162
-  const { getFieldDecorator } = props.form;
163
-  return (
164
-    <>
165
-      <Form {...formItemLayout} onSubmit={handleSubmit}>
166
-        <Form.Item label="所属项目">
167
-          {getFieldDecorator('buildingId', {
168
-            rules: [
169
-              {
170
-                required: true,
171
-                message: '请选择所属项目',
172
-              },
173
-            ],
174
-          })(<BuildSelect disabled={disable} />)}
175
-        </Form.Item>
176
-        <Form.Item label="活动封面图1" help="建议图片尺寸:750px*420px,比例16:9,格式:jpg,用于:首页推荐/活动列表">
177
-          {getFieldDecorator('listImgUrl', {
178
-            rules: [
179
-              {
180
-                required: true,
181
-                message: '请选择活动封面图1',
182
-              },
183
-            ],
184
-          })(<ImageUploader />)}
185
-        </Form.Item>
186
-        <Form.Item label="活动封面图2" help="建议图片尺寸:750*250,比例3:1,格式:jpg,用于:项目详情页">
187
-          {getFieldDecorator('bannerListImg', {
188
-            rules: [
189
-              {
190
-                required: true,
191
-                message: '请选择活动封面图2',
192
-              },
193
-            ],
194
-          })(<ImageUploader />)}
195
-        </Form.Item>
196
-        <Form.Item label="活动详情主图" help="建议图片尺寸:750*600px,比例5:4,格式:jpg,用于:普通活动详情">
197
-          {getFieldDecorator('imgUrl', {
198
-            rules: [
199
-              {
200
-                required: true,
201
-                message: '请选择活动详情主图',
202
-              },
203
-            ],
204
-          })(<ImageUploader />)}
205
-        </Form.Item>
206
-        <Form.Item label="活动标题">
207
-          {getFieldDecorator('title', {
208
-            rules: [
209
-              {
210
-                required: true,
211
-                message: '请输入活动标题',
212
-              },
213
-            ],
214
-          })(<Input />)}
215
-        </Form.Item>
216
-        <Form.Item label="活动时间">
217
-          {getFieldDecorator('activityTime', {
218
-            rules: [
219
-              {
220
-                required: true,
221
-                message: '请选择活动时间',
222
-              },
223
-            ],
224
-          })(<RangePicker format="YYYY-MM-DD HH:mm" />)}
225
-        </Form.Item>
226
-        <Form.Item label="活动地点">
227
-          {getFieldDecorator('address', {
228
-            rules: [
229
-              {
230
-                required: true,
231
-                message: '请输入活动地点',
232
-              },
233
-            ],
234
-          })(<Input />)}
235
-        </Form.Item>
236
-        {/* disabled={activityStatus === 0 ? true : false} */}
237
-        <Form.Item label="活动人数" help="当前活动最多可报名人数">
238
-          {getFieldDecorator('personNum', {
239
-            rules: [
240
-              {
241
-                required: true,
242
-                message: '请输入活动人数',
243
-              },
244
-              // {
245
-              //   min: data.personNum,min={data.personNum || 0}
246
-              //   message: '活动人数必须大于已报名人数',
247
-              // },
248
-            ],
249
-          })(<Input type="number" />)}
250
-        </Form.Item>
251
-        <Form.Item label="用户携带人数" help="每个用户最多可携带参与活动的人数">
252
-          {getFieldDecorator('maxEnlistByPerson', {
253
-            rules: [
254
-              {
255
-                required: true,
256
-                message: '请输入用户携带人数',
257
-              },
258
-            ],
259
-          })(<Input type="number" min={1} />)}
260
-        </Form.Item>
261
-        <Form.Item label="活动详情">
262
-          {getFieldDecorator('desc')(<Wangedit />)}
263
-        </Form.Item>
264
-        <Form.Item label="报名时间">
265
-          {getFieldDecorator('signupTime', {
266
-            rules: [
267
-              {
268
-                required: true,
269
-                message: '请选择报名时间',
270
-              },
271
-            ],
272
-          })(<RangePicker format="YYYY-MM-DD HH:mm" onChange={changeTime} />)}
273
-        </Form.Item>
274
-        <Form.Item label="权重">
275
-          {getFieldDecorator('heavy', {
276
-
277
-            rules: [
278
-              {
279
-                required: true,
280
-                message: '请输入权重',
281
-              },
282
-            ],
283
-          })(<Input type="number" style={{ width: 80 }} />)}<span style={{ marginLeft: 30, color: 'grey' }}>数字越大越靠前</span>
284
-        </Form.Item>
285
-        <Form.Item wrapperCol={{ span: 12, offset: 8 }}>
286
-          <Button type="primary" htmlType="submit">
287
-            确认
288
-          </Button>
289
-          &nbsp;&nbsp;&nbsp;&nbsp;
290
-          <Button onClick={() => cancelPage()}>
291
-            取消
292
-          </Button>
293
-        </Form.Item>
294
-      </Form>
295
-    </>
296
-  )
297
-}
298
-
299
-const Basic = Form.create({ name: 'BasicForm' })(BasicForm);
300
-
301
-const Poster = props => {
302
-  const { dynamicId } = props
303
-  const [inputValue, changeInput] = useState('')
304
-  const [textAreaValue, changeTextArea] = useState('')
305
-  const [imgValue, changeImg] = useState('')
306
-  const [posterId, setPosterId] = useState('')
307
-
308
-  useEffect(() => {
309
-    if (dynamicId) {
310
-      request({ ...apis.activity.poster, params: { targetId: dynamicId, targetType: 'activity' } }).then(data => {
311
-
312
-        if (data.length > 0) {
313
-          setPosterId(data[0].posterId)
314
-          changeImg(data[0].posterImg)
315
-          changeTextArea(data[0].posterDescription)
316
-          changeInput(data[0].posterTitle)
317
-        }
318
-      }).catch(err => {
319
-        message.info(err.msg || err.message)
320
-      })
321
-    }
322
-    // getMiniappName()
323
-  }, [])
324
-  
325
-  // 获取小程序名称
326
-  // const [miniappName, setMiniappName] = useState('')
327
-  // function getMiniappName() {
328
-  //   request({ ...apis.building.getMiniappName }).then(res => {
329
-  //     console.log(res, "0000000000000")
330
-  //     setMiniappName(res)
331
-  //   })
332
-  // }
333
-
334
-  const submitPoster = () => {
335
-    if (dynamicId) {
336
-      if (posterId) {
337
-        request({ ...apis.activity.updatePoster, urlData: { id: posterId }, data: { targetId: dynamicId, targetType: 'activity', posterImg: imgValue, posterTitle: inputValue, posterDescription: textAreaValue } }).then(data => {
338
-          message.info('保存成功')
339
-        }).catch(err => {
340
-          message.info(err.msg || err.message)
341
-        })
342
-      } else {
343
-        request({ ...apis.activity.addPoster, data: { targetId: dynamicId, targetType: 'activity', posterImg: imgValue, posterTitle: inputValue, posterDescription: textAreaValue } }).then(data => {
344
-          setPosterId(data.posterId)
345
-          message.info('保存成功')
346
-        }).catch(err => {
347
-          message.info(err.msg || err.message)
348
-        })
349
-      }
350
-    } else {
351
-      message.warn('请先保存基本信息数据')
352
-    }
353
-  }
354
-
355
-  return <div>
356
-    <div style={{ display: 'flex' }}>
357
-      <div style={{ width: '420px', height: '900px', display: 'inline-block', marginTop: '30px' }}>
358
-        <div style={{ width: '375px', height: '700px', backgroundColor: '#fff', boxShadow: '0px 0px 16px 6px rgba(0,0,0,0.15)', position: 'relative', margin: '0 auto' }}>
359
-          <img style={{ width: '100%', height: '300px' }} src={imgValue || poster1} alt="" />
360
-          <div style={{ display: 'flex', alignItems: 'center', marginTop: '-24px' }}>
361
-            <img style={{ width: '70px', height: '70px', border: '4px solid #fff', borderRadius: '35px', marginLeft: '16px' }} src={touxiang} alt="" />
362
-            <span style={{ color: '#222', fontWeight: '600', margin: '24px 10px 0 14px', fontSize: '17px' }}>喵喵</span>
363
-            <span style={{ color: '#999', marginTop: '25px', fontSize: '17px' }}>邀您参与</span>
364
-            <span style={{ color: '#999', margin: '25px 0 0 60px', fontSize: '17px' }}>2019.09.21</span>
365
-          </div>
366
-          <p style={{
367
-            margin: '10px 20px',
368
-            fontSize: '20px',
369
-            color: '#222',
370
-            fontWeight: '600',
371
-            display: '-webkit-box',
372
-            lineClamp: '3',
373
-            height: '60px',
374
-            WebkitLineClamp: '2',
375
-            WebkitBoxOrient: 'vertical',
376
-            overflow: 'hidden',
377
-            textOverflow: 'ellipsis',
378
-          }}>{inputValue || '海报标题'}</p>
379
-
380
-          <img src={yinhao} style={{ width: '30px', marginLeft: '20px' }} alt="" />
381
-          <p style={{
382
-            margin: '16px 20px 28px 20px',
383
-            fontSize: '17px',
384
-            color: '#999',
385
-            display: '-webkit-box',
386
-            lineClamp: '3',
387
-            height: '72px',
388
-            WebkitLineClamp: '3',
389
-            WebkitBoxOrient: 'vertical',
390
-            overflow: 'hidden',
391
-            textOverflow: 'ellipsis',
392
-          }}>{textAreaValue || '海报描述'}</p>
393
-          <div style={{ backgroundColor: '#f1f1f1', padding: '22px 30px', boxShadow: '0px 6px 12px -4px #dcdcdc', position: 'relative' }}>
394
-            <p style={{ margin: '0', fontSize: '18px', color: '#888' }}>长按识别小程序码</p>
395
-            <p style={{ margin: '0', fontSize: '18px', color: '#888' }}>进入活动查看详情</p>
396
-            <img style={{ width: '80px', position: 'absolute', right: '30px', top: '10px' }} src={xiaochengxu} alt="" />
397
-          </div>
398
-        </div>
399
-        <p style={{ textAlign: 'center', fontSize: '19px', color: '#666', marginTop: '30px' }}>海报模板</p>
400
-      </div>
401
-
402
-      <div >
403
-        <div style={{ display: 'flex', width: '100%', margin: '60px 0' }}>
404
-          <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>活动海报图</p>
405
-          <ImageUploader value={imgValue} onChange={e => changeImg(e)} />
406
-        </div>
407
-        <p style={{ fontSize: '0.5vw', color: '#A9A9A9', marginLeft: '230px', marginBottom: '30px' }}>建议图片尺寸:640*670px,比例64:67,格式:jpg,用于普通活动海报</p>
408
-        <div style={{ display: 'flex', alignItems: 'center', width: '100%', marginBottom: '60px' }}>
409
-          <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>海报标题</p>
410
-          <Input style={{ width: '20vw' }} value={inputValue} placeholder="请输入海报标题" onChange={e => changeInput(e.target.value)} />
411
-        </div>
412
-        <div style={{ display: 'flex', margin: '10px 0 40px 0', width: '100%' }}>
413
-          <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>海报描述</p>
414
-          <TextArea rows={5} maxLength={1024} value={textAreaValue} onChange={e => changeTextArea(e.target.value)} />
415
-        </div>
416
-
417
-      </div>
418
-    </div>
419
-    <Button type="primary" onClick={submitPoster} style={{ margin: '40px 40px 40px 30vw' }}> 确定</Button>
420
-    <Button onClick={() => cancelPage()}>
421
-      取消
422
-    </Button>
423
-  </div>
424
-}
425
-
426
-const Share = props => {
427
-  const { dynamicId } = props
428
-  const [inputValue, changeInput] = useState('')
429
-  const [imgValue, changeImg] = useState('')
430
-  const [shareContentId, setShareContentId] = useState('')
431
-
432
-  useEffect(() => {
433
-    if (dynamicId) {
434
-      request({ ...apis.activity.shareContent, params: { targetId: dynamicId, targetType: 'activity' } }).then(data => {
435
-
436
-        if (data.length > 0) {
437
-          setShareContentId(data[0].shareContentId)
438
-          changeImg(data[0].shareContentImg)
439
-          changeInput(data[0].shareContentTitle)
440
-        }
441
-      }).catch(err => {
442
-        message.info(err.msg || err.message)
443
-      })
444
-    }
445
-  }, [dynamicId])
446
-
447
-  const submitShare = () => {
448
-    if (dynamicId) {
449
-      if (shareContentId) {
450
-        request({ ...apis.activity.updateShareContent, urlData: { id: shareContentId }, data: { targetId: dynamicId, shareContentType: 'activity', shareContentImg: imgValue, shareContentTitle: inputValue } }).then(data => {
451
-          message.info('保存成功')
452
-        }).catch(err => {
453
-          message.info(err.msg || err.message)
454
-        })
455
-      } else {
456
-        request({ ...apis.activity.addShareContent, data: { targetId: dynamicId, shareContentType: 'activity', shareContentImg: imgValue, shareContentTitle: inputValue } }).then(data => {
457
-          setShareContentId(data.shareContentId)
458
-          message.info('保存成功')
459
-        }).catch(err => {
460
-          message.info(err.msg || err.message)
461
-        })
462
-      }
463
-    } else {
464
-      message.warn('请先保存基本信息数据')
465
-    }
466
-  }
467
-
468
-  return <div style={{ padding: '20px' }}>
469
-    <div style={{ display: 'flex', margin: '10px 0 40px 0', width: '100%' }}>
470
-      <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>分享模板</p>
471
-      <div>
472
-        <p style={{ display: 'flex', alignItems: 'center', fontSize: '14px', color: '#999', margin: '0', lineHeight: '0' }}>
473
-          <img src={logo} style={{ width: '22px', marginRight: '10px' }} alt=""/>橙蕉互动</p>
474
-        <p style={{ fontSize: '16px', color: '#222', fontWeight: '600', margin: '0' }}>{inputValue || '置业V客厅 精准获客平台'}</p>
475
-        <img style={{ width: '200px', height: '160px' }} src={imgValue || poster2} alt="" />
476
-      </div>
477
-    </div>
478
-    <div style={{ display: 'flex', alignItems: 'center', width: '100%' }}>
479
-      <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>分享标题</p>
480
-      <Input placeholder="请输入分享标题" value={inputValue} onChange={e => changeInput(e.target.value)} />
481
-    </div>
482
-    <div style={{ display: 'flex', width: '100%', marginTop: '40px' }}>
483
-      <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>活动分享图</p>
484
-      <ImageUploader value={imgValue} onChange={e => changeImg(e)} />
485
-    </div>
486
-    <p style={{ fontSize: '0.5vw', color: '#A9A9A9', marginLeft: '230px', marginTop: '20px' }}>建议图片尺寸:750*600px,比例5:4,格式:jpg,用于活动分享好友</p>
487
-    <Button type="primary" htmlType="submit" onClick={submitShare} style={{ margin: '40px 40px 40px 220px' }}> 确定</Button>
488
-    <Button onClick={() => cancelPage()}>
489
-      取消
490
-    </Button>
491
-  </div>
492
-}
493
-
494
-
495
-/**
496
- *
497
- *
498
- * @param {*} props
499
- * @returns
500
- */
501
-const Edit = props => {
502
-  const [tab, changeTab] = useState('basic')
503
-  const { dynamicId } = props.location.query
504
-
505
-  return (
506
-    <div>
507
-      <div>
508
-        <Radio.Group value={tab} buttonStyle="solid" onChange={e => changeTab(e.target.value)}>
509
-          <Radio.Button value="basic">基本信息</Radio.Button>
510
-          <Radio.Button value="poster">海报图片</Radio.Button>
511
-          <Radio.Button value="share">分享设置</Radio.Button>
512
-        </Radio.Group>
513
-      </div>
514
-      <div>
515
-        {tab === 'basic' && <Basic dynamicId={dynamicId} />}
516
-        {tab === 'poster' && <Poster dynamicId={dynamicId}/>}
517
-        {tab === 'share' && <Share dynamicId={dynamicId}/>}
518
-      </div>
519
-    
520
-    </div>
521
-  );
522
-}
523
-
524
-export default Edit

+ 6
- 6
src/pages/activity/SignupActivity/edit/index.jsx Visa fil

1
 import React, { useState } from 'react';
1
 import React, { useState } from 'react';
2
 import { Radio, Card } from 'antd';
2
 import { Radio, Card } from 'antd';
3
 import Basic from './Basic';
3
 import Basic from './Basic';
4
-import Poster from './Poster';
5
-import Share from './Share';
6
-
4
+// import Poster from './Poster';
5
+import Share from '@/components/Share';
6
+import Poster from '@/components/Poster'
7
 const type= 'dymic'
7
 const type= 'dymic'
8
 /**
8
 /**
9
  *
9
  *
14
 const Edit = props => {
14
 const Edit = props => {
15
   const [tab, changeTab] = useState('basic');
15
   const [tab, changeTab] = useState('basic');
16
   const { dynamicId } = props.location.query;
16
   const { dynamicId } = props.location.query;
17
-
17
+  const target = { id:dynamicId, type: 'activity' }
18
   return (
18
   return (
19
     <Card>
19
     <Card>
20
       <div>
20
       <div>
26
       </div>
26
       </div>
27
       <div>
27
       <div>
28
         {tab === 'basic' && <Basic dynamicId={dynamicId} type={type}/>}
28
         {tab === 'basic' && <Basic dynamicId={dynamicId} type={type}/>}
29
-        {tab === 'poster' && <Poster dynamicId={dynamicId} />}
30
-        {tab === 'share' && <Share dynamicId={dynamicId} />}
29
+        {tab === 'poster' && <Poster target={target} />}
30
+        {tab === 'share' && <Share target={target} />}
31
       </div>
31
       </div>
32
     </Card>
32
     </Card>
33
   );
33
   );

+ 0
- 524
src/pages/activity/groupRoomActivity/edit/ind.jsx Visa fil

1
-import React, { useState, useEffect } from 'react';
2
-import { Form, Input, Button, Icon, Select, Tabs, Radio, DatePicker, message, Upload } from 'antd';
3
-
4
-import router from 'umi/router';
5
-import apis from '@/services/apis';
6
-import moment from 'moment';
7
-import BuildSelect from '@/components/SelectButton/BuildSelect2'
8
-import Wangedit from '@/components/Wangedit/Wangedit'
9
-import request from '@/utils/request'
10
-import yinhao from '@/assets/yinhao.png'
11
-import ImageUploader from '@/components/XForm/ImageUpload';
12
-import logo from '@/assets/logo.svg';
13
-import touxiang from '@/assets/touxiang.jpg';
14
-import poster1 from '@/assets/poster1.png';
15
-import poster2 from '@/assets/poster2.png';
16
-import xiaochengxu from '@/assets/xiaochengxu.png'
17
-
18
-const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
19
-const { TextArea } = Input;
20
-
21
-const formItemLayout = {
22
-  labelCol: { span: 6 },
23
-  wrapperCol: { span: 14 },
24
-};
25
-
26
-const cancelPage = () => {
27
-  router.push({
28
-    pathname: '/activity/ActivityList',
29
-  });
30
-}
31
-
32
-const BasicForm = props => {
33
-  const [isEnlist, setIsEnlist] = useState(1)
34
-  const [activityStatus, setActivityStatus] = useState(1)
35
-  const [disable, setDisable] = useState(false)
36
-  const [data, setData] = useState(1)
37
-  const [showSignupTime, setShowSignupTime] = useState([])
38
-
39
-
40
-  const radioOnChange = e => {
41
-    setIsEnlist(e.target.value)
42
-  }
43
-
44
-  const { dynamicId } = props
45
-
46
-  // 查询详情
47
-  const getDynamicData = dynamicId => {
48
-    request({ ...apis.activity.details, params: { dynamicId } }).then(data => {
49
- 
50
-      data.activityTime = [moment(data.startDate), moment(data.endDate)]
51
-      data.signupTime = [moment(data.enlistStart), moment(data.enlistEnd)]
52
-      // setSignupTime([moment(data.enlistStart), moment(data.enlistEnd)])
53
-      setData(data)
54
-      setIsEnlist(data.isEnlist)
55
-      setActivityStatus(data.activityStatus)
56
-      setDisable(data.activityStatus === 0)
57
-      props.form.setFieldsValue(data)
58
-    })
59
-  }
60
-
61
-  // eslint-disable-next-line react-hooks/rules-of-hooks
62
-  useEffect(() => {
63
-    props.form.setFieldsValue({ isEnlist })
64
-    if (dynamicId) {
65
-      getDynamicData(dynamicId);
66
-    }
67
-  }, [])
68
-  const checkTime = () => {
69
-    function compareDate(dateTime1, dateTime2) {
70
-      return new Date(dateTime1) > new Date(dateTime2)
71
-    }
72
-    // 1)修改后的开始时间不得大于当前时间(会存在已经成功报名的用户)
73
-
74
-    // (2)修改后开始时间<当前时间<修改后结束时间:活动进行中
75
-
76
-    // (3)修改后结束时间<当前时间:活动已结束
77
-    if (showSignupTime[0]) {
78
-      // const date = data.signupTime
79
-      const nowDate = new Date()
80
-      // console.log(compareDate(nowDate, showSignupTime[0]))
81
-      if (compareDate(nowDate, showSignupTime[0])) {
82
-        return true
83
-      } else {
84
-        return '修改后的开始时间不得大于当前时间(会存在已经成功报名的用户)'
85
-      }
86
-    }
87
-    return true
88
-  }
89
-
90
-
91
-  const handleSubmit = e => {
92
-    e.preventDefault();
93
-    props.form.validateFields((err, values) => {
94
-
95
-      if (!err) {
96
-        console.log('Received values of form: ', values);
97
-        const { activityTime, signupTime } = values
98
-        const [startDate, endDate] = activityTime
99
-        values.startDate = moment(startDate).format('YYYY-MM-DD HH:mm');
100
-        values.endDate = moment(endDate).format('YYYY-MM-DD HH:mm');
101
-        if (signupTime) {
102
-          const [enlistStart, enlistEnd] = signupTime
103
-          values.enlistStart = moment(enlistStart).format('YYYY-MM-DD HH:mm');
104
-          values.enlistEnd = moment(enlistEnd).format('YYYY-MM-DD HH:mm');
105
-        }
106
-
107
-        console.log('submit data --->', values)
108
-        if (dynamicId) {
109
-          const checks = checkTime()
110
-          if (checks != true) {
111
-            message.info(checks)
112
-            return
113
-          }
114
-          console.log(data.enlistNum,values.personNum,'143')
115
-
116
-          if (data.enlistNum > values.personNum) {
117
-            message.info('活动人数必须大于已报名人数')
118
-            return
119
-          }
120
-
121
-          values.dynamicId = dynamicId
122
-          request({ ...apis.activity.update, data: values }).then(data => {
123
-            message.info('保存成功')
124
-            // router.go(-1)
125
-          }).catch((err) => {
126
-            message.info(err.msg || err.message)
127
-          })
128
-        } else {
129
-          request({ ...apis.activity.add, data: { ...values } }).then((data) => {
130
-            message.info('保存成功')
131
-            router.push({
132
-              pathname: '/activity/editActivity',
133
-              query: {
134
-                dynamicId: data.dynamicId,
135
-              },
136
-            });
137
-            // router.go(-1)
138
-          }).catch((err) => {
139
-            message.info(err.msg || err.message)
140
-          })
141
-        }
142
-      }
143
-    });
144
-  }
145
-  const changeTime = (value, date) => {
146
-    // console.log(value, data, '-----checkTime---------')
147
-    // console.log(props.form.getFieldsValue(), '--------time1-----------')
148
-    // let datas = data
149
-    // console.log(value, date, datas)
150
-    // datas.signupTime = date
151
-
152
-    // //   data.signupTime = [moment(data.enlistStart), moment(data.enlistEnd)]
153
-
154
-    // console.log(datas,'-------datas--------')
155
-    //   props.form.setFieldsValue(data)
156
-    setShowSignupTime(date)
157
-    // props.form.setFieldsValue(datas)
158
-    // // form.setFieldsValue
159
-    // console.log('-------1--------')
160
-  }
161
-
162
-  const { getFieldDecorator } = props.form;
163
-  return (
164
-    <>
165
-      <Form {...formItemLayout} onSubmit={handleSubmit}>
166
-        <Form.Item label="所属项目">
167
-          {getFieldDecorator('buildingId', {
168
-            rules: [
169
-              {
170
-                required: true,
171
-                message: '请选择所属项目',
172
-              },
173
-            ],
174
-          })(<BuildSelect disabled={disable} />)}
175
-        </Form.Item>
176
-        <Form.Item label="活动封面图1" help="建议图片尺寸:750px*420px,比例16:9,格式:jpg,用于:首页推荐/活动列表">
177
-          {getFieldDecorator('listImgUrl', {
178
-            rules: [
179
-              {
180
-                required: true,
181
-                message: '请选择活动封面图1',
182
-              },
183
-            ],
184
-          })(<ImageUploader />)}
185
-        </Form.Item>
186
-        <Form.Item label="活动封面图2" help="建议图片尺寸:750*250,比例3:1,格式:jpg,用于:项目详情页">
187
-          {getFieldDecorator('bannerListImg', {
188
-            rules: [
189
-              {
190
-                required: true,
191
-                message: '请选择活动封面图2',
192
-              },
193
-            ],
194
-          })(<ImageUploader />)}
195
-        </Form.Item>
196
-        <Form.Item label="活动详情主图" help="建议图片尺寸:750*600px,比例5:4,格式:jpg,用于:普通活动详情">
197
-          {getFieldDecorator('imgUrl', {
198
-            rules: [
199
-              {
200
-                required: true,
201
-                message: '请选择活动详情主图',
202
-              },
203
-            ],
204
-          })(<ImageUploader />)}
205
-        </Form.Item>
206
-        <Form.Item label="活动标题">
207
-          {getFieldDecorator('title', {
208
-            rules: [
209
-              {
210
-                required: true,
211
-                message: '请输入活动标题',
212
-              },
213
-            ],
214
-          })(<Input />)}
215
-        </Form.Item>
216
-        <Form.Item label="活动时间">
217
-          {getFieldDecorator('activityTime', {
218
-            rules: [
219
-              {
220
-                required: true,
221
-                message: '请选择活动时间',
222
-              },
223
-            ],
224
-          })(<RangePicker format="YYYY-MM-DD HH:mm" />)}
225
-        </Form.Item>
226
-        <Form.Item label="活动地点">
227
-          {getFieldDecorator('address', {
228
-            rules: [
229
-              {
230
-                required: true,
231
-                message: '请输入活动地点',
232
-              },
233
-            ],
234
-          })(<Input />)}
235
-        </Form.Item>
236
-        {/* disabled={activityStatus === 0 ? true : false} */}
237
-        <Form.Item label="活动人数" help="当前活动最多可报名人数">
238
-          {getFieldDecorator('personNum', {
239
-            rules: [
240
-              {
241
-                required: true,
242
-                message: '请输入活动人数',
243
-              },
244
-              // {
245
-              //   min: data.personNum,min={data.personNum || 0}
246
-              //   message: '活动人数必须大于已报名人数',
247
-              // },
248
-            ],
249
-          })(<Input type="number" />)}
250
-        </Form.Item>
251
-        <Form.Item label="用户携带人数" help="每个用户最多可携带参与活动的人数">
252
-          {getFieldDecorator('maxEnlistByPerson', {
253
-            rules: [
254
-              {
255
-                required: true,
256
-                message: '请输入用户携带人数',
257
-              },
258
-            ],
259
-          })(<Input type="number" min={1} />)}
260
-        </Form.Item>
261
-        <Form.Item label="活动详情">
262
-          {getFieldDecorator('desc')(<Wangedit />)}
263
-        </Form.Item>
264
-        <Form.Item label="报名时间">
265
-          {getFieldDecorator('signupTime', {
266
-            rules: [
267
-              {
268
-                required: true,
269
-                message: '请选择报名时间',
270
-              },
271
-            ],
272
-          })(<RangePicker format="YYYY-MM-DD HH:mm" onChange={changeTime} />)}
273
-        </Form.Item>
274
-        <Form.Item label="权重">
275
-          {getFieldDecorator('heavy', {
276
-
277
-            rules: [
278
-              {
279
-                required: true,
280
-                message: '请输入权重',
281
-              },
282
-            ],
283
-          })(<Input type="number" style={{ width: 80 }} />)}<span style={{ marginLeft: 30, color: 'grey' }}>数字越大越靠前</span>
284
-        </Form.Item>
285
-        <Form.Item wrapperCol={{ span: 12, offset: 8 }}>
286
-          <Button type="primary" htmlType="submit">
287
-            确认
288
-          </Button>
289
-          &nbsp;&nbsp;&nbsp;&nbsp;
290
-          <Button onClick={() => cancelPage()}>
291
-            取消
292
-          </Button>
293
-        </Form.Item>
294
-      </Form>
295
-    </>
296
-  )
297
-}
298
-
299
-const Basic = Form.create({ name: 'BasicForm' })(BasicForm);
300
-
301
-const Poster = props => {
302
-  const { dynamicId } = props
303
-  const [inputValue, changeInput] = useState('')
304
-  const [textAreaValue, changeTextArea] = useState('')
305
-  const [imgValue, changeImg] = useState('')
306
-  const [posterId, setPosterId] = useState('')
307
-
308
-  useEffect(() => {
309
-    if (dynamicId) {
310
-      request({ ...apis.activity.poster, params: { targetId: dynamicId, targetType: 'activity' } }).then(data => {
311
-
312
-        if (data.length > 0) {
313
-          setPosterId(data[0].posterId)
314
-          changeImg(data[0].posterImg)
315
-          changeTextArea(data[0].posterDescription)
316
-          changeInput(data[0].posterTitle)
317
-        }
318
-      }).catch(err => {
319
-        message.info(err.msg || err.message)
320
-      })
321
-    }
322
-    // getMiniappName()
323
-  }, [])
324
-  
325
-  // 获取小程序名称
326
-  // const [miniappName, setMiniappName] = useState('')
327
-  // function getMiniappName() {
328
-  //   request({ ...apis.building.getMiniappName }).then(res => {
329
-  //     console.log(res, "0000000000000")
330
-  //     setMiniappName(res)
331
-  //   })
332
-  // }
333
-
334
-  const submitPoster = () => {
335
-    if (dynamicId) {
336
-      if (posterId) {
337
-        request({ ...apis.activity.updatePoster, urlData: { id: posterId }, data: { targetId: dynamicId, targetType: 'activity', posterImg: imgValue, posterTitle: inputValue, posterDescription: textAreaValue } }).then(data => {
338
-          message.info('保存成功')
339
-        }).catch(err => {
340
-          message.info(err.msg || err.message)
341
-        })
342
-      } else {
343
-        request({ ...apis.activity.addPoster, data: { targetId: dynamicId, targetType: 'activity', posterImg: imgValue, posterTitle: inputValue, posterDescription: textAreaValue } }).then(data => {
344
-          setPosterId(data.posterId)
345
-          message.info('保存成功')
346
-        }).catch(err => {
347
-          message.info(err.msg || err.message)
348
-        })
349
-      }
350
-    } else {
351
-      message.warn('请先保存基本信息数据')
352
-    }
353
-  }
354
-
355
-  return <div>
356
-    <div style={{ display: 'flex' }}>
357
-      <div style={{ width: '420px', height: '900px', display: 'inline-block', marginTop: '30px' }}>
358
-        <div style={{ width: '375px', height: '700px', backgroundColor: '#fff', boxShadow: '0px 0px 16px 6px rgba(0,0,0,0.15)', position: 'relative', margin: '0 auto' }}>
359
-          <img style={{ width: '100%', height: '300px' }} src={imgValue || poster1} alt="" />
360
-          <div style={{ display: 'flex', alignItems: 'center', marginTop: '-24px' }}>
361
-            <img style={{ width: '70px', height: '70px', border: '4px solid #fff', borderRadius: '35px', marginLeft: '16px' }} src={touxiang} alt="" />
362
-            <span style={{ color: '#222', fontWeight: '600', margin: '24px 10px 0 14px', fontSize: '17px' }}>喵喵</span>
363
-            <span style={{ color: '#999', marginTop: '25px', fontSize: '17px' }}>邀您参与</span>
364
-            <span style={{ color: '#999', margin: '25px 0 0 60px', fontSize: '17px' }}>2019.09.21</span>
365
-          </div>
366
-          <p style={{
367
-            margin: '10px 20px',
368
-            fontSize: '20px',
369
-            color: '#222',
370
-            fontWeight: '600',
371
-            display: '-webkit-box',
372
-            lineClamp: '3',
373
-            height: '60px',
374
-            WebkitLineClamp: '2',
375
-            WebkitBoxOrient: 'vertical',
376
-            overflow: 'hidden',
377
-            textOverflow: 'ellipsis',
378
-          }}>{inputValue || '海报标题'}</p>
379
-
380
-          <img src={yinhao} style={{ width: '30px', marginLeft: '20px' }} alt="" />
381
-          <p style={{
382
-            margin: '16px 20px 28px 20px',
383
-            fontSize: '17px',
384
-            color: '#999',
385
-            display: '-webkit-box',
386
-            lineClamp: '3',
387
-            height: '72px',
388
-            WebkitLineClamp: '3',
389
-            WebkitBoxOrient: 'vertical',
390
-            overflow: 'hidden',
391
-            textOverflow: 'ellipsis',
392
-          }}>{textAreaValue || '海报描述'}</p>
393
-          <div style={{ backgroundColor: '#f1f1f1', padding: '22px 30px', boxShadow: '0px 6px 12px -4px #dcdcdc', position: 'relative' }}>
394
-            <p style={{ margin: '0', fontSize: '18px', color: '#888' }}>长按识别小程序码</p>
395
-            <p style={{ margin: '0', fontSize: '18px', color: '#888' }}>进入活动查看详情</p>
396
-            <img style={{ width: '80px', position: 'absolute', right: '30px', top: '10px' }} src={xiaochengxu} alt="" />
397
-          </div>
398
-        </div>
399
-        <p style={{ textAlign: 'center', fontSize: '19px', color: '#666', marginTop: '30px' }}>海报模板</p>
400
-      </div>
401
-
402
-      <div >
403
-        <div style={{ display: 'flex', width: '100%', margin: '60px 0' }}>
404
-          <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>活动海报图</p>
405
-          <ImageUploader value={imgValue} onChange={e => changeImg(e)} />
406
-        </div>
407
-        <p style={{ fontSize: '0.5vw', color: '#A9A9A9', marginLeft: '230px', marginBottom: '30px' }}>建议图片尺寸:640*670px,比例64:67,格式:jpg,用于普通活动海报</p>
408
-        <div style={{ display: 'flex', alignItems: 'center', width: '100%', marginBottom: '60px' }}>
409
-          <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>海报标题</p>
410
-          <Input style={{ width: '20vw' }} value={inputValue} placeholder="请输入海报标题" onChange={e => changeInput(e.target.value)} />
411
-        </div>
412
-        <div style={{ display: 'flex', margin: '10px 0 40px 0', width: '100%' }}>
413
-          <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>海报描述</p>
414
-          <TextArea rows={5} maxLength={1024} value={textAreaValue} onChange={e => changeTextArea(e.target.value)} />
415
-        </div>
416
-
417
-      </div>
418
-    </div>
419
-    <Button type="primary" onClick={submitPoster} style={{ margin: '40px 40px 40px 30vw' }}> 确定</Button>
420
-    <Button onClick={() => cancelPage()}>
421
-      取消
422
-    </Button>
423
-  </div>
424
-}
425
-
426
-const Share = props => {
427
-  const { dynamicId } = props
428
-  const [inputValue, changeInput] = useState('')
429
-  const [imgValue, changeImg] = useState('')
430
-  const [shareContentId, setShareContentId] = useState('')
431
-
432
-  useEffect(() => {
433
-    if (dynamicId) {
434
-      request({ ...apis.activity.shareContent, params: { targetId: dynamicId, targetType: 'activity' } }).then(data => {
435
-
436
-        if (data.length > 0) {
437
-          setShareContentId(data[0].shareContentId)
438
-          changeImg(data[0].shareContentImg)
439
-          changeInput(data[0].shareContentTitle)
440
-        }
441
-      }).catch(err => {
442
-        message.info(err.msg || err.message)
443
-      })
444
-    }
445
-  }, [dynamicId])
446
-
447
-  const submitShare = () => {
448
-    if (dynamicId) {
449
-      if (shareContentId) {
450
-        request({ ...apis.activity.updateShareContent, urlData: { id: shareContentId }, data: { targetId: dynamicId, shareContentType: 'activity', shareContentImg: imgValue, shareContentTitle: inputValue } }).then(data => {
451
-          message.info('保存成功')
452
-        }).catch(err => {
453
-          message.info(err.msg || err.message)
454
-        })
455
-      } else {
456
-        request({ ...apis.activity.addShareContent, data: { targetId: dynamicId, shareContentType: 'activity', shareContentImg: imgValue, shareContentTitle: inputValue } }).then(data => {
457
-          setShareContentId(data.shareContentId)
458
-          message.info('保存成功')
459
-        }).catch(err => {
460
-          message.info(err.msg || err.message)
461
-        })
462
-      }
463
-    } else {
464
-      message.warn('请先保存基本信息数据')
465
-    }
466
-  }
467
-
468
-  return <div style={{ padding: '20px' }}>
469
-    <div style={{ display: 'flex', margin: '10px 0 40px 0', width: '100%' }}>
470
-      <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>分享模板</p>
471
-      <div>
472
-        <p style={{ display: 'flex', alignItems: 'center', fontSize: '14px', color: '#999', margin: '0', lineHeight: '0' }}>
473
-          <img src={logo} style={{ width: '22px', marginRight: '10px' }} alt=""/>橙蕉互动</p>
474
-        <p style={{ fontSize: '16px', color: '#222', fontWeight: '600', margin: '0' }}>{inputValue || '置业V客厅 精准获客平台'}</p>
475
-        <img style={{ width: '200px', height: '160px' }} src={imgValue || poster2} alt="" />
476
-      </div>
477
-    </div>
478
-    <div style={{ display: 'flex', alignItems: 'center', width: '100%' }}>
479
-      <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>分享标题</p>
480
-      <Input placeholder="请输入分享标题" value={inputValue} onChange={e => changeInput(e.target.value)} />
481
-    </div>
482
-    <div style={{ display: 'flex', width: '100%', marginTop: '40px' }}>
483
-      <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>活动分享图</p>
484
-      <ImageUploader value={imgValue} onChange={e => changeImg(e)} />
485
-    </div>
486
-    <p style={{ fontSize: '0.5vw', color: '#A9A9A9', marginLeft: '230px', marginTop: '20px' }}>建议图片尺寸:750*600px,比例5:4,格式:jpg,用于活动分享好友</p>
487
-    <Button type="primary" htmlType="submit" onClick={submitShare} style={{ margin: '40px 40px 40px 220px' }}> 确定</Button>
488
-    <Button onClick={() => cancelPage()}>
489
-      取消
490
-    </Button>
491
-  </div>
492
-}
493
-
494
-
495
-/**
496
- *
497
- *
498
- * @param {*} props
499
- * @returns
500
- */
501
-const Edit = props => {
502
-  const [tab, changeTab] = useState('basic')
503
-  const { dynamicId } = props.location.query
504
-
505
-  return (
506
-    <div>
507
-      <div>
508
-        <Radio.Group value={tab} buttonStyle="solid" onChange={e => changeTab(e.target.value)}>
509
-          <Radio.Button value="basic">基本信息</Radio.Button>
510
-          <Radio.Button value="poster">海报图片</Radio.Button>
511
-          <Radio.Button value="share">分享设置</Radio.Button>
512
-        </Radio.Group>
513
-      </div>
514
-      <div>
515
-        {tab === 'basic' && <Basic dynamicId={dynamicId} />}
516
-        {tab === 'poster' && <Poster dynamicId={dynamicId}/>}
517
-        {tab === 'share' && <Share dynamicId={dynamicId}/>}
518
-      </div>
519
-    
520
-    </div>
521
-  );
522
-}
523
-
524
-export default Edit

+ 9
- 6
src/pages/activity/groupRoomActivity/edit/index.jsx Visa fil

1
 import React, { useState } from 'react';
1
 import React, { useState } from 'react';
2
 import { Radio, Card } from 'antd';
2
 import { Radio, Card } from 'antd';
3
 import Basic from './Basic';
3
 import Basic from './Basic';
4
-import Poster from './Poster';
5
-import Share from './Share';
4
+// import Poster from './Poster';
5
+import Share from '@/components/Share';
6
+import Poster from '@/components/Poster'
7
+
8
+const type= 'house'
6
 /**
9
 /**
7
  *
10
  *
8
  *
11
  *
12
 const Edit = props => {
15
 const Edit = props => {
13
   const [tab, changeTab] = useState('basic');
16
   const [tab, changeTab] = useState('basic');
14
   const { dynamicId } = props.location.query;
17
   const { dynamicId } = props.location.query;
15
-
18
+  const target = { id:dynamicId, type: 'activity' }
16
   return (
19
   return (
17
     <Card>
20
     <Card>
18
       <div>
21
       <div>
23
         </Radio.Group>
26
         </Radio.Group>
24
       </div>
27
       </div>
25
       <div>
28
       <div>
26
-        {tab === 'basic' && <Basic dynamicId={dynamicId} />}
27
-        {tab === 'poster' && <Poster dynamicId={dynamicId} />}
28
-        {tab === 'share' && <Share dynamicId={dynamicId} />}
29
+        {tab === 'basic' && <Basic dynamicId={dynamicId} type={type}/>}
30
+        {tab === 'poster' && <Poster target={target} />}
31
+        {tab === 'share' && <Share target={target} />}
29
       </div>
32
       </div>
30
     </Card>
33
     </Card>
31
   );
34
   );

+ 12
- 9
src/pages/activity/groupRoomActivity/index.jsx Visa fil

24
 import request from '@/utils/request';
24
 import request from '@/utils/request';
25
 import QueryTable from '@/components/QueryTable';
25
 import QueryTable from '@/components/QueryTable';
26
 
26
 
27
+const type= 'house'
28
+
27
 const GroupRoomActivity = props => {
29
 const GroupRoomActivity = props => {
28
   const ref = useRef();
30
   const ref = useRef();
29
 
31
 
54
     },
56
     },
55
   ];
57
   ];
56
 
58
 
57
-  const toGroupRoomActivityDetail = dynamicId => () => {
59
+  const toSignupActivityDetail = dynamicId => () => {
58
     router.push({
60
     router.push({
59
-      pathname: '/activity/groupRoomActivity/detail',
61
+      pathname: '/activity/SignupActivity/detail',
60
       query: {
62
       query: {
61
         dynamicId,
63
         dynamicId,
62
       },
64
       },
64
   };
66
   };
65
 
67
 
66
   // 跳转到编辑
68
   // 跳转到编辑
67
-  const toGroupRoomActivityEdit = dynamicId => {
69
+  const toSignupActivityEdit = dynamicId => {
68
     router.push({
70
     router.push({
69
-      pathname: '/activity/groupRoomActivity/edit',
71
+      pathname: '/activity/SignupActivity/edit',
70
       query: {
72
       query: {
71
         dynamicId,
73
         dynamicId,
72
       },
74
       },
173
 
175
 
174
   const getJoinPeople = dynamicId => () => {
176
   const getJoinPeople = dynamicId => () => {
175
     router.push({
177
     router.push({
176
-      pathname: '/activity/groupRoomActivity/registrationRecord',
178
+      pathname: '/activity/SignupActivity/registrationRecord',
177
       query: {
179
       query: {
178
         dynamicId,
180
         dynamicId,
179
       },
181
       },
188
       align: 'center',
190
       align: 'center',
189
       width: '20%',
191
       width: '20%',
190
       render: (x, row) => (
192
       render: (x, row) => (
191
-        <Navigate onClick={toGroupRoomActivityDetail(row.dynamicId)}>
193
+        <Navigate onClick={toSignupActivityDetail(row.dynamicId)}>
192
           <Typography.Text ellipsis>{row.title}</Typography.Text>
194
           <Typography.Text ellipsis>{row.title}</Typography.Text>
193
         </Navigate>
195
         </Navigate>
194
       ),
196
       ),
264
           />
266
           />
265
         </AuthButton>,
267
         </AuthButton>,
266
 
268
 
267
-        // //   <EditIcon type="look" text="查看详情" onClick={toGroupRoomActivityDetail(row.dynamicId)} />,
269
+        // //   <EditIcon type="look" text="查看详情" onClick={toSignupActivityDetail(row.dynamicId)} />,
268
 
270
 
269
         row.activityStatus === 0 ? (
271
         row.activityStatus === 0 ? (
270
           <AuthButton name="admin.buildingDynamic.finish.put" noRight={null}>
272
           <AuthButton name="admin.buildingDynamic.finish.put" noRight={null}>
295
             <EditIcon
297
             <EditIcon
296
               type="edit"
298
               type="edit"
297
               text="编辑"
299
               text="编辑"
298
-              onClick={() => toGroupRoomActivityEdit(row.dynamicId, row.count)}
300
+              onClick={() => toSignupActivityEdit(row.dynamicId, row.count)}
299
             />
301
             />
300
           </AuthButton>
302
           </AuthButton>
301
         ) : null,
303
         ) : null,
305
 
307
 
306
   const actionRender = () => {
308
   const actionRender = () => {
307
     return (
309
     return (
308
-      <Button type="primary" icon="plus" onClick={() => toGroupRoomActivityEdit()}>
310
+      <Button type="primary" icon="plus" onClick={() => toSignupActivityEdit()}>
309
         新增
311
         新增
310
       </Button>
312
       </Button>
311
     );
313
     );
320
       columns={columns}
322
       columns={columns}
321
       postData={data => {
323
       postData={data => {
322
         data.time && (data.time = `${moment(data.time).format('YYYY-MM-DDT00:00:00.000')}Z`);
324
         data.time && (data.time = `${moment(data.time).format('YYYY-MM-DDT00:00:00.000')}Z`);
325
+        data.type=type
323
         return data;
326
         return data;
324
       }}
327
       }}
325
       actionRender={actionRender}
328
       actionRender={actionRender}

+ 0
- 524
src/pages/activity/lookHouseActivity/edit/ind.jsx Visa fil

1
-import React, { useState, useEffect } from 'react';
2
-import { Form, Input, Button, Icon, Select, Tabs, Radio, DatePicker, message, Upload } from 'antd';
3
-
4
-import router from 'umi/router';
5
-import apis from '@/services/apis';
6
-import moment from 'moment';
7
-import BuildSelect from '@/components/SelectButton/BuildSelect2'
8
-import Wangedit from '@/components/Wangedit/Wangedit'
9
-import request from '@/utils/request'
10
-import yinhao from '@/assets/yinhao.png'
11
-import ImageUploader from '@/components/XForm/ImageUpload';
12
-import logo from '@/assets/logo.png';
13
-import touxiang from '@/assets/touxiang.jpg';
14
-import poster1 from '@/assets/poster1.png';
15
-import poster2 from '@/assets/poster2.png';
16
-import xiaochengxu from '@/assets/xiaochengxu.png'
17
-
18
-const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
19
-const { TextArea } = Input;
20
-
21
-const formItemLayout = {
22
-  labelCol: { span: 6 },
23
-  wrapperCol: { span: 14 },
24
-};
25
-
26
-const cancelPage = () => {
27
-  router.push({
28
-    pathname: '/activity/ActivityList',
29
-  });
30
-}
31
-
32
-const BasicForm = props => {
33
-  const [isEnlist, setIsEnlist] = useState(1)
34
-  const [activityStatus, setActivityStatus] = useState(1)
35
-  const [disable, setDisable] = useState(false)
36
-  const [data, setData] = useState(1)
37
-  const [showSignupTime, setShowSignupTime] = useState([])
38
-
39
-
40
-  const radioOnChange = e => {
41
-    setIsEnlist(e.target.value)
42
-  }
43
-
44
-  const { dynamicId } = props
45
-
46
-  // 查询详情
47
-  const getDynamicData = dynamicId => {
48
-    request({ ...apis.activity.details, params: { dynamicId } }).then(data => {
49
- 
50
-      data.activityTime = [moment(data.startDate), moment(data.endDate)]
51
-      data.signupTime = [moment(data.enlistStart), moment(data.enlistEnd)]
52
-      // setSignupTime([moment(data.enlistStart), moment(data.enlistEnd)])
53
-      setData(data)
54
-      setIsEnlist(data.isEnlist)
55
-      setActivityStatus(data.activityStatus)
56
-      setDisable(data.activityStatus === 0)
57
-      props.form.setFieldsValue(data)
58
-    })
59
-  }
60
-
61
-  // eslint-disable-next-line react-hooks/rules-of-hooks
62
-  useEffect(() => {
63
-    props.form.setFieldsValue({ isEnlist })
64
-    if (dynamicId) {
65
-      getDynamicData(dynamicId);
66
-    }
67
-  }, [])
68
-  const checkTime = () => {
69
-    function compareDate(dateTime1, dateTime2) {
70
-      return new Date(dateTime1) > new Date(dateTime2)
71
-    }
72
-    // 1)修改后的开始时间不得大于当前时间(会存在已经成功报名的用户)
73
-
74
-    // (2)修改后开始时间<当前时间<修改后结束时间:活动进行中
75
-
76
-    // (3)修改后结束时间<当前时间:活动已结束
77
-    if (showSignupTime[0]) {
78
-      // const date = data.signupTime
79
-      const nowDate = new Date()
80
-      // console.log(compareDate(nowDate, showSignupTime[0]))
81
-      if (compareDate(nowDate, showSignupTime[0])) {
82
-        return true
83
-      } else {
84
-        return '修改后的开始时间不得大于当前时间(会存在已经成功报名的用户)'
85
-      }
86
-    }
87
-    return true
88
-  }
89
-
90
-
91
-  const handleSubmit = e => {
92
-    e.preventDefault();
93
-    props.form.validateFields((err, values) => {
94
-
95
-      if (!err) {
96
-        console.log('Received values of form: ', values);
97
-        const { activityTime, signupTime } = values
98
-        const [startDate, endDate] = activityTime
99
-        values.startDate = moment(startDate).format('YYYY-MM-DD HH:mm');
100
-        values.endDate = moment(endDate).format('YYYY-MM-DD HH:mm');
101
-        if (signupTime) {
102
-          const [enlistStart, enlistEnd] = signupTime
103
-          values.enlistStart = moment(enlistStart).format('YYYY-MM-DD HH:mm');
104
-          values.enlistEnd = moment(enlistEnd).format('YYYY-MM-DD HH:mm');
105
-        }
106
-
107
-        console.log('submit data --->', values)
108
-        if (dynamicId) {
109
-          const checks = checkTime()
110
-          if (checks != true) {
111
-            message.info(checks)
112
-            return
113
-          }
114
-          console.log(data.enlistNum,values.personNum,'143')
115
-
116
-          if (data.enlistNum > values.personNum) {
117
-            message.info('活动人数必须大于已报名人数')
118
-            return
119
-          }
120
-
121
-          values.dynamicId = dynamicId
122
-          request({ ...apis.activity.update, data: values }).then(data => {
123
-            message.info('保存成功')
124
-            // router.go(-1)
125
-          }).catch((err) => {
126
-            message.info(err.msg || err.message)
127
-          })
128
-        } else {
129
-          request({ ...apis.activity.add, data: { ...values } }).then((data) => {
130
-            message.info('保存成功')
131
-            router.push({
132
-              pathname: '/activity/editActivity',
133
-              query: {
134
-                dynamicId: data.dynamicId,
135
-              },
136
-            });
137
-            // router.go(-1)
138
-          }).catch((err) => {
139
-            message.info(err.msg || err.message)
140
-          })
141
-        }
142
-      }
143
-    });
144
-  }
145
-  const changeTime = (value, date) => {
146
-    // console.log(value, data, '-----checkTime---------')
147
-    // console.log(props.form.getFieldsValue(), '--------time1-----------')
148
-    // let datas = data
149
-    // console.log(value, date, datas)
150
-    // datas.signupTime = date
151
-
152
-    // //   data.signupTime = [moment(data.enlistStart), moment(data.enlistEnd)]
153
-
154
-    // console.log(datas,'-------datas--------')
155
-    //   props.form.setFieldsValue(data)
156
-    setShowSignupTime(date)
157
-    // props.form.setFieldsValue(datas)
158
-    // // form.setFieldsValue
159
-    // console.log('-------1--------')
160
-  }
161
-
162
-  const { getFieldDecorator } = props.form;
163
-  return (
164
-    <>
165
-      <Form {...formItemLayout} onSubmit={handleSubmit}>
166
-        <Form.Item label="所属项目">
167
-          {getFieldDecorator('buildingId', {
168
-            rules: [
169
-              {
170
-                required: true,
171
-                message: '请选择所属项目',
172
-              },
173
-            ],
174
-          })(<BuildSelect disabled={disable} />)}
175
-        </Form.Item>
176
-        <Form.Item label="活动封面图1" help="建议图片尺寸:750px*420px,比例16:9,格式:jpg,用于:首页推荐/活动列表">
177
-          {getFieldDecorator('listImgUrl', {
178
-            rules: [
179
-              {
180
-                required: true,
181
-                message: '请选择活动封面图1',
182
-              },
183
-            ],
184
-          })(<ImageUploader />)}
185
-        </Form.Item>
186
-        <Form.Item label="活动封面图2" help="建议图片尺寸:750*250,比例3:1,格式:jpg,用于:项目详情页">
187
-          {getFieldDecorator('bannerListImg', {
188
-            rules: [
189
-              {
190
-                required: true,
191
-                message: '请选择活动封面图2',
192
-              },
193
-            ],
194
-          })(<ImageUploader />)}
195
-        </Form.Item>
196
-        <Form.Item label="活动详情主图" help="建议图片尺寸:750*600px,比例5:4,格式:jpg,用于:普通活动详情">
197
-          {getFieldDecorator('imgUrl', {
198
-            rules: [
199
-              {
200
-                required: true,
201
-                message: '请选择活动详情主图',
202
-              },
203
-            ],
204
-          })(<ImageUploader />)}
205
-        </Form.Item>
206
-        <Form.Item label="活动标题">
207
-          {getFieldDecorator('title', {
208
-            rules: [
209
-              {
210
-                required: true,
211
-                message: '请输入活动标题',
212
-              },
213
-            ],
214
-          })(<Input />)}
215
-        </Form.Item>
216
-        <Form.Item label="活动时间">
217
-          {getFieldDecorator('activityTime', {
218
-            rules: [
219
-              {
220
-                required: true,
221
-                message: '请选择活动时间',
222
-              },
223
-            ],
224
-          })(<RangePicker format="YYYY-MM-DD HH:mm" />)}
225
-        </Form.Item>
226
-        <Form.Item label="活动地点">
227
-          {getFieldDecorator('address', {
228
-            rules: [
229
-              {
230
-                required: true,
231
-                message: '请输入活动地点',
232
-              },
233
-            ],
234
-          })(<Input />)}
235
-        </Form.Item>
236
-        {/* disabled={activityStatus === 0 ? true : false} */}
237
-        <Form.Item label="活动人数" help="当前活动最多可报名人数">
238
-          {getFieldDecorator('personNum', {
239
-            rules: [
240
-              {
241
-                required: true,
242
-                message: '请输入活动人数',
243
-              },
244
-              // {
245
-              //   min: data.personNum,min={data.personNum || 0}
246
-              //   message: '活动人数必须大于已报名人数',
247
-              // },
248
-            ],
249
-          })(<Input type="number" />)}
250
-        </Form.Item>
251
-        <Form.Item label="用户携带人数" help="每个用户最多可携带参与活动的人数">
252
-          {getFieldDecorator('maxEnlistByPerson', {
253
-            rules: [
254
-              {
255
-                required: true,
256
-                message: '请输入用户携带人数',
257
-              },
258
-            ],
259
-          })(<Input type="number" min={1} />)}
260
-        </Form.Item>
261
-        <Form.Item label="活动详情">
262
-          {getFieldDecorator('desc')(<Wangedit />)}
263
-        </Form.Item>
264
-        <Form.Item label="报名时间">
265
-          {getFieldDecorator('signupTime', {
266
-            rules: [
267
-              {
268
-                required: true,
269
-                message: '请选择报名时间',
270
-              },
271
-            ],
272
-          })(<RangePicker format="YYYY-MM-DD HH:mm" onChange={changeTime} />)}
273
-        </Form.Item>
274
-        <Form.Item label="权重">
275
-          {getFieldDecorator('heavy', {
276
-
277
-            rules: [
278
-              {
279
-                required: true,
280
-                message: '请输入权重',
281
-              },
282
-            ],
283
-          })(<Input type="number" style={{ width: 80 }} />)}<span style={{ marginLeft: 30, color: 'grey' }}>数字越大越靠前</span>
284
-        </Form.Item>
285
-        <Form.Item wrapperCol={{ span: 12, offset: 8 }}>
286
-          <Button type="primary" htmlType="submit">
287
-            确认
288
-          </Button>
289
-          &nbsp;&nbsp;&nbsp;&nbsp;
290
-          <Button onClick={() => cancelPage()}>
291
-            取消
292
-          </Button>
293
-        </Form.Item>
294
-      </Form>
295
-    </>
296
-  )
297
-}
298
-
299
-const Basic = Form.create({ name: 'BasicForm' })(BasicForm);
300
-
301
-const Poster = props => {
302
-  const { dynamicId } = props
303
-  const [inputValue, changeInput] = useState('')
304
-  const [textAreaValue, changeTextArea] = useState('')
305
-  const [imgValue, changeImg] = useState('')
306
-  const [posterId, setPosterId] = useState('')
307
-
308
-  useEffect(() => {
309
-    if (dynamicId) {
310
-      request({ ...apis.activity.poster, params: { targetId: dynamicId, targetType: 'activity' } }).then(data => {
311
-
312
-        if (data.length > 0) {
313
-          setPosterId(data[0].posterId)
314
-          changeImg(data[0].posterImg)
315
-          changeTextArea(data[0].posterDescription)
316
-          changeInput(data[0].posterTitle)
317
-        }
318
-      }).catch(err => {
319
-        message.info(err.msg || err.message)
320
-      })
321
-    }
322
-    // getMiniappName()
323
-  }, [])
324
-  
325
-  // 获取小程序名称
326
-  // const [miniappName, setMiniappName] = useState('')
327
-  // function getMiniappName() {
328
-  //   request({ ...apis.building.getMiniappName }).then(res => {
329
-  //     console.log(res, "0000000000000")
330
-  //     setMiniappName(res)
331
-  //   })
332
-  // }
333
-
334
-  const submitPoster = () => {
335
-    if (dynamicId) {
336
-      if (posterId) {
337
-        request({ ...apis.activity.updatePoster, urlData: { id: posterId }, data: { targetId: dynamicId, targetType: 'activity', posterImg: imgValue, posterTitle: inputValue, posterDescription: textAreaValue } }).then(data => {
338
-          message.info('保存成功')
339
-        }).catch(err => {
340
-          message.info(err.msg || err.message)
341
-        })
342
-      } else {
343
-        request({ ...apis.activity.addPoster, data: { targetId: dynamicId, targetType: 'activity', posterImg: imgValue, posterTitle: inputValue, posterDescription: textAreaValue } }).then(data => {
344
-          setPosterId(data.posterId)
345
-          message.info('保存成功')
346
-        }).catch(err => {
347
-          message.info(err.msg || err.message)
348
-        })
349
-      }
350
-    } else {
351
-      message.warn('请先保存基本信息数据')
352
-    }
353
-  }
354
-
355
-  return <div>
356
-    <div style={{ display: 'flex' }}>
357
-      <div style={{ width: '420px', height: '900px', display: 'inline-block', marginTop: '30px' }}>
358
-        <div style={{ width: '375px', height: '700px', backgroundColor: '#fff', boxShadow: '0px 0px 16px 6px rgba(0,0,0,0.15)', position: 'relative', margin: '0 auto' }}>
359
-          <img style={{ width: '100%', height: '300px' }} src={imgValue || poster1} alt="" />
360
-          <div style={{ display: 'flex', alignItems: 'center', marginTop: '-24px' }}>
361
-            <img style={{ width: '70px', height: '70px', border: '4px solid #fff', borderRadius: '35px', marginLeft: '16px' }} src={touxiang} alt="" />
362
-            <span style={{ color: '#222', fontWeight: '600', margin: '24px 10px 0 14px', fontSize: '17px' }}>喵喵</span>
363
-            <span style={{ color: '#999', marginTop: '25px', fontSize: '17px' }}>邀您参与</span>
364
-            <span style={{ color: '#999', margin: '25px 0 0 60px', fontSize: '17px' }}>2019.09.21</span>
365
-          </div>
366
-          <p style={{
367
-            margin: '10px 20px',
368
-            fontSize: '20px',
369
-            color: '#222',
370
-            fontWeight: '600',
371
-            display: '-webkit-box',
372
-            lineClamp: '3',
373
-            height: '60px',
374
-            WebkitLineClamp: '2',
375
-            WebkitBoxOrient: 'vertical',
376
-            overflow: 'hidden',
377
-            textOverflow: 'ellipsis',
378
-          }}>{inputValue || '海报标题'}</p>
379
-
380
-          <img src={yinhao} style={{ width: '30px', marginLeft: '20px' }} alt="" />
381
-          <p style={{
382
-            margin: '16px 20px 28px 20px',
383
-            fontSize: '17px',
384
-            color: '#999',
385
-            display: '-webkit-box',
386
-            lineClamp: '3',
387
-            height: '72px',
388
-            WebkitLineClamp: '3',
389
-            WebkitBoxOrient: 'vertical',
390
-            overflow: 'hidden',
391
-            textOverflow: 'ellipsis',
392
-          }}>{textAreaValue || '海报描述'}</p>
393
-          <div style={{ backgroundColor: '#f1f1f1', padding: '22px 30px', boxShadow: '0px 6px 12px -4px #dcdcdc', position: 'relative' }}>
394
-            <p style={{ margin: '0', fontSize: '18px', color: '#888' }}>长按识别小程序码</p>
395
-            <p style={{ margin: '0', fontSize: '18px', color: '#888' }}>进入活动查看详情</p>
396
-            <img style={{ width: '80px', position: 'absolute', right: '30px', top: '10px' }} src={xiaochengxu} alt="" />
397
-          </div>
398
-        </div>
399
-        <p style={{ textAlign: 'center', fontSize: '19px', color: '#666', marginTop: '30px' }}>海报模板</p>
400
-      </div>
401
-
402
-      <div >
403
-        <div style={{ display: 'flex', width: '100%', margin: '60px 0' }}>
404
-          <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>活动海报图</p>
405
-          <ImageUploader value={imgValue} onChange={e => changeImg(e)} />
406
-        </div>
407
-        <p style={{ fontSize: '0.5vw', color: '#A9A9A9', marginLeft: '230px', marginBottom: '30px' }}>建议图片尺寸:640*670px,比例64:67,格式:jpg,用于普通活动海报</p>
408
-        <div style={{ display: 'flex', alignItems: 'center', width: '100%', marginBottom: '60px' }}>
409
-          <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>海报标题</p>
410
-          <Input style={{ width: '20vw' }} value={inputValue} placeholder="请输入海报标题" onChange={e => changeInput(e.target.value)} />
411
-        </div>
412
-        <div style={{ display: 'flex', margin: '10px 0 40px 0', width: '100%' }}>
413
-          <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>海报描述</p>
414
-          <TextArea rows={5} maxLength={1024} value={textAreaValue} onChange={e => changeTextArea(e.target.value)} />
415
-        </div>
416
-
417
-      </div>
418
-    </div>
419
-    <Button type="primary" onClick={submitPoster} style={{ margin: '40px 40px 40px 30vw' }}> 确定</Button>
420
-    <Button onClick={() => cancelPage()}>
421
-      取消
422
-    </Button>
423
-  </div>
424
-}
425
-
426
-const Share = props => {
427
-  const { dynamicId } = props
428
-  const [inputValue, changeInput] = useState('')
429
-  const [imgValue, changeImg] = useState('')
430
-  const [shareContentId, setShareContentId] = useState('')
431
-
432
-  useEffect(() => {
433
-    if (dynamicId) {
434
-      request({ ...apis.activity.shareContent, params: { targetId: dynamicId, targetType: 'activity' } }).then(data => {
435
-
436
-        if (data.length > 0) {
437
-          setShareContentId(data[0].shareContentId)
438
-          changeImg(data[0].shareContentImg)
439
-          changeInput(data[0].shareContentTitle)
440
-        }
441
-      }).catch(err => {
442
-        message.info(err.msg || err.message)
443
-      })
444
-    }
445
-  }, [dynamicId])
446
-
447
-  const submitShare = () => {
448
-    if (dynamicId) {
449
-      if (shareContentId) {
450
-        request({ ...apis.activity.updateShareContent, urlData: { id: shareContentId }, data: { targetId: dynamicId, shareContentType: 'activity', shareContentImg: imgValue, shareContentTitle: inputValue } }).then(data => {
451
-          message.info('保存成功')
452
-        }).catch(err => {
453
-          message.info(err.msg || err.message)
454
-        })
455
-      } else {
456
-        request({ ...apis.activity.addShareContent, data: { targetId: dynamicId, shareContentType: 'activity', shareContentImg: imgValue, shareContentTitle: inputValue } }).then(data => {
457
-          setShareContentId(data.shareContentId)
458
-          message.info('保存成功')
459
-        }).catch(err => {
460
-          message.info(err.msg || err.message)
461
-        })
462
-      }
463
-    } else {
464
-      message.warn('请先保存基本信息数据')
465
-    }
466
-  }
467
-
468
-  return <div style={{ padding: '20px' }}>
469
-    <div style={{ display: 'flex', margin: '10px 0 40px 0', width: '100%' }}>
470
-      <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>分享模板</p>
471
-      <div>
472
-        <p style={{ display: 'flex', alignItems: 'center', fontSize: '14px', color: '#999', margin: '0', lineHeight: '0' }}>
473
-          <img src={logo} style={{ width: '22px', marginRight: '10px' }} alt=""/>橙蕉互动</p>
474
-        <p style={{ fontSize: '16px', color: '#222', fontWeight: '600', margin: '0' }}>{inputValue || '置业V客厅 精准获客平台'}</p>
475
-        <img style={{ width: '200px', height: '160px' }} src={imgValue || poster2} alt="" />
476
-      </div>
477
-    </div>
478
-    <div style={{ display: 'flex', alignItems: 'center', width: '100%' }}>
479
-      <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>分享标题</p>
480
-      <Input placeholder="请输入分享标题" value={inputValue} onChange={e => changeInput(e.target.value)} />
481
-    </div>
482
-    <div style={{ display: 'flex', width: '100%', marginTop: '40px' }}>
483
-      <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>活动分享图</p>
484
-      <ImageUploader value={imgValue} onChange={e => changeImg(e)} />
485
-    </div>
486
-    <p style={{ fontSize: '0.5vw', color: '#A9A9A9', marginLeft: '230px', marginTop: '20px' }}>建议图片尺寸:750*600px,比例5:4,格式:jpg,用于活动分享好友</p>
487
-    <Button type="primary" htmlType="submit" onClick={submitShare} style={{ margin: '40px 40px 40px 220px' }}> 确定</Button>
488
-    <Button onClick={() => cancelPage()}>
489
-      取消
490
-    </Button>
491
-  </div>
492
-}
493
-
494
-
495
-/**
496
- *
497
- *
498
- * @param {*} props
499
- * @returns
500
- */
501
-const Edit = props => {
502
-  const [tab, changeTab] = useState('basic')
503
-  const { dynamicId } = props.location.query
504
-
505
-  return (
506
-    <div>
507
-      <div>
508
-        <Radio.Group value={tab} buttonStyle="solid" onChange={e => changeTab(e.target.value)}>
509
-          <Radio.Button value="basic">基本信息</Radio.Button>
510
-          <Radio.Button value="poster">海报图片</Radio.Button>
511
-          <Radio.Button value="share">分享设置</Radio.Button>
512
-        </Radio.Group>
513
-      </div>
514
-      <div>
515
-        {tab === 'basic' && <Basic dynamicId={dynamicId} />}
516
-        {tab === 'poster' && <Poster dynamicId={dynamicId}/>}
517
-        {tab === 'share' && <Share dynamicId={dynamicId}/>}
518
-      </div>
519
-    
520
-    </div>
521
-  );
522
-}
523
-
524
-export default Edit

+ 9
- 6
src/pages/activity/lookHouseActivity/edit/index.jsx Visa fil

1
 import React, { useState } from 'react';
1
 import React, { useState } from 'react';
2
 import { Radio, Card } from 'antd';
2
 import { Radio, Card } from 'antd';
3
 import Basic from './Basic';
3
 import Basic from './Basic';
4
-import Poster from './Poster';
5
-import Share from './Share';
4
+// import Poster from './Poster';
5
+import Share from '@/components/Share';
6
+import Poster from '@/components/Poster'
7
+
8
+const type= 'look'
6
 /**
9
 /**
7
  *
10
  *
8
  *
11
  *
12
 const Edit = props => {
15
 const Edit = props => {
13
   const [tab, changeTab] = useState('basic');
16
   const [tab, changeTab] = useState('basic');
14
   const { dynamicId } = props.location.query;
17
   const { dynamicId } = props.location.query;
15
-
18
+  const target = { id:dynamicId, type: 'activity' }
16
   return (
19
   return (
17
     <Card>
20
     <Card>
18
       <div>
21
       <div>
23
         </Radio.Group>
26
         </Radio.Group>
24
       </div>
27
       </div>
25
       <div>
28
       <div>
26
-        {tab === 'basic' && <Basic dynamicId={dynamicId} />}
27
-        {tab === 'poster' && <Poster dynamicId={dynamicId} />}
28
-        {tab === 'share' && <Share dynamicId={dynamicId} />}
29
+        {tab === 'basic' && <Basic dynamicId={dynamicId} type={type}/>}
30
+        {tab === 'poster' && <Poster target={target} />}
31
+        {tab === 'share' && <Share target={target} />}
29
       </div>
32
       </div>
30
     </Card>
33
     </Card>
31
   );
34
   );

+ 12
- 9
src/pages/activity/lookHouseActivity/index.jsx Visa fil

24
 import request from '@/utils/request';
24
 import request from '@/utils/request';
25
 import QueryTable from '@/components/QueryTable';
25
 import QueryTable from '@/components/QueryTable';
26
 
26
 
27
+const type= 'look'
28
+
27
 const LookHouseActivity = props => {
29
 const LookHouseActivity = props => {
28
   const ref = useRef();
30
   const ref = useRef();
29
 
31
 
54
     },
56
     },
55
   ];
57
   ];
56
 
58
 
57
-  const toLookHouseActivityDetail = dynamicId => () => {
59
+  const toSignupActivityDetail = dynamicId => () => {
58
     router.push({
60
     router.push({
59
-      pathname: '/activity/lookHouseActivity/detail',
61
+      pathname: '/activity/SignupActivity/detail',
60
       query: {
62
       query: {
61
         dynamicId,
63
         dynamicId,
62
       },
64
       },
64
   };
66
   };
65
 
67
 
66
   // 跳转到编辑
68
   // 跳转到编辑
67
-  const toLookHouseActivityEdit = dynamicId => {
69
+  const toSignupActivityEdit = dynamicId => {
68
     router.push({
70
     router.push({
69
-      pathname: '/activity/lookHouseActivity/edit',
71
+      pathname: '/activity/SignupActivity/edit',
70
       query: {
72
       query: {
71
         dynamicId,
73
         dynamicId,
72
       },
74
       },
173
 
175
 
174
   const getJoinPeople = dynamicId => () => {
176
   const getJoinPeople = dynamicId => () => {
175
     router.push({
177
     router.push({
176
-      pathname: '/activity/lookHouseActivity/registrationRecord',
178
+      pathname: '/activity/SignupActivity/registrationRecord',
177
       query: {
179
       query: {
178
         dynamicId,
180
         dynamicId,
179
       },
181
       },
188
       align: 'center',
190
       align: 'center',
189
       width: '20%',
191
       width: '20%',
190
       render: (x, row) => (
192
       render: (x, row) => (
191
-        <Navigate onClick={toLookHouseActivityDetail(row.dynamicId)}>
193
+        <Navigate onClick={toSignupActivityDetail(row.dynamicId)}>
192
           <Typography.Text ellipsis>{row.title}</Typography.Text>
194
           <Typography.Text ellipsis>{row.title}</Typography.Text>
193
         </Navigate>
195
         </Navigate>
194
       ),
196
       ),
264
           />
266
           />
265
         </AuthButton>,
267
         </AuthButton>,
266
 
268
 
267
-        // //   <EditIcon type="look" text="查看详情" onClick={toLookHouseActivityDetail(row.dynamicId)} />,
269
+        // //   <EditIcon type="look" text="查看详情" onClick={toSignupActivityDetail(row.dynamicId)} />,
268
 
270
 
269
         row.activityStatus === 0 ? (
271
         row.activityStatus === 0 ? (
270
           <AuthButton name="admin.buildingDynamic.finish.put" noRight={null}>
272
           <AuthButton name="admin.buildingDynamic.finish.put" noRight={null}>
295
             <EditIcon
297
             <EditIcon
296
               type="edit"
298
               type="edit"
297
               text="编辑"
299
               text="编辑"
298
-              onClick={() => toLookHouseActivityEdit(row.dynamicId, row.count)}
300
+              onClick={() => toSignupActivityEdit(row.dynamicId, row.count)}
299
             />
301
             />
300
           </AuthButton>
302
           </AuthButton>
301
         ) : null,
303
         ) : null,
305
 
307
 
306
   const actionRender = () => {
308
   const actionRender = () => {
307
     return (
309
     return (
308
-      <Button type="primary" icon="plus" onClick={() => toLookHouseActivityEdit()}>
310
+      <Button type="primary" icon="plus" onClick={() => toSignupActivityEdit()}>
309
         新增
311
         新增
310
       </Button>
312
       </Button>
311
     );
313
     );
320
       columns={columns}
322
       columns={columns}
321
       postData={data => {
323
       postData={data => {
322
         data.time && (data.time = `${moment(data.time).format('YYYY-MM-DDT00:00:00.000')}Z`);
324
         data.time && (data.time = `${moment(data.time).format('YYYY-MM-DDT00:00:00.000')}Z`);
325
+        data.type=type
323
         return data;
326
         return data;
324
       }}
327
       }}
325
       actionRender={actionRender}
328
       actionRender={actionRender}

+ 2
- 2
src/pages/building/Edit/Apartment/Form.jsx Visa fil

121
         })(
121
         })(
122
           <Select placeholder="销售状态">
122
           <Select placeholder="销售状态">
123
             {saleType.map((item, _) => (
123
             {saleType.map((item, _) => (
124
-              <Option value={item.id}>{item.name}</Option>
124
+              <Option value={item.id} key={item.id}>{item.name}</Option>
125
             ))}
125
             ))}
126
           </Select>,
126
           </Select>,
127
         )}
127
         )}
137
         })(
137
         })(
138
           <Select placeholder="户型">
138
           <Select placeholder="户型">
139
             {houseType.map((item, _) => (
139
             {houseType.map((item, _) => (
140
-              <Option value={item.id}>{item.name}</Option>
140
+              <Option value={item.id} key={item.id}>{item.name}</Option>
141
             ))}
141
             ))}
142
           </Select>,
142
           </Select>,
143
         )}
143
         )}

+ 73
- 18
src/pages/building/Edit/Channel.jsx Visa fil

1
-import React from 'react'
2
-import { Button, Form, Input, Select } from 'antd'
1
+import React, { useEffect, useState } from 'react'
2
+import { connect } from 'dva';
3
+import { Button, Form, Input, message, Select } from 'antd'
4
+import { fetch, apis } from '@/utils/request'
3
 import InputNumber from './components/InputNumber'
5
 import InputNumber from './components/InputNumber'
4
 import { formItemLayout, validMinNum } from './utils'
6
 import { formItemLayout, validMinNum } from './utils'
5
 
7
 
6
-const ChannelForm = (props) => {
7
-  const { form } = props
8
-  const { getFieldDecorator } = form
8
+const getChannel = fetch(apis.building.channel.get)
9
+// const saveChannel = fetch(apis.building.channel.save)
10
+const updateChannel = fetch(apis.building.channel.update)
11
+const getChannelDict = fetch(apis.channelList.getList)
12
+
13
+const ChannelForm = React.forwardRef((props, ref) => {
14
+  const { form, history, user } = props
15
+  const { getFieldDecorator, setFieldsValue, validateFields } = form
16
+  const { query } = history.location;
17
+  const { id } = query;
18
+
19
+  const [loading, setLoading] = useState(false)
20
+  const [dict, setDict] = useState([])
21
+
22
+  const handleSubmit = (e) => {
23
+    e.preventDefault();
24
+    validateFields((err, values) => {
25
+      if (!err) {
26
+        const data = {
27
+          ...values,
28
+          buildingId: id,
29
+        }
30
+
31
+        setLoading(true)
32
+        updateChannel({ data }).then(() => {
33
+          setLoading(false)
34
+          message.success('数据保存成功')
35
+        }).catch(() => {
36
+          setLoading(false)
37
+        })
38
+      }
39
+    });
40
+  }
41
+
42
+  useEffect(() => {
43
+    getChannelDict({ params: { pageSize: 500, institutionId: user.institutionId }}).then((res) => {
44
+      const { records } = res || {}
45
+      if (records?.length) {
46
+        setDict(records)
47
+      }
48
+    })
49
+  }, [])
50
+
51
+  useEffect(() => {
52
+    if (id) {
53
+      getChannel({ urlData: { id } }).then((res) => {
54
+        if (res) {
55
+          setFieldsValue(res)
56
+        }
57
+      })
58
+    }
59
+  }, [id])
9
 
60
 
10
   return (
61
   return (
11
-    <Form {...formItemLayout}>
62
+    <Form {...formItemLayout} onSubmit={handleSubmit}>
12
       <Form.Item label="渠道">
63
       <Form.Item label="渠道">
13
-      {getFieldDecorator('shareContentTitle', {
14
-        rules: [{required: true, message: '请填写分享标题'}]
15
-      })(<Select />)}
64
+      {getFieldDecorator('channelIdList', {
65
+        rules: [{required: true, message: '请选择渠道'}]
66
+      })(
67
+        <Select mode="multiple" style={{ width: '100%' }}>
68
+          {
69
+            dict.map((item) => (<Select.Option key={item.channelId} value={`${item.channelId}`}>{item.channelName}</Select.Option>))
70
+          }          
71
+        </Select>
72
+      )}
16
       </Form.Item>
73
       </Form.Item>
17
       <Form.Item label="报备有效期">
74
       <Form.Item label="报备有效期">
18
-      {getFieldDecorator('posterImg', {
75
+      {getFieldDecorator('expirationDate', {
19
           rules: [{ validator: validMinNum }],
76
           rules: [{ validator: validMinNum }],
20
       })(<InputNumber min={0} step={1} addonAfter="天" />)}
77
       })(<InputNumber min={0} step={1} addonAfter="天" />)}
21
       </Form.Item>
78
       </Form.Item>
22
-      <Form.Item label="报备有效期">
23
-      {getFieldDecorator('posterImg', {
24
-          rules: [{ validator: validMinNum }],
25
-      })(<Input.TextArea row={4} />)}
79
+      <Form.Item label="报备规则">
80
+      {getFieldDecorator('remark', {})(<Input.TextArea row={4} />)}
26
       </Form.Item>
81
       </Form.Item>
27
       <Form.Item label=" " colon={false} style={{marginTop: '2em'}}>
82
       <Form.Item label=" " colon={false} style={{marginTop: '2em'}}>
28
-        <Button style={{marginLeft: '4em'}} type="primary" htmlType="submit">保存</Button>
29
-        <Button style={{marginLeft: '2em'}} onClick={props.onCancel}>取消</Button>
83
+        <Button style={{marginLeft: '4em'}} loading={loading} type="primary" htmlType="submit">保存</Button>
84
+        {/* <Button style={{marginLeft: '2em'}} onClick={props.onCancel}>取消</Button> */}
30
       </Form.Item>
85
       </Form.Item>
31
     </Form>
86
     </Form>
32
   )
87
   )
33
-}
88
+})
34
 
89
 
35
-export default Form.create({})(ChannelForm)
90
+export default connect((s) => ({ user: s.user.currentUser }))(Form.create({})(ChannelForm))

+ 9
- 17
src/pages/news/list/Edit.jsx Visa fil

1
-import React, { useMemo, useRef, useEffect, useState } from 'react';
1
+import React from 'react';
2
 // import { PageHeaderWrapper } from '@ant-design/pro-layout'
2
 // import { PageHeaderWrapper } from '@ant-design/pro-layout'
3
-import { Button, notification, Spin, Modal, message, Card, Tabs } from 'antd';
4
-import { router } from 'umi';
5
-import QueryTable from '@/components/QueryTable';
6
-import request from '@/utils/request';
7
-import apis from '@/services/apis';
3
+import { Card, Tabs } from 'antd';
8
 import Basic from './compents/Basic'
4
 import Basic from './compents/Basic'
9
-import Poster from './compents/Poster'
10
-import Share from './compents/Share'
11
-import SelectCity from '@/components/SelectButton/CitySelect';
12
-import NewsTypeSelect from '../../../components/SelectButton/NewTypeSelect';
13
-import BuildSelect from '@/components/SelectButton/BuildSelect';
14
-import moment from 'moment';
15
-import OperButton from '@/components/OperButton';
16
-import AuthButton from '@/components/AuthButton';
17
-import withActions from '@/components/ActionList';
5
+import Share from '@/components/Share';
6
+import Poster from '@/components/Poster'
18
 
7
 
19
 const { TabPane } = Tabs;
8
 const { TabPane } = Tabs;
20
 
9
 
21
 export default props => {
10
 export default props => {
22
     const newsId = props.location.query.newsId
11
     const newsId = props.location.query.newsId
12
+
13
+    const target = { id:newsId, type: 'news' }
23
 //   const [dynamicData, setDynamicData] = useState({});
14
 //   const [dynamicData, setDynamicData] = useState({});
24
 
15
 
25
 //   useEffect(() => {
16
 //   useEffect(() => {
53
         </TabPane>
44
         </TabPane>
54
 
45
 
55
         <TabPane tab="海报图片" key="2">
46
         <TabPane tab="海报图片" key="2">
56
-        <Poster newsId={newsId} />
47
+        <Poster target={target} />
48
+      
57
         </TabPane>
49
         </TabPane>
58
         <TabPane tab="分享设置" key="3">
50
         <TabPane tab="分享设置" key="3">
59
-        <Share newsId={newsId} />
51
+        <Share target={target} />
60
         </TabPane>
52
         </TabPane>
61
       </Tabs>
53
       </Tabs>
62
     </Card>
54
     </Card>

+ 0
- 0
src/pages/staff/Organization/addForm.jsx Visa fil


+ 3
- 3
src/pages/staff/Organization/form.jsx Visa fil

60
   //     }
60
   //     }
61
   //   });
61
   //   });
62
   // }
62
   // }
63
-  //挂载 我先看看
63
+  //挂载 
64
   const componentDidMount = () => {
64
   const componentDidMount = () => {
65
     console.log(this.props.FromValue)
65
     console.log(this.props.FromValue)
66
 
66
 
71
   return (
71
   return (
72
 
72
 
73
     <Form   {...formItemLayout} ref={formRef}
73
     <Form   {...formItemLayout} ref={formRef}
74
-      // onChange={onChange}  onSubmit只有一个 随便写个不行吗onDelete
74
+      // onChange={onChange}  
75
       onSubmit={e => handleChange(e, props)}
75
       onSubmit={e => handleChange(e, props)}
76
 
76
 
77
 
77
 
171
               { required: true, message: '请选择出生日期' }
171
               { required: true, message: '请选择出生日期' }
172
             ]
172
             ]
173
           })(
173
           })(
174
-            // <RangePicker style={{width: '255px'}} 还是有点问题0.0为啥 />
174
+            // <RangePicker style={{width: '255px'}}  />
175
             <DatePicker onChange={onChange} />
175
             <DatePicker onChange={onChange} />
176
           )
176
           )
177
         }
177
         }

+ 22
- 9
src/pages/staff/Organization/index.jsx Visa fil

1
 
1
 
2
-import { Row, Col, Card, Tree, Form, TreeSelect, Input, InputNumber, Modal, Button, message } from 'antd'
2
+import { Row, Col, Card, Tree, Form, Tabs, TreeSelect, Input, InputNumber, Modal, Button, message } from 'antd'
3
 import React, { useState, useEffect } from 'react';
3
 import React, { useState, useEffect } from 'react';
4
 import request from '@/utils/request';
4
 import request from '@/utils/request';
5
 import apis from '@/services/apis';
5
 import apis from '@/services/apis';
8
 const { TreeNode, DirectoryTree } = Tree;
8
 const { TreeNode, DirectoryTree } = Tree;
9
 const FormItem = Form.Item;
9
 const FormItem = Form.Item;
10
 const { Search } = Input;
10
 const { Search } = Input;
11
+const { TabPane } = Tabs;
11
 
12
 
12
 const treeData =
13
 const treeData =
13
   [
14
   [
55
       testarr: []
56
       testarr: []
56
     };
57
     };
57
   }
58
   }
59
+  // --------标签页
60
+  callback = (key) => {
61
+    console.log(key);
62
+  }
63
+
64
+
58
 
65
 
59
 
66
 
60
   onExpand = expandedKeys => {
67
   onExpand = expandedKeys => {
278
           </Col>
285
           </Col>
279
           <Col xs={{ span: 10, offset: 10 }} lg={{ span: 10, offset: 4 }}>
286
           <Col xs={{ span: 10, offset: 10 }} lg={{ span: 10, offset: 4 }}>
280
             <Card>
287
             <Card>
281
-              <TreedataFrom
282
-                ref={this.formRef}
283
-                triggerRef={this.bindRef}
284
-                onChangethis={this.onChangethis}
285
-                onSubmit={this.onChangethis}
286
-
287
-
288
-              />
288
+              <Tabs defaultActiveKey='1' onChange={this.callback}  >
289
+                <TabPane tab='编辑' key='1'>
290
+                  <TreedataFrom
291
+                    ref={this.formRef}
292
+                    triggerRef={this.bindRef}
293
+                    onChangethis={this.onChangethis}
294
+                    onSubmit={this.onChangethis}
295
+                  />
296
+                </TabPane>
297
+                <TabPane tab='新增' key='2'>
298
+                  <div>You cannot set a form field before rendering a field associated with the value. </div>
299
+                </TabPane>
300
+
301
+              </Tabs>
289
             </Card>
302
             </Card>
290
           </Col>
303
           </Col>
291
         </Row>
304
         </Row>

+ 0
- 110
src/pages/staff/Organization/tree.jsx Visa fil

1
-
2
-
3
-
4
-// import { Tree } from 'antd';
5
-
6
-// const { TreeNode } = Tree;
7
-
8
-// const treeData = [
9
-//   {
10
-//     title: '0-0',
11
-//     key: '0-0',
12
-//     children: [
13
-//       {
14
-//         title: '0-0-0',
15
-//         key: '0-0-0',
16
-//         children: [
17
-//           { title: '0-0-0-0', key: '0-0-0-0' },
18
-//           { title: '0-0-0-1', key: '0-0-0-1' },
19
-//           { title: '0-0-0-2', key: '0-0-0-2' },
20
-//         ],
21
-//       },
22
-//       {
23
-//         title: '0-0-1',
24
-//         key: '0-0-1',
25
-//         children: [
26
-//           { title: '0-0-1-0', key: '0-0-1-0' },
27
-//           { title: '0-0-1-1', key: '0-0-1-1' },
28
-//           { title: '0-0-1-2', key: '0-0-1-2' },
29
-//         ],
30
-//       },
31
-//       {
32
-//         title: '0-0-2',
33
-//         key: '0-0-2',
34
-//       },
35
-//     ],
36
-//   },
37
-//   {
38
-//     title: '0-1',
39
-//     key: '0-1',
40
-//     children: [
41
-//       { title: '0-1-0-0', key: '0-1-0-0' },
42
-//       { title: '0-1-0-1', key: '0-1-0-1' },
43
-//       { title: '0-1-0-2', key: '0-1-0-2' },
44
-//     ],
45
-//   },
46
-//   {
47
-//     title: '0-2',
48
-//     key: '0-2',
49
-//   },
50
-// ];
51
-
52
-// class Demo extends React.Component {
53
-//   state = {
54
-//     expandedKeys: ['0-0-0', '0-0-1'],
55
-//     autoExpandParent: true,
56
-//     checkedKeys: ['0-0-0'],
57
-//     selectedKeys: [],
58
-//   };
59
-
60
-//   onExpand = expandedKeys => {
61
-//     console.log('onExpand', expandedKeys);
62
-//     // if not set autoExpandParent to false, if children expanded, parent can not collapse.
63
-//     // or, you can remove all expanded children keys.
64
-//     this.setState({
65
-//       expandedKeys,
66
-//       autoExpandParent: false,
67
-//     });
68
-//   };
69
-
70
-//   onCheck = checkedKeys => {
71
-//     console.log('onCheck', checkedKeys);
72
-//     this.setState({ checkedKeys });
73
-//   };
74
-
75
-//   onSelect = (selectedKeys, info) => {
76
-//     console.log('onSelect', info);
77
-//     this.setState({ selectedKeys });
78
-//   };
79
-
80
-//   renderTreeNodes = data =>
81
-//     data.map(item => {
82
-//       if (item.children) {
83
-//         return (
84
-//           <TreeNode title={item.title} key={item.key} dataRef={item}>
85
-//             {this.renderTreeNodes(item.children)}
86
-//           </TreeNode>
87
-//         );
88
-//       }
89
-//       return <TreeNode key={item.key} {...item} />;
90
-//     });
91
-
92
-//   render() {
93
-//     return (
94
-//       <Tree
95
-//         checkable
96
-//         onExpand={this.onExpand}
97
-//         expandedKeys={this.state.expandedKeys}
98
-//         autoExpandParent={this.state.autoExpandParent}
99
-//         onCheck={this.onCheck}
100
-//         checkedKeys={this.state.checkedKeys}
101
-//         onSelect={this.onSelect}
102
-//         selectedKeys={this.state.selectedKeys}
103
-//       >
104
-//         {this.renderTreeNodes(treeData)}
105
-//       </Tree>
106
-//     );
107
-//   }
108
-// }
109
-
110
-// export default Demo 

+ 53
- 1
src/services/apis.js Visa fil

201
       method: 'DELETE',
201
       method: 'DELETE',
202
       action: 'admin.marketing.id.delete',
202
       action: 'admin.marketing.id.delete',
203
     },
203
     },
204
-
204
+    // 渠道
205
+    channel: {
206
+      get: {
207
+        url: `${prefix}/buildingChannel/:id`,
208
+        method: 'GET',
209
+        action: 'admin.building.channel.get',
210
+      },
211
+      save: {
212
+        url: `${prefix}/buildingChannel`,
213
+        method: 'POST',
214
+        action: 'admin.building.channel.post',
215
+      },
216
+      update: {
217
+        url: `${prefix}/buildingChannel`,
218
+        method: 'PUT',
219
+        action: 'admin.building.channel.post',
220
+      }
221
+    }
205
   },
222
   },
206
   buildingType: {
223
   buildingType: {
207
     getList: {
224
     getList: {
2198
       action: 'admin.institution.list.get',
2215
       action: 'admin.institution.list.get',
2199
     },
2216
     },
2200
   },
2217
   },
2218
+
2219
+  // 视频
2220
+  video: {
2221
+    list: {
2222
+      method: 'GET',
2223
+      url: `${prefix}/video`,
2224
+      action: 'admin.video.get',
2225
+    },
2226
+    getDetail: {
2227
+      method: 'GET',
2228
+      url: `${prefix}/video/:id`,
2229
+      action: 'admin.video.get.id',
2230
+    },
2231
+    save: {
2232
+      method: 'POST',
2233
+      url: `${prefix}/video`,
2234
+      action: 'admin.video.post',
2235
+    },
2236
+    updata: {
2237
+      method: 'PUT',
2238
+      url: `${prefix}/video/:id`,
2239
+      action: 'admin.video.id.put',
2240
+    },
2241
+    publish: {
2242
+      method: 'PUT',
2243
+      url: `${prefix}/publish/:id`,
2244
+      action: 'admin.publish.id.put',
2245
+    },
2246
+    delete: {
2247
+      method: 'DELETE',
2248
+      url: `${prefix}/video/:id`,
2249
+      action: 'admin.publish.id.put',
2250
+    },
2251
+   
2252
+  },
2201
 };
2253
 };

+ 3
- 3
src/utils/request.js Visa fil

82
     } else {
82
     } else {
83
       // console.log('response.headers: ', response.headers)
83
       // console.log('response.headers: ', response.headers)
84
       // console.log('response.headers.Content-Type: ', response.headers.get('Content-Type'))
84
       // console.log('response.headers.Content-Type: ', response.headers.get('Content-Type'))
85
-      console.log(response,'response')
85
+      // console.log(response,'response')
86
       if (response.headers.get('Content-Type') === 'application/octet-stream;charset=utf-8') {
86
       if (response.headers.get('Content-Type') === 'application/octet-stream;charset=utf-8') {
87
         return await response.clone().blob();
87
         return await response.clone().blob();
88
       }
88
       }
91
       if (response.url.indexOf('gaode_amap') !== -1) {
91
       if (response.url.indexOf('gaode_amap') !== -1) {
92
         return await response.clone().json();
92
         return await response.clone().json();
93
       }
93
       }
94
-      console.log(response,'response')
94
+      // console.log(response,'response')
95
       const { code, data, message } = await response.clone().json();
95
       const { code, data, message } = await response.clone().json();
96
-     
96
+
97
       if (code != 1000) {
97
       if (code != 1000) {
98
         if (code === 1001) {
98
         if (code === 1001) {
99
           // notification.error({
99
           // notification.error({