张延森 5 년 전
부모
커밋
9661d132ca
5개의 변경된 파일51개의 추가작업 그리고 21개의 파일을 삭제
  1. 3
    3
      project.config.json
  2. 1
    0
      src/components/Poster/index.js
  3. 3
    1
      src/onlineSelling/components/HouseGrid/Room.js
  4. 27
    17
      src/onlineSelling/pages/houseList/index.js
  5. 17
    0
      src/pages/temp/index.js

+ 3
- 3
project.config.json 파일 보기

@@ -48,9 +48,9 @@
48 48
 			"list": [
49 49
 				{
50 50
 					"id": -1,
51
-					"name": "pages/help/index",
52
-					"pathName": "onlineSelling/pages/help/index",
53
-					"query": "",
51
+					"name": "pages/houseList/index",
52
+					"pathName": "onlineSelling/pages/houseList/index",
53
+					"query": "id=6&buildingId=7a46e04f15c324fa9cf44ce27f9573c5",
54 54
 					"scene": null
55 55
 				},
56 56
 				{

+ 1
- 0
src/components/Poster/index.js 파일 보기

@@ -75,6 +75,7 @@ export default class Poster extends Component {
75 75
 
76 76
   onCreateSuccess = (inx) => {
77 77
     return (result) => {
78
+      debugger
78 79
       const { tempFilePath, errMsg } = result;
79 80
       if (errMsg === 'canvasToTempFilePath:ok') {
80 81
         this.tmpImgs[inx] = tempFilePath

+ 3
- 1
src/onlineSelling/components/HouseGrid/Room.js 파일 보기

@@ -12,12 +12,14 @@ export default function Room(props) {
12 12
     }
13 13
   }
14 14
 
15
+  const wanY = Number(price / 10000).toFixed(0)
16
+
15 17
   return (
16 18
     <HotBlock number={heat + realHeat + 0}>
17 19
       <View className="room" onClick={handleClick}>
18 20
         <View className="warn">{roomName}</View>
19 21
         <View className="warn">{personNum}</View>
20
-        <View className="info">{price || '0'}万</View>
22
+        <View className="info">{wanY}万</View>
21 23
         <View className="info">{apartmentName || 'A户型'}</View>
22 24
       </View>
23 25
     </HotBlock>

+ 27
- 17
src/onlineSelling/pages/houseList/index.js 파일 보기

@@ -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}

+ 17
- 0
src/pages/temp/index.js 파일 보기

@@ -0,0 +1,17 @@
1
+import Taro, { Component } from '@tarojs/taro'
2
+import { Navigator } from "@tarojs/components";
3
+
4
+export default class extends Component {
5
+  render() {
6
+    return (
7
+      <Navigator
8
+        target="miniProgram"
9
+        path="pages/roomend/main.html?roomId=1358593484"
10
+        appId="wxb825ab501296672e"
11
+        style="width: 100vw; height: 100vh"
12
+      >
13
+        <Image style="width: 100vw; height: 100vh" src="https://njcj.oss-cn-shanghai.aliyuncs.com/20200213105513.png" />
14
+      </Navigator>
15
+    )
16
+  }
17
+}