|
@@ -9,13 +9,13 @@ import BuildSelect from '../../components/SelectButton/BuildSelect'
|
9
|
9
|
import XForm, { FieldTypes } from '../../components/XForm';
|
10
|
10
|
import Wangedit from '../../components/Wangedit/Wangedit'
|
11
|
11
|
import request from '../../utils/request'
|
12
|
|
-import PosterBottom from '../../assets/bottom.png'
|
13
|
12
|
import yinhao from '../../assets/yinhao.png'
|
14
|
13
|
import ImageUploader from '../../components/XForm/ImageUpload';
|
15
|
14
|
import logo from '../../assets/logo.png';
|
16
|
15
|
import touxiang from '../../assets/touxiang.jpg';
|
17
|
16
|
import poster1 from '../../assets/poster1.png';
|
18
|
17
|
import poster2 from '../../assets/poster2.png';
|
|
18
|
+import xiaochengxu from '../../assets/xiaochengxu.png'
|
19
|
19
|
|
20
|
20
|
const { MonthPicker, RangePicker, WeekPicker } = DatePicker;
|
21
|
21
|
const { TextArea } = Input;
|
|
@@ -174,11 +174,12 @@ const Edit = (props) => {
|
174
|
174
|
const [imgValue, changeImg] = useState('')
|
175
|
175
|
const [posterId, setPosterId] = useState('')
|
176
|
176
|
|
177
|
|
- if(dynamicId){
|
|
177
|
+ if (dynamicId) {
|
|
178
|
+ console.log(dynamicId, 'dynamicId')
|
178
|
179
|
useEffect(() => {
|
179
|
|
- request({ ...apis.activity.poster, params: {targetId: dynamicId,targetType: 'activity'} }).then((data) => {
|
180
|
|
- console.log(data,"2222")
|
181
|
|
- if(data.length > 0){
|
|
180
|
+ request({ ...apis.activity.poster, params: { targetId: dynamicId, targetType: 'activity' } }).then((data) => {
|
|
181
|
+ console.log(data, "2222")
|
|
182
|
+ if (data.length > 0) {
|
182
|
183
|
setPosterId(data[0].posterId)
|
183
|
184
|
changeImg(data[0].posterImg)
|
184
|
185
|
changeTextArea(data[0].posterDescription)
|
|
@@ -187,34 +188,45 @@ const Edit = (props) => {
|
187
|
188
|
}).catch((err) => {
|
188
|
189
|
message.info(err.msg || err.message)
|
189
|
190
|
})
|
|
191
|
+ getMiniappName()
|
190
|
192
|
}, [])
|
|
193
|
+ }else{
|
|
194
|
+ getMiniappName()
|
|
195
|
+ }
|
|
196
|
+ // 获取小程序名称
|
|
197
|
+ const [miniappName, setMiniappName] = useState('')
|
|
198
|
+ function getMiniappName() {
|
|
199
|
+ request({ ...apis.building.getMiniappName }).then(res => {
|
|
200
|
+ console.log(res, "0000000000000")
|
|
201
|
+ setMiniappName(res)
|
|
202
|
+ })
|
191
|
203
|
}
|
192
|
204
|
|
193
|
|
- const submitPoster = () => {
|
194
|
|
- if(dynamicId){
|
195
|
|
- if(posterId){
|
196
|
|
- request({ ...apis.activity.updatePoster, urlData: {id: posterId}, data: {targetId: dynamicId,targetType: 'activity',posterImg: imgValue,posterTitle: inputValue,posterDescription: textAreaValue},}).then((data) => {
|
|
205
|
+ const submitPoster = () => {
|
|
206
|
+ if (dynamicId) {
|
|
207
|
+ if (posterId) {
|
|
208
|
+ request({ ...apis.activity.updatePoster, urlData: { id: posterId }, data: { targetId: dynamicId, targetType: 'activity', posterImg: imgValue, posterTitle: inputValue, posterDescription: textAreaValue }, }).then((data) => {
|
197
|
209
|
message.info("保存成功")
|
198
|
210
|
}).catch((err) => {
|
199
|
211
|
message.info(err.msg || err.message)
|
200
|
212
|
})
|
201
|
|
- }else{
|
202
|
|
- request({ ...apis.activity.addPoster, data: {targetId: dynamicId,targetType: 'activity',posterImg: imgValue,posterTitle: inputValue,posterDescription: textAreaValue},}).then((data) => {
|
|
213
|
+ } else {
|
|
214
|
+ request({ ...apis.activity.addPoster, data: { targetId: dynamicId, targetType: 'activity', posterImg: imgValue, posterTitle: inputValue, posterDescription: textAreaValue }, }).then((data) => {
|
203
|
215
|
setPosterId(data.posterId)
|
204
|
216
|
message.info("保存成功")
|
205
|
217
|
}).catch((err) => {
|
206
|
218
|
message.info(err.msg || err.message)
|
207
|
219
|
})
|
208
|
|
- }
|
209
|
|
- }else{
|
|
220
|
+ }
|
|
221
|
+ } else {
|
210
|
222
|
message.warn("请先保存基本信息数据")
|
211
|
|
- }
|
|
223
|
+ }
|
212
|
224
|
}
|
213
|
225
|
|
214
|
226
|
return <div>
|
215
|
227
|
<div style={{ display: 'flex' }}>
|
216
|
228
|
<div style={{ width: '420px', height: '900px', display: 'inline-block', marginTop: '30px' }}>
|
217
|
|
- <div style={{ width: '375px', height: '785px', backgroundColor: '#fff', boxShadow: '0px 0px 16px 6px rgba(0,0,0,0.15)', position: 'relative', margin: '0 auto' }}>
|
|
229
|
+ <div style={{ width: '375px', height: '700px', backgroundColor: '#fff', boxShadow: '0px 0px 16px 6px rgba(0,0,0,0.15)', position: 'relative', margin: '0 auto' }}>
|
218
|
230
|
<img style={{ width: '100%', height: '300px' }} src={imgValue ? imgValue : poster1} alt="" />
|
219
|
231
|
<div style={{ display: 'flex', alignItems: 'center', marginTop: '-24px' }}>
|
220
|
232
|
<img style={{ width: '70px', height: '70px', border: '4px solid #fff', borderRadius: '35px', marginLeft: '16px' }} src={touxiang} alt="" />
|
|
@@ -234,13 +246,17 @@ const Edit = (props) => {
|
234
|
246
|
<img src={yinhao} style={{ width: '30px', marginLeft: '20px' }} alt="" />
|
235
|
247
|
<p style={{
|
236
|
248
|
margin: '16px 20px 28px 20px', fontSize: '17px', color: '#999',
|
237
|
|
- display: '-webkit-box', lineClamp: '3', height: '76px',
|
|
249
|
+ display: '-webkit-box', lineClamp: '3', height: '72px',
|
238
|
250
|
WebkitLineClamp: '3',
|
239
|
251
|
WebkitBoxOrient: 'vertical',
|
240
|
252
|
overflow: 'hidden',
|
241
|
253
|
textOverflow: 'ellipsis'
|
242
|
254
|
}}>{textAreaValue ? textAreaValue : '海报描述'}</p>
|
243
|
|
- <img src={PosterBottom} style={{ width: '100%' }} alt="" />
|
|
255
|
+ <div style={{ backgroundColor: '#f1f1f1', padding: '22px 30px', boxShadow: '0px 6px 12px -4px #dcdcdc', position: 'relative' }}>
|
|
256
|
+ <p style={{ margin: '0', fontSize: '18px', color: '#888' }}>长按识别小程序码</p>
|
|
257
|
+ <p style={{ margin: '0', fontSize: '18px', color: '#888' }}>进入<span style={{ margin: '0 5px', fontSize: '18px', color: '#333', fontWeight: '600' }}>{miniappName || '置业V顾问'}</span>报名活动</p>
|
|
258
|
+ <img style={{ width: '80px', position: 'absolute', right: '30px', top: '10px' }} src={xiaochengxu} alt="" />
|
|
259
|
+ </div>
|
244
|
260
|
</div>
|
245
|
261
|
<p style={{ textAlign: 'center', fontSize: '19px', color: '#666', marginTop: '30px' }}>海报模板</p>
|
246
|
262
|
</div>
|
|
@@ -273,12 +289,12 @@ const Edit = (props) => {
|
273
|
289
|
const [inputValue, changeInput] = useState('')
|
274
|
290
|
const [imgValue, changeImg] = useState('')
|
275
|
291
|
const [shareContentId, setShareContentId] = useState('')
|
276
|
|
-
|
277
|
|
- if(dynamicId){
|
|
292
|
+
|
|
293
|
+ if (dynamicId) {
|
278
|
294
|
useEffect(() => {
|
279
|
|
- request({ ...apis.activity.shareContent, params: {targetId: dynamicId,targetType: 'activity'},}).then((data) => {
|
280
|
|
- console.log(data,"2222")
|
281
|
|
- if(data.length > 0){
|
|
295
|
+ request({ ...apis.activity.shareContent, params: { targetId: dynamicId, targetType: 'activity' }, }).then((data) => {
|
|
296
|
+ console.log(data, "2222")
|
|
297
|
+ if (data.length > 0) {
|
282
|
298
|
setShareContentId(data[0].shareContentId)
|
283
|
299
|
changeImg(data[0].shareContentImg)
|
284
|
300
|
changeInput(data[0].shareContentTitle)
|
|
@@ -290,24 +306,24 @@ const Edit = (props) => {
|
290
|
306
|
}
|
291
|
307
|
|
292
|
308
|
const submitShare = () => {
|
293
|
|
- if(dynamicId){
|
294
|
|
- if(shareContentId){
|
295
|
|
- request({ ...apis.activity.updateShareContent, urlData: {id: shareContentId},data: {targetId: dynamicId,shareContentType: 'activity',shareContentImg: imgValue,shareContentTitle: inputValue},}).then((data) => {
|
|
309
|
+ if (dynamicId) {
|
|
310
|
+ if (shareContentId) {
|
|
311
|
+ request({ ...apis.activity.updateShareContent, urlData: { id: shareContentId }, data: { targetId: dynamicId, shareContentType: 'activity', shareContentImg: imgValue, shareContentTitle: inputValue }, }).then((data) => {
|
296
|
312
|
message.info("保存成功")
|
297
|
313
|
}).catch((err) => {
|
298
|
314
|
message.info(err.msg || err.message)
|
299
|
315
|
})
|
300
|
|
- }else{
|
301
|
|
- request({ ...apis.activity.addShareContent, data: {targetId: dynamicId,shareContentType: 'activity',shareContentImg: imgValue,shareContentTitle: inputValue},}).then((data) => {
|
|
316
|
+ } else {
|
|
317
|
+ request({ ...apis.activity.addShareContent, data: { targetId: dynamicId, shareContentType: 'activity', shareContentImg: imgValue, shareContentTitle: inputValue }, }).then((data) => {
|
302
|
318
|
setShareContentId(data.shareContentId)
|
303
|
319
|
message.info("保存成功")
|
304
|
320
|
}).catch((err) => {
|
305
|
321
|
message.info(err.msg || err.message)
|
306
|
322
|
})
|
307
|
|
- }
|
308
|
|
- }else{
|
|
323
|
+ }
|
|
324
|
+ } else {
|
309
|
325
|
message.warn("请先保存基本信息数据")
|
310
|
|
- }
|
|
326
|
+ }
|
311
|
327
|
}
|
312
|
328
|
|
313
|
329
|
return <div style={{ padding: '20px' }}>
|