ソースを参照

Merge branch 'v3.5.1' of http://git.ycjcjy.com/zhiyuxing/miniapp-v3 into v3.5.1

周立森 5 年 前
コミット
0e737ddc7c

+ 2
- 2
config/dev.js ファイルの表示

@@ -9,8 +9,8 @@ module.exports = {
9 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: {}

+ 2
- 2
config/prod.js ファイルの表示

@@ -7,8 +7,8 @@ module.exports = {
7 7
     // WSS_HOST: '"ws://192.168.0.218:8080"',
8 8
     HOST: '"https://dev.jinchengjiaye.com"',
9 9
     WSS_HOST: '"wss://dev.jinchengjiaye.com"',
10
-    //   HOST: '"https://lt.pawoma.cn"',
11
-    //   WSS_HOST: '"wss://lt.pawoma.cn"',
10
+      // HOST: '"https://lt.pawoma.cn"',
11
+      // WSS_HOST: '"wss://lt.pawoma.cn"',
12 12
   },
13 13
   weapp: {},
14 14
   h5: {}

+ 93
- 0
src/components/achieveAvatar/index.js ファイルの表示

@@ -0,0 +1,93 @@
1
+import Taro, { Component } from '@tarojs/taro'
2
+import { connect } from '@tarojs/redux'
3
+import * as actions from '@actions/user'
4
+import './index.scss'
5
+
6
+@connect(state => state.user, { ...actions })
7
+
8
+export default class Index extends Component {
9
+
10
+  state = {}
11
+  componentDidMount() {
12
+    const { user = {} } = this.props
13
+    console.log('111')
14
+    if (user.avatar && typeof this.props.onSuccess === 'function') {
15
+      this.props.onSuccess();
16
+    }
17
+  }
18
+  getUserInfo() {
19
+    const { dispatchUpdateUserInfo } = this.props
20
+    const sessionKey = Taro.getStorageSync('sessionKey')
21
+    Taro.getUserInfo({
22
+      lang: 'zh_CN',
23
+      success: res => {
24
+        console.log(res, "res")
25
+        const payload = Object.assign(res, { sessionKey })
26
+        // const { userInfo: { nickName, gender, country, city, province } } = payload
27
+        // App.zhuge.identify(nickName, {
28
+        //   '昵称': nickName,
29
+        //   '性别': gender == 1 ? '男' : '女',
30
+        //   '国家': country,
31
+        //   '省份': province,
32
+        //   '城市': city
33
+        // })
34
+        // 用户信息保存至服务器
35
+        dispatchUpdateUserInfo(payload).then(res => {
36
+          console.log('更新信息')
37
+          // this.toPage(true)
38
+          this.props.onSuccess();
39
+        })
40
+      },
41
+      fail: () => {
42
+        Taro.showToast({
43
+          title: '获取用户信息失败',
44
+          icon: 'none'
45
+        })
46
+        return
47
+        // this.toPage(false)
48
+      }
49
+    })
50
+  }
51
+  toPage(succed) {
52
+    const router = Taro.getStorageSync('router')
53
+    const { query, path } = router
54
+
55
+    if (!succed && path === 'pages/signin/index') {
56
+      return
57
+    }
58
+    if (path === 'pages/project/index' || path === 'pages/shop/index' || path === 'pages/person/index') {
59
+      Taro.switchTab({
60
+        url: '/' + path
61
+      })
62
+      return
63
+    }
64
+    Taro.reLaunch({
65
+      url: `/${path}?${query.params}`
66
+    })
67
+  }
68
+
69
+  renderMaskBanner() {
70
+    return (
71
+      <View>
72
+        <View className="avatar-page">
73
+          <View className="content">
74
+            <View className="title">请允许获取昵称、头像、地区及性别</View>
75
+            <Image className="touxiang" src={require('@assets/default-avatar.png')}></Image>
76
+            <View className="name">用户昵称</View>
77
+            <Button className="btn" open-type="getUserInfo" lang="zh_CN" onGetUserInfo={this.getUserInfo}>好</Button>
78
+          </View>
79
+        </View>
80
+      </View>
81
+    )
82
+  }
83
+  render() {
84
+    const { user = {} } = this.props
85
+
86
+    return (
87
+      <Block>
88
+        {this.renderMaskBanner()}
89
+        {/* {!user.avatar && this.renderMaskBanner()} */}
90
+      </Block>
91
+    )
92
+  }
93
+}

+ 54
- 0
src/components/achieveAvatar/index.scss ファイルの表示

@@ -0,0 +1,54 @@
1
+
2
+.avatar-page{
3
+  position: fixed;
4
+  width: 100vw;
5
+  height: 100vh;
6
+  left: 0;
7
+  top: 0;
8
+  z-index: 9999;
9
+  background: rgba(0, 0, 0, 0.22);
10
+  display: flex;
11
+  flex-direction: column;
12
+  justify-content: center;
13
+  align-items: center;
14
+  
15
+  .content {
16
+    width: 94vw;
17
+    height: 430px;
18
+    position: absolute;
19
+    left: 50%;
20
+    top: 50%;
21
+    margin-left: -47vw;
22
+    transform: translateY(-50%);
23
+    background-color: #fff;
24
+    border-radius: 12px;
25
+    padding: 40px;
26
+    text-align: center;
27
+    .title{
28
+      font-size: 34px;
29
+      color: #333;
30
+    }
31
+    .touxiang{
32
+      width: 110px;
33
+      height: 110px;
34
+      border-radius: 50%;
35
+      margin: 20px 0 10px 0;
36
+    }
37
+    .name{
38
+      font-size: 26px;
39
+      color: #333;
40
+    }
41
+  
42
+  
43
+    .btn{
44
+      width:290px;
45
+      height:90px;
46
+      background:rgba(187,156,121,1);
47
+      border-radius:12px;
48
+      font-size: 34px;
49
+      color: #fff;
50
+      line-height: 90px;
51
+      margin-top: 40px;
52
+    }
53
+  }
54
+}

+ 6
- 2
src/components/achievePhone/index.js ファイルの表示

@@ -12,7 +12,6 @@ export default class Index extends Component {
12 12
 
13 13
   componentDidMount() {
14 14
     const { user = {}} = this.props
15
-    console.log('111')
16 15
     if (user.phone && typeof this.props.onSuccess === 'function') {
17 16
       this.props.onSuccess();
18 17
     }
@@ -25,10 +24,15 @@ export default class Index extends Component {
25 24
           title: '获取手机号失败',
26 25
           icon: 'none'
27 26
         })
27
+
28
+        if (typeof this.props.onCancel === 'function') {
29
+          this.props.onCancel();
30
+        }
31
+
28 32
         return
29 33
       } else {        
30 34
         if (typeof this.props.onSuccess === 'function') {
31
-          this.props.onSuccess();
35
+          this.props.onSuccess(phoneNumber);
32 36
         }
33 37
       }
34 38
     })

+ 2
- 1
src/components/authorize/index.js ファイルの表示

@@ -27,7 +27,9 @@ export default class Index extends Component {
27 27
         return
28 28
       } else {
29 29
         this.props.dispatchUpdateUserInfoNew(this.state.user.id)
30
+        console.log(this.props.from,"this.props.from")
30 31
         if (this.props.from) {
32
+          console.log('跳转啦啦啦啦啦啦啦啦')
31 33
           Taro.reLaunch({
32 34
             url: this.props.from
33 35
           })
@@ -36,7 +38,6 @@ export default class Index extends Component {
36 38
             url: '/pages/person/index'
37 39
           })
38 40
         }
39
-
40 41
       }
41 42
     })
42 43
   }

+ 1
- 1
src/pages/activity/activity.js ファイルの表示

@@ -52,7 +52,7 @@ export default class active extends Component {
52 52
   }
53 53
 
54 54
   renderLogin() {
55
-    return <Authorize from="/pages/activity/activity"></Authorize>
55
+    return <Authorize></Authorize>
56 56
   }
57 57
 
58 58
   render() {

+ 61
- 47
src/pages/activity/detail/assemble.js ファイルの表示

@@ -3,6 +3,7 @@ import './index.scss'
3 3
 import Notice from '@components/Notice'
4 4
 import BackHomeBtn from '@components/BackHomeBtn'
5 5
 import AchievePhone from '@components/achievePhone'
6
+import AchieveAvatar from '@components/achieveAvatar'
6 7
 import Poster from '@components/Poster'
7 8
 import FormIdCollector from '@components/formIdCollector'
8 9
 import dayjs from 'dayjs'
@@ -72,7 +73,9 @@ export default class Detail extends Component {
72 73
     ready.queue(() => {
73 74
       // 必须授权电话
74 75
       if (this.toggleGrantPhone()) {
75
-        this.initPageData()
76
+        if (this.toggleGrantAvatar()) {
77
+          this.initPageData()
78
+        }
76 79
       }
77 80
     })
78 81
   }
@@ -122,13 +125,16 @@ export default class Detail extends Component {
122 125
     }
123 126
   }
124 127
 
125
-  // 调起授权电话
126
-  toggleGrantPhone = () => {
128
+
129
+   // 调起授权电话
130
+   toggleGrantPhone = () => {
127 131
     const { userInfo: { person: { phone, tel } } } = this.props
128 132
     if (!phone && !tel) {
129 133
       this.setState({ grantPhoneVisible: true })
130 134
       return false
131 135
     }
136
+    console.log('phone:',phone,'tel:',tel,'!!!!!')
137
+    console.log(this.props,'this.propsphone!!!!!')
132 138
 
133 139
     return true
134 140
   }
@@ -140,7 +146,8 @@ export default class Detail extends Component {
140 146
       this.setState({ grantAvatarVisible: true })
141 147
       return false
142 148
     }
143
-
149
+    console.log(avatarurl,"avatarurl")
150
+    console.log(this.props.userInfo,"this.props")
144 151
     return true
145 152
   }
146 153
 
@@ -394,7 +401,7 @@ export default class Detail extends Component {
394 401
         if (res.confirm) {
395 402
 
396 403
           // 必须授权头像
397
-          if (this.toggleGrantAvatar()) {            
404
+          if (this.toggleGrantAvatar()) {
398 405
             createGroupActivity({
399 406
               groupActivityId: detail.groupActivityId,
400 407
               personId: person.personId,
@@ -402,16 +409,16 @@ export default class Detail extends Component {
402 409
               phone: person.tel || person.phone,
403 410
               avatarurl: person.avatarurl,
404 411
             }).then(res => {
405
-                this.setState({
406
-                  recordDetail: res.taShareRecord,
407
-                  recordId: res.taShareRecord.recordId,
408
-                  memberList: res.shareChildRecordList || [],
409
-                  isStarter: true,
410
-                  groupState: res.taShareRecord.status,
411
-                }, () => cb && cb())
412
-              
412
+              this.setState({
413
+                recordDetail: res.taShareRecord,
414
+                recordId: res.taShareRecord.recordId,
415
+                memberList: res.shareChildRecordList || [],
416
+                isStarter: true,
417
+                groupState: res.taShareRecord.status,
418
+              }, () => cb && cb())
419
+
413 420
             }).catch(err => {
414
-              console.log(err,'11111111111111')
421
+              console.log(err, '11111111111111')
415 422
               Taro.showToast({
416 423
                 title: '发起失败: ' + err.message,
417 424
                 icon: 'none'
@@ -479,6 +486,7 @@ export default class Detail extends Component {
479 486
       groupState,
480 487
       actionSheetVisible,
481 488
       grantPhoneVisible,
489
+      grantAvatarVisible,
482 490
       posterTpls,
483 491
       posters,
484 492
       qrCode,
@@ -522,7 +530,11 @@ export default class Detail extends Component {
522 530
 
523 531
         {
524 532
           grantPhoneVisible &&
525
-          <AchievePhone user={userInfo.person} onSuccess={this.initPageData}></AchievePhone>
533
+          <AchievePhone user={userInfo.person} onSuccess={this.toggleGrantAvatar}></AchievePhone>
534
+        }
535
+        {
536
+          grantAvatarVisible &&
537
+          <AchieveAvatar user={userInfo.person} onSuccess={this.initPageData} ></AchieveAvatar>
526 538
         }
527 539
         <BackHomeBtn></BackHomeBtn>
528 540
         {
@@ -558,7 +570,9 @@ export default class Detail extends Component {
558 570
                     (
559 571
                       <Block>
560 572
                         <Image className="status__img" style="margin:12rpx auto 24rpx auto" src={getThumbnail(successImg)}></Image>
561
-                        <View className="hexiaoma" style="margin:0 auto 40rpx auto">核销码: {verificationCode}</View>
573
+                        {
574
+                          verificationCode && <View className="hexiaoma" style="margin:0 auto 40rpx auto">核销码: {verificationCode}</View>
575
+                        }
562 576
                       </Block>
563 577
                     )
564 578
                   }
@@ -615,42 +629,42 @@ export default class Detail extends Component {
615 629
                 <View style="padding:0 40rpx 180rpx 40rpx">
616 630
                   <Image src={getThumbnail(detail.descImg)} mode="widthFix" style="width:100%;"></Image>
617 631
                 </View>
618
-                { (actState === ActBeforeStart||(isStarter && actState === ActInProcess && groupState === GroupInProcess)||(!isStarter && actState === ActInProcess && groupState != GroupInProcess )||(!isStarter && actState === ActInProcess && groupState === GroupInProcess))&&
619
-                <View className="btn-fixed">
620
-                  {
621
-                    actState === ActBeforeStart &&
622
-                    (<View className="nostart-btn"><FormIdCollector><Button className="nostart-btn" style="margin: auto">未开始</Button></FormIdCollector></View>)
623
-                  }
624
-                  {
625
-                    isStarter && actState === ActInProcess && groupState === GroupInProcess &&
626
-                    (<View className="assistance-btn"><FormIdCollector><Button className="assistance-btn" style="margin: auto" onClick={this.groupBuyInvite}>邀请好友拼团</Button></FormIdCollector></View>)
627
-                  }
628
-                  {
629
-                    !isStarter && actState === ActInProcess && groupState != GroupInProcess &&
632
+                {(actState === ActBeforeStart || (isStarter && actState === ActInProcess && groupState === GroupInProcess) || (!isStarter && actState === ActInProcess && groupState != GroupInProcess) || (!isStarter && actState === ActInProcess && groupState === GroupInProcess)) &&
633
+                  <View className="btn-fixed">
634
+                    {
635
+                      actState === ActBeforeStart &&
636
+                      (<View className="nostart-btn"><FormIdCollector><Button className="nostart-btn" style="margin: auto">未开始</Button></FormIdCollector></View>)
637
+                    }
638
+                    {
639
+                      isStarter && actState === ActInProcess && groupState === GroupInProcess &&
640
+                      (<View className="assistance-btn"><FormIdCollector><Button className="assistance-btn" style="margin: auto" onClick={this.groupBuyInvite}>邀请好友拼团</Button></FormIdCollector></View>)
641
+                    }
642
+                    {
643
+                      !isStarter && actState === ActInProcess && groupState != GroupInProcess &&
630 644
 
631
-                    <View className={groupState === GroupInProcess ? "set-btn" : "assistance-btn"} style="border:none">
632
-                      <FormIdCollector>
633
-                        <Button className={groupState === GroupInProcess ? "set-btn" : "assistance-btn"} onClick={this.startMine}>发起我的拼团</Button>
634
-                      </FormIdCollector>
635
-                    </View>
636
-                  }
637
-                  {
638
-                    !isStarter && actState === ActInProcess && groupState === GroupInProcess &&
639
-
640
-                    <View className="btn-box" style="margin: auto; padding: 0;">
641
-                      {
642
-                        (groupState === GroupInProcess && !isJoin) &&
643
-                        (<View className="assistance-btn"><FormIdCollector><Button className="assistance-btn" onClick={this.joinGroup}>立即参团</Button></FormIdCollector></View>)
644
-                      }                      
645
-                      <View className={groupState === GroupInProcess && !isJoin ? "set-btn" : "assistance-btn"} style="border:none">
645
+                      <View className={groupState === GroupInProcess ? "set-btn" : "assistance-btn"} style="border:none">
646 646
                         <FormIdCollector>
647
-                          <Button className={groupState === GroupInProcess && !isJoin ? "set-btn" : "assistance-btn"} onClick={this.startMine}>发起我的拼团</Button>
647
+                          <Button className={groupState === GroupInProcess ? "set-btn" : "assistance-btn"} onClick={this.startMine}>发起我的拼团</Button>
648 648
                         </FormIdCollector>
649 649
                       </View>
650
-                    </View>
650
+                    }
651
+                    {
652
+                      !isStarter && actState === ActInProcess && groupState === GroupInProcess &&
653
+
654
+                      <View className="btn-box" style="margin: auto; padding: 0;">
655
+                        {
656
+                          (groupState === GroupInProcess && !isJoin) &&
657
+                          (<View className="assistance-btn"><FormIdCollector><Button className="assistance-btn" onClick={this.joinGroup}>立即参团</Button></FormIdCollector></View>)
658
+                        }
659
+                        <View className={groupState === GroupInProcess && !isJoin ? "set-btn" : "assistance-btn"} style="border:none">
660
+                          <FormIdCollector>
661
+                            <Button className={groupState === GroupInProcess && !isJoin ? "set-btn" : "assistance-btn"} onClick={this.startMine}>发起我的拼团</Button>
662
+                          </FormIdCollector>
663
+                        </View>
664
+                      </View>
651 665
 
652
-                  }
653
-                </View>
666
+                    }
667
+                  </View>
654 668
                 }
655 669
               </ScrollView>
656 670
 

+ 15
- 5
src/pages/activity/detail/assistance.js ファイルの表示

@@ -3,6 +3,7 @@ import './index.scss'
3 3
 import Notice from '@components/Notice'
4 4
 import BackHomeBtn from '@components/BackHomeBtn'
5 5
 import AchievePhone from '@components/achievePhone'
6
+import AchieveAvatar from '@components/achieveAvatar'
6 7
 import Poster from '@components/Poster'
7 8
 import FormIdCollector from '@components/formIdCollector'
8 9
 import dayjs from 'dayjs'
@@ -69,9 +70,11 @@ export default class Detail extends Component {
69 70
 
70 71
   componentWillMount() {
71 72
     ready.queue(() => {
72
-      // 必须授权电话
73
+      // 必须授权电话
73 74
       if (this.toggleGrantPhone()) {
74
-        this.initPageData()
75
+        if (this.toggleGrantAvatar()) {
76
+          this.initPageData()
77
+        }
75 78
       }
76 79
     })
77 80
   }
@@ -128,6 +131,8 @@ export default class Detail extends Component {
128 131
       this.setState({ grantPhoneVisible: true })
129 132
       return false
130 133
     }
134
+    console.log('phone:',phone,'tel:',tel,'!!!!!')
135
+    console.log(this.props,'this.propsphone!!!!!')
131 136
 
132 137
     return true
133 138
   }
@@ -139,7 +144,8 @@ export default class Detail extends Component {
139 144
       this.setState({ grantAvatarVisible: true })
140 145
       return false
141 146
     }
142
-
147
+    console.log(avatarurl,"avatarurl")
148
+    console.log(this.props.userInfo,"this.props")
143 149
     return true
144 150
   }
145 151
 
@@ -470,6 +476,7 @@ export default class Detail extends Component {
470 476
       helpState,
471 477
       actionSheetVisible,
472 478
       grantPhoneVisible,
479
+      grantAvatarVisible,
473 480
       posterTpls,
474 481
       posters,
475 482
       qrCode,
@@ -505,10 +512,13 @@ export default class Detail extends Component {
505 512
             <Poster configs={posterConfigs} onCancel={this.togglePosterVisible} onFinish={this.togglePosterVisible}></Poster>
506 513
           )
507 514
         }
508
-
509 515
         {
510 516
           grantPhoneVisible &&
511
-          <AchievePhone user={userInfo.person} onSuccess={this.initPageData}></AchievePhone>
517
+          <AchievePhone user={userInfo.person} onSuccess={this.toggleGrantAvatar}></AchievePhone>
518
+        }
519
+        {
520
+          grantAvatarVisible &&
521
+          <AchieveAvatar user={userInfo.person} onSuccess={this.initPageData} ></AchieveAvatar>
512 522
         }
513 523
         <BackHomeBtn></BackHomeBtn>
514 524
         {

+ 23
- 19
src/pages/agent/recommend/index.js ファイルの表示

@@ -411,29 +411,30 @@ export default class Index extends Component {
411 411
   }
412 412
   // 性别
413 413
   radioChange(e) {
414
-    console.log(e.detail.value)
415 414
     this.setState({
416 415
       sex: e.detail.value
417 416
     })
418 417
   }
419
-  renderLogin () {
420
-    return <Authorize from="/pages/agent/recommend/index"></Authorize>
418
+  renderLogin() {
419
+    const from = "/pages/agent/recommend/index"
420
+    return <Authorize from={from}></Authorize>
421 421
   }
422 422
 
423 423
   renderDetail() {
424
-    const { reType } = this.state
424
+    const { reType, name, phone, floorArray, floorID, floorColor, intention, adviserArray, adviserID, adviserColor, remarks, radioList } = this.state
425
+ 
425 426
     return (
426 427
       <View className='recommend__customers'>
427 428
         <View className='submit__infor ani'>
428 429
           <View className='info info__1'>
429 430
             <Text className='customers__txt'>客户姓名</Text>
430
-            <Input className="input customers__name" name="name" data-id='name' value={this.state.name} onInput={this.BindInfo.bind(this)} placeholder="请输入" />
431
+            <Input className="input customers__name" name="name" data-id='name' value={name} onInput={this.BindInfo.bind(this)} placeholder="请输入" />
431 432
           </View>
432 433
           <View className='info info__2'>
433 434
             <Text className='customers__txt'>客户性别</Text>
434 435
             <View className='radio-list input'>
435 436
               <RadioGroup onChange={this.radioChange}>
436
-                {this.state.radioList.map((item, i) => {
437
+                {radioList.map((item, i) => {
437 438
                   return (
438 439
                     <Label className='radio-list__label' for={i} key={i}>
439 440
                       <Radio className='radio-list__radio' color={item.color} value={item.value} checked={item.checked} >{item.text}</Radio>
@@ -445,31 +446,31 @@ export default class Index extends Component {
445 446
           </View>
446 447
           <View className='info info__3'>
447 448
             <Text className='customers__txt'>电话号码</Text>
448
-            <Input type='number' className="input customers__sex" name="phone" data-id="phone" value={this.state.phone} onInput={this.BindInfo.bind(this)} placeholder="请输入" />
449
+            <Input type='number' className="input customers__sex" name="phone" data-id="phone" value={phone} onInput={this.BindInfo.bind(this)} placeholder="请输入" />
449 450
           </View>
450 451
           <View className='info info__4'>
451 452
             <Text className='customers__txt'>意向楼盘</Text>
452 453
             {
453
-              reType == 'index' ? (<Picker className='input customers__name' onChange={this.bindFloorChange} value={this.state.floorID} range={this.state.floorArray} range-key="buildingName">
454
-                <View class="picker overtext" style={this.state.floorColor}>
455
-                  {this.state.floorArray[this.state.floorID].buildingName}
454
+              reType == 'index' ? (<Picker className='input customers__name' onChange={this.bindFloorChange} value={floorID} range={floorArray} range-key="buildingName">
455
+                <View class="picker overtext" style={floorColor}>
456
+                  {floorArray[floorID].buildingName}
456 457
                 </View>
457
-              </Picker>) : (<Input className="input customers__name" style='color:#999;' disabled='disabled' name="name" value={this.state.intention} onInput={this.bindFloorChange.bind(this)} placeholder="" />)
458
+              </Picker>) : (<Input className="input customers__name" style='color:#999;' disabled='disabled' name="name" value={intention} onInput={this.bindFloorChange.bind(this)} placeholder="" />)
458 459
             }
459 460
 
460 461
           </View>
461 462
           <View className='info info__4__1'>
462 463
             <Text className='customers__txt'>置业顾问</Text>
463
-            <Picker className='input customers__adviser' onChange={this.bindAdviserChange} value={this.state.adviserID} range={this.state.adviserArray} range-key="name">
464
-              <View class="picker overtext" style={this.state.adviserColor}>
465
-                {this.state.adviserArray[this.state.adviserID].name}
464
+            <Picker className='input customers__adviser' onChange={this.bindAdviserChange} value={adviserID} range={adviserArray} range-key="name">
465
+              <View class="picker overtext" style={adviserColor}>
466
+                {adviserArray[adviserID].name}
466 467
               </View>
467 468
             </Picker>
468 469
           </View>
469 470
 
470 471
           <View className='info info__6'>
471 472
             <Text className='customers__txt'>客户描述</Text>
472
-            <Input className="input customers__remarks" data-id="remarks" name="remarks" value={this.state.remarks} onInput={this.BindInfo.bind(this)} placeholder="(选填)" />
473
+            <Input className="input customers__remarks" data-id="remarks" name="remarks" value={remarks} onInput={this.BindInfo.bind(this)} placeholder="(选填)" />
473 474
           </View>
474 475
         </View>
475 476
         <View className='submit-btn'>
@@ -480,12 +481,15 @@ export default class Index extends Component {
480 481
     );
481 482
   }
482 483
   render() {
483
-    const { person: { phone, tel } } = this.props.userInfo
484
+
485
+
486
+    const { person: { phone, tel, personId } } = this.props.userInfo
487
+    const visable = (!phone && !tel)
488
+
484 489
     return (
485 490
       <View style="width:100%;height:100%">
486
-    {console.log(this.props.userInfo,'this.props.userInfo')}
487
-      {(!phone && !tel) ? this.renderLogin() : this.renderDetail()}
488
-    </View>
491
+        {visable ? this.renderLogin() : this.renderDetail()}
492
+      </View>
489 493
     );
490 494
   }
491 495
 }

+ 75
- 43
src/pages/card/index.js ファイルの表示

@@ -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
   }
@@ -61,6 +62,7 @@ export default class Index extends Component {
61 62
       this.initPageData()
62 63
     })
63 64
   }
65
+
64 66
   initPageData() {
65 67
     const router = Taro.getStorageSync('router')
66 68
     const id = this.$router.params.id || router.query.id
@@ -79,20 +81,16 @@ export default class Index extends Component {
79 81
 
80 82
     addCardUv(id)
81 83
   }
84
+
85
+  componentWillReceiveProps(nextProps) {
86
+    const { userInfo: { person: { phone, tel } } } = nextProps
87
+    this.handleModalConfirm(tel || phone)
88
+  }
89
+
82 90
   componentWillUnmount() {
83 91
     const { recordId } = this.state
84 92
     recordId && updatePoint(recordId)
85 93
   }
86
-  componentDidMount() {
87
-    const options = wx.getLaunchOptionsSync()
88
-    const sceneList = [ 1011, 1012, 1013, 1031, 1032, 1036, 1047, 1048]
89
-
90
-    if (sceneList.indexOf(options.scene) != -1) {
91
-      this.setState({
92
-        grantPhoneVisible: true,
93
-      })
94
-    }
95
-  }
96 94
 
97 95
   loadCardDetail() {
98 96
     const { cardId } = this.state
@@ -104,7 +102,7 @@ export default class Index extends Component {
104 102
         loaded: true,
105 103
         isSave: res.isSave
106 104
       })
107
-      let buildingId = res.projects[0]
105
+      let buildingId = (res.projects || [])[0]
108 106
       if (buildingId) {
109 107
         dispatchProjectDetail(buildingId)
110 108
       }
@@ -351,25 +349,48 @@ export default class Index extends Component {
351 349
     })
352 350
   }
353 351
 
354
-  handleModalConfirm() {
352
+  handleModalConfirm(phoneNumber) {
355 353
     const {
356
-      cardInfo: { id, projects },
357
-      userInfo: { person: { phone, tel } }
354
+      cardInfo: { id, projects = [] },
355
+      userInfo: { person: { phone, tel, personType, avatarurl } }
358 356
     } = this.props
359 357
 
358
+    if (personType === ROLE_CODE['CONSULTANT']) {
359
+      return
360
+    }
361
+
360 362
     const buildingId = projects[0]
363
+    const realPhone = phoneNumber || phone || tel
361 364
 
362
-    const payload = {
363
-      realtyConsultant: id, //报备人 置业顾问
364
-      buildingId,
365
-      phone: phone || tel
366
-    }
367
-    reportClient(payload).then(res => {
368
-      this.hideModal()
369
-      Taro.showToast({
370
-        title: '报备成功'
365
+    // TODO:
366
+    // 此处使用头像控制, 后期需要去掉这个条件
367
+    if (realPhone && id && buildingId && !this.state.bound && (avatarurl || '').indexOf('wx.qlogo.cn') > -1) {
368
+      const payload = {
369
+        realtyConsultant: id, //报备人 置业顾问
370
+        buildingId,
371
+        phone: realPhone
372
+      }
373
+
374
+      reportClient(payload).then(res => {
375
+        this.hideModal()
376
+        this.setState({ bound: true })
377
+
378
+        if (res !== 'bound') {
379
+          Taro.showToast({
380
+            title: '恭喜您绑定成功'
381
+          })
382
+        }
383
+      }).catch(err => {
384
+        console.error(err)
385
+        this.setState({ bound: true })
386
+
387
+        Taro.showToast({
388
+          title: err.message || err,
389
+          icon: 'none'
390
+        })
371 391
       })
372
-    })
392
+
393
+    }
373 394
   }
374 395
 
375 396
   // 卡片收藏
@@ -419,14 +440,23 @@ export default class Index extends Component {
419 440
     })
420 441
   }
421 442
   
422
-  handleAuthPhoneSuccess = () => {
443
+  handleAuthPhoneSuccess = (phone) => {
423 444
     const { person = {} } = this.props.userInfo || {}
424 445
     if ((person.avatarurl || '').indexOf('wx.qlogo.cn') === -1) {
425 446
       Taro.reLaunch({ url: '/pages/auth/index' })
426 447
       return
427 448
     }
428 449
 
450
+    this.setState({ grantPhoneVisible: false })
429 451
     this.initPageData()
452
+    // this.handleModalConfirm(phone)
453
+  }
454
+
455
+  handeAuthPhoneFail = () => {
456
+    Taro.showToast({ 
457
+      title: '未授权手机号无法成为报备客户',
458
+      icon: 'none'
459
+     })
430 460
   }
431 461
 
432 462
   render() {
@@ -440,34 +470,36 @@ export default class Index extends Component {
440 470
     const isSelf = personId === id
441 471
 
442 472
     const isConsultant = personType === ROLE_CODE['CONSULTANT']
443
-    const hadPhone = (phone || tel) ? true : false
473
+    const hadPhone = (phone || tel) ? true : false  // nb
444 474
     const visibleChatBtn = !isConsultant && !isSelf
445 475
     // const visibleConfirmModal = modalStatus && !isReport && !isSelf && (personType === ROLE_CODE['DRIFT'] || personType === ROLE_CODE['CUSTOMER'])
446 476
     const visibleConfirmModal = modalStatus && !isReport && !isSelf
477
+    const showAuthPhone = grantPhoneVisible && userInfo.person.personId && !userInfo.person.phone
478
+
447 479
     return (
448 480
       <Block>
449 481
         {/* 生成海报 */}
450 482
         {makePosterStatus && (<Poster data={posterData} toggle={this.toggleVisiblePoster}></Poster>)}
451 483
         {
452
-          (grantPhoneVisible && userInfo.person.personId && !userInfo.person.phone) &&
453
-          <AchievePhone user={userInfo.person} onSuccess={this.handleAuthPhoneSuccess}></AchievePhone>
484
+          showAuthPhone &&
485
+          <AchievePhone user={userInfo.person} onCancel={this.handeAuthPhoneFail} onSuccess={this.handleAuthPhoneSuccess}></AchievePhone>
454 486
         }
455 487
         {
456
-          visibleConfirmModal && (
457
-            <View className="modal">
458
-              <View className="modal-mask" onClick={this.hideModal}></View>
459
-              <View className="modal-body">
460
-                <View className="modal-body__con">请确认是否成为他的客户?</View>
461
-                {
462
-                  hadPhone ? (
463
-                    <Button onClick={this.handleModalConfirm} className='modal-body__btn'>确认</Button>
464
-                  ) : (
465
-                      <Button open-type="getPhoneNumber" onGetphonenumber={this.handleGetPhone} className='modal-body__btn'>确认</Button>
466
-                    )
467
-                }
468
-              </View>
469
-            </View>
470
-          )
488
+          // !showAuthPhone && visibleConfirmModal && (
489
+          //   <View className="modal">
490
+          //     <View className="modal-mask" onClick={this.hideModal}></View>
491
+          //     <View className="modal-body">
492
+          //       <View className="modal-body__con">请确认是否成为他的客户?</View>
493
+          //       {
494
+          //         hadPhone ? (
495
+          //           <Button onClick={this.handleModalConfirm} className='modal-body__btn'>确认</Button>
496
+          //         ) : (
497
+          //             <Button open-type="getPhoneNumber" onGetphonenumber={this.handleGetPhone} className='modal-body__btn'>确认</Button>
498
+          //           )
499
+          //       }
500
+          //     </View>
501
+          //   </View>
502
+          // )
471 503
         }
472 504
 
473 505
         {this.state.loaded && (

+ 2
- 5
src/pages/person/index.js ファイルの表示

@@ -92,10 +92,7 @@ export default class Person extends Component {
92 92
       }
93 93
     }
94 94
     else {
95
-
96
-
97
-      putRegisterConsultant().then(res => {
98
-    
95
+      putRegisterConsultant().then(res => {    
99 96
 
100 97
         // if (res) {
101 98
           Taro.showToast({
@@ -160,7 +157,7 @@ export default class Person extends Component {
160 157
   }
161 158
 
162 159
   renderLogin () {
163
-    return <Authorize from="/pages/person/index"></Authorize>
160
+    return <Authorize></Authorize>
164 161
   }
165 162
 
166 163
   renderDetail () {

+ 1
- 1
src/pages/shop/index.js ファイルの表示

@@ -197,7 +197,7 @@ export default class Shop extends Component {
197 197
   }
198 198
 
199 199
   renderLogin () {
200
-    return <Authorize from="/pages/shop/index"></Authorize>
200
+    return <Authorize></Authorize>
201 201
   }
202 202
   handleBannerClick = (item) => {
203 203
     console.log(this, "this")

+ 1
- 0
src/utils/request.js ファイルの表示

@@ -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) {