周立森 5 yıl önce
ebeveyn
işleme
76b6031ab3

+ 35
- 0
config/routes.js Dosyayı Görüntüle

@@ -274,6 +274,23 @@ export default [
274 274
                 hideInMenu: true,
275 275
                 component: './activity/drainage/Detail',
276 276
               },
277
+              {
278
+                path: '/activity/helpActivity/list',
279
+                name: '助力活动',
280
+                component: './activity/helpActivity/list',
281
+              },
282
+              {
283
+                path: '/activity/helpActivity/helpRecord',
284
+                name: '助力记录',
285
+                hideInMenu: true,
286
+                component: './activity/helpActivity/helpRecord',
287
+              },
288
+              {
289
+                path: '/activity/helpActivity/edithelpActivity',
290
+                name: '新增',
291
+                hideInMenu: true,
292
+                component: './activity/helpActivity/edithelpActivity',
293
+              },
277 294
             ],
278 295
           },
279 296
           {
@@ -374,6 +391,24 @@ export default [
374 391
               },
375 392
             ],
376 393
           },
394
+          {
395
+            path: '/third',
396
+            name: '第三方管理',
397
+            component: '../layouts/BlankLayout',
398
+            routes: [
399
+              {
400
+                path: '/third/thirdList',
401
+                name: '第三方公司',
402
+                component: './third/thirdList',
403
+              },
404
+              {
405
+                path: '/third/editThirdParty',
406
+                name: '编辑活动',
407
+                hideInMenu: true,
408
+                component: './third/editThirdParty',
409
+              },
410
+            ],
411
+          },
377 412
           {
378 413
             component: './404',
379 414
           },

+ 34
- 34
src/pages/activity/ActivityList.jsx Dosyayı Görüntüle

@@ -13,40 +13,40 @@ import AuthButton from '@/components/AuthButton';
13 13
 const { Option } = Select;
14 14
 const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
15 15
 
16
-const header = (props) => {
17
-  const [ data, setData ] = useState({})
16
+const header = props => {
17
+  // eslint-disable-next-line react-hooks/rules-of-hooks
18
+  const [data, setData] = useState({ list: [], total: 0 })
18 19
 //   const [page, changePage] = useState({})
19 20
 
21
+ // 查询列表
22
+ const getList = params => {
23
+  request({ ...apis.activity.list, params: { ...params } }).then(data => {
24
+      console.log(data)
25
+      setData(data)
26
+  })
27
+}
28
+
29
+  // eslint-disable-next-line react-hooks/rules-of-hooks
20 30
   useEffect(() => {
21 31
     getList({ pageNum: 1, pageSize: 10 });
22
-  },[])
23
-
24
-  // 查询列表
25
-  const getList = (params) => {
26
-    request({ ...apis.activity.list, params: { ...params } }).then((data) => {
27
-        console.log(data)
28
-        setData(data)
29
-    })
30
-  }
32
+  }, [])
31 33
 
32
-  
33 34
 // 跳转到编辑商品
34
-const toEditGoods = (dynamicId) => () => {
35
+const toEditGoods = dynamicId => () => {
35 36
     router.push({
36 37
       pathname: '/activity/editActivity',
37 38
       query: {
38
-        dynamicId
39
+        dynamicId,
39 40
       },
40 41
     });
41 42
   }
42
-  
43
+
43 44
   /**
44 45
    *
45 46
    *
46 47
    * @param {*} props
47 48
    * @returns
48 49
    */
49
-  
50 50
   const columns = [
51 51
     {
52 52
       title: '活动标题',
@@ -90,14 +90,14 @@ const toEditGoods = (dynamicId) => () => {
90 90
       dataIndex: 'isEnlist',
91 91
       key: 'isEnlist',
92 92
       align: 'center',
93
-      render: (isEnlist)=> <><span>{isEnlist == 0 ?"未开始" : isEnlist==1 ? "进行中" : "已结束"}</span></>
93
+      render: isEnlist => <><span>{isEnlist == 0 ? "未开始" : isEnlist == 1 ? '进行中' : '已结束'}</span></>,
94 94
     },
95 95
     {
96 96
       title: '操作',
97 97
       dataIndex: 'handle',
98 98
       key: 'handle',
99 99
       align: 'center',
100
-      render: (x,row) => (
100
+      render: (x, row) => (
101 101
         <>
102 102
           <AuthButton name="admin.SignList.get" noRight={null}>
103 103
             <span style={{ color: '#1990FF', cursor: 'pointer'}} onClick={getSignList.bind(this, row.dynamicId)}>{row.isEnlist == '1' || row.isEnlist == '2' ? "报名记录" : ""}<Icon type="snippets" className={styles.shoppingCart} /></span>
@@ -116,48 +116,48 @@ const toEditGoods = (dynamicId) => () => {
116 116
       )
117 117
     },
118 118
   ];
119
-  
120
-  const getSignList = (dynamicId) => {
119
+
120
+  const getSignList = dynamicId => {
121 121
       router.push({
122 122
           pathname: '/activity/SignList',
123 123
           query: {
124
-              dynamicId
124
+              dynamicId,
125 125
           },
126 126
         });
127 127
   }
128
-  
129
-  const finishDynamic = (row) => {
128
+
129
+  const finishDynamic = row => {
130 130
       Modal.confirm({
131 131
           title: '结束以后将无法编辑, 是否继续?',
132 132
           okText: '确定',
133 133
           cancelText: '取消',
134 134
           onOk() {
135
-              request({ ...apis.activity.finish, data: {dynamicId: row.dynamicId, top: ""} }).then((data) => {
135
+              request({ ...apis.activity.finish, data: {dynamicId: row.dynamicId, top: "" } }).then(data => {
136 136
                   console.log(data)
137 137
                   message.info('操作成功!')
138 138
                   getList({ pageNum: 1, pageSize: 10 })
139
-              }).catch((err) => {
139
+              }).catch(err => {
140 140
                   console.log(err)
141 141
                   message.info(err.msg || err.message)
142 142
               })
143 143
           },
144 144
         });
145 145
   }
146
-  
146
+
147 147
 //   置顶
148
-  const topDynamic = (row) => () => {
148
+  const topDynamic = row => () => {
149 149
       const weight = Math.abs(row.weight - 1)
150
-      request({ ...apis.activity.weight, params: {dynamicId: row.dynamicId, weight} }).then((data) => {
150
+      request({ ...apis.activity.weight, params: {dynamicId: row.dynamicId, weight} }).then(data => {
151 151
           console.log(data)
152 152
           message.info('操作成功!')
153 153
           getList({ pageNum: 1, pageSize: 10 })
154
-      }).catch((err) => {
154
+      }).catch(err => {
155 155
           console.log(err)
156 156
           message.info(err.msg || err.message)
157 157
       })
158 158
   }
159 159
   
160
-  const sendOrPublicDynamic = (row) => {
160
+  const sendOrPublicDynamic = row => {
161 161
       if (row.status === 1) {
162 162
           cancelDynamic(row)
163 163
       } else {
@@ -166,7 +166,7 @@ const toEditGoods = (dynamicId) => () => {
166 166
   }
167 167
   
168 168
   // 取消活动
169
-  const cancelDynamic = (row) => {
169
+  const cancelDynamic = row => {
170 170
       request({ ...apis.activity.cancel, urlData: {id: row.dynamicId}}).then((data) => {
171 171
           message.info('操作成功!')
172 172
           getList({ pageNum: 1, pageSize: 10 })
@@ -177,7 +177,7 @@ const toEditGoods = (dynamicId) => () => {
177 177
   }
178 178
   
179 179
   //发布活动
180
-  const sendDynamic = (row) => {
180
+  const sendDynamic = row => {
181 181
       request({ ...apis.activity.send, urlData: {id: row.dynamicId}}).then((data) => {
182 182
           message.info('操作成功!')
183 183
           getList({ pageNum: 1, pageSize: 10 });
@@ -187,7 +187,7 @@ const toEditGoods = (dynamicId) => () => {
187 187
       })
188 188
   }
189 189
   
190
-  const changePageNum = (pageNumber) => {
190
+  const changePageNum = pageNumber => {
191 191
       getList({ pageNum: pageNumber, pageSize: 10 })
192 192
   }
193 193
 
@@ -258,7 +258,7 @@ const handleSubmit = (e, props) => {
258 258
       </AuthButton>
259 259
       <Table dataSource={data.list} columns={columns} pagination={false} rowKey="activityList"/>
260 260
       <div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
261
-        <Pagination showQuickJumper defaultCurrent={1} total={data.total} onChange={changePageNum} />
261
+       <Pagination showQuickJumper defaultCurrent={1} total={data.total} onChange={(e) => changePageNum(e)} />
262 262
       </div>
263 263
     </>
264 264
   )

+ 10
- 4
src/pages/activity/editActivity.jsx Dosyayı Görüntüle

@@ -29,7 +29,7 @@ const { TextArea } = Input;
29 29
 const Edit = (props) => {
30 30
   const [tab, changeTab] = useState('basic')
31 31
   const dynamicId = props.location.query.dynamicId
32
-  const [dynamicData, setDynamicData] = useState({})
32
+  const [dynamicData, setDynamicData] = useState({ isEnlist: 1 })
33 33
   if (dynamicId) {
34 34
     useEffect(() => {
35 35
       getDynamicData(dynamicId);
@@ -50,6 +50,11 @@ const Edit = (props) => {
50 50
     });
51 51
   }
52 52
 
53
+  const radioOnChange = e => {
54
+    console.log(e.target.value)
55
+    setDynamicData({ ...dynamicData, isEnlist: e.target.value })
56
+  }
57
+
53 58
   const Basic = (props) => {
54 59
     const fields = [
55 60
       {
@@ -123,7 +128,7 @@ const Edit = (props) => {
123 128
       {
124 129
         label: '是否需要报名',
125 130
         name: 'isEnlist',
126
-        render: <Radio.Group name="radiogroup">
131
+        render: <Radio.Group name="radiogroup" onChange={(e) => radioOnChange(e)}>
127 132
           <Radio value={1}>是</Radio>
128 133
           <Radio value={0}>否</Radio>
129 134
         </Radio.Group>,
@@ -132,9 +137,10 @@ const Edit = (props) => {
132 137
       {
133 138
         label: '报名时间',
134 139
         name: 'signupTime',
135
-        type: FieldTypes.RangePicker,
140
+        // type: FieldTypes.RangePicker,
141
+        render: dynamicData.isEnlist === 1 ? (<RangePicker format={ 'YYYY/MM/DD HH:mm' } style={{ width: '100%' }} />) : '',
136 142
         value: dynamicData.enlistStart != null ? [moment(dynamicData.enlistStart, 'YYYY-MM-DD HH:mm'), moment(dynamicData.enlistEnd, 'YYYY-MM-DD HH:mm')] : null,
137
-        props: {showTime:{ format: 'HH:mm' }},
143
+        // props: {showTime:{ format: 'HH:mm' }},
138 144
         rules: [
139 145
           { required: true, message: '请选择报名时间' },
140 146
         ]

+ 365
- 0
src/pages/activity/helpActivity/edithelpActivity.jsx Dosyayı Görüntüle

@@ -0,0 +1,365 @@
1
+import React, { useState, useEffect } from 'react';
2
+import { Form, Input, Button, Icon, Select, Tabs, Radio, DatePicker, message, Upload } from 'antd';
3
+import { FormattedMessage } from 'umi-plugin-react/locale';
4
+import styles from '../../style/GoodsList.less';
5
+import apis from '../../../services/apis';
6
+import moment from 'moment';
7
+import router from 'umi/router';
8
+import BuildSelect from '../../../components/SelectButton/BuildSelect'
9
+import XForm, { FieldTypes } from '../../../components/XForm';
10
+import Wangedit from '../../../components/Wangedit/Wangedit'
11
+import request from '../../../utils/request'
12
+import yinhao from '../../../assets/yinhao.png'
13
+import ImageUploader from '../../../components/XForm/ImageUpload';
14
+import logo from '../../../assets/logo.png';
15
+import touxiang from '../../../assets/touxiang.jpg';
16
+import poster1 from '../../../assets/poster1.png';
17
+import poster2 from '../../../assets/poster2.png';
18
+import xiaochengxu from '../../../assets/xiaochengxu.png'
19
+
20
+const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
21
+const { TextArea } = Input;
22
+
23
+/**
24
+ *
25
+ *
26
+ * @param {*} props
27
+ * @returns
28
+ */
29
+const Edit = props => {
30
+  const [tab, changeTab] = useState('basic')
31
+  // 判断是否展示助力次数的输入框
32
+  // const [help, helpTab] = useState('1')
33
+  const { dynamicId } = props.location.query
34
+  const [dynamicData, setDynamicData] = useState({})
35
+  if (dynamicId) {
36
+    // eslint-disable-next-line react-hooks/rules-of-hooks
37
+    useEffect(() => {
38
+      // eslint-disable-next-line no-use-before-define
39
+      getDynamicData(dynamicId);
40
+    }, [])
41
+
42
+    // 查询列表
43
+    const getDynamicData = (dynamicId) => {
44
+      request({ ...apis.activity.details, params: { dynamicId } }).then((data) => {
45
+        console.log(data)
46
+        setDynamicData(data)
47
+      })
48
+    }
49
+  }
50
+
51
+  const cancelPage = () => {
52
+    router.push({
53
+      pathname: '/activity/ActivityList',
54
+    });
55
+  }
56
+
57
+  const Basic = props => {
58
+    const fields = [
59
+      {
60
+        label: '选择项目',
61
+        name: 'buildingId',
62
+        render: <BuildSelect />,
63
+        value: dynamicData.buildingId,
64
+        rules: [
65
+          { required: true, message: '请选择项目' },
66
+        ]
67
+      },
68
+      {
69
+        label: '活动标题',
70
+        name: 'title',
71
+        type: FieldTypes.Text,
72
+        value: dynamicData.title,
73
+        rules: [
74
+          { required: true, message: '请输入活动标题' },
75
+        ]
76
+      },
77
+      {
78
+        label: '活动主图',
79
+        name: 'img',
80
+        type: FieldTypes.ImageUploader,
81
+        value: dynamicData.img,
82
+        help: '建议图片尺寸:750px*560px',
83
+      },
84
+      {
85
+        label: '活动时间',
86
+        name: 'activityTime',
87
+        type: FieldTypes.RangePicker,
88
+        value: dynamicData.startDate != null ? [moment(dynamicData.startDate, 'YYYY-MM-DD HH:mm'), moment(dynamicData.endDate, 'YYYY-MM-DD HH:mm')] : null,
89
+        props: { showTime: { format: 'HH:mm' } },
90
+        rules: [
91
+          { required: true, message: '请选择活动时间' },
92
+        ],
93
+      },
94
+      {
95
+        label: '助力邀请人数',
96
+        name: 'personNum',
97
+        type: FieldTypes.Text,
98
+        value: dynamicData.persionNum,
99
+        rules: [
100
+          { required: true, message: '请输入活动人数' },
101
+        ]
102
+      },
103
+      {
104
+        label: '助力次数',
105
+        name: 'maxEnlistByPerson',
106
+        type: FieldTypes.Text,
107
+        value: dynamicData.helpNum,
108
+        rules: [
109
+          { required: true, message: '请选择是否助力' },
110
+        ],
111
+        render: <Radio.Group name="radiogroup">
112
+        <Radio value={1}>不限制</Radio>
113
+        <Radio value={0}>次数限制</Radio>
114
+      </Radio.Group>,
115
+      },
116
+      {
117
+        label: ' ',
118
+        name: 'personNum',
119
+        type: FieldTypes.Text,
120
+        value: dynamicData.personNum,
121
+        rules: [
122
+          { required: true, message: '请输入次数' },
123
+        ],
124
+      },
125
+      {
126
+        label: '活动说明',
127
+        name: 'activityInstructions',
128
+        type: FieldTypes.ImageUploader,
129
+        value: dynamicData.activityInstructions,
130
+        help: '建议图片尺寸:750px*560px',
131
+      },
132
+    ]
133
+
134
+    const handleSubmit = val => {
135
+      const { activityTime, signupTime, ...submitValue } = val
136
+      console.log('val', val)
137
+      const [startDate, endDate] = activityTime
138
+      submitValue.startDate = moment(startDate).format('YYYY-MM-DD HH:mm');
139
+      submitValue.endDate = moment(endDate).format('YYYY-MM-DD HH:mm');
140
+      // const [enlistStart, enlistEnd] = signupTime
141
+      // submitValue.enlistStart = moment(enlistStart).format('YYYY-MM-DD HH:mm');
142
+      // submitValue.enlistEnd = moment(enlistEnd).format('YYYY-MM-DD HH:mm');
143
+      console.log('submit data --->', submitValue)
144
+      // if (dynamicId) {
145
+      //   submitValue.dynamicId = dynamicId
146
+      //   request({ ...apis.activity.update, data: submitValue }).then((data) => {
147
+      //     message.info("保存成功")
148
+      //     cancelPage()
149
+      //   }).catch((err) => {
150
+      //     message.info(err.msg || err.message)
151
+      //   })
152
+      // } else {
153
+      //   request({ ...apis.activity.add, data: submitValue }).then((data) => {
154
+      //     message.info("保存成功")
155
+      //     cancelPage()
156
+      //   }).catch((err) => {
157
+      //     message.info(err.msg || err.message)
158
+      //   })
159
+      // }
160
+    }
161
+
162
+    return <XForm onSubmit={handleSubmit} onCancel={cancelPage} fields={fields}></XForm>
163
+  }
164
+
165
+  const Poster = (props) => {
166
+    const [inputValue, changeInput] = useState('')
167
+    const [textAreaValue, changeTextArea] = useState('')
168
+    const [imgValue, changeImg] = useState('')
169
+    const [posterId, setPosterId] = useState('')
170
+
171
+    if (dynamicId) {
172
+      console.log(dynamicId, 'dynamicId')
173
+      useEffect(() => {
174
+        request({ ...apis.activity.poster, params: { targetId: dynamicId, targetType: 'activity' } }).then((data) => {
175
+          console.log(data, "2222")
176
+          if (data.length > 0) {
177
+            setPosterId(data[0].posterId)
178
+            changeImg(data[0].posterImg)
179
+            changeTextArea(data[0].posterDescription)
180
+            changeInput(data[0].posterTitle)
181
+          }
182
+        }).catch((err) => {
183
+          message.info(err.msg || err.message)
184
+        })
185
+        getMiniappName()
186
+      }, [])
187
+    }else{
188
+      getMiniappName()
189
+    }
190
+    // 获取小程序名称
191
+    const [miniappName, setMiniappName] = useState('')
192
+    function getMiniappName() {
193
+      request({ ...apis.building.getMiniappName }).then(res => {
194
+        console.log(res, "0000000000000")
195
+        setMiniappName(res)
196
+      })
197
+    }
198
+
199
+    const submitPoster = () => {
200
+      if (dynamicId) {
201
+        if (posterId) {
202
+          request({ ...apis.activity.updatePoster, urlData: { id: posterId }, data: { targetId: dynamicId, targetType: 'activity', posterImg: imgValue, posterTitle: inputValue, posterDescription: textAreaValue }, }).then((data) => {
203
+            message.info("保存成功")
204
+          }).catch((err) => {
205
+            message.info(err.msg || err.message)
206
+          })
207
+        } else {
208
+          request({ ...apis.activity.addPoster, data: { targetId: dynamicId, targetType: 'activity', posterImg: imgValue, posterTitle: inputValue, posterDescription: textAreaValue }, }).then((data) => {
209
+            setPosterId(data.posterId)
210
+            message.info("保存成功")
211
+          }).catch((err) => {
212
+            message.info(err.msg || err.message)
213
+          })
214
+        }
215
+      } else {
216
+        message.warn("请先保存基本信息数据")
217
+      }
218
+    }
219
+
220
+    return <div>
221
+      <div style={{ display: 'flex' }}>
222
+        <div style={{ width: '420px', height: '900px', display: 'inline-block', marginTop: '30px' }}>
223
+          <div style={{ width: '375px', height: '700px', backgroundColor: '#fff', boxShadow: '0px 0px 16px 6px rgba(0,0,0,0.15)', position: 'relative', margin: '0 auto' }}>
224
+            <img style={{ width: '100%', height: '300px' }} src={imgValue ? imgValue : poster1} alt="" />
225
+            <div style={{ display: 'flex', alignItems: 'center', marginTop: '-24px' }}>
226
+              <img style={{ width: '70px', height: '70px', border: '4px solid #fff', borderRadius: '35px', marginLeft: '16px' }} src={touxiang} alt="" />
227
+              <span style={{ color: '#222', fontWeight: '600', margin: '24px 10px 0 14px', fontSize: '17px' }}>喵喵</span>
228
+              <span style={{ color: '#999', marginTop: '25px', fontSize: '17px' }}>邀您阅读</span>
229
+              <span style={{ color: '#999', margin: '25px 0 0 60px', fontSize: '17px' }}>2019.09.21</span>
230
+            </div>
231
+            <p style={{
232
+              margin: '10px 20px', fontSize: '20px', color: '#222', fontWeight: '600',
233
+              display: '-webkit-box', lineClamp: '3', height: '60px',
234
+              WebkitLineClamp: '2',
235
+              WebkitBoxOrient: 'vertical',
236
+              overflow: 'hidden',
237
+              textOverflow: 'ellipsis'
238
+            }}>{inputValue ? inputValue : '海报标题'}</p>
239
+
240
+            <img src={yinhao} style={{ width: '30px', marginLeft: '20px' }} alt="" />
241
+            <p style={{
242
+              margin: '16px 20px 28px 20px', fontSize: '17px', color: '#999',
243
+              display: '-webkit-box', lineClamp: '3', height: '72px',
244
+              WebkitLineClamp: '3',
245
+              WebkitBoxOrient: 'vertical',
246
+              overflow: 'hidden',
247
+              textOverflow: 'ellipsis'
248
+            }}>{textAreaValue ? textAreaValue : '海报描述'}</p>
249
+            <div style={{ backgroundColor: '#f1f1f1', padding: '22px 30px', boxShadow: '0px 6px 12px -4px #dcdcdc', position: 'relative' }}>
250
+              <p style={{ margin: '0', fontSize: '18px', color: '#888' }}>长按识别小程序码</p>
251
+              <p style={{ margin: '0', fontSize: '18px', color: '#888' }}>进入<span style={{ margin: '0 5px', fontSize: '18px', color: '#333', fontWeight: '600' }}>{miniappName || '置业V顾问'}</span>报名活动</p>
252
+              <img style={{ width: '80px', position: 'absolute', right: '30px', top: '10px' }} src={xiaochengxu} alt="" />
253
+            </div>
254
+          </div>
255
+          <p style={{ textAlign: 'center', fontSize: '19px', color: '#666', marginTop: '30px' }}>海报模板</p>
256
+        </div>
257
+
258
+        <div >
259
+          <div style={{ display: 'flex', width: '100%', margin: '60px 0' }}>
260
+            <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>海报图片1</p>
261
+            <ImageUploader value={imgValue} onChange={e => changeImg(e)} />
262
+          </div>
263
+          <div style={{ display: 'flex', alignItems: 'center', width: '100%', marginBottom: '60px' }}>
264
+            <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>海报标题1</p>
265
+            <Input style={{ width: '20vw' }} value={inputValue} placeholder="请输入海报标题" onChange={e => changeInput(e.target.value)} />
266
+          </div>
267
+          <div style={{ display: 'flex', margin: '10px 0 40px 0', width: '100%' }}>
268
+            <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>海报描述1</p>
269
+            <TextArea rows={5} value={textAreaValue} onChange={e => changeTextArea(e.target.value)} />
270
+          </div>
271
+
272
+        </div>
273
+      </div>
274
+      <Button type="primary" onClick={submitPoster} style={{ margin: '40px 40px 40px 30vw' }}> 确定</Button>
275
+      <Button onClick={() => router.go(-1)}>取消</Button>
276
+    </div>
277
+
278
+  }
279
+
280
+
281
+
282
+  const Share = (props) => {
283
+    const [inputValue, changeInput] = useState('')
284
+    const [imgValue, changeImg] = useState('')
285
+    const [shareContentId, setShareContentId] = useState('')
286
+
287
+    if (dynamicId) {
288
+      useEffect(() => {
289
+        request({ ...apis.activity.shareContent, params: { targetId: dynamicId, targetType: 'activity' }, }).then((data) => {
290
+          console.log(data, "2222")
291
+          if (data.length > 0) {
292
+            setShareContentId(data[0].shareContentId)
293
+            changeImg(data[0].shareContentImg)
294
+            changeInput(data[0].shareContentTitle)
295
+          }
296
+        }).catch((err) => {
297
+          message.info(err.msg || err.message)
298
+        })
299
+      }, [])
300
+    }
301
+
302
+    const submitShare = () => {
303
+      if (dynamicId) {
304
+        if (shareContentId) {
305
+          request({ ...apis.activity.updateShareContent, urlData: { id: shareContentId }, data: { targetId: dynamicId, shareContentType: 'activity', shareContentImg: imgValue, shareContentTitle: inputValue }, }).then((data) => {
306
+            message.info("保存成功")
307
+          }).catch((err) => {
308
+            message.info(err.msg || err.message)
309
+          })
310
+        } else {
311
+          request({ ...apis.activity.addShareContent, data: { targetId: dynamicId, shareContentType: 'activity', shareContentImg: imgValue, shareContentTitle: inputValue }, }).then((data) => {
312
+            setShareContentId(data.shareContentId)
313
+            message.info("保存成功")
314
+          }).catch((err) => {
315
+            message.info(err.msg || err.message)
316
+          })
317
+        }
318
+      } else {
319
+        message.warn("请先保存基本信息数据")
320
+      }
321
+    }
322
+
323
+    return <div style={{ padding: '20px' }}>
324
+      <div style={{ display: 'flex', margin: '10px 0 40px 0', width: '100%' }}>
325
+        <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>分享模板1</p>
326
+        <div>
327
+          <p style={{ display: 'flex', alignItems: 'center', fontSize: '14px', color: '#999', margin: '0', lineHeight: '0' }}><img src={logo} style={{ width: '22px', marginRight: '10px' }} />知与行互动</p>
328
+          <p style={{ fontSize: '16px', color: '#222', fontWeight: '600', margin: '0' }}>{inputValue ? inputValue : '置业V客厅 精准获客平台'}</p>
329
+          <img style={{ width: '200px', height: '140px' }} src={imgValue ? imgValue : poster2} alt="" />
330
+        </div>
331
+      </div>
332
+      <div style={{ display: 'flex', alignItems: 'center', width: '100%' }}>
333
+        <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>分享标题1</p>
334
+        <Input placeholder="请输入分享标题" value={inputValue} onChange={e => changeInput(e.target.value)} />
335
+      </div>
336
+      <div style={{ display: 'flex', width: '100%', marginTop: '40px' }}>
337
+        <p style={{ minWidth: '200px', color: '#222', textAlign: 'right', margin: '0 30px 0 0' }}>分享图片1</p>
338
+        <ImageUploader value={imgValue} onChange={e => changeImg(e)} />
339
+      </div>
340
+      <Button type="primary" htmlType="submit" onClick={submitShare} style={{ margin: '40px 40px 40px 220px' }}> 确定</Button>
341
+      <Button onClick={() => router.go(-1)}>取消</Button>
342
+    </div>
343
+  }
344
+
345
+  return (
346
+    <div>
347
+      <div>
348
+        <Radio.Group value={tab} buttonStyle="solid" onChange={e => changeTab(e.target.value)}>
349
+          <Radio.Button value="basic">基本信息1</Radio.Button>
350
+          <Radio.Button value="poster">海报图片1</Radio.Button>
351
+          <Radio.Button value="share">分享设置1</Radio.Button>
352
+        </Radio.Group>
353
+      </div>
354
+      <div>
355
+        {tab === 'basic' && <Basic />}
356
+        {tab === 'poster' && <Poster />}
357
+        {tab === 'share' && <Share />}
358
+      </div>
359
+    </div>
360
+  );
361
+}
362
+
363
+
364
+
365
+export default Edit

+ 330
- 0
src/pages/activity/helpActivity/helpRecord.jsx Dosyayı Görüntüle

@@ -0,0 +1,330 @@
1
+import React, { useState, useEffect } from 'react';
2
+import { Form, Icon, Input, Button, DatePicker, Select, Card, Row, Col, Pagination, Alert, Table, Avatar, Radio, Modal, Descriptions } from 'antd';
3
+import moment from 'moment';
4
+import request from '../../../utils/request';
5
+import apis from '../../../services/apis';
6
+import router from 'umi/router';
7
+import BuildSelect from '../../../components/SelectButton/BuildSelect'
8
+import AuthButton from '@/components/AuthButton';
9
+
10
+
11
+const { Option } = Select;
12
+// eslint-disable-next-line @typescript-eslint/no-unused-vars
13
+const { Meta } = Card;
14
+
15
+/**
16
+ *
17
+ *
18
+ * @param {*} props
19
+ * @returns
20
+ */
21
+function body(props) {
22
+  const { getFieldDecorator, getFieldsValue } = props.form
23
+
24
+  // eslint-disable-next-line react-hooks/rules-of-hooks
25
+  const [dataSource, setDataSource] = useState({ records: [] })
26
+  // eslint-disable-next-line react-hooks/rules-of-hooks
27
+  // const [columns, setColumns] = useState(privateColumns)
28
+
29
+  // 默认私客
30
+  // eslint-disable-next-line react-hooks/rules-of-hooks
31
+  const [customerType, setCustomerType] = useState('private')
32
+
33
+  // 调整归属 ============  start
34
+  // eslint-disable-next-line react-hooks/rules-of-hooks
35
+  const [gVisibleData, setGVisibleData] = useState({ visible: false, customerId: '', realtyConsultant: '' })
36
+  // 调整归属 ============= end
37
+
38
+  // 积分记录 ============  start
39
+  // eslint-disable-next-line react-hooks/rules-of-hooks
40
+  const [recordVisibleData, setRecordVisibleData] = useState({ visible: false, customerId: '' })
41
+  // 积分记录 ============= end
42
+
43
+  // 变更状态 ============  start
44
+  // eslint-disable-next-line react-hooks/rules-of-hooks
45
+  const [statusVisibleData, setStatusVisibleData] = useState({ visible: false, customerId: '', status: '' })
46
+  // 变更状态 ============= end
47
+
48
+  // eslint-disable-next-line react-hooks/rules-of-hooks
49
+  useEffect(() => {
50
+    getList({ pageNumber: 1, pageSize: 10, customerType })
51
+  }, [])
52
+
53
+  function getList(params) {
54
+    // 网路请求
55
+    request({ ...apis.customer.customerRecommend, params: { ...params } }).then(res => {
56
+      setDataSource(res)
57
+    }).catch(err => {
58
+      // eslint-disable-next-line no-unused-expressions
59
+      <Alert
60
+        style={{
61
+          marginBottom: 24,
62
+        }}
63
+        message={err}
64
+        type="error"
65
+        showIcon
66
+      />
67
+    })
68
+  }
69
+
70
+  function displayNone() {
71
+    setRecordVisibleData({ visible: false, customerId: '' })
72
+    setGVisibleData({ visible: false, customerId: '', realtyConsultant: '' })
73
+    setStatusVisibleData({ visible: false, customerId: '', status: '' })
74
+  }
75
+
76
+  // 提交事件
77
+  function handleSubmit(e) {
78
+    displayNone()
79
+
80
+
81
+    e.preventDefault();
82
+    props.form.validateFields((err, values) => {
83
+      if (!err) {
84
+        getList({ pageNum: 1, pageSize: 10, customerType, ...values })
85
+      }
86
+    });
87
+  }
88
+
89
+  // Change 事件
90
+  function handleSelectChange(e) {
91
+    // eslint-disable-next-line no-console
92
+    console.log(e)
93
+  }
94
+
95
+  // 分页
96
+  function onChange(pageNum) {
97
+    // eslint-disable-next-line react-hooks/rules-of-hooks
98
+    getList({ pageNumber: pageNum, pageSize: 10, customerType })
99
+  }
100
+
101
+  // 私客/公客切换
102
+  function radioButtonHandleSizeChange(e) {
103
+    displayNone()
104
+
105
+    const { value } = e.target
106
+    setCustomerType(value)
107
+    //setColumns(value === 'private' ? privateColumns : publicColumns)
108
+    getList({ pageNumber: 1, pageSize: 10, customerType: value })
109
+  }
110
+
111
+  function handleReset() {
112
+    props.form.resetFields();
113
+    getList({ pageNumber: 1, pageSize: 10, customerType })
114
+  }
115
+
116
+
117
+  // 这里有个 Bug, 就是 Modal 弹框,会联动出现, 比如 我点击 调整归属的Model弹框, 那么 积分记录的Model弹框莫名其妙的也显示了
118
+  // 所有这里临时解决方法是,弹出一个Modal对话框的时候,把其他的对话框给隐藏
119
+
120
+  function showGM(record) {
121
+    setGVisibleData({ visible: true, customerId: record.customerId, realtyConsultant: record.realtyConsultant })
122
+    setRecordVisibleData({ visible: false, customerId: '' })
123
+    setStatusVisibleData({ visible: false, customerId: '' })
124
+  }
125
+
126
+  function showRecord(record) {
127
+    setRecordVisibleData({ visible: true, customerId: record.customerId })
128
+    setGVisibleData({ visible: false, customerId: '', realtyConsultant: '' })
129
+    setStatusVisibleData({ visible: false, customerId: '' })
130
+  }
131
+
132
+  function showStatus(record) {
133
+    setRecordVisibleData({ visible: false, customerId: '' })
134
+    setGVisibleData({ visible: false, customerId: '', realtyConsultant: '' })
135
+    setStatusVisibleData({ visible: true, customerId: record.customerId, status: record.status })
136
+  }
137
+  function toCustomerDateil(record) {
138
+    router.push({
139
+      pathname: '/customer/customerlist/customerDetail',
140
+      query: {
141
+        id: record.customerId,
142
+      },
143
+    });
144
+  }
145
+
146
+  function exportCustomer () {
147
+    const fieldsValue = getFieldsValue()
148
+    request({ ...apis.customer.customerRecommendExport, responseType: 'blob', params: { ...fieldsValue, customerType } })
149
+      .then(response => {
150
+        download(response)
151
+      }).catch(error => {
152
+
153
+      })
154
+  }
155
+
156
+  function download (data) {
157
+    if (!data) {
158
+      return
159
+    }
160
+    const url = window.URL.createObjectURL(new Blob([data]))
161
+    const link = document.createElement('a')
162
+    link.style.display = 'none'
163
+    link.href = url
164
+    link.setAttribute('download', '客户列表.xlsx')
165
+    document.body.append(link)
166
+    link.click()
167
+  }
168
+
169
+  const publicColumns = [
170
+    {
171
+      title: '头像',
172
+      dataIndex: 'picture',
173
+      key: 'picture',
174
+      align: 'center',
175
+      width: '15%',
176
+      render: (_, record) => <Avatar shape="square" src={customerType === 'private' ? record.picture : record.avatarurl} size={64} icon="user" />,
177
+    },
178
+    {
179
+      title: '姓名',
180
+      dataIndex: 'name',
181
+      key: 'name',
182
+      align: 'center',
183
+      width: '10%',
184
+      // eslint-disable-next-line no-nested-ternary
185
+      render: (_, record) => <><span>{customerType === 'private' ? record.name : record.nickname}</span></>,
186
+    },
187
+    {
188
+      title: '电话',
189
+      dataIndex: 'phone',
190
+      key: 'phone',
191
+      align: 'center',
192
+      width: '15%',
193
+    },
194
+    {
195
+      title: '推广人员',
196
+      dataIndex: 'sharePersonName',
197
+      key: 'sharePersonName',
198
+      align: 'center',
199
+      width: '15%',
200
+    },
201
+  ]
202
+
203
+  const privateColumns = [
204
+    {
205
+      title: '头像',
206
+      dataIndex: 'picture',
207
+      key: 'picture',
208
+      align: 'center',
209
+      width: '15%',
210
+      render: (_, record) => <Avatar shape="square" src={customerType === 'private' ? record.picture : record.avatarurl} size={64} icon="user" />,
211
+    },
212
+    {
213
+      title: '姓名',
214
+      dataIndex: 'name',
215
+      key: 'name',
216
+      align: 'center',
217
+      width: '10%',
218
+      // eslint-disable-next-line no-nested-ternary
219
+      render: (_, record) => <><span>{customerType === 'private' ? record.name : record.nickname}</span></>,
220
+    },
221
+    {
222
+      title: '电话',
223
+      dataIndex: 'phone',
224
+      key: 'phone',
225
+      align: 'center',
226
+      width: '15%',
227
+    },
228
+    {
229
+      title: '性别',
230
+      dataIndex: 'sex',
231
+      key: 'sex',
232
+      align: 'center',
233
+      width: '10%',
234
+      // eslint-disable-next-line no-nested-ternary
235
+      render: (_, record) => <><span>{record.sex === 1 ? '男' : record.sex === 2 ? '女' : '未知'}</span></>,
236
+    },
237
+    {
238
+      title: '置业顾问',
239
+      dataIndex: 'consultantName',
240
+      key: 'consultantName',
241
+      align: 'center',
242
+      width: '15%',
243
+      // eslint-disable-next-line no-nested-ternary
244
+      render: (_, record) => (
245
+        <>
246
+          <span>{record.consultantName}</span>
247
+          <br />
248
+          <span>{record.consultTel}</span>
249
+        </>
250
+      ),
251
+    },
252
+    {
253
+      title: '推广人员',
254
+      dataIndex: 'sharePersonName',
255
+      key: 'sharePersonName',
256
+      align: 'center',
257
+      width: '15%',
258
+    },
259
+    {
260
+      title: '客户状态',
261
+      dataIndex: 'reportRecommendStatus',
262
+      key: 'reportRecommendStatus',
263
+      align: 'center',
264
+      width: '10%',
265
+      // eslint-disable-next-line no-nested-ternary
266
+      render: (text, records) => {
267
+        if (records.status === 1) { return '报备' }
268
+        if (records.status === 2) { return '到访' }
269
+        if (records.status === 3) { return '认筹' }
270
+        if (records.status === 4) { return '签约' }
271
+      },
272
+    },
273
+    {
274
+      title: '操作',
275
+      dataIndex: 'customerId',
276
+      key: 'customerId',
277
+      align: 'center',
278
+      width: '25%',
279
+      // eslint-disable-next-line no-nested-ternary
280
+    },
281
+  ]
282
+
283
+  return (
284
+    <>
285
+    {console.log('customerType', customerType)}
286
+      <Form layout="inline" onSubmit={e => handleSubmit(e, props)}>
287
+        <Form.Item>
288
+          {getFieldDecorator('tel')(
289
+            <Input
290
+              prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
291
+              placeholder="电话"
292
+            />,
293
+          )}
294
+        </Form.Item>
295
+        <Form.Item>
296
+            <Button type="primary" htmlType="submit" >
297
+              查询
298
+            </Button>
299
+            <Button style={{ marginLeft: 8 }} onClick={handleReset}>
300
+              重置
301
+            </Button>
302
+            <Button style={{ marginLeft: 8 }} onClick={handleReset}>
303
+              返回
304
+            </Button>
305
+        </Form.Item>
306
+      </Form>
307
+      <Button type="primary" onClick={() => exportCustomer()} style={{ float: 'right', margin: '20px 0', zIndex: 1 }}>
308
+        导出
309
+      </Button>
310
+
311
+      <div style={{ margin: '20px 0'}}>
312
+        <AuthButton name="admin.customer.recommend.get" noRight={null}>
313
+          <Radio.Group value={customerType} onChange={radioButtonHandleSizeChange} buttonStyle="solid">
314
+            <Radio.Button value="private">助力成功</Radio.Button>
315
+            <Radio.Button value="public">进行中</Radio.Button>
316
+            <Radio.Button value="error ">助力失败</Radio.Button>
317
+          </Radio.Group>
318
+        </AuthButton>
319
+      </div>
320
+      {customerType === 'private' ? 
321
+        <Table dataSource={dataSource.records} columns={privateColumns} pagination={{ total: dataSource.total, onChange }} rowKey="customerList" /> :
322
+        <Table dataSource={dataSource.records} columns={publicColumns} pagination={{ total: dataSource.total, onChange }} rowKey="customerList" /> 
323
+      }
324
+    </>
325
+  );
326
+}
327
+
328
+const WrappedBody = Form.create({ name: 'body' })(body);
329
+
330
+export default WrappedBody

+ 261
- 0
src/pages/activity/helpActivity/list.jsx Dosyayı Görüntüle

@@ -0,0 +1,261 @@
1
+import React, { useState, useEffect } from 'react';
2
+import { Form, Input, Button, Icon, Select, message, Table, Divider, Tag, Pagination, Modal, DatePicker } from 'antd';
3
+import { FormattedMessage } from 'umi-plugin-react/locale';
4
+import styles from '../../style/GoodsList.less';
5
+import router from 'umi/router';
6
+import moment from 'moment';
7
+import SelectCity from '../../../components/SelectButton/CitySelect'
8
+import BuildSelect from '../../../components/SelectButton/BuildSelect'
9
+import apis from '../../../services/apis';
10
+import request from '../../../utils/request';
11
+import AuthButton from '@/components/AuthButton';
12
+
13
+const { Option } = Select;
14
+const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
15
+
16
+const header = (props) => {
17
+  const [ data, setData ] = useState({})
18
+//   const [page, changePage] = useState({})
19
+
20
+  useEffect(() => {
21
+    getList({ pageNum: 1, pageSize: 10 });
22
+  },[])
23
+
24
+  // 查询列表
25
+  const getList = (params) => {
26
+    request({ ...apis.helpActivity.list, params: { ...params } }).then((data) => {
27
+        console.log(data)
28
+        setData(data)
29
+    })
30
+  }
31
+
32
+  
33
+// 跳转到助力新增
34
+const toEditGoods = (dynamicId) => () => {
35
+    router.push({
36
+      pathname: '/activity/helpActivity/edithelpActivity',
37
+      query: {
38
+        dynamicId
39
+      },
40
+    });
41
+  }
42
+  
43
+  /**
44
+   *
45
+   *
46
+   * @param {*} props
47
+   * @returns
48
+   */
49
+  
50
+  const columns = [
51
+    {
52
+      title: '活动标题',
53
+      dataIndex: 'title',
54
+      key: 'title',
55
+      align: 'center',
56
+    },
57
+    {
58
+      title: '活动时间',
59
+      dataIndex: 'startDate',
60
+      key: 'startDate',
61
+      align: 'center',
62
+      render: (x, row) => <><span>{`${moment(row.startDate).format('YYYY-MM-DD')} —— ${moment(row.endDate).format('YYYY-MM-DD')}`}</span></>
63
+    },
64
+    {
65
+      title: '已参加人数',
66
+      dataIndex: 'enlistNum',
67
+      key: 'enlistNum',
68
+      align: 'center',
69
+    },
70
+    {
71
+      title: '助力成功数',
72
+      dataIndex: 'persionNum',
73
+      key: 'persionNum',
74
+      align: 'center',
75
+    },  
76
+    {
77
+      title: '状态',
78
+      dataIndex: 'isEnlist',
79
+      key: 'isEnlist',
80
+      align: 'center',
81
+      render: (text, records) => {
82
+        if (records.status === 0) { return '未开始' }
83
+        if (records.status === 1) { return '进行中' }
84
+        if (records.status === 2) { return '已结束' }
85
+      },
86
+    },
87
+    {
88
+      title: '操作',
89
+      dataIndex: 'handle',
90
+      key: 'handle',
91
+      align: 'center',
92
+      render: (x,row) => (
93
+        <>
94
+          <AuthButton name="admin.SignList.get" noRight={null}>
95
+            <span style={{ color: '#1990FF', cursor: 'pointer'}} onClick={getSignList.bind(this, row.dynamicId)}>{row.isEnlist == '1' || row.isEnlist == '2' ? "助力记录" : ""}<Icon type="snippets" className={styles.shoppingCart} /></span>
96
+          </AuthButton>
97
+          <AuthButton name="admin.buildingDynamic.send.dynamicId.put" noRight={null}>
98
+            <span style={{ color: '#1990FF', cursor: 'pointer' }} onClick={sendOrPublicDynamic.bind(this,row)}>{ row.status === 1 ? '取消发布' : '发布' }<Icon type="close-circle" className={styles.edit} /></span>
99
+          </AuthButton>
100
+          <AuthButton name="admin.buildingDynamic.finish.put" noRight={null}>
101
+            {row.isEnlist != 2 && <span style={{ color: '#1990FF', cursor: 'pointer' }} onClick={finishDynamic.bind(this,row)}>结束活动<Icon type="poweroff" className={styles.edit} /></span>}
102
+          </AuthButton>
103
+          <AuthButton name="admin.buildingDynamic.update.put" noRight={null}>
104
+            <span style={{ color: '#1990FF', marginRight: '20px', cursor: 'pointer' }} onClick={topDynamic(row)}>{ row.weight === 1 ? '取消置顶' : '置顶' }<Icon type="vertical-align-top" className={styles.edit} /></span>
105
+            {row.isEnlist != 2 && <span style={{ color: '#FF925C', cursor: 'pointer' }} onClick={toEditGoods(row.dynamicId)}>编辑<Icon type="form" className={styles.edit} /></span>}
106
+          </AuthButton>
107
+        </>
108
+      )
109
+    },
110
+  ];
111
+  
112
+  const getSignList = (dynamicId) => {
113
+      router.push({
114
+          pathname: '/activity/helpActivity/helpRecord',
115
+          query: {
116
+              dynamicId
117
+          },
118
+        });
119
+  }
120
+  
121
+  const finishDynamic = (row) => {
122
+      Modal.confirm({
123
+          title: '结束以后将无法编辑, 是否继续?',
124
+          okText: '确定',
125
+          cancelText: '取消',
126
+          onOk() {
127
+              request({ ...apis.activity.finish, data: {dynamicId: row.dynamicId, top: ""} }).then((data) => {
128
+                  console.log(data)
129
+                  message.info('操作成功!')
130
+                  getList({ pageNum: 1, pageSize: 10 })
131
+              }).catch((err) => {
132
+                  console.log(err)
133
+                  message.info(err.msg || err.message)
134
+              })
135
+          },
136
+        });
137
+  }
138
+  
139
+//   置顶
140
+  const topDynamic = (row) => () => {
141
+      const weight = Math.abs(row.weight - 1)
142
+      request({ ...apis.activity.weight, params: {dynamicId: row.dynamicId, weight} }).then((data) => {
143
+          console.log(data)
144
+          message.info('操作成功!')
145
+          getList({ pageNum: 1, pageSize: 10 })
146
+      }).catch((err) => {
147
+          console.log(err)
148
+          message.info(err.msg || err.message)
149
+      })
150
+  }
151
+  
152
+  const sendOrPublicDynamic = (row) => {
153
+      if (row.status === 1) {
154
+          cancelDynamic(row)
155
+      } else {
156
+          sendDynamic(row)
157
+      }
158
+  }
159
+  
160
+  // 取消活动
161
+  const cancelDynamic = (row) => {
162
+      request({ ...apis.activity.cancel, urlData: {id: row.dynamicId}}).then((data) => {
163
+          message.info('操作成功!')
164
+          getList({ pageNum: 1, pageSize: 10 })
165
+      }).catch((err) => {
166
+          console.log(err)
167
+          message.info(err.msg || err.message)
168
+      })
169
+  }
170
+  
171
+  //发布活动
172
+  const sendDynamic = (row) => {
173
+      request({ ...apis.activity.send, urlData: {id: row.dynamicId}}).then((data) => {
174
+          message.info('操作成功!')
175
+          getList({ pageNum: 1, pageSize: 10 });
176
+      }).catch(err => {
177
+          console.log(err)
178
+          message.info(err.msg || err.message)
179
+      })
180
+  }
181
+  
182
+  const changePageNum = pageNumber => {
183
+      getList({ pageNum: pageNumber, pageSize: 10 })
184
+  }
185
+
186
+  // 提交事件
187
+const handleSubmit = (e, props) => {
188
+    e.preventDefault();
189
+    props.form.validateFields((err, values) => {
190
+      if (!err) {
191
+        console.log('提交数据: ', values)
192
+        getList({ pageNum: 1, pageSize: 10, ...values })
193
+      }
194
+    });
195
+  }
196
+
197
+   //重置搜索
198
+   function handleReset() {
199
+    props.form.resetFields();
200
+  }
201
+
202
+
203
+  const { getFieldDecorator } = props.form
204
+  return (
205
+
206
+    <>
207
+      <Form layout="inline" onSubmit={e => handleSubmit(e, props)}>
208
+        <Form.Item>
209
+          {getFieldDecorator('cityId')(
210
+            <SelectCity />,
211
+          )}
212
+        </Form.Item>
213
+        <Form.Item>
214
+          {getFieldDecorator('buildingId')(
215
+            <BuildSelect />,
216
+          )}
217
+        </Form.Item>
218
+        <Form.Item>
219
+          {getFieldDecorator('title')(
220
+            <Input
221
+              prefix={<Icon type="text" style={{ color: 'rgba(0,0,0,.25)' }} />}
222
+              placeholder="请输入标题"
223
+            />,
224
+          )}
225
+        </Form.Item>
226
+        {/* <Form.Item>
227
+          {getFieldDecorator('time')(
228
+            <DatePicker />
229
+          )}
230
+        </Form.Item> */}
231
+        <Form.Item>
232
+          {getFieldDecorator('isEnlist')(
233
+            <Select style={{ width: '180px' }} placeholder="活动状态">
234
+              <Option value="1">进行中</Option>
235
+              <Option value="2">未开始</Option>
236
+              <Option value="3">已结束</Option>
237
+            </Select>,
238
+          )}
239
+        </Form.Item>
240
+        <Form.Item>
241
+          <Button type="primary" htmlType="submit" className={styles.searchBtn}>
242
+            搜索
243
+          </Button>
244
+          <Button style={{ marginLeft: 8 }} onClick={handleReset}>
245
+              重置
246
+            </Button>
247
+        </Form.Item>
248
+      </Form>
249
+      <AuthButton name="admin.buildingDynamic.add.post" noRight={null}>
250
+        <Button type="danger" className={styles.addBtn} onClick={toEditGoods()}>新增</Button>
251
+      </AuthButton>
252
+      <Table dataSource={data.records} columns={columns} pagination={false} rowKey="activityList"/>
253
+      <div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
254
+        <Pagination showQuickJumper defaultCurrent={1} total={data.total} onChange={changePageNum} />
255
+      </div>
256
+    </>
257
+  )
258
+}
259
+const WrappedHeader = Form.create({ name: 'header' })(header);
260
+
261
+export default WrappedHeader

+ 1
- 1
src/pages/building/list/add/components/base.jsx Dosyayı Görüntüle

@@ -90,7 +90,7 @@ function AddBuilding(props) {
90 90
     const api = data.buildingId === undefined ? apis.building.addBuilding : apis.building.updateBuilding
91 91
     request({ ...api, data: { ...data } }).then(() => {
92 92
       openNotificationWithIcon('success', '操作成功')
93
-      router.go(-1)
93
+      // router.go(-1)
94 94
     }).catch(err => {
95 95
       openNotificationWithIcon('error', err.message)
96 96
     })

+ 14
- 5
src/pages/building/list/add/components/buildingProjectType.jsx Dosyayı Görüntüle

@@ -1,5 +1,5 @@
1 1
 import React, { useEffect, useState } from 'react'
2
-import { Button, Radio, Icon, Form, Input, Row, Col, Modal, notification, Checkbox } from 'antd';
2
+import { Button, Radio, Icon, Form, Input, Row, Col, Modal, notification, Checkbox, InputNumber } from 'antd';
3 3
 import { render } from 'react-dom';
4 4
 import request from '../../../../../utils/request';
5 5
 import apis from '../../../../../services/apis';
@@ -32,7 +32,13 @@ class TypeForm extends React.Component {
32 32
     this.props.form.validateFieldsAndScroll((err, values) => {
33 33
       if (!err) {
34 34
         // console.log('Received values of form: ', values);
35
-        values[name] = e.target.value
35
+        const currentValue = e.target.value
36
+        if (currentValue === '') {
37
+          values[name] = null
38
+        } else {
39
+          values[name] = currentValue
40
+        }
41
+        
36 42
         values.buildingTypeName = this.props.type.buildingTypeName
37 43
         console.log('values: ', values)
38 44
         this.props.onSuccess(values)
@@ -48,7 +54,7 @@ class TypeForm extends React.Component {
48 54
     const { getFieldDecorator } = this.props.form;
49 55
 
50 56
     // this.props.form.setFieldsValue(this.props.type)
51
-
57
+    console.log(this.props.type)
52 58
     return (
53 59
       <>
54 60
         <Col span={11} style={{
@@ -130,7 +136,7 @@ class ProjectTypeBody extends React.Component {
130 136
     const { projectType } = this.state
131 137
     const buildingType = projectType.filter(item => checked.includes(`${item.buildingTypeId}`))
132 138
 
133
-    const tempDate = buildingType.map(item => ({ buildingTypeId: item.buildingTypeId, buildingTypeName: item.buildingTypeName, price: '', decoration: '', rightsYear: '', status: '1' }))
139
+    const tempDate = buildingType.map(item => ({ buildingTypeId: item.buildingTypeId, buildingTypeName: item.buildingTypeName, price: null, decoration: null, rightsYear: null, status: '1' }))
134 140
     const updateProjectDate = this.updateProjectType(tempDate)
135 141
     console.log('updateProjectDate: ', updateProjectDate)
136 142
     this.setState({ data: updateProjectDate })
@@ -138,7 +144,10 @@ class ProjectTypeBody extends React.Component {
138 144
 
139 145
   onClose = e => {
140 146
     const { data } = this.state
147
+    console.log('onClose——data: ', data)
148
+    console.log('onClose: ', e.buildingTypeId)
141 149
     const buildingType = data.filter(item => e.buildingTypeId !== item.buildingTypeId)
150
+    console.log('onClose——data: ', buildingType)
142 151
     this.setState({ data: buildingType })
143 152
     this.setState({ defaultCheckboxValue: buildingType.map(item => item.buildingTypeId) })
144 153
   }
@@ -234,7 +243,7 @@ class ProjectTypeBody extends React.Component {
234 243
         </Modal>
235 244
         <Row type="flex" justify="space-between">
236 245
           {
237
-            this.state.data.map(item => <WrappedTypeForm type={item} key={item.id} onSuccess={(e) => this.onSuccess(e, item)} onClose={(e) => this.onClose(e)} />)
246
+            this.state.data.map(item => <WrappedTypeForm type={item} key={item.buildingTypeId} onSuccess={(e) => this.onSuccess(e, item)} onClose={(e) => this.onClose(e)} />)
238 247
           }
239 248
         </Row>
240 249
       </>

+ 109
- 0
src/pages/third/editThirdParty.jsx Dosyayı Görüntüle

@@ -0,0 +1,109 @@
1
+import React, { useState, useEffect } from 'react';
2
+import { Form, Input, Button, Icon, Select, Tabs, Radio, DatePicker, message, Upload } from 'antd';
3
+import { FormattedMessage } from 'umi-plugin-react/locale';
4
+import styles from '../style/GoodsList.less';
5
+import apis from '../../services/apis';
6
+import moment from 'moment';
7
+import router from 'umi/router';
8
+import BuildSelect from '../../components/SelectButton/BuildSelect'
9
+import XForm, { FieldTypes } from '../../components/XForm';
10
+import Wangedit from '../../components/Wangedit/Wangedit'
11
+import request from '../../utils/request'
12
+import yinhao from '../../assets/yinhao.png'
13
+import ImageUploader from '../../components/XForm/ImageUpload';
14
+import logo from '../../assets/logo.png';
15
+import touxiang from '../../assets/touxiang.jpg';
16
+import poster1 from '../../assets/poster1.png';
17
+import poster2 from '../../assets/poster2.png';
18
+import xiaochengxu from '../../assets/xiaochengxu.png'
19
+
20
+const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
21
+const { TextArea } = Input;
22
+
23
+/**
24
+ *
25
+ *
26
+ * @param {*} props
27
+ * @returns
28
+ */
29
+const third = (props) => {
30
+  const configId = props.location.query.configId
31
+  const [thirdData, setThirdData] = useState({})
32
+  if (configId) {
33
+    useEffect(() => {
34
+      getThirdData(configId);
35
+    }, [])
36
+
37
+    // 查询列表
38
+    const getThirdData = (configId) => {
39
+      request({ ...apis.third.details, urlData: { id: configId } }).then((data) => {
40
+        console.log(data)
41
+        setThirdData(data)
42
+      })
43
+    }
44
+  }
45
+
46
+  const cancelPage = () => {
47
+    router.push({
48
+      pathname: '/third/thirdList',
49
+    });
50
+  }
51
+ 
52
+  const fields = [
53
+    {
54
+      label: 'appid',
55
+      name: 'appid',
56
+      type: FieldTypes.Text,
57
+      value: thirdData.appid,
58
+      rules: [
59
+        { required: true, message: '请输入appid' },
60
+      ]
61
+    },
62
+    {
63
+      label: 'appSecret',
64
+      name: 'appSecret',
65
+      type: FieldTypes.Text,
66
+      value: thirdData.appSecret,
67
+      rules: [
68
+        { required: true, message: '请输入appSecret' },
69
+      ]
70
+    },
71
+    {
72
+      label: '过期时间',
73
+      name: 'expirationDate',
74
+      type: FieldTypes.DatePicker,
75
+      value: thirdData.expirationDate != null ? moment(thirdData.expirationDate, 'YYYY-MM-DD HH:mm') : null,
76
+      rules: [
77
+        { required: true, message: '请选择时间' },
78
+      ]
79
+    },
80
+  ]
81
+
82
+  const handleSubmit = val => {
83
+    console.log('submit data --->', val)
84
+    if (configId) {
85
+      val.configId = configId
86
+      request({ ...apis.third.update, data: val }).then((data) => {
87
+        message.info("保存成功")
88
+        cancelPage()
89
+      }).catch((err) => {
90
+        message.info(err.msg || err.message)
91
+      })
92
+    } else {
93
+      request({ ...apis.third.add, data: val }).then((data) => {
94
+        message.info("保存成功")
95
+        cancelPage()
96
+      }).catch((err) => {
97
+        message.info(err.msg || err.message)
98
+      })
99
+    }
100
+  }
101
+
102
+  return (
103
+    <XForm onSubmit={handleSubmit} onCancel={cancelPage} fields={fields}></XForm>
104
+  );
105
+}
106
+
107
+
108
+
109
+export default third

+ 103
- 0
src/pages/third/thirdList.jsx Dosyayı Görüntüle

@@ -0,0 +1,103 @@
1
+import React, { useState, useEffect } from 'react';
2
+import { Form, Input, Button, Icon, Select, message, Table, Divider, Tag, Pagination, Modal, DatePicker } from 'antd';
3
+import { FormattedMessage } from 'umi-plugin-react/locale';
4
+import styles from '../style/GoodsList.less';
5
+import router from 'umi/router';
6
+import moment from 'moment';
7
+import SelectCity from '../../components/SelectButton/CitySelect'
8
+import BuildSelect from '../../components/SelectButton/BuildSelect'
9
+import apis from '../../services/apis';
10
+import request from '../../utils/request';
11
+import AuthButton from '@/components/AuthButton';
12
+
13
+const { Option } = Select;
14
+const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
15
+
16
+const header = (props) => {
17
+  const [ data, setData ] = useState({})
18
+//   const [page, changePage] = useState({})
19
+
20
+  useEffect(() => {
21
+    getList({ pageNum: 1, pageSize: 10 });
22
+  },[])
23
+
24
+  // 查询列表
25
+  const getList = (params) => {
26
+    request({ ...apis.third.thirdPartyMiniapp, params: { ...params },}).then((data) => {
27
+        console.log(data)
28
+        setData(data)
29
+    })
30
+  }
31
+
32
+  //重置搜索
33
+  const handleReset = () => {
34
+    props.form.resetFields();
35
+  }
36
+
37
+  const toEditThirdParty =  (configId) => () => {
38
+    router.push({
39
+      pathname: '/third/editThirdParty',
40
+      query: {
41
+        configId
42
+      },
43
+    });
44
+  }
45
+
46
+  const columns = [
47
+    {
48
+      title: 'appid',
49
+      dataIndex: 'appid',
50
+      key: 'appid',
51
+      align: 'center',
52
+    },
53
+    {
54
+      title: 'appSecret',
55
+      dataIndex: 'appSecret',
56
+      key: 'appSecret',
57
+      align: 'center',
58
+    },
59
+    {
60
+      title: '过期时间',
61
+      dataIndex: 'expirationDate',
62
+      key: 'expirationDate',
63
+      align: 'center',
64
+      render: (x, row) => <><span>{moment(row.expirationDate).format('YYYY-MM-DD')}</span></>
65
+    },
66
+    {
67
+      title: '操作',
68
+      dataIndex: 'handle',
69
+      key: 'handle',
70
+      align: 'center',
71
+      render: (x,row) => (
72
+        <>
73
+          <AuthButton name="admin.buildingDynamic.update.put" noRight={null}>
74
+            <span style={{ color: '#FF925C', cursor: 'pointer' }} onClick={toEditThirdParty(row.configId)}>编辑<Icon type="form" className={styles.edit} /></span>
75
+          </AuthButton>
76
+        </>
77
+      )
78
+    },
79
+  ];
80
+   
81
+  
82
+  const changePageNum = (pageNumber) => {
83
+      getList({ pageNum: pageNumber, pageSize: 10 })
84
+  }
85
+ 
86
+
87
+  const { getFieldDecorator } = props.form
88
+  return (
89
+
90
+    <>
91
+      <AuthButton name="admin.buildingDynamic.add.post" noRight={null}>
92
+        <Button type="danger" className={styles.addBtn} onClick={toEditThirdParty()}>新增</Button>
93
+      </AuthButton>
94
+      <Table rowKey="messageList" dataSource={data.records} columns={columns} pagination={false}/>
95
+      <div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
96
+        <Pagination showQuickJumper defaultCurrent={1} total={data.total} onChange={changePageNum} />
97
+      </div>
98
+    </>
99
+  )
100
+}
101
+const WrappedHeader = Form.create({ name: 'header' })(header);
102
+
103
+export default WrappedHeader

+ 29
- 0
src/services/apis.js Dosyayı Görüntüle

@@ -678,4 +678,33 @@ export default {
678 678
     action: 'admin.updateAuthMenu.post',
679 679
   },
680 680
  },
681
+ helpActivity: {
682
+  list: {
683
+    url: `${prefix}/helpActivity/list`,
684
+    method: 'GET',
685
+    action: 'admin.taRole.get',
686
+  },
687
+ },
688
+ third: {
689
+  thirdPartyMiniapp: {
690
+    url: `${prefix}/thirdPartyMiniapp`,
691
+    method: 'GET',
692
+    action: 'admin.thirdPartyMiniapp.get',
693
+  },
694
+  update: {
695
+    url: `${prefix}/thirdPartyMiniapp/update`,
696
+    method: 'PUT',
697
+    action: 'admin.thirdPartyMiniapp.update.put',
698
+  },
699
+  add: {
700
+    url: `${prefix}/thirdPartyMiniapp/add`,
701
+    method: 'POST',
702
+    action: 'admin.thirdPartyMiniapp.add.post',
703
+  },
704
+  details: {
705
+    url: `${prefix}/thirdPartyMiniapp/:id`,
706
+    method: 'GET',
707
+    action: 'admin.thirdPartyMiniapp.id.get',
708
+  },
709
+ },
681 710
 }