|
@@ -25,16 +25,14 @@ const Poster = props => {
|
25
|
25
|
const [posterId, setPosterId] = useState('')
|
26
|
26
|
|
27
|
27
|
const [building, setBuilding] = useState({ buildingImg: [{ url: '' }] })
|
28
|
|
- const { buildingId } = props.building
|
29
|
|
- // ============这边改造下就可以饿============================
|
30
|
|
- if (buildingId) {
|
|
28
|
+ const { salesBatchId } = props.salesBatchId
|
|
29
|
+ if (salesBatchId) {
|
31
|
30
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
32
|
31
|
useEffect(() => {
|
33
|
32
|
request({
|
34
|
33
|
...apis.activity.poster,
|
35
|
|
- params: { targetId: buildingId, targetType: 'building' },
|
|
34
|
+ params: { targetId: salesBatchId, targetType: 'house' },
|
36
|
35
|
}).then(data => {
|
37
|
|
- console.log(data, '2222')
|
38
|
36
|
if (data.length > 0) {
|
39
|
37
|
setPosterId(data[0].posterId)
|
40
|
38
|
changeImg(data[0].posterImg)
|
|
@@ -45,7 +43,7 @@ const Poster = props => {
|
45
|
43
|
message.info(err.msg || err.message)
|
46
|
44
|
})
|
47
|
45
|
|
48
|
|
- getById(buildingId)
|
|
46
|
+ // getById(salesBatchId)
|
49
|
47
|
getMiniappName()
|
50
|
48
|
}, [])
|
51
|
49
|
}
|
|
@@ -70,7 +68,7 @@ const Poster = props => {
|
70
|
68
|
}
|
71
|
69
|
|
72
|
70
|
const submitPoster = () => {
|
73
|
|
- if (buildingId) {
|
|
71
|
+ if (salesBatchId) {
|
74
|
72
|
if (!imgValue) {
|
75
|
73
|
message.error('请选择海报图片')
|
76
|
74
|
return
|
|
@@ -80,7 +78,7 @@ const Poster = props => {
|
80
|
78
|
request({
|
81
|
79
|
...apis.activity.updatePoster,
|
82
|
80
|
urlData: { id: posterId },
|
83
|
|
- data: { targetId: buildingId, targetType: 'building', posterImg: imgValue, posterTitle: inputValue, posterDescription: textAreaValue },
|
|
81
|
+ data: { targetId: salesBatchId, targetType: 'house', posterImg: imgValue, posterTitle: inputValue, posterDescription: textAreaValue },
|
84
|
82
|
}).then(() => {
|
85
|
83
|
message.info('保存成功')
|
86
|
84
|
}).catch(err => {
|
|
@@ -89,7 +87,7 @@ const Poster = props => {
|
89
|
87
|
} else {
|
90
|
88
|
request({
|
91
|
89
|
...apis.activity.addPoster,
|
92
|
|
- data: { targetId: buildingId, targetType: 'building', posterImg: imgValue, posterTitle: inputValue, posterDescription: textAreaValue },
|
|
90
|
+ data: { targetId: salesBatchId, targetType: 'house', posterImg: imgValue, posterTitle: inputValue, posterDescription: textAreaValue },
|
93
|
91
|
}).then(data => {
|
94
|
92
|
setPosterId(data.posterId)
|
95
|
93
|
message.info('保存成功')
|