Browse Source

Merge branch 'main' of http://git.ycjcjy.com/marketing/miniapp into main

1002884655 3 years ago
parent
commit
20de9d0091

+ 1
- 1
config/dev.js View File

4
   },
4
   },
5
   defineConstants: {
5
   defineConstants: {
6
     // HOST: '"https://xlk.njyz.tech"',
6
     // HOST: '"https://xlk.njyz.tech"',
7
-    HOST: '"http://127.0.0.1:8567"',
7
+    HOST: '"http://127.0.0.1:8081"',
8
     WSS_HOST: '"wss://xlk.njyz.tech"',
8
     WSS_HOST: '"wss://xlk.njyz.tech"',
9
     OSS_PATH: '"https://xlk-assets.oss-accelerate.aliyuncs.com/"',
9
     OSS_PATH: '"https://xlk-assets.oss-accelerate.aliyuncs.com/"',
10
     OSS_FAST_PATH: '"https://xlk-assets.oss-accelerate.aliyuncs.com/"',
10
     OSS_FAST_PATH: '"https://xlk-assets.oss-accelerate.aliyuncs.com/"',

+ 1
- 1
config/prod.js View File

10
     OSS_PATH: '"https://xlk-assets.oss-accelerate.aliyuncs.com/"',
10
     OSS_PATH: '"https://xlk-assets.oss-accelerate.aliyuncs.com/"',
11
     OSS_FAST_PATH: '"https://xlk-assets.oss-accelerate.aliyuncs.com/"',
11
     OSS_FAST_PATH: '"https://xlk-assets.oss-accelerate.aliyuncs.com/"',
12
     ICON_FONT: '"https://yz-websit.oss-cn-hangzhou.aliyuncs.com/xlk/css/iconfont.ttf"',
12
     ICON_FONT: '"https://yz-websit.oss-cn-hangzhou.aliyuncs.com/xlk/css/iconfont.ttf"',
13
-    Version: '"V0.0.26-20210808"'
13
+    Version: '"V0.0.28-20210808"'
14
   },
14
   },
15
   mini: {},
15
   mini: {},
16
   h5: {
16
   h5: {

+ 1
- 1
project.config.json View File

2
 	"miniprogramRoot": "dist/",
2
 	"miniprogramRoot": "dist/",
3
 	"projectname": "miniapp",
3
 	"projectname": "miniapp",
4
 	"description": "",
4
 	"description": "",
5
-	"appid": "wxc96058d57e77f373",
5
+	"appid": "wxe44244d1a5ea3364",
6
 	"setting": {
6
 	"setting": {
7
 		"urlCheck": false,
7
 		"urlCheck": false,
8
 		"es6": false,
8
 		"es6": false,

+ 38
- 12
src/app.jsx View File

11
 
11
 
12
 class App extends Component {
12
 class App extends Component {
13
   // 是否登录
13
   // 是否登录
14
-  logged;
14
+  logged = false;
15
+
15
   // 更新埋点
16
   // 更新埋点
16
-  updateTracking;
17
+  updateTracking = () => undefined;
17
 
18
 
18
   componentDidMount () {}
19
   componentDidMount () {}
19
 
20
 
46
   }
47
   }
47
   
48
   
48
   onLaunch (options) {
49
   onLaunch (options) {
50
+
51
+    console.log('【onLaunch】:', JSON.stringify(options))
52
+    const { mode } = options
53
+    Taro.setStorageSync('mode', mode)
54
+
49
     // 加载远程字体
55
     // 加载远程字体
50
     this.loadFontFace()
56
     this.loadFontFace()
51
 
57
 
59
     getLocation().then((loc) => {
65
     getLocation().then((loc) => {
60
       getRouterParams(options).then(router => {
66
       getRouterParams(options).then(router => {
61
         Taro.setStorageSync('router', router)
67
         Taro.setStorageSync('router', router)
68
+
62
         const { query: payload } = router
69
         const { query: payload } = router
63
 
70
 
64
         payload.path = router.path
71
         payload.path = router.path
69
           payload.lat = loc.lat
76
           payload.lat = loc.lat
70
         }
77
         }
71
 
78
 
72
-        // login
73
-        login(payload).then((res) => {
74
-          const { person: { personId } } = res
75
-          
76
-          // 初始化 im
77
-          im.init(personId)
79
+        const { path, scene, ...params } = payload
78
 
80
 
79
-          this.logged = true
81
+        if (mode === 'singlePage') {
82
+          // 分享朋友圈的单页模式
83
+          params.singleMode = true
80
 
84
 
81
-          // 埋点
82
-          trackUserSource(options).then((x) => (this.updateTracking = x))
83
-        })
85
+          // login
86
+          login(params).then(() => {
87
+            this.logged = true
88
+          })
89
+        } else {
90
+          // 非单页模式
91
+          Taro.login({
92
+            success: ({ code }) => {
93
+              params.code = code
94
+
95
+              // login
96
+              login(params).then((res) => {
97
+                const { person: { personId } } = res
98
+                
99
+                // 初始化 im
100
+                im.init(personId)
101
+
102
+                this.logged = true
103
+
104
+                // 埋点
105
+                trackUserSource(options).then((x) => (this.updateTracking = x))
106
+              })
107
+            }
108
+          })
109
+        }
84
       })
110
       })
85
     })
111
     })
86
   }
112
   }

+ 30
- 4
src/components/ShareToCircle/index.jsx View File

1
+
2
+import { useEffect, useState } from 'react'
3
+import Taro from '@tarojs/taro'
1
 import classNames from 'classnames'
4
 import classNames from 'classnames'
2
 import './style.scss'
5
 import './style.scss'
3
 
6
 
4
 export default (props) => {
7
 export default (props) => {
5
-  const { visible = false, close = () => {} } = props
8
+  const { visible = false, onClose = () => {} } = props
9
+  const [style, setStyle] = useState({ right: '50px' })
10
+
11
+  useEffect(() => {
12
+    Taro.nextTick(() => {
13
+      // https://developers.weixin.qq.com/miniprogram/dev/api/ui/menu/wx.getMenuButtonBoundingClientRect.html
14
+      const bound = Taro.getMenuButtonBoundingClientRect()
15
+
16
+      Taro.getStorage({
17
+        key: 'systemInfo',
18
+        success: (res) => {
19
+          const { screenWidth } = res.data
20
+          // 胶囊右边距
21
+          const marginRight = screenWidth - bound.right
22
+          // 提示的右边距
23
+          const right = bound.width / 2 + marginRight
24
+          //
25
+          setStyle({ right: `${right}px` })
26
+        }
27
+      }) || {};
28
+
29
+      // 需要依据 bound 来调整位置
30
+    })
31
+  }, [])
6
 
32
 
7
   return (
33
   return (
8
-    <view className={classNames('components', 'ShareToCircle', { show: visible })}>
9
-      <view>
34
+    <view className={classNames('components', 'ShareToCircle', { show: visible })} onClick={onClose}>
35
+      <view style={style}>
10
         <text>从这里“分享到朋友圈”~</text>
36
         <text>从这里“分享到朋友圈”~</text>
11
-        <text className='iconfont icon-guanbi1' onClick={close}></text>
37
+        <text className='iconfont icon-guanbi1' onClick={onClose}></text>
12
       </view>
38
       </view>
13
     </view>
39
     </view>
14
   )
40
   )

+ 50
- 7
src/layout/index.js View File

10
 import Spin from '@/components/Spin/Spin2'
10
 import Spin from '@/components/Spin/Spin2'
11
 import FixedConsultant from '@/components/FixedConsultant'
11
 import FixedConsultant from '@/components/FixedConsultant'
12
 import FirstScreen from '@/components/FirstScreen'
12
 import FirstScreen from '@/components/FirstScreen'
13
+import ShareToCircle from '@/components/ShareToCircle'
13
 import { report as reportCustomer } from '@/utils/customer'
14
 import { report as reportCustomer } from '@/utils/customer'
14
 import nav2Target from '@/utils/nav2Target'
15
 import nav2Target from '@/utils/nav2Target'
15
 import { ROLE_CODE } from '@/constants/user'
16
 import { ROLE_CODE } from '@/constants/user'
20
 import './style.scss'
21
 import './style.scss'
21
 
22
 
22
 export default (ChildComponent) => (props) => {
23
 export default (ChildComponent) => (props) => {
24
+  const mode = Taro.getStorageSync('mode')
25
+  const isSinglePage = mode === 'singlePage'
26
+
23
   const consultant = useSelector(s => s.system.consultant)
27
   const consultant = useSelector(s => s.system.consultant)
24
   const city = useSelector(s => s.city.curCity)
28
   const city = useSelector(s => s.city.curCity)
25
   const { spinning, userInfo } = useSelector(s => s.user)
29
   const { spinning, userInfo } = useSelector(s => s.user)
28
   const page = routes.filter((r) => (router.path.indexOf(r.page) > -1))[0]
32
   const page = routes.filter((r) => (router.path.indexOf(r.page) > -1))[0]
29
   const [loading, setLoading] = useState(false)
33
   const [loading, setLoading] = useState(false)
30
   const [authPhone, authAvatar, authPage] = useAuth(person, page)
34
   const [authPhone, authAvatar, authPage] = useAuth(person, page)
35
+  const [shareTimelineVisible, setShareTimelineVisible] = useState(false)
36
+
31
 
37
 
32
   const { id } = router.params
38
   const { id } = router.params
33
   const showConsultant = page.shortcut && page.shortcut.consultant
39
   const showConsultant = page.shortcut && page.shortcut.consultant
44
     nav2Target(screenInfo)
50
     nav2Target(screenInfo)
45
   }
51
   }
46
 
52
 
53
+  // 分享朋友圈提示
54
+  const showShareTimeline = (visible) => setShareTimelineVisible(visible)
55
+
56
+  // 设置当前页标题
57
+  const setNavigationBarTitle = title => {
58
+    if (!title) return;
59
+
60
+    Taro.nextTick(() => {
61
+      Taro.setNavigationBarTitle({ title })
62
+    })
63
+  }
64
+
47
   // 报备客户
65
   // 报备客户
48
   useEffect(() => {
66
   useEffect(() => {
67
+    if (isSinglePage) return;
68
+
49
     reportCustomer(person, consultant, false).catch(() => {})
69
     reportCustomer(person, consultant, false).catch(() => {})
50
-  }, [person, consultant])
70
+  }, [person, consultant, isSinglePage])
51
 
71
 
52
   // 请求埋点设置
72
   // 请求埋点设置
53
   useEffect(() => {
73
   useEffect(() => {
74
+    if (isSinglePage) return;
75
+
54
     if (id) {
76
     if (id) {
55
       setShareContent({})
77
       setShareContent({})
56
     }
78
     }
57
-  } ,[id, page.type])
79
+  } ,[id, page.type, isSinglePage])
58
 
80
 
59
   // 埋点数据
81
   // 埋点数据
60
   useEffect(() => {
82
   useEffect(() => {
83
+    if (isSinglePage) return;
84
+
61
     const consultantId = person?.personType === ROLE_CODE.CONSULTANT ? person.personId : undefined
85
     const consultantId = person?.personType === ROLE_CODE.CONSULTANT ? person.personId : undefined
62
 
86
 
63
     setTrackData({
87
     setTrackData({
67
       sharePersonId: person?.personId,
91
       sharePersonId: person?.personId,
68
       targetId: id,
92
       targetId: id,
69
     })
93
     })
70
-  }, [person, page, id])
94
+  }, [person, page, id, isSinglePage])
71
 
95
 
72
   // 主要用于埋点
96
   // 主要用于埋点
73
   useEffect(() => {
97
   useEffect(() => {
81
 
105
 
82
   return (
106
   return (
83
     <>
107
     <>
108
+      {/* 菊花转 */}
84
       <Overlay visible={loading} style={{background: '#fff'}}>
109
       <Overlay visible={loading} style={{background: '#fff'}}>
85
         <Loading />
110
         <Loading />
86
       </Overlay>
111
       </Overlay>
87
-      <Overlay visible={authPhone} aligin='bottom'>
112
+
113
+      {/* 授权手机 */}
114
+      <Overlay visible={authPhone && !isSinglePage} aligin='bottom'>
88
         <View className='auth-wrapper'>
115
         <View className='auth-wrapper'>
89
           <AuthPhone consultant={consultant} router={router} page={page} />
116
           <AuthPhone consultant={consultant} router={router} page={page} />
90
         </View>
117
         </View>
91
       </Overlay>
118
       </Overlay>
92
-      <Overlay visible={!authPhone && authAvatar} aligin='bottom'>
119
+
120
+      {/* 授权头像 */}
121
+      <Overlay visible={!authPhone && authAvatar && !isSinglePage} aligin='bottom'>
93
         <View className='auth-wrapper'>
122
         <View className='auth-wrapper'>
94
           <AuthAvatar />
123
           <AuthAvatar />
95
         </View>
124
         </View>
96
       </Overlay>
125
       </Overlay>
97
-      { authPage && <AuthPage /> }
126
+
127
+      {/* 授权头像-全屏 */}
128
+      { authPage && !isSinglePage && <AuthPage /> }
129
+
130
+      {/* 显示分享朋友圈 */}
131
+      <ShareToCircle visible={shareTimelineVisible && !isSinglePage} onClose={() => setShareTimelineVisible(false)} />
132
+
133
+      {/* 页面内容 */}
98
       <Spin size={32} spinning={spinning} />
134
       <Spin size={32} spinning={spinning} />
99
       {
135
       {
100
         person && !!person.personId && (
136
         person && !!person.personId && (
104
             consultant={consultant}
140
             consultant={consultant}
105
             page={page}
141
             page={page}
106
             city={city}
142
             city={city}
143
+            mode={mode}
107
             shareContent={shareContent}
144
             shareContent={shareContent}
108
             trackData={trackData}
145
             trackData={trackData}
146
+            showShareTimeline={showShareTimeline}
147
+            setNavigationBarTitle={setNavigationBarTitle}
109
             {...props}
148
             {...props}
110
             {...extInfo}
149
             {...extInfo}
111
           />
150
           />
112
         )
151
         )
113
       }
152
       }
153
+
154
+      {/* 当前置业顾问 */}
114
       {
155
       {
115
         !!showConsultant && (<FixedConsultant consultant={consultant} />)
156
         !!showConsultant && (<FixedConsultant consultant={consultant} />)
116
       }
157
       }
158
+
159
+      {/* 开屏广告 */}
117
       <FirstScreen
160
       <FirstScreen
118
         info={screenInfo}
161
         info={screenInfo}
119
-        visible={screenVisible}
162
+        visible={screenVisible && !isSinglePage}
120
         onClick={handleScreen}
163
         onClick={handleScreen}
121
         onClose={toggleShowScreen}
164
         onClose={toggleShowScreen}
122
       />
165
       />

+ 4
- 7
src/pages/index/activityDetail/index.jsx View File

12
   Button
12
   Button
13
 } from '@tarojs/components';
13
 } from '@tarojs/components';
14
 import Disclaimer from '@/components/Disclaimer';
14
 import Disclaimer from '@/components/Disclaimer';
15
-import ShareToCircle from '@/components/ShareToCircle'
16
 import { useSelector } from 'react-redux';
15
 import { useSelector } from 'react-redux';
17
 import {
16
 import {
18
   signupActivity,
17
   signupActivity,
53
 };
52
 };
54
 
53
 
55
 export default withLayout((props) => {
54
 export default withLayout((props) => {
56
-  const { router, shareContent, trackData, person, page } = props;
55
+  const { router, shareContent, trackData, person, page, showShareTimeline, setNavigationBarTitle } = props;
57
   const { id } = router.params;
56
   const { id } = router.params;
58
 
57
 
59
   const user = useSelector((state) => state.user);
58
   const user = useSelector((state) => state.user);
64
   const [selectorChecked, setSelectorChecked] = useState('1');
63
   const [selectorChecked, setSelectorChecked] = useState('1');
65
   const [selector, setSelector] = useState('');
64
   const [selector, setSelector] = useState('');
66
 
65
 
67
-  const [ShowShareLayer, setShowShareLayer] = useState(false)
68
-
69
   const buildingId = detail?.buildingId;
66
   const buildingId = detail?.buildingId;
70
 
67
 
71
   const [btnText, btnDisabled] = useStatus(detail)
68
   const [btnText, btnDisabled] = useStatus(detail)
77
       const maxperson = 10
74
       const maxperson = 10
78
       setSelector(times(maxperson).map((_, i) => `${i + 1}`));
75
       setSelector(times(maxperson).map((_, i) => `${i + 1}`));
79
 
76
 
80
-      setDetail(res);
77
+      setDetail(res ||{});
78
+      setNavigationBarTitle(res?.title)
81
       Taro.hideLoading();
79
       Taro.hideLoading();
82
     });
80
     });
83
   };
81
   };
214
             <text>分享</text>
212
             <text>分享</text>
215
             <Button open-type='share' className='ShareBtn'>分享</Button>
213
             <Button open-type='share' className='ShareBtn'>分享</Button>
216
           </view>
214
           </view>
217
-          <view onClick={() => { setShowShareLayer(true) }}>
215
+          <view onClick={() => showShareTimeline(true)}>
218
             <text className='iconfont icon-pengyouquan1' style='font-size: 32rpx'></text>
216
             <text className='iconfont icon-pengyouquan1' style='font-size: 32rpx'></text>
219
             <text>朋友圈</text>
217
             <text>朋友圈</text>
220
           </view>
218
           </view>
242
     <>
240
     <>
243
       {detail && (
241
       {detail && (
244
         <view className='Page activityDetail flex-v'>
242
         <view className='Page activityDetail flex-v'>
245
-          <ShareToCircle visible={ShowShareLayer} close={() => { setShowShareLayer(false) }}></ShareToCircle>
246
           <view className='flex-item'>
243
           <view className='flex-item'>
247
             <view>
244
             <view>
248
               <ScrollView scroll-y>
245
               <ScrollView scroll-y>

+ 2
- 1
src/pages/index/buildingDetail/index.jsx View File

24
 import './index.scss'
24
 import './index.scss'
25
 
25
 
26
 export default withLayout((props) => {
26
 export default withLayout((props) => {
27
-  const { router, person, shareContent, trackData, page } = props
27
+  const { router, person, shareContent, trackData, page, setNavigationBarTitle } = props
28
   const { id } = router.params
28
   const { id } = router.params
29
 
29
 
30
   const [showPoster, setShowPoster] = useState(false)
30
   const [showPoster, setShowPoster] = useState(false)
52
     // 获取楼盘信息
52
     // 获取楼盘信息
53
     fetch({ url: `${API_ITEMS_DETAIL}/${id}`, spin: true }).then((res) => {
53
     fetch({ url: `${API_ITEMS_DETAIL}/${id}`, spin: true }).then((res) => {
54
       setDetailInfo(res || {})
54
       setDetailInfo(res || {})
55
+      setNavigationBarTitle(res?.buildingName)
55
       
56
       
56
       if (res?.buildingApartment) {
57
       if (res?.buildingApartment) {
57
         const List = res.buildingApartment.filter(item => item.apartmentType === 'photo')
58
         const List = res.buildingApartment.filter(item => item.apartmentType === 'photo')

+ 3
- 2
src/pages/index/encyDetail/index.jsx View File

9
 import { formatDate } from "@/utils/chatDate";
9
 import { formatDate } from "@/utils/chatDate";
10
 
10
 
11
 export default withLayout((props) => {
11
 export default withLayout((props) => {
12
-  const { router, shareContent, trackData, person, page } = props;
12
+  const { router, shareContent, trackData, person, page, setNavigationBarTitle } = props;
13
   const { id } = router.params;
13
   const { id } = router.params;
14
   const [data, setData] = useState({});
14
   const [data, setData] = useState({});
15
 
15
 
16
   const getData = (params) => {
16
   const getData = (params) => {
17
     Taro.showLoading();
17
     Taro.showLoading();
18
     queryPolicyDetail(params).then((res) => {
18
     queryPolicyDetail(params).then((res) => {
19
-      setData(res);
19
+      setData(res||{});
20
+      setNavigationBarTitle(res?.title)
20
       Taro.hideLoading();
21
       Taro.hideLoading();
21
     });
22
     });
22
   };
23
   };

+ 3
- 3
src/pages/index/encyclopediasOfBuyHouse/index.jsx View File

9
 import { queryPolicyTypeList, queryPolicyList } from "@/services/policy";
9
 import { queryPolicyTypeList, queryPolicyList } from "@/services/policy";
10
 
10
 
11
 const EncyItem = (props) => {
11
 const EncyItem = (props) => {
12
-  const city = useSelector(state => state.city)
12
+  const { city } = props
13
 
13
 
14
   const { item, index } = props;
14
   const { item, index } = props;
15
   const [list, setList] = useState([]);
15
   const [list, setList] = useState([]);
18
     if (item.policyTypeId) {
18
     if (item.policyTypeId) {
19
       getPolicyListByType(item.policyTypeId);
19
       getPolicyListByType(item.policyTypeId);
20
     }
20
     }
21
-  }, [item,city]);
21
+  }, [item,city?.id]);
22
 
22
 
23
   const getPolicyListByType = policyTypeId => {
23
   const getPolicyListByType = policyTypeId => {
24
-    queryPolicyList({ pageSize: 100,policyTypeId,cityId: city?.curCity?.id }).then((res) => {
24
+    queryPolicyList({ pageSize: 100, policyTypeId, cityId: city?.id }).then((res) => {
25
       setList(res.records);
25
       setList(res.records);
26
     });
26
     });
27
   };
27
   };

+ 8
- 7
src/pages/index/index.jsx View File

34
   // 分享
34
   // 分享
35
   useShare(shareContent, trackData)
35
   useShare(shareContent, trackData)
36
 
36
 
37
-  useEffect(() => {
38
-    if (city?.id) {
39
-      GetBanner()
40
-      GetProjectList()
41
-    }
42
-  }, [city?.id])
43
-
44
   const GetBanner = () => { // 获取banner
37
   const GetBanner = () => { // 获取banner
45
     fetch({ url: `${API_BANNER_LIST}/banner`, method: 'get', payload: { cityId: city.id, showPosition: 'index' } }).then((res) => {
38
     fetch({ url: `${API_BANNER_LIST}/banner`, method: 'get', payload: { cityId: city.id, showPosition: 'index' } }).then((res) => {
46
       setBannerList(res || [])
39
       setBannerList(res || [])
61
     setShowLive(e)
54
     setShowLive(e)
62
   }
55
   }
63
 
56
 
57
+  useEffect(() => {
58
+    if (city?.id) {
59
+      GetBanner()
60
+      GetProjectList()
61
+    }
62
+  }, [city?.id])
63
+
64
+
64
   return (
65
   return (
65
     <view className='Page Index'>
66
     <view className='Page Index'>
66
       {/* <ShareToCircle visible></ShareToCircle> */}
67
       {/* <ShareToCircle visible></ShareToCircle> */}

+ 2
- 1
src/pages/index/newsDetail/index.config.js View File

1
 export default {
1
 export default {
2
-  navigationBarTitleText: '资讯详情'
2
+  navigationBarTitleText: '资讯详情',
3
+  enableShareAppMessage: true
3
 }
4
 }

+ 20
- 38
src/pages/index/newsDetail/index.jsx View File

2
 import Taro from "@tarojs/taro";
2
 import Taro from "@tarojs/taro";
3
 import withLayout from "@/layout";
3
 import withLayout from "@/layout";
4
 import { ScrollView, Image, RichText, WebView } from "@tarojs/components";
4
 import { ScrollView, Image, RichText, WebView } from "@tarojs/components";
5
+import useParams from '@/utils/hooks/useParams'
5
 import useFavor from "@/utils/hooks/useFavor";
6
 import useFavor from "@/utils/hooks/useFavor";
6
 import { queryNewsDetail } from "@/services/news";
7
 import { queryNewsDetail } from "@/services/news";
7
 import { formatDate } from "@/utils/chatDate";
8
 import { formatDate } from "@/utils/chatDate";
9
+import useShare from "@/utils/hooks/useShare";
8
 import "@/assets/css/iconfont.css";
10
 import "@/assets/css/iconfont.css";
9
 import "./index.scss";
11
 import "./index.scss";
10
 
12
 
11
 export default withLayout((props) => {
13
 export default withLayout((props) => {
12
-  const { trackData } = props
14
+  const { router, shareContent, person, trackData, page, showShareTimeline, setNavigationBarTitle } = props
13
   const { id } = props.router.params;
15
   const { id } = props.router.params;
14
 
16
 
17
+  const paramsRef = useParams({person, from: `${page.type}_share`})
15
   const [data, setData] = useState(null);
18
   const [data, setData] = useState(null);
16
-  const [IsPull, setPull] = useState(false);
17
-  const [PullTimer, setPullTimer] = useState(null);
18
 
19
 
19
 
20
 
20
   const [isSave, handleFavor] = useFavor(data?.isSave, {
21
   const [isSave, handleFavor] = useFavor(data?.isSave, {
22
     buildingId: data?.buildingId,
23
     buildingId: data?.buildingId,
23
     ...trackData,
24
     ...trackData,
24
   });
25
   });
25
-
26
-  const PageRefresh = () => {
27
-    // 页面下拉刷新回调
28
-    setPull(true);
29
-  };
30
-
31
-  useEffect(() => {
32
-    // 下拉刷新触发
33
-    if (IsPull) {
34
-      clearTimeout(PullTimer);
35
-      setPullTimer(
36
-        setTimeout(() => {
37
-          setPull(false);
38
-        }, 2000)
39
-      );
40
-    }
41
-  }, [IsPull]);
26
+  
27
+  const fullTrackData = { ...trackData, buildingId: data?.buildingId };
28
+  
29
+  useShare(
30
+    {
31
+      title: shareContent.shareContentTitle || data?.newsName,
32
+      path: `${router.path}?${paramsRef.current}`,
33
+      image: shareContent.shareContentImg,
34
+    },
35
+    fullTrackData
36
+  );
42
 
37
 
43
   const getData = (params) => {
38
   const getData = (params) => {
44
     Taro.showLoading();
39
     Taro.showLoading();
45
     queryNewsDetail(params).then((res) => {
40
     queryNewsDetail(params).then((res) => {
46
 
41
 
47
       setData(res);
42
       setData(res);
43
+      setNavigationBarTitle(res?.newsName);
48
       Taro.hideLoading();
44
       Taro.hideLoading();
49
     });
45
     });
50
   };
46
   };
51
 
47
 
52
-  const shareTimeline = () => {
53
-    Taro.showToast({
54
-      title: '请点击右上角分享到朋友圈',
55
-      icon: 'none',
56
-      duration: 3000,
57
-    })
58
-  }
59
-
60
   useEffect(() => {
48
   useEffect(() => {
61
     if (id) {
49
     if (id) {
62
       getData(id);
50
       getData(id);
68
       {data && (data.newsDetailType === '0' ? <WebView src={data.newsDetail} /> : <>
56
       {data && (data.newsDetailType === '0' ? <WebView src={data.newsDetail} /> : <>
69
         <view className='flex-item'>
57
         <view className='flex-item'>
70
           <view>
58
           <view>
71
-            <ScrollView
72
-              scroll-y
73
-              refresher-enabled
74
-              refresher-triggered={IsPull}
75
-              onrefresherrefresh={PageRefresh}
76
-              refresher-background='#fff'
77
-            >
59
+            <ScrollView scrollY>
78
               <view className='PageContent'>
60
               <view className='PageContent'>
79
                 <view className='Info'>
61
                 <view className='Info'>
80
                   <view>
62
                   <view>
99
           </view>
81
           </view>
100
         </view>
82
         </view>
101
         <view className='Bottom'>
83
         <view className='Bottom'>
102
-          <view>
103
-            <text onClick={shareTimeline} className='iconfont icon-pengyouquan1'></text>
104
-            <text onClick={shareTimeline}>分享朋友圈</text>
84
+          <view onClick={() => showShareTimeline(true)}>
85
+            <text className='iconfont icon-pengyouquan1'></text>
86
+            <text>分享朋友圈</text>
105
           </view>
87
           </view>
106
           <view>
88
           <view>
107
             <text className='iconfont icon-shoucang' style={isSave ? { color: 'red' } : undefined} onClick={handleFavor}></text>
89
             <text className='iconfont icon-shoucang' style={isSave ? { color: 'red' } : undefined} onClick={handleFavor}></text>

+ 3
- 2
src/pages/video/liveDetail/index.jsx View File

11
 import "./index.scss";
11
 import "./index.scss";
12
 
12
 
13
 export default withLayout((props) => {
13
 export default withLayout((props) => {
14
-  const { router, shareContent, trackData, person, page } = props;
14
+  const { router, shareContent, trackData, person, page, setNavigationBarTitle } = props;
15
   const { id } = router.params;
15
   const { id } = router.params;
16
 
16
 
17
   const [data, setData] = useState({})
17
   const [data, setData] = useState({})
38
 
38
 
39
   const getData = () => {
39
   const getData = () => {
40
     queryLiveDetail(id).then(res => {
40
     queryLiveDetail(id).then(res => {
41
-      setData(res)
41
+      setData(res||{})
42
+      setNavigationBarTitle(res?.name)
42
       if (res?.liveRoomParam) {
43
       if (res?.liveRoomParam) {
43
         const { livingid } = JSON.parse(res.liveRoomParam)
44
         const { livingid } = JSON.parse(res.liveRoomParam)
44
         getLivingCode(livingid).then((liveInfo) => {
45
         getLivingCode(livingid).then((liveInfo) => {

+ 3
- 2
src/pages/video/videoDetail/index.jsx View File

11
 import "./index.scss";
11
 import "./index.scss";
12
 
12
 
13
 export default withLayout((props) => {
13
 export default withLayout((props) => {
14
-  const { router, shareContent, trackData, person, page } = props;
14
+  const { router, shareContent, trackData, person, page, setNavigationBarTitle } = props;
15
   const { id } = router.params;
15
   const { id } = router.params;
16
 
16
 
17
   const [data, setData] = useState({});
17
   const [data, setData] = useState({});
36
 
36
 
37
   const getData = () => {
37
   const getData = () => {
38
     fetch({ url: `${API_VIDEO_DETAIL}/${id}` }).then(res=>{
38
     fetch({ url: `${API_VIDEO_DETAIL}/${id}` }).then(res=>{
39
-      setData(res)
39
+      setData(res||{})
40
+      setNavigationBarTitle(res?.name)
40
     });
41
     });
41
   };
42
   };
42
 
43
 

+ 1
- 0
src/routes.js View File

29
     pkg: 'main',
29
     pkg: 'main',
30
     isTab: true,
30
     isTab: true,
31
     type: 'chat',
31
     type: 'chat',
32
+    auth: ['page'],
32
   },
33
   },
33
   {
34
   {
34
     name: '我是',
35
     name: '我是',

+ 42
- 50
src/utils/login.js View File

7
 import { getCardDetail } from '@/services/card'
7
 import { getCardDetail } from '@/services/card'
8
 import { queryUserInfo } from '@/services/user'
8
 import { queryUserInfo } from '@/services/user'
9
 
9
 
10
-export default (payload) => {
11
-  return new Promise((resolve, reject) => {
12
-    const { path, scene, ...params } = payload
13
-  
14
-    // 获取 code
15
-    Taro.login({
16
-      success: ({ code }) => {
17
-        params.code = code
18
-  
19
-        // 转换 undefined 为 ''
20
-        const loginParams = Object.keys(params).reduce((acc, k) => ({ ...acc, [`${k}`]: ifNull(params[k], '') }), {})
21
-  
22
-        // 远程登录获取人员
23
-        wxLogin(loginParams, false).then(data => {
24
-  
25
-          const { extraInfo, miniApp, person, city } = data
26
-          const { token, sessionKey } = miniApp
27
-          const { dispatch, getState } = store
28
-  
29
-          Taro.setStorageSync('token', token)
30
-          Taro.setStorageSync('sessionKey', sessionKey)
31
-  
32
-          dispatch({ type: USER_INFO, payload: { extraInfo, person, miniApp } })
33
-          const { city: { curCity } } = getState()
34
-  
35
-          if (!curCity || Object.keys(curCity).length == 0) {
36
-            if (city) {
37
-              dispatchCitySelected(city)(dispatch)
38
-            }
39
-          }
10
+export default (params) => {
11
+  return new Promise((resolve, reject) => {  
12
+    // 转换 undefined 为 ''
13
+    const loginParams = Object.keys(params).reduce((acc, k) => ({ ...acc, [`${k}`]: ifNull(params[k], '') }), {})
40
 
14
 
41
-          // 获取人员详细信息
42
-          // eslint-disable-next-line no-unused-vars
43
-          queryUserInfo().then(info => {
44
-            // const { unReadNum } = info
15
+    // 远程登录获取人员
16
+    wxLogin(loginParams, false).then(data => {
45
 
17
 
46
-            // 默认红点开始就有
47
-            dispatch({ type: ASSIGN_UNREADNUM, payload: true });
48
-            resolve(data)
49
-          }).catch(reject)
18
+      const { extraInfo, miniApp, person, city } = data
19
+      const { token, sessionKey } = miniApp
20
+      const { dispatch, getState } = store
50
 
21
 
51
-          // 如果有推荐人信息
52
-          if (loginParams.recommender && loginParams.recommender !== person.personId) {
53
-            getCardDetail(loginParams.recommender).then((res) => {
54
-              dispatch({ type: 'SYNC_RECOMMENDER', payload: res });
55
-              if (res.personType === ROLE_CODE.CONSULTANT) {
56
-                dispatch({ type: 'SYNC_CONSULTANT', payload: res });
57
-              }
58
-            })
59
-          }
22
+      Taro.setStorageSync('token', token)
23
+      Taro.setStorageSync('sessionKey', sessionKey)
60
 
24
 
61
-          // 如果通过扫码进入
25
+      dispatch({ type: USER_INFO, payload: { extraInfo, person, miniApp } })
26
+      const { city: { curCity } } = getState()
62
 
27
 
63
-        }).catch(reject)
28
+      if (!curCity || Object.keys(curCity).length == 0) {
29
+        if (city) {
30
+          dispatchCitySelected(city)(dispatch)
31
+        }
64
       }
32
       }
65
-    })
33
+
34
+      // 获取人员详细信息
35
+      // eslint-disable-next-line no-unused-vars
36
+      queryUserInfo().then(info => {
37
+        // const { unReadNum } = info
38
+
39
+        // 默认红点开始就有
40
+        dispatch({ type: ASSIGN_UNREADNUM, payload: true });
41
+        resolve(data)
42
+      }).catch(reject)
43
+
44
+      // 如果有推荐人信息
45
+      if (loginParams.recommender && loginParams.recommender !== person.personId) {
46
+        getCardDetail(loginParams.recommender).then((res) => {
47
+          dispatch({ type: 'SYNC_RECOMMENDER', payload: res });
48
+          if (res.personType === ROLE_CODE.CONSULTANT) {
49
+            dispatch({ type: 'SYNC_CONSULTANT', payload: res });
50
+          }
51
+        })
52
+      }
53
+
54
+      // 如果通过扫码进入
55
+
56
+    }).catch(reject)
57
+  
66
   })
58
   })
67
 }
59
 }