张延森 5 år sedan
förälder
incheckning
071e82729b
3 ändrade filer med 19 tillägg och 7 borttagningar
  1. 4
    4
      config/dev.js
  2. 14
    3
      src/pages/card/index.js
  3. 1
    0
      src/utils/request.js

+ 4
- 4
config/dev.js Visa fil

@@ -5,12 +5,12 @@ module.exports = {
5 5
   defineConstants: {
6 6
     // HOST: '"http://47.101.36.130:8085"',//测试
7 7
     // WSS_HOST: '"wss://47.101.36.130:8085"',
8
-    HOST:  '"https://dev.jinchengjiaye.com"',//测试
9
-    WSS_HOST: '"wss://dev.jinchengjiaye.com"',
8
+    // HOST:  '"https://dev.jinchengjiaye.com"',//测试
9
+    // WSS_HOST: '"wss://dev.jinchengjiaye.com"',
10 10
     // HOST: '"https://lt.pawoma.cn"',
11 11
     // WSS_HOST: '"wss://lt.pawoma.cn"',
12
-    // HOST: '"http://192.168.0.84:8080"',
13
-    // WSS_HOST: '"ws://192.168.0.84:8080"',
12
+    HOST: '"http://192.168.0.238:8080"',
13
+    WSS_HOST: '"ws://192.168.0.238:8080"',
14 14
   },
15 15
   weapp: {},
16 16
   h5: {}

+ 14
- 3
src/pages/card/index.js Visa fil

@@ -37,6 +37,7 @@ export default class Index extends Component {
37 37
     actionSheetHide: true, // 控制分享弹窗modal
38 38
     recordId: null,
39 39
     isSave: false,
40
+    bound: false,
40 41
     modalStatus: false,
41 42
     grantPhoneVisible: false, // 授权手机弹框
42 43
   }
@@ -81,6 +82,11 @@ export default class Index extends Component {
81 82
     addCardUv(id)
82 83
   }
83 84
 
85
+  componentWillReceiveProps(nextProps) {
86
+    const { userInfo: { person: { phone, tel } } } = nextProps
87
+    this.handleModalConfirm(tel || phone)
88
+  }
89
+
84 90
   componentWillUnmount() {
85 91
     const { recordId } = this.state
86 92
     recordId && updatePoint(recordId)
@@ -346,13 +352,15 @@ export default class Index extends Component {
346 352
   handleModalConfirm(phoneNumber) {
347 353
     const {
348 354
       cardInfo: { id, projects = [] },
349
-      userInfo: { person: { phone, tel } }
355
+      userInfo: { person: { phone, tel, avatarurl } }
350 356
     } = this.props
351 357
 
352 358
     const buildingId = projects[0]
353 359
     const realPhone = phoneNumber || phone || tel
354 360
 
355
-    if (realPhone) {
361
+    // TODO:
362
+    // 此处使用头像控制, 后期需要去掉这个条件
363
+    if (realPhone && id && buildingId && !this.state.bound && (avatarurl || '').indexOf('wx.qlogo.cn') > -1) {
356 364
       const payload = {
357 365
         realtyConsultant: id, //报备人 置业顾问
358 366
         buildingId,
@@ -361,6 +369,7 @@ export default class Index extends Component {
361 369
 
362 370
       reportClient(payload).then(res => {
363 371
         this.hideModal()
372
+        this.setState({ bound: true })
364 373
 
365 374
         if (res !== 'bound') {
366 375
           Taro.showToast({
@@ -369,12 +378,14 @@ export default class Index extends Component {
369 378
         }
370 379
       }).catch(err => {
371 380
         console.error(err)
381
+        this.setState({ bound: true })
372 382
 
373 383
         Taro.showToast({
374 384
           title: err.message || err,
375 385
           icon: 'none'
376 386
         })
377 387
       })
388
+
378 389
     }
379 390
   }
380 391
 
@@ -434,7 +445,7 @@ export default class Index extends Component {
434 445
 
435 446
     this.setState({ grantPhoneVisible: false })
436 447
     this.initPageData()
437
-    this.handleModalConfirm(phone)
448
+    // this.handleModalConfirm(phone)
438 449
   }
439 450
 
440 451
   handeAuthPhoneFail = () => {

+ 1
- 0
src/utils/request.js Visa fil

@@ -79,6 +79,7 @@ export const fetch = async (options) => {
79 79
       throw res.data
80 80
     }
81 81
   }).catch((err) => {
82
+    console.error(err)
82 83
     
83 84
     let errMessage = `请求失败: ${err.errMsg}`
84 85
     if (err.errMsg) {