|
@@ -7,7 +7,8 @@ import Blank from '../../components/Blank'
|
7
|
7
|
import ActSheet from '../../components/ActSheet'
|
8
|
8
|
import ShareButtons from '../../components/ShareButtons'
|
9
|
9
|
import GrantProfile from '../../components/GrantProfile'
|
10
|
|
-import Poster from './poster'
|
|
10
|
+// import Poster from './poster'
|
|
11
|
+import Poster from '@/components/Poster'
|
11
|
12
|
import { connect } from '@tarojs/redux'
|
12
|
13
|
import ready from '@/utils/ready'
|
13
|
14
|
import { queryHouseList, queryNoticeInfo, queryApartmentType, querySalesInfo } from '@/services/project'
|
|
@@ -17,12 +18,12 @@ import { share as shareSavePoint } from '@/utils/shareSavePoint'
|
17
|
18
|
import { ROLE_CODE } from '@/constants/user'
|
18
|
19
|
import { report as reportCustomer } from '@/utils/customer'
|
19
|
20
|
import { getMiniQrcode, savePoint, updatePoint } from '@/services/common'
|
|
21
|
+import { getCanvasConfig } from '@/utils/tools'
|
20
|
22
|
// import Consultant from '@/components/consultant'
|
21
|
23
|
|
22
|
24
|
import './index.scss'
|
23
|
25
|
|
24
|
26
|
@connect(s => s.user)
|
25
|
|
-@withDetail()
|
26
|
27
|
export default class HouseList extends Component {
|
27
|
28
|
config = {
|
28
|
29
|
navigationBarTitleText: '房源',
|
|
@@ -45,8 +46,8 @@ export default class HouseList extends Component {
|
45
|
46
|
posterShow: false,
|
46
|
47
|
posterData: {},
|
47
|
48
|
shareContents: [],
|
48
|
|
- buildingId: null
|
49
|
|
-
|
|
49
|
+ buildingId: null,
|
|
50
|
+ posterConfig: [],
|
50
|
51
|
}
|
51
|
52
|
|
52
|
53
|
componentWillMount() {
|
|
@@ -59,6 +60,13 @@ export default class HouseList extends Component {
|
59
|
60
|
componentWillReceiveProps() {
|
60
|
61
|
this.reportClientFn()
|
61
|
62
|
}
|
|
63
|
+
|
|
64
|
+ transTPLs2Configs(tpls, params) {
|
|
65
|
+ return tpls.map((tpl) => {
|
|
66
|
+ const conf = getCanvasConfig(tpl.configs, params)
|
|
67
|
+ return { ...conf }
|
|
68
|
+ })
|
|
69
|
+ }
|
62
|
70
|
|
63
|
71
|
// 报备客户
|
64
|
72
|
reportClientFn() {
|
|
@@ -115,17 +123,18 @@ export default class HouseList extends Component {
|
115
|
123
|
})
|
116
|
124
|
})
|
117
|
125
|
querySalesInfo(id).then(res => {
|
|
126
|
+ const { templates = [], posterImg = '' } = (res.posters || [])[0]
|
|
127
|
+
|
118
|
128
|
this.setState({
|
119
|
129
|
buildingId: res.buildingId,
|
120
|
|
- posterData: res.posters || [],
|
|
130
|
+ posterData: { poster: posterImg },
|
121
|
131
|
shareContents: res.shareContents || [],
|
122
|
132
|
}, () => {
|
123
|
|
- const { posterData } = this.state
|
124
|
|
- if (posterData && posterData.length && posterData[0].posterImg) {
|
125
|
|
- this.setState({
|
126
|
|
- posterShow: true
|
127
|
|
- })
|
128
|
|
- }
|
|
133
|
+ debugger
|
|
134
|
+ this.getPosterData().then(posterData => {
|
|
135
|
+ const posterConfig = this.transTPLs2Configs(templates, posterData)
|
|
136
|
+ this.setState({ posterConfig, posterData })
|
|
137
|
+ })
|
129
|
138
|
})
|
130
|
139
|
})
|
131
|
140
|
queryApartmentType({ salesBatchId: id }).then(res => {
|
|
@@ -183,7 +192,6 @@ export default class HouseList extends Component {
|
183
|
192
|
if (!found) {
|
184
|
193
|
list.push({ ...unit, unitList: [unit] })
|
185
|
194
|
}
|
186
|
|
- console.log(list, "listlistlistlistlistlistlistlistlistlistlistlistlist")
|
187
|
195
|
|
188
|
196
|
return list
|
189
|
197
|
}, [])
|
|
@@ -302,10 +310,10 @@ export default class HouseList extends Component {
|
302
|
310
|
const payload = { page, scene }
|
303
|
311
|
|
304
|
312
|
getMiniQrcode(payload).then(qrcode => {
|
305
|
|
- const { posterData } = this.state
|
|
313
|
+ const { posterData = {} } = this.state
|
306
|
314
|
let data = {
|
307
|
315
|
qrcode,//小程序二维码
|
308
|
|
- poster:posterData[0].posterImg
|
|
316
|
+ ...posterData,
|
309
|
317
|
}
|
310
|
318
|
resolve(data)
|
311
|
319
|
})
|
|
@@ -520,9 +528,11 @@ export default class HouseList extends Component {
|
520
|
528
|
}
|
521
|
529
|
|
522
|
530
|
render() {
|
523
|
|
- const { showShareMenu, showPoster, showGrantProfile, houseList, conditionVisible, posterData, posterShow } = this.state
|
|
531
|
+ const { showShareMenu, showPoster, houseList, conditionVisible, posterData, posterShow, posterConfig } = this.state
|
524
|
532
|
const { userInfo: { person } } = this.props
|
525
|
533
|
|
|
534
|
+ const showCircleBtn = posterData && posterData.qrcode
|
|
535
|
+console.log('==============>', posterData, showPoster, posterConfig)
|
526
|
536
|
return (
|
527
|
537
|
<Block>
|
528
|
538
|
{conditionVisible && this.renderCondition()}
|
|
@@ -530,7 +540,7 @@ export default class HouseList extends Component {
|
530
|
540
|
<GrantProfile both person={person} />
|
531
|
541
|
|
532
|
542
|
{/* 生成海报 */}
|
533
|
|
- {showPoster && <Poster data={posterData} toggle={this.togglePosterStatus}></Poster>}
|
|
543
|
+ {showPoster && <Poster data={posterData} configs={posterConfig} onCancel={this.togglePosterStatus} onFinish={this.togglePosterStatus} ></Poster>}
|
534
|
544
|
{!conditionVisible && <Block>
|
535
|
545
|
<View className="houselist">
|
536
|
546
|
{this.renderBar()}
|
|
@@ -540,7 +550,7 @@ export default class HouseList extends Component {
|
540
|
550
|
{/* 分享按钮 */}
|
541
|
551
|
<ActSheet show={showShareMenu}>
|
542
|
552
|
<ShareButtons
|
543
|
|
- circleBtn={posterShow}
|
|
553
|
+ circleBtn={showCircleBtn}
|
544
|
554
|
onShareFrineds={this.handleShareFrineds}
|
545
|
555
|
onSharingCircleOfFriends={() => this.togglePosterStatus(true)}
|
546
|
556
|
// onSharingCircleOfFriends={this.handleSharingCircleOfFriends}
|