xujing преди 5 години
родител
ревизия
2bbd182a68
променени са 1 файла, в които са добавени 25 реда и са изтрити 2 реда
  1. 25
    2
      src/pages/news/detail/index.js

+ 25
- 2
src/pages/news/detail/index.js Целия файл

@@ -13,6 +13,7 @@ import { report as reportCustomer } from '@utils/customer'
13 13
 import { getCardDetail } from '@services/card'
14 14
 import { ROLE_CODE } from '@constants/user'
15 15
 import Consultant from '@components/consultant'
16
+import AchievePhone from '@components/achievePhone'
16 17
 // import AuthorizationComponent from '@components/authorizationComponent'
17 18
 // import { reportClient } from '@services/report'
18 19
 import {
@@ -51,6 +52,13 @@ export default class NewsDetail extends Component {
51 52
       console.info('news-1:', router)
52 53
       console.info('news-2:', this.$router)
53 54
 
55
+      const { person = {} } = this.props.userInfo || {}
56
+      console.log('-------person----->', person)
57
+      if ((person.tel || person.phone) && (person.avatarurl || '').indexOf('wx.qlogo.cn') === -1) {
58
+        Taro.reLaunch({ url: '/pages/auth/index' })
59
+        return
60
+      }
61
+
54 62
       const newsId = this.$router.params.id || router.query.id
55 63
 
56 64
       if (!newsId) {
@@ -73,6 +81,16 @@ export default class NewsDetail extends Component {
73 81
       }
74 82
     })
75 83
   }
84
+  handleAuthPhoneSuccess = () => {
85
+    const { person = {} } = this.props.userInfo || {}
86
+    if ((person.avatarurl || '').indexOf('wx.qlogo.cn') === -1) {
87
+      Taro.reLaunch({ url: '/pages/auth/index' })
88
+      return
89
+    }
90
+    const newsId = this.state
91
+    this.loadDetail()
92
+    addNewsUv(newsId)
93
+  }
76 94
 
77 95
   componentWillReceiveProps(nextProps) {
78 96
     this.reportClientFn()
@@ -314,10 +332,15 @@ export default class NewsDetail extends Component {
314 332
 
315 333
   render() {
316 334
     const { detail, loaded, isSaved, posterVisible, posterData, posterShow, consultData, consultShow } = this.state
317
-    const { userInfo: { person: { personId, nickname, name } } } = this.props
335
+    const { userInfo = { person: {} } } = this.props
336
+
318 337
     return (
319 338
       // <AuthorizationComponent>
320 339
       <Block>
340
+        {
341
+          (userInfo.person.personId && !userInfo.person.phone && !userInfo.person.tel) &&
342
+          <AchievePhone user={userInfo.person} onSuccess={this.handleAuthPhoneSuccess}></AchievePhone>
343
+        }
321 344
         {/* 生成海报 */}
322 345
         {posterVisible && (<Poster data={posterData} toggle={this.handleTogglePoster}></Poster>)}
323 346
         {
@@ -343,7 +366,7 @@ export default class NewsDetail extends Component {
343 366
               <Notice></Notice>
344 367
               <BackHomeBtn style={consultShow ? "bottom:310rpx" : ''}></BackHomeBtn>
345 368
               {
346
-                consultShow && <Consultant style="bottom:150rpx" smallStyle="bottom:178rpx" personId={personId} name={name || nickname} data={consultData}></Consultant>
369
+                consultShow && <Consultant style="bottom:150rpx" smallStyle="bottom:178rpx" personId={userInfo.person.personId} name={userInfo.person.name || userInfo.person.nickname} data={consultData}></Consultant>
347 370
               }
348 371
               <View className="bot-nav flex">
349 372
                 <View className='btn poster-btn' style={{ display: posterShow }} onClick={() => { this.handleTogglePoster(true) }}>