张延森 5 years ago
parent
commit
67ba6ffc7d

+ 18
- 9
src/pages/activity/detail/assemble.js View File

11
 // import getUserPhone from '@utils/getUserPhone'
11
 // import getUserPhone from '@utils/getUserPhone'
12
 import ready from '@utils/ready'
12
 import ready from '@utils/ready'
13
 import { getDownloadURL, times, formateLeftTime, getCanvasConfig, transferImage } from '@utils/tools'
13
 import { getDownloadURL, times, formateLeftTime, getCanvasConfig, transferImage } from '@utils/tools'
14
+import { getQrCodeParams } from '@utils/qrcode'
14
 import {
15
 import {
15
   getGroupDetail,
16
   getGroupDetail,
16
   createGroupActivity,
17
   createGroupActivity,
95
   // 初始化页面数据
96
   // 初始化页面数据
96
   initPageData = () => {
97
   initPageData = () => {
97
     if (!this.state.detail.groupActivityId) {
98
     if (!this.state.detail.groupActivityId) {
98
-      let id = this.$router.params.id
99
-      let recordId = this.$router.params.recordId
99
+      const router = Taro.getStorageSync('router')
100
+      let id = this.$router.params.id || router.query.id
101
+      let recordId = this.$router.params.recordId || router.query.recordId
100
 
102
 
101
       if (!id) {
103
       if (!id) {
102
-        const router = Taro.getStorageSync('router')
103
-        id = router.query.id
104
-        recordId = router.query.recordId
104
+        getQrCodeParams(this.$router.params.scene).then(res => {
105
+          this.setState({ id: res.id, recordId: res.recordId }, () => {
106
+            this.loadDetail()
107
+          })
108
+        }).catch(err => {
109
+          Taro.showToast({
110
+            title: '没有找到活动',
111
+            icon: 'none'
112
+          })
113
+        })
114
+      } else {
115
+        this.setState({ id, recordId }, () => {
116
+          this.loadDetail()
117
+        })
105
       }
118
       }
106
-
107
-      this.setState({ id, recordId }, () => {
108
-        this.loadDetail()
109
-      })
110
     }
119
     }
111
   }
120
   }
112
 
121
 

+ 18
- 8
src/pages/activity/detail/assistance.js View File

11
 // import getUserPhone from '@utils/getUserPhone'
11
 // import getUserPhone from '@utils/getUserPhone'
12
 import ready from '@utils/ready'
12
 import ready from '@utils/ready'
13
 import { getDownloadURL, times, formateLeftTime, getCanvasConfig, transferImage } from '@utils/tools'
13
 import { getDownloadURL, times, formateLeftTime, getCanvasConfig, transferImage } from '@utils/tools'
14
+import { getQrCodeParams } from '@utils/qrcode'
14
 import {
15
 import {
15
   getHelpDetail,
16
   getHelpDetail,
16
   createHelpActivity,
17
   createHelpActivity,
95
   // 初始化页面数据
96
   // 初始化页面数据
96
   initPageData = () => {
97
   initPageData = () => {
97
     if (!this.state.detail.helpActivityId) {
98
     if (!this.state.detail.helpActivityId) {
98
-      let id = this.$router.params.id
99
-      let initiateId = this.$router.params.initiateId
99
+      const router = Taro.getStorageSync('router')
100
+      let id = this.$router.params.id || router.query.id
101
+      let initiateId = this.$router.params.initiateId || router.query.initiateId
100
 
102
 
101
       if (!id) {
103
       if (!id) {
102
-        const router = Taro.getStorageSync('router')
103
-        id = router.query.id
104
-        initiateId = router.query.initiateId
104
+        getQrCodeParams(this.$router.params.scene).then(res => {
105
+          this.setState({ id: res.id, initiateId: res.initiateId }, () => {
106
+            this.loadDetail()
107
+          })
108
+        }).catch(err => {
109
+          Taro.showToast({
110
+            title: '没有找到活动',
111
+            icon: 'none'
112
+          })
113
+        })
114
+      } else {
115
+        this.setState({ id, initiateId }, () => {
116
+          this.loadDetail()
117
+        })
105
       }
118
       }
106
 
119
 
107
-      this.setState({ id, initiateId }, () => {
108
-        this.loadDetail()
109
-      })
110
     }
120
     }
111
   }
121
   }
112
 
122
 

+ 20
- 4
src/pages/activity/detail/index.js View File

8
 import getUserPhone from '@utils/getUserPhone'
8
 import getUserPhone from '@utils/getUserPhone'
9
 import ready from '@utils/ready'
9
 import ready from '@utils/ready'
10
 import { getDownloadURL, times, transferImage } from '@utils/tools'
10
 import { getDownloadURL, times, transferImage } from '@utils/tools'
11
+import { getQrCodeParams } from '@utils/qrcode'
11
 import {
12
 import {
12
   addActivityShareNum,
13
   addActivityShareNum,
13
   signupActivity,
14
   signupActivity,
47
   componentWillMount() {
48
   componentWillMount() {
48
     ready.queue(() => {
49
     ready.queue(() => {
49
       const router = Taro.getStorageSync('router')
50
       const router = Taro.getStorageSync('router')
50
-      const id = this.$router.params.id || router.query.id || '2fe920719b8b0db50011441462e647ad'
51
-      this.setState({ id }, () => {
52
-        this.loadDetail()
53
-      })
51
+      // const id = this.$router.params.id || router.query.id || '2fe920719b8b0db50011441462e647ad'
52
+
53
+      const id = this.$router.params.id || router.query.id
54
+      if (!id) {
55
+        getQrCodeParams(this.$router.params.scene).then(res => {
56
+          this.setState({ id: res.id }, () => {
57
+            this.loadDetail()
58
+          })
59
+        }).catch(err => {
60
+          Taro.showToast({
61
+            title: '没有找到活动',
62
+            icon: 'none'
63
+          })
64
+        })
65
+      } else {
66
+        this.setState({ id }, () => {
67
+          this.loadDetail()
68
+        })
69
+      }
54
     })
70
     })
55
   }
71
   }
56
   componentWillUnmount() {
72
   componentWillUnmount() {

+ 13
- 40
src/pages/card/index.js View File

36
     recordId: null,
36
     recordId: null,
37
     isSave: false,
37
     isSave: false,
38
     bound: false,
38
     bound: false,
39
-    modalStatus: false,
40
     grantPhoneVisible: false, // 授权手机弹框
39
     grantPhoneVisible: false, // 授权手机弹框
41
   }
40
   }
42
 
41
 
43
   componentWillMount() {
42
   componentWillMount() {
44
     ready.queue(() => {
43
     ready.queue(() => {
45
-      // const router = Taro.getStorageSync('router')
46
-      // const id = this.$router.params.id || router.query.id || '4604a792d575eb8187711625bd88832c'
47
       // 分享场景需要先授权手机, 再授权头像
44
       // 分享场景需要先授权手机, 再授权头像
48
       const options = wx.getLaunchOptionsSync()
45
       const options = wx.getLaunchOptionsSync()
49
       if (sceneInShare(options.scene)) {
46
       if (sceneInShare(options.scene)) {
66
     const router = Taro.getStorageSync('router')
63
     const router = Taro.getStorageSync('router')
67
     const id = this.$router.params.id || router.query.id
64
     const id = this.$router.params.id || router.query.id
68
 
65
 
69
-    if (router.query.id) {
70
-      this.setState({
71
-        cardId: id,
72
-        modalStatus: true
73
-      }, this.loadCardDetail)
66
+    if (!id) {
67
+      getQrCodeParams(this.$router.params.scene).then(res => {
68
+        this.setState({ cardId: res.id }, this.loadCardDetail)
69
+        addCardUv(res.id)
70
+      }).catch(err => {
71
+        Taro.showToast({
72
+          title: '没有找到卡片',
73
+          icon: 'none'
74
+        })
75
+      })
74
     } else {
76
     } else {
75
-      this.setState({
76
-        cardId: id,
77
-        modalStatus: false
78
-      }, this.loadCardDetail)
77
+      this.setState({ cardId: id }, this.loadCardDetail)
78
+      addCardUv(id)
79
     }
79
     }
80
-
81
-    addCardUv(id)
82
   }
80
   }
83
 
81
 
84
   componentWillReceiveProps(nextProps) {
82
   componentWillReceiveProps(nextProps) {
377
       const { cardInfo, userInfo: { person } } = this.props
375
       const { cardInfo, userInfo: { person } } = this.props
378
       if (person.personId != cardInfo.id) {
376
       if (person.personId != cardInfo.id) {
379
         reportClient(payload).then(res => {
377
         reportClient(payload).then(res => {
380
-          this.hideModal()
381
           this.setState({ bound: true })
378
           this.setState({ bound: true })
382
           if (res !== 'bound') {
379
           if (res !== 'bound') {
383
             Taro.showToast({
380
             Taro.showToast({
439
     }
436
     }
440
   }
437
   }
441
 
438
 
442
-  hideModal() {
443
-    this.setState({
444
-      modalStatus: false
445
-    })
446
-  }
447
   handleAuthPhoneSuccess = (phone) => {
439
   handleAuthPhoneSuccess = (phone) => {
448
     const { person = {} } = this.props.userInfo || {}
440
     const { person = {} } = this.props.userInfo || {}
449
     if ((person.avatarurl || '').indexOf('wx.qlogo.cn') === -1) {
441
     if ((person.avatarurl || '').indexOf('wx.qlogo.cn') === -1) {
463
     })
455
     })
464
   }
456
   }
465
   render() {
457
   render() {
466
-    const { makePosterStatus, posterData, modalStatus, grantPhoneVisible } = this.state
458
+    const { makePosterStatus, posterData, grantPhoneVisible } = this.state
467
     const { userInfo, cardInfo, projectDetail } = this.props
459
     const { userInfo, cardInfo, projectDetail } = this.props
468
     const { person: { personType, personId, phone, tel } } = userInfo
460
     const { person: { personType, personId, phone, tel } } = userInfo
469
     const { unReadNum, picture, visitors, id, isReport } = cardInfo
461
     const { unReadNum, picture, visitors, id, isReport } = cardInfo
475
     const isConsultant = personType === ROLE_CODE['CONSULTANT']
467
     const isConsultant = personType === ROLE_CODE['CONSULTANT']
476
     const hadPhone = (phone || tel) ? true : false  // nb
468
     const hadPhone = (phone || tel) ? true : false  // nb
477
     const visibleChatBtn = !isConsultant && !isSelf
469
     const visibleChatBtn = !isConsultant && !isSelf
478
-    // const visibleConfirmModal = modalStatus && !isReport && !isSelf && (personType === ROLE_CODE['DRIFT'] || personType === ROLE_CODE['CUSTOMER'])
479
-    const visibleConfirmModal = modalStatus && !isReport && !isSelf
480
     const showAuthPhone = grantPhoneVisible && userInfo.person.personId && !userInfo.person.phone
470
     const showAuthPhone = grantPhoneVisible && userInfo.person.personId && !userInfo.person.phone
481
     return (
471
     return (
482
       <Block>
472
       <Block>
487
           showAuthPhone &&
477
           showAuthPhone &&
488
           <AchievePhone user={userInfo.person} onCancel={this.handeAuthPhoneFail} onSuccess={this.handleAuthPhoneSuccess}></AchievePhone>
478
           <AchievePhone user={userInfo.person} onCancel={this.handeAuthPhoneFail} onSuccess={this.handleAuthPhoneSuccess}></AchievePhone>
489
         }
479
         }
490
-        {
491
-          // !showAuthPhone && visibleConfirmModal && (
492
-          //   <View className="modal">
493
-          //     <View className="modal-mask" onClick={this.hideModal}></View>
494
-          //     <View className="modal-body">
495
-          //       <View className="modal-body__con">请确认是否成为他的客户?</View>
496
-          //       {
497
-          //         hadPhone ? (
498
-          //           <Button onClick={this.handleModalConfirm} className='modal-body__btn'>确认</Button>
499
-          //         ) : (
500
-          //             <Button open-type="getPhoneNumber" onGetphonenumber={this.handleGetPhone} className='modal-body__btn'>确认</Button>
501
-          //           )
502
-          //       }
503
-          //     </View>
504
-          //   </View>
505
-          // )
506
-        }
507
 
480
 
508
         {this.state.loaded && (
481
         {this.state.loaded && (
509
           <View className='mycard'>
482
           <View className='mycard'>

+ 20
- 5
src/pages/news/detail/index.js View File

8
 import Notice from '@components/Notice'
8
 import Notice from '@components/Notice'
9
 import { getMiniQrcode, savePoint, updatePoint } from '@services/common'
9
 import { getMiniQrcode, savePoint, updatePoint } from '@services/common'
10
 import { getDownloadURL, transferImage } from '@utils/tools'
10
 import { getDownloadURL, transferImage } from '@utils/tools'
11
+import { getQrCodeParams } from '@utils/qrcode'
11
 import {
12
 import {
12
   addNewsUv,
13
   addNewsUv,
13
   favorNews,
14
   favorNews,
41
       console.info('news-1:', router)
42
       console.info('news-1:', router)
42
       console.info('news-2:', this.$router)
43
       console.info('news-2:', this.$router)
43
 
44
 
44
-      const newsId = this.$router.params.id || router.query.id || '16'
45
+      const newsId = this.$router.params.id || router.query.id
45
 
46
 
46
-      this.setState({ newsId }, () => {
47
-        this.loadDetail()
48
-        addNewsUv(newsId)
49
-      })
47
+      if (!newsId) {
48
+        getQrCodeParams(this.$router.params.scene).then(res => {
49
+          this.setState({ newsId: res.id }, () => {
50
+            this.loadDetail()
51
+            addNewsUv(res.id)
52
+          })
53
+        }).catch(err => {
54
+          Taro.showToast({
55
+            title: '没有找到资讯',
56
+            icon: 'none'
57
+          })
58
+        })
59
+      } else {
60
+        this.setState({ newsId }, () => {
61
+          this.loadDetail()
62
+          addNewsUv(newsId)
63
+        })
64
+      }
50
     })
65
     })
51
   }
66
   }
52
 
67
 

+ 2
- 0
src/pages/project/index.js View File

60
       this.loadOpenScreenBanner()
60
       this.loadOpenScreenBanner()
61
       this.getLocation()
61
       this.getLocation()
62
 
62
 
63
+      Taro.setNavigationBarTitle({ title: this.props.userInfo.miniApp.name })
64
+
63
       savePoint({
65
       savePoint({
64
         event: 'index',
66
         event: 'index',
65
         eventType: 'main',
67
         eventType: 'main',