瀏覽代碼

Merge branch 'v3.5.1' into dev

张延森 5 年之前
父節點
當前提交
b34d41c75b

+ 3
- 0
.vscode/settings.json 查看文件

1
+{
2
+  "editor.fontFamily": "'Cascadia Code', Consolas, 'Courier New', monospace"
3
+}

+ 7
- 2
config/dev.js 查看文件

5
   defineConstants: {
5
   defineConstants: {
6
     // HOST: '"http://47.101.36.130:8085"',//测试
6
     // HOST: '"http://47.101.36.130:8085"',//测试
7
     // WSS_HOST: '"wss://47.101.36.130:8085"',
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
     // HOST: '"https://lt.pawoma.cn"',
10
     // HOST: '"https://lt.pawoma.cn"',
11
     // WSS_HOST: '"wss://lt.pawoma.cn"',
11
     // WSS_HOST: '"wss://lt.pawoma.cn"',
12
+<<<<<<< HEAD
12
     // HOST: '"http://192.168.2.52:8080"',
13
     // HOST: '"http://192.168.2.52:8080"',
13
     // WSS_HOST: '"ws://192.168.2.52:8080"',
14
     // WSS_HOST: '"ws://192.168.2.52:8080"',
15
+=======
16
+    HOST: '"http://127.0.0.1:8080"',
17
+    WSS_HOST: '"ws://127.0.0.1:8080"',
18
+>>>>>>> v3.5.1
14
   },
19
   },
15
   weapp: {},
20
   weapp: {},
16
   h5: {}
21
   h5: {}

+ 4
- 4
config/prod.js 查看文件

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

+ 2
- 2
project.config.json 查看文件

1
 {
1
 {
2
 	"miniprogramRoot": "dist/",
2
 	"miniprogramRoot": "dist/",
3
 	"projectname": "mini-chengjiao",
3
 	"projectname": "mini-chengjiao",
4
-	"description": "知与行联调",
5
-	"appid": "wxd9ee3a9480a4e544",
4
+	"description": "知与行互动",
5
+	"appid": "wxd6f47a9bb3052175",
6
 	"setting": {
6
 	"setting": {
7
 		"urlCheck": false,
7
 		"urlCheck": false,
8
 		"es6": false,
8
 		"es6": false,

+ 1
- 1
src/app.js 查看文件

182
   }
182
   }
183
 
183
 
184
   initData () {
184
   initData () {
185
-    console.info('app componentDidShow')
185
+    // console.info('app componentDidShow')
186
     console.info('router1', this.$router.params)
186
     console.info('router1', this.$router.params)
187
     console.info('ready status1', ready)
187
     console.info('ready status1', ready)
188
 
188
 

+ 106
- 44
src/components/TimeTicker/index.jsx 查看文件

1
 import Taro from '@tarojs/taro'
1
 import Taro from '@tarojs/taro'
2
 import dayjs from 'dayjs'
2
 import dayjs from 'dayjs'
3
-
4
-// 未开始
5
-const STATUS_READY = -1
6
-
7
-// 进行中
8
-const STATUS_PROCESSING = 0
9
-
10
-// 已结束
11
-const STATUS_OVER = 1
3
+import {
4
+  STATUS_READY,
5
+  STATUS_PROCESSING,
6
+  STATUS_OVER,
7
+  getPreText,
8
+  getTkText,
9
+  isFunction,
10
+} from './utils'
12
 
11
 
13
 export default class TimeTicker extends Taro.Component {
12
 export default class TimeTicker extends Taro.Component {
13
+  static options = {
14
+    addGlobalClass: true
15
+  }
14
 
16
 
15
   state = {
17
   state = {
16
     status: STATUS_READY,
18
     status: STATUS_READY,
23
   timer = null
25
   timer = null
24
 
26
 
25
   componentWillMount() {
27
   componentWillMount() {
28
+    this.computeProps(this.props)
29
+  }
26
 
30
 
31
+  componentWillReceiveProps(nextProps) {
32
+    this.computeProps(nextProps)
33
+  }
27
 
34
 
35
+  componentWillUnmount() {
36
+    if (this.timer) {
37
+      clearInterval(this.timer)
38
+    }
28
   }
39
   }
29
 
40
 
30
   computeProps(props) {
41
   computeProps(props) {
44
 
55
 
45
     if (!t1 || !t2) {
56
     if (!t1 || !t2) {
46
       // 只设置了一个时间
57
       // 只设置了一个时间
47
-      targetTime = t1 ? dayjs(t1).valueOf() : dayjs(t2).valueOf()
48
-
49
-      if (now > targetTime) {
50
-        status = STATUS_OVER
51
-      } else if (now === targetTime) {
52
-        status = STATUS_PROCESSING
53
-      } else {
54
-        status = STATUS_READY
55
-      }
58
+      tmEnd = tmStart = t1 ? dayjs(t1).valueOf() : dayjs(t2).valueOf()
56
     } else {
59
     } else {
57
       // 设置了时间区间
60
       // 设置了时间区间
58
-      const dtStart = dayjs(t1).valueOf()
59
-      const dtEnd = dayjs(t2).valueOf()
60
-
61
-      if (dtStart > now) {
62
-        status = STATUS_READY
63
-        targetTime = dtStart
64
-      } else if (dtStart <= now && now < dtEnd) {
65
-        status = STATUS_PROCESSING
66
-        targetTime = dtEnd
67
-      } else {
68
-        status = STATUS_OVER
69
-        targetTime = dtEnd
70
-      }
61
+      tmStart = dayjs(t1).valueOf()
62
+      tmEnd = dayjs(t2).valueOf()
71
     }
63
     }
72
 
64
 
73
-    this.setState({ status, targetTime }, this.startTimer.bind(this))
65
+    if (tmStart > now) {
66
+      status = STATUS_READY
67
+    } else if (tmStart <= now && now < tmEnd) {
68
+      status = STATUS_PROCESSING
69
+    } else {
70
+      status = STATUS_OVER
71
+    }
72
+
73
+    this.setState({ status, tmStart, tmEnd }, () => this.startTimer(props))
74
   }
74
   }
75
 
75
 
76
-  startTimer = (props) => {
76
+  computeStatus(props) {
77
     const {
77
     const {
78
-      status,
79
-      targetTime,
80
-      interval = 1000,
81
       onStart,
78
       onStart,
82
       onProcess,
79
       onProcess,
83
       onEnd,
80
       onEnd,
84
     } = props || {}
81
     } = props || {}
85
 
82
 
86
-    if (this.timer) {
87
-      clearInterval(this.timer)
83
+    let {
84
+      status,
85
+      tmStart,
86
+      tmEnd,
87
+      preText,
88
+      tkText,
89
+    } = this.state
90
+
91
+    const now = dayjs().valueOf()
92
+    const diff = status === STATUS_READY ? tmStart - now : tmEnd - now
93
+
94
+    if (diff <= 0) {
95
+      if (status === STATUS_READY) {
96
+        status = tmStart === tmEnd ? STATUS_OVER : STATUS_PROCESSING
97
+        
98
+        if (isFunction(onStart)) {
99
+          [preText, tkText] = onStart()
100
+        }
101
+      } else {
102
+        status = STATUS_OVER
103
+        if (this.timer) {
104
+          clearInterval(this.timer)
105
+        }
106
+
107
+        if (isFunction(onEnd)) {
108
+          [preText, tkText] = onEnd()
109
+        }
110
+      }
111
+    } else {
112
+      if (isFunction(onProcess)) {
113
+        [preText, tkText] = onProcess(diff, status)
114
+      }
88
     }
115
     }
89
 
116
 
90
-    this.timer = setInterval(() => {
91
-      const now = dayjs().valueOf()
92
-      const diff = targetTime - now
117
+    if (preText === undefined) {
118
+      preText = getPreText(diff, status)
119
+    }
120
+    
121
+    if (tkText === undefined) {
122
+      tkText = getTkText(diff, status)
123
+    }
93
 
124
 
125
+    this.setState({ status, preText, tkText })
126
+  }
94
 
127
 
128
+  startTimer = (props) => {
129
+    const { interval = 1000 } = props || {}
95
 
130
 
96
-    }, interval)
131
+    if (this.timer) {
132
+      clearInterval(this.timer)
133
+    }
97
 
134
 
135
+    // 立即执行一次
136
+    this.computeStatus(props);
137
+    // 再循环执行
138
+    this.timer = setInterval(() => this.computeStatus(props), interval)
98
   }
139
   }
99
 
140
 
100
-  render() {
101
-    
102
 
141
 
103
 
142
 
143
+  classNames = (...args) => {
144
+    return (args || []).reduce((cls, item) => {
145
+      return [].concat(cls).concat(item)
146
+    }, []).filter(x => x).join(' ')
147
+  }
148
+
149
+  render() {
150
+    const wrapperCls = this.classNames('tk-box', this.props.className)
151
+    const headerCls = this.classNames('tk-box-header', this.props.headerClass)
152
+    const bodyCls = this.classNames('tk-box-body', this.props.bodyClass)
153
+
154
+    return (
155
+      <View className={wrapperCls}>
156
+        {
157
+          this.state.preText &&
158
+          (<Text className={headerCls}>{this.state.preText}</Text>)
159
+        }        
160
+        {
161
+          this.state.tkText &&
162
+          (<Text className={bodyCls}>{this.state.tkText}</Text>)
163
+        }        
164
+      </View>
165
+    );
104
   }
166
   }
105
 }
167
 }

+ 23
- 0
src/components/TimeTicker/utils.js 查看文件

1
+
2
+import { formateLeftTime } from '@utils/tools'
3
+
4
+// 未开始
5
+export const STATUS_READY = -1
6
+
7
+// 进行中
8
+export const STATUS_PROCESSING = 0
9
+
10
+// 已结束
11
+export const STATUS_OVER = 1
12
+
13
+export function getPreText(tk, status) {
14
+  return status === STATUS_OVER ? '已结束' : `距离 ${status === STATUS_READY ? '开始' : '结束'} 还有: `
15
+}
16
+
17
+export function getTkText(tk, status) {
18
+  return status === STATUS_OVER ? '' : formateLeftTime(tk)
19
+}
20
+
21
+export function isFunction(fn) {
22
+  return typeof fn === 'function'
23
+}

+ 19
- 10
src/pages/activity/detail/assemble.js 查看文件

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
 
684
       </Block>
693
       </Block>
685
     )
694
     )
686
   }
695
   }
687
-}
696
+}

+ 19
- 9
src/pages/activity/detail/assistance.js 查看文件

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
 
650
       </View>
660
       </View>
651
     )
661
     )
652
   }
662
   }
653
-}
663
+}

+ 20
- 4
src/pages/activity/detail/index.js 查看文件

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 查看文件

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 查看文件

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
 

+ 22
- 5
src/pages/project/detail/index.js 查看文件

22
 import ready from '@utils/ready'
22
 import ready from '@utils/ready'
23
 import Notice from '@components/Notice'
23
 import Notice from '@components/Notice'
24
 import { getDownloadURL, transferImage, sceneInShare } from '@utils/tools'
24
 import { getDownloadURL, transferImage, sceneInShare } from '@utils/tools'
25
+import { getQrCodeParams } from '@utils/qrcode'
25
 import { connect } from '@tarojs/redux'
26
 import { connect } from '@tarojs/redux'
26
 import { dispatchProjectDetail } from '@actions/project'
27
 import { dispatchProjectDetail } from '@actions/project'
27
 import getUserPhone from '@utils/getUserPhone'
28
 import getUserPhone from '@utils/getUserPhone'
79
         })
80
         })
80
       }
81
       }
81
 
82
 
82
-      this.initPageData()
83
+      
84
+      const router = Taro.getStorageSync('router')
85
+      const id = this.$router.params.id || router.query.id
86
+
87
+      // 没有找到 id , 再重新找一次
88
+      if (!id) {
89
+        getQrCodeParams(this.$router.params.scene).then(res => {
90
+          this.initPageData(res.id)
91
+        }).catch(err => {
92
+          Taro.showToast({
93
+            title: '没有找到项目',
94
+            icon: 'none'
95
+          })
96
+        })
97
+      } else {
98
+        this.initPageData(id)
99
+      }
83
     })
100
     })
84
   }
101
   }
85
 
102
 
88
     recordId && updatePoint(recordId)
105
     recordId && updatePoint(recordId)
89
   }
106
   }
90
 
107
 
91
-  initPageData () {
92
-    const router = Taro.getStorageSync('router')
93
-    const id = this.$router.params.id || router.query.id
108
+  initPageData (id) {
109
+    console.log('----项目ID---->', id)
110
+
94
     // const id='82b54f4a1f5b981df572253792afbfa1' 
111
     // const id='82b54f4a1f5b981df572253792afbfa1' 
95
     this.setState({
112
     this.setState({
96
       buildingId: id
113
       buildingId: id
502
       return
519
       return
503
     }
520
     }
504
 
521
 
505
-    this.initPageData()
522
+    this.initPageData(this.state.buildingId)
506
   }
523
   }
507
 
524
 
508
   renderBottomMenu () {
525
   renderBottomMenu () {

+ 2
- 0
src/pages/project/index.js 查看文件

57
     ready.queue(() => {
57
     ready.queue(() => {
58
       this.getLocation()
58
       this.getLocation()
59
 
59
 
60
+      Taro.setNavigationBarTitle({ title: this.props.userInfo.miniApp.name })
61
+
60
       savePoint({
62
       savePoint({
61
         event: 'index',
63
         event: 'index',
62
         eventType: 'main',
64
         eventType: 'main',