Преглед на файлове

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

许静 преди 5 години
родител
ревизия
90d5d9c050

+ 6
- 2
src/app.js Целия файл

164
         console.info('router2:', router)
164
         console.info('router2:', router)
165
         console.info('-----------')
165
         console.info('-----------')
166
         const { query: payload } = router
166
         const { query: payload } = router
167
+
168
+        payload.path = router.path
169
+        payload.scene = router.scene
170
+
167
         // login
171
         // login
168
         login(payload, res => {
172
         login(payload, res => {
169
           // 获取未读消息
173
           // 获取未读消息
209
   componentDidMount() {
213
   componentDidMount() {
210
     console.info('app componentDidMount')
214
     console.info('app componentDidMount')
211
   }
215
   }
212
-  componentWillMount() {
213
-    console.info('app componentWillMount')
216
+  componentWillMount(params) {
217
+    console.info('app componentWillMount', params)
214
   }
218
   }
215
 
219
 
216
   getRouterParams() {
220
   getRouterParams() {

+ 2
- 2
src/pages/activity/detail/poster.js Целия файл

67
         fontSize: 30,
67
         fontSize: 30,
68
         color: 'black',
68
         color: 'black',
69
         baseLine: 'middle',
69
         baseLine: 'middle',
70
-        lineNum: 2,
70
+        lineNum: 1,
71
         lineHeight: 48,
71
         lineHeight: 48,
72
         // textAlign: 'center',
72
         // textAlign: 'center',
73
         width: 560,
73
         width: 560,
80
         fontSize: 28,
80
         fontSize: 28,
81
         color: '#999',
81
         color: '#999',
82
         baseLine: 'middle',
82
         baseLine: 'middle',
83
-        lineNum: 2,
83
+        lineNum: 1,
84
         lineHeight: 48,
84
         lineHeight: 48,
85
         width: 560,
85
         width: 560,
86
         zIndex: 999
86
         zIndex: 999

+ 29
- 2
src/pages/card/index.js Целия файл

8
 import getUserPhone from '@utils/getUserPhone'
8
 import getUserPhone from '@utils/getUserPhone'
9
 import AchievePhone from '@components/achievePhone'
9
 import AchievePhone from '@components/achievePhone'
10
 import ready from '@utils/ready'
10
 import ready from '@utils/ready'
11
+import { sceneInShare } from '@utils/tools'
11
 
12
 
12
 import { ROLE_CODE } from '@constants/user'
13
 import { ROLE_CODE } from '@constants/user'
13
 import { addCardUv, addCardShareNum, favorCard, cancelFavorCard } from '@services/card'
14
 import { addCardUv, addCardShareNum, favorCard, cancelFavorCard } from '@services/card'
42
 
43
 
43
   componentWillMount() {
44
   componentWillMount() {
44
     ready.queue(() => {
45
     ready.queue(() => {
46
+
47
+      // 分享场景需要先授权手机, 再授权头像
48
+      const options = wx.getLaunchOptionsSync()
49
+      if (sceneInShare(options.scene)) {
50
+        const { person = {} } = this.props.userInfo || {}
51
+        if ((person.tel || person.phone) && (person.avatarurl || '').indexOf('wx.qlogo.cn') === -1) {
52
+          Taro.reLaunch({ url: '/pages/auth/index' })
53
+          return
54
+        }
55
+
56
+        this.setState({
57
+          grantPhoneVisible: true,
58
+        })
59
+      }
60
+
45
       this.initPageData()
61
       this.initPageData()
46
     })
62
     })
47
   }
63
   }
48
   initPageData() {
64
   initPageData() {
49
     const router = Taro.getStorageSync('router')
65
     const router = Taro.getStorageSync('router')
50
-    const id = this.$router.params.id || router.query.id || '4604a792d575eb8187711625bd88832c'
66
+    const id = this.$router.params.id || router.query.id
51
 
67
 
52
     if (router.query.id) {
68
     if (router.query.id) {
53
       this.setState({
69
       this.setState({
402
       modalStatus: false
418
       modalStatus: false
403
     })
419
     })
404
   }
420
   }
421
+  
422
+  handleAuthPhoneSuccess = () => {
423
+    const { person = {} } = this.props.userInfo || {}
424
+    if ((person.avatarurl || '').indexOf('wx.qlogo.cn') === -1) {
425
+      Taro.reLaunch({ url: '/pages/auth/index' })
426
+      return
427
+    }
428
+
429
+    this.initPageData()
430
+  }
431
+
405
   render() {
432
   render() {
406
     const { makePosterStatus, posterData, modalStatus, grantPhoneVisible } = this.state
433
     const { makePosterStatus, posterData, modalStatus, grantPhoneVisible } = this.state
407
     const { userInfo, cardInfo, projectDetail } = this.props
434
     const { userInfo, cardInfo, projectDetail } = this.props
423
         {makePosterStatus && (<Poster data={posterData} toggle={this.toggleVisiblePoster}></Poster>)}
450
         {makePosterStatus && (<Poster data={posterData} toggle={this.toggleVisiblePoster}></Poster>)}
424
         {
451
         {
425
           (grantPhoneVisible && userInfo.person.personId && !userInfo.person.phone) &&
452
           (grantPhoneVisible && userInfo.person.personId && !userInfo.person.phone) &&
426
-          <AchievePhone user={userInfo.person} onSuccess={this.initPageData}></AchievePhone>
453
+          <AchievePhone user={userInfo.person} onSuccess={this.handleAuthPhoneSuccess}></AchievePhone>
427
         }
454
         }
428
         {
455
         {
429
           visibleConfirmModal && (
456
           visibleConfirmModal && (

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

67
         fontSize: 30,
67
         fontSize: 30,
68
         color: 'black',
68
         color: 'black',
69
         baseLine: 'middle',
69
         baseLine: 'middle',
70
-        lineNum: 2,
70
+        lineNum: 1,
71
         lineHeight: 48,
71
         lineHeight: 48,
72
         // textAlign: 'center',
72
         // textAlign: 'center',
73
         width: 560,
73
         width: 560,
80
         fontSize: 28,
80
         fontSize: 28,
81
         color: '#999',
81
         color: '#999',
82
         baseLine: 'middle',
82
         baseLine: 'middle',
83
-        lineNum: 2,
83
+        lineNum: 1,
84
         lineHeight: 48,
84
         lineHeight: 48,
85
         width: 560,
85
         width: 560,
86
         zIndex: 999
86
         zIndex: 999

+ 13
- 6
src/pages/project/album/index.js Целия файл

24
 
24
 
25
 
25
 
26
   componentWillMount () {
26
   componentWillMount () {
27
-    const { id = '369b7d7e5bc6e6b91f2e8f5e775035e2' } = this.$router.params
28
-    const { projectDetail: { buildingId }, dispatchProjectDetail } = this.props
29
 
27
 
28
+
29
+    const { id = '369b7d7e5bc6e6b91f2e8f5e775035e2', current } = this.$router.params
30
+    const { projectDetail: { buildingId }, dispatchProjectDetail } = this.props
31
+    if (current) {
32
+      this.setState({
33
+        current,
34
+      })
35
+    }
30
     if (!buildingId) {
36
     if (!buildingId) {
31
       dispatchProjectDetail(id)
37
       dispatchProjectDetail(id)
32
     }
38
     }
59
     const { projectDetail: { buildingApartment = [] } } = this.props
65
     const { projectDetail: { buildingApartment = [] } } = this.props
60
     const list = buildingApartment.filter(item => item.apartmentType === 'photo')
66
     const list = buildingApartment.filter(item => item.apartmentType === 'photo')
61
     const listimg = list.filter(item => item.buildingImgList.length > 0)
67
     const listimg = list.filter(item => item.buildingImgList.length > 0)
62
-    console.log(listimg, '--------------')
68
+
63
     const { current } = this.state
69
     const { current } = this.state
64
     const imgList = (listimg[current] || {}).buildingImgList || []
70
     const imgList = (listimg[current] || {}).buildingImgList || []
71
+
65
     let _photosImgs = imgList.map(img => img.url)
72
     let _photosImgs = imgList.map(img => img.url)
66
 
73
 
67
     return (
74
     return (
68
       <View className='photos'>
75
       <View className='photos'>
69
         <View className="around-tab">
76
         <View className="around-tab">
77
+          {console.log(listimg, '-----listimg---------')}
78
+          {console.log(imgList, '-------imgList-------')}
70
           {listimg.map((item, index) => {
79
           {listimg.map((item, index) => {
71
             const { apartmentName } = item || {}
80
             const { apartmentName } = item || {}
72
             const buildingImgList = item.buildingImgList || []
81
             const buildingImgList = item.buildingImgList || []
76
             return (
85
             return (
77
               <View
86
               <View
78
                 key={current}
87
                 key={current}
79
-                className={`around-tab__item ${current === index ? 'active' : ''}`}
88
+                className={`around-tab__item ${current == index ? 'active' : ''}`}
80
                 onClick={() => this.setState({ current: index })}
89
                 onClick={() => this.setState({ current: index })}
81
               >
90
               >
82
                 {buildingImgList.length > 0 && <View className="around-tab-text"> {`${apartmentName}(${buildingImgList.length})`} </View>}
91
                 {buildingImgList.length > 0 && <View className="around-tab-text"> {`${apartmentName}(${buildingImgList.length})`} </View>}
83
               </View>
92
               </View>
84
             )
93
             )
85
 
94
 
86
-
87
-
88
           })}
95
           })}
89
         </View>
96
         </View>
90
         <View className='photos__item'>
97
         <View className='photos__item'>

+ 47
- 68
src/pages/project/detail/index.js Целия файл

21
 import 'dayjs/locale/zh-cn' // 按需加载
21
 import 'dayjs/locale/zh-cn' // 按需加载
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, getThumbnail } from '@utils/tools'
24
+import { getDownloadURL, getThumbnail, sceneInShare } from '@utils/tools'
25
 import { connect } from '@tarojs/redux'
25
 import { connect } from '@tarojs/redux'
26
 import { dispatchProjectDetail } from '@actions/project'
26
 import { dispatchProjectDetail } from '@actions/project'
27
 import getUserPhone from '@utils/getUserPhone'
27
 import getUserPhone from '@utils/getUserPhone'
62
   }
62
   }
63
 
63
 
64
   componentWillMount() {
64
   componentWillMount() {
65
-    // const { id = '78c3dd489791dc1d29472fa344b08c45' } = this.$router.params
66
-
67
     ready.queue(() => {
65
     ready.queue(() => {
66
+    
67
+      // 分享场景需要先授权手机, 再授权头像
68
+      const options = wx.getLaunchOptionsSync()
69
+      if (sceneInShare(options.scene)) {
70
+        const { person = {} } = this.props.userInfo || {}
71
+        if ((person.tel || person.phone) && (person.avatarurl || '').indexOf('wx.qlogo.cn') === -1) {
72
+          Taro.reLaunch({ url: '/pages/auth/index' })
73
+          return
74
+        }
75
+
76
+        this.setState({
77
+          grantPhoneVisible: true,
78
+        })
79
+      }
80
+
68
       this.initPageData()
81
       this.initPageData()
69
     })
82
     })
70
   }
83
   }
102
       })
115
       })
103
     })
116
     })
104
   }
117
   }
105
-  componentDidMount() {
106
-    const options = wx.getLaunchOptionsSync()
107
-    const sceneList = [1011, 1012, 1013, 1031, 1032, 1036, 1047, 1048]
108
-
109
-    if (sceneList.indexOf(options.scene) != -1) {
110
-      this.setState({
111
-        grantPhoneVisible: true,
112
-      })
113
-    }
114
-  }
115
 
118
 
116
   loadHelpGroupList() {
119
   loadHelpGroupList() {
117
     const { buildingId } = this.state
120
     const { buildingId } = this.state
169
     queryActivityList(payload).then(res => {
172
     queryActivityList(payload).then(res => {
170
       console.log(res, 'Activity')
173
       console.log(res, 'Activity')
171
       this.setState({
174
       this.setState({
172
-        activityList: res || []
175
+        activityList: res.list || []
173
       })
176
       })
174
     })
177
     })
175
   }
178
   }
242
     })
245
     })
243
   }
246
   }
244
 
247
 
245
-  toViewAlbum() {
248
+  toViewAlbum (index){
246
     const { buildingId } = this.state
249
     const { buildingId } = this.state
247
-    this.navigateTo(`/pages/project/album/index?id=${buildingId}`)
250
+    console.log('1111111',index)
251
+    this.navigateTo(`/pages/project/album/index?id=${buildingId}&current=${index}` )
248
   }
252
   }
249
 
253
 
250
   onViewFans() {
254
   onViewFans() {
488
     })
492
     })
489
   }
493
   }
490
 
494
 
495
+  handleAuthPhoneSuccess = () => {
496
+    const { person = {} } = this.props.userInfo || {}
497
+    if ((person.avatarurl || '').indexOf('wx.qlogo.cn') === -1) {
498
+      Taro.reLaunch({ url: '/pages/auth/index' })
499
+      return
500
+    }
501
+
502
+    this.initPageData()
503
+  }
504
+
491
   renderBottomMenu() {
505
   renderBottomMenu() {
492
     const { userInfo: { person: { personType } } } = this.props
506
     const { userInfo: { person: { personType } } } = this.props
493
     const { posterShow } = this.state
507
     const { posterShow } = this.state
611
             <View className='photos__type'>
625
             <View className='photos__type'>
612
               <View className='photos__type__title'>相册</View>
626
               <View className='photos__type__title'>相册</View>
613
               <ScrollView scrollX>
627
               <ScrollView scrollX>
614
-                <View className='photos__type__content' onClick={this.toViewAlbum}>
628
+                <View className='photos__type__content' >
615
 
629
 
616
                   <View className="around-tab">
630
                   <View className="around-tab">
617
                     {listimg.map((item, index) => {
631
                     {listimg.map((item, index) => {
622
                       console.log(buildingImgUrl, 'buildingImgUrl')
636
                       console.log(buildingImgUrl, 'buildingImgUrl')
623
 
637
 
624
                       // if (buildingImgUrl != null) {
638
                       // if (buildingImgUrl != null) {
625
-                      return (<View key={index + "listimg"}>
639
+                      return ( <View key={index + "listimg"}>
626
                         {buildingImgUrl != null && (<View
640
                         {buildingImgUrl != null && (<View
627
                           style={{ marginRight: '8px' }}
641
                           style={{ marginRight: '8px' }}
642
+                          
628
                         >
643
                         >
629
 
644
 
630
                           <View>
645
                           <View>
631
-                            <Image className='albumimg' src={getThumbnail(buildingImgList[0].url)} ></Image>
646
+                            <Image className='albumimg' src={getThumbnail(buildingImgList[0].url)} onClick={()=>this.toViewAlbum(index)}></Image>
632
                             <View style={{ width: '218rpx', display: 'flex', justifyContent: 'center' }} >
647
                             <View style={{ width: '218rpx', display: 'flex', justifyContent: 'center' }} >
633
                               <View style={{ overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}> {apartmentName}  </View>
648
                               <View style={{ overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}> {apartmentName}  </View>
634
                               <View> ({buildingImgList.length})</View>
649
                               <View> ({buildingImgList.length})</View>
635
                             </View>
650
                             </View>
636
                           </View>
651
                           </View>
637
-                        </View>)}</View>
652
+                        </View>)}
653
+                        </View>
638
                       )
654
                       )
639
                       // }
655
                       // }
640
 
656
 
851
     )
867
     )
852
   }
868
   }
853
   renderActivities() {
869
   renderActivities() {
854
-    // renderGroup () {
855
-    //   const { groupList } = this.state
856
-    //   return (
857
-    //     <Block>
858
-    //       {groupList.length > 0 &&
859
-    //         <View className="activity">
860
-    //           <View className="title">拼团活动</View>
861
-    //           <View
862
-    //             style={{ position: 'relative' }}>
863
-    //             <HelpGroupBanner
864
-    //               style={{ height: '250rpx' }}
865
-    //               indicatorDots={false}
866
-    //               list={groupList}
867
-    //               onClick={this.handleGroupClick}>
868
-    //             </HelpGroupBanner>
869
-    //           </View>
870
-    //         </View>
871
-    //       }
872
-    //     </Block>
873
-    //   )
874
-    // }
870
+
871
+ 
875
     const { activityList } = this.state
872
     const { activityList } = this.state
873
+   
876
     return (
874
     return (
877
       <Block>
875
       <Block>
878
         {
876
         {
879
           activityList.length > 0 && (
877
           activityList.length > 0 && (
880
             <View className="activity" >
878
             <View className="activity" >
881
-              {console.log(activityList, '----activityList-----')}
879
+           
882
               <View className="section-head">
880
               <View className="section-head">
883
-                <Text className="section-head__title">热门活动</Text>
884
-                <View className="section-head__more" onClick={this.handleActivityMoreClick}>
885
-                  更多活动<Text className="iconfont icon-more"></Text>
886
-                </View>
887
-              </View>
881
+                 <Text className="section-head__title" style={{margin: '10rpx 0 40rpx 35rpx'}}>热门活动</Text>
882
+                 <View className="section-head__more"  style={{marginRight: '20rpx'}} onClick={this.handleActivityMoreClick}>
883
+                   更多活动<Text className="iconfont icon-more"></Text>
884
+                 </View>
885
+               </View>
888
               <View
886
               <View
889
                 style={{ position: 'relative' }}>
887
                 style={{ position: 'relative' }}>
890
                 <HelpGroupBanner
888
                 <HelpGroupBanner
899
 
897
 
900
               </View>
898
               </View>
901
             </View>
899
             </View>
902
-            // <View classN                                                                                                                                                                                                                                                                                                                                                                                                                                                    ame="house-type">
903
-            //   <View className="section-head">
904
-            //     <Text className="section-head__title">热门活动</Text>
905
-            //     <View className="section-head__more" onClick={this.handleActivityMoreClick}>
906
-            //       更多活动<Text className="iconfont icon-more"></Text>
907
-            //     </View>
908
-            //   </View>
909
-            //   <ScrollView scrollX>
910
-            //     <View className="house-type__list" style="margin-top:10px">
911
-            //       {
912
-            //         activityList.map(item => (
913
-            //           <View className="news-item" key={item.dynamicId} onClick={this.handActivityItemClick.bind(this, item.dynamicId)}>
914
-            //             <Image mode="widthFix" src={getThumbnail(item.imgUrl)} className="news-item__pic"></Image>
915
-            //             <View className="news-item__title">{item.title}</View>
916
-            //           </View>
917
-            //         ))
918
-            //       }
919
-            //     </View>
920
-            //   </ScrollView>
921
-            // </View>
900
+      
922
           )
901
           )
923
         }
902
         }
924
       </Block>
903
       </Block>
1045
       <Block>
1024
       <Block>
1046
         {
1025
         {
1047
           (grantPhoneVisible && userInfo.person.personId && !userInfo.person.phone) &&
1026
           (grantPhoneVisible && userInfo.person.personId && !userInfo.person.phone) &&
1048
-          <AchievePhone user={userInfo.person} onSuccess={this.initPageData}></AchievePhone>
1027
+          <AchievePhone user={userInfo.person} onSuccess={this.handleAuthPhoneSuccess}></AchievePhone>
1049
         }
1028
         }
1050
         {
1029
         {
1051
           loaded && (
1030
           loaded && (

+ 2
- 1
src/pages/project/detail/poster.js Целия файл

70
         fontSize: 28,
70
         fontSize: 28,
71
         color: '#999',
71
         color: '#999',
72
         baseLine: 'middle',
72
         baseLine: 'middle',
73
-        lineNum: 2,
73
+        lineNum: 1,
74
         lineHeight: 48,
74
         lineHeight: 48,
75
         // textAlign: 'center',
75
         // textAlign: 'center',
76
         width: 560,
76
         width: 560,
117
         color: '#999',
117
         color: '#999',
118
         baseLine: 'middle',
118
         baseLine: 'middle',
119
         lineHeight: 48,
119
         lineHeight: 48,
120
+        lineNum: 1,
120
         width: 150,
121
         width: 150,
121
         zIndex: 11
122
         zIndex: 11
122
       },
123
       },

+ 1
- 1
src/pages/shop/record/index.js Целия файл

74
 									<Image className="botttom_img" mode="aspectFill" src={item.image} />
74
 									<Image className="botttom_img" mode="aspectFill" src={item.image} />
75
 									<View className="bottom-right">
75
 									<View className="bottom-right">
76
 										<View className="bottom-right-top">
76
 										<View className="bottom-right-top">
77
-											<View className="product-name">{item.targetName}</View>
77
+											<View className="product-name" style={{ overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap',width:'300rpx' }}>{item.targetName}</View>
78
 											<View className="product-score">{item.points}积分</View>
78
 											<View className="product-score">{item.points}积分</View>
79
 										</View>
79
 										</View>
80
 										<View className="bottom-right-down">领取地址:{item.address}</View>
80
 										<View className="bottom-right-down">领取地址:{item.address}</View>

+ 1
- 0
src/pages/shop/record/index.scss Целия файл

61
 					width: 100%;
61
 					width: 100%;
62
 					display: flex;
62
 					display: flex;
63
 					justify-content: space-between;
63
 					justify-content: space-between;
64
+			
64
 					.product-score{
65
 					.product-score{
65
 						color:rgba(255,59,51,1);
66
 						color:rgba(255,59,51,1);
66
 					}
67
 					}

+ 17
- 4
src/utils/login.js Целия файл

2
 import { getStore } from '@tarojs/redux'
2
 import { getStore } from '@tarojs/redux'
3
 import { USER_INFO } from '@constants/user'
3
 import { USER_INFO } from '@constants/user'
4
 import { wxLogin } from '@services/login'
4
 import { wxLogin } from '@services/login'
5
+import { sceneInShare } from '@utils/tools'
5
 import ready from '@utils/ready'
6
 import ready from '@utils/ready'
6
 let loading = false
7
 let loading = false
7
-export default function (params, callback) {
8
+export default function (payload, callback) {
9
+  const { path, scene, ...params } = payload
10
+
8
   if (loading) {
11
   if (loading) {
9
     return
12
     return
10
   }
13
   }
34
           callback && callback(data)
37
           callback && callback(data)
35
 
38
 
36
         } else {
39
         } else {
37
-          Taro.reLaunch({
38
-            url: '/pages/auth/index'
39
-          })
40
+
41
+          // 非扫码进入项目详情或者卡片主页, 跳转到授权头像
42
+          // 否则不跳
43
+          const noAuthPages = [
44
+            'pages/project/detail/index',
45
+            'pages/card/index',
46
+          ]
47
+
48
+          if (noAuthPages.indexOf(path) === -1 || !sceneInShare(scene)) {
49
+            Taro.reLaunch({
50
+              url: '/pages/auth/index'
51
+            })
52
+          }
40
         }
53
         }
41
         ready.open()
54
         ready.open()
42
 
55
 

+ 12
- 0
src/utils/tools.js Целия файл

1
 import Taro from '@tarojs/taro';
1
 import Taro from '@tarojs/taro';
2
 
2
 
3
+/**
4
+ * 是否分享场景(含扫码)
5
+ * @param {*} scene 
6
+ */
7
+export function sceneInShare(scene) {
8
+  return [1011, 1012, 1013, 1031, 1032, 1036, 1047, 1048].indexOf(scene) > -1
9
+}
10
+
11
+/**
12
+ * 造空数组
13
+ * @param {int}} n 
14
+ */
3
 export function times(n) {
15
 export function times(n) {
4
   return n > 0 ? '*'.repeat(n - 1).split('*') : []
16
   return n > 0 ? '*'.repeat(n - 1).split('*') : []
5
 }
17
 }