Your Name 3 years ago
parent
commit
fa3ace1fd6

+ 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.27-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,

+ 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
   )

+ 21
- 0
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'
28
   const page = routes.filter((r) => (router.path.indexOf(r.page) > -1))[0]
29
   const page = routes.filter((r) => (router.path.indexOf(r.page) > -1))[0]
29
   const [loading, setLoading] = useState(false)
30
   const [loading, setLoading] = useState(false)
30
   const [authPhone, authAvatar, authPage] = useAuth(person, page)
31
   const [authPhone, authAvatar, authPage] = useAuth(person, page)
32
+  const [shareTimelineVisible, setShareTimelineVisible] = useState(false)
31
 
33
 
32
   const { id } = router.params
34
   const { id } = router.params
33
   const showConsultant = page.shortcut && page.shortcut.consultant
35
   const showConsultant = page.shortcut && page.shortcut.consultant
44
     nav2Target(screenInfo)
46
     nav2Target(screenInfo)
45
   }
47
   }
46
 
48
 
49
+  const showShareTimeline = (visible) => setShareTimelineVisible(visible)
50
+
47
   // 报备客户
51
   // 报备客户
48
   useEffect(() => {
52
   useEffect(() => {
49
     reportCustomer(person, consultant, false).catch(() => {})
53
     reportCustomer(person, consultant, false).catch(() => {})
81
 
85
 
82
   return (
86
   return (
83
     <>
87
     <>
88
+      {/* 菊花转 */}
84
       <Overlay visible={loading} style={{background: '#fff'}}>
89
       <Overlay visible={loading} style={{background: '#fff'}}>
85
         <Loading />
90
         <Loading />
86
       </Overlay>
91
       </Overlay>
92
+
93
+      {/* 授权手机 */}
87
       <Overlay visible={authPhone} aligin='bottom'>
94
       <Overlay visible={authPhone} aligin='bottom'>
88
         <View className='auth-wrapper'>
95
         <View className='auth-wrapper'>
89
           <AuthPhone consultant={consultant} router={router} page={page} />
96
           <AuthPhone consultant={consultant} router={router} page={page} />
90
         </View>
97
         </View>
91
       </Overlay>
98
       </Overlay>
99
+
100
+      {/* 授权头像 */}
92
       <Overlay visible={!authPhone && authAvatar} aligin='bottom'>
101
       <Overlay visible={!authPhone && authAvatar} aligin='bottom'>
93
         <View className='auth-wrapper'>
102
         <View className='auth-wrapper'>
94
           <AuthAvatar />
103
           <AuthAvatar />
95
         </View>
104
         </View>
96
       </Overlay>
105
       </Overlay>
106
+
107
+      {/* 授权头像-全屏 */}
97
       { authPage && <AuthPage /> }
108
       { authPage && <AuthPage /> }
109
+
110
+      {/* 显示分享朋友圈 */}
111
+      <ShareToCircle visible={shareTimelineVisible} onClose={() => setShareTimelineVisible(false)} />
112
+
113
+      {/* 页面内容 */}
98
       <Spin size={32} spinning={spinning} />
114
       <Spin size={32} spinning={spinning} />
99
       {
115
       {
100
         person && !!person.personId && (
116
         person && !!person.personId && (
106
             city={city}
122
             city={city}
107
             shareContent={shareContent}
123
             shareContent={shareContent}
108
             trackData={trackData}
124
             trackData={trackData}
125
+            showShareTimeline={showShareTimeline}
109
             {...props}
126
             {...props}
110
             {...extInfo}
127
             {...extInfo}
111
           />
128
           />
112
         )
129
         )
113
       }
130
       }
131
+
132
+      {/* 当前置业顾问 */}
114
       {
133
       {
115
         !!showConsultant && (<FixedConsultant consultant={consultant} />)
134
         !!showConsultant && (<FixedConsultant consultant={consultant} />)
116
       }
135
       }
136
+
137
+      {/* 开屏广告 */}
117
       <FirstScreen
138
       <FirstScreen
118
         info={screenInfo}
139
         info={screenInfo}
119
         visible={screenVisible}
140
         visible={screenVisible}

+ 2
- 6
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 } = 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)
214
             <text>分享</text>
211
             <text>分享</text>
215
             <Button open-type='share' className='ShareBtn'>分享</Button>
212
             <Button open-type='share' className='ShareBtn'>分享</Button>
216
           </view>
213
           </view>
217
-          <view onClick={() => { setShowShareLayer(true) }}>
214
+          <view onClick={() => showShareTimeline(true)}>
218
             <text className='iconfont icon-pengyouquan1' style='font-size: 32rpx'></text>
215
             <text className='iconfont icon-pengyouquan1' style='font-size: 32rpx'></text>
219
             <text>朋友圈</text>
216
             <text>朋友圈</text>
220
           </view>
217
           </view>
242
     <>
239
     <>
243
       {detail && (
240
       {detail && (
244
         <view className='Page activityDetail flex-v'>
241
         <view className='Page activityDetail flex-v'>
245
-          <ShareToCircle visible={ShowShareLayer} close={() => { setShowShareLayer(false) }}></ShareToCircle>
246
           <view className='flex-item'>
242
           <view className='flex-item'>
247
             <view>
243
             <view>
248
               <ScrollView scroll-y>
244
               <ScrollView scroll-y>

+ 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
 }

+ 19
- 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 } = 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();
49
     });
44
     });
50
   };
45
   };
51
 
46
 
52
-  const shareTimeline = () => {
53
-    Taro.showToast({
54
-      title: '请点击右上角分享到朋友圈',
55
-      icon: 'none',
56
-      duration: 3000,
57
-    })
58
-  }
59
-
60
   useEffect(() => {
47
   useEffect(() => {
61
     if (id) {
48
     if (id) {
62
       getData(id);
49
       getData(id);
68
       {data && (data.newsDetailType === '0' ? <WebView src={data.newsDetail} /> : <>
55
       {data && (data.newsDetailType === '0' ? <WebView src={data.newsDetail} /> : <>
69
         <view className='flex-item'>
56
         <view className='flex-item'>
70
           <view>
57
           <view>
71
-            <ScrollView
72
-              scroll-y
73
-              refresher-enabled
74
-              refresher-triggered={IsPull}
75
-              onrefresherrefresh={PageRefresh}
76
-              refresher-background='#fff'
77
-            >
58
+            <ScrollView scrollY>
78
               <view className='PageContent'>
59
               <view className='PageContent'>
79
                 <view className='Info'>
60
                 <view className='Info'>
80
                   <view>
61
                   <view>
99
           </view>
80
           </view>
100
         </view>
81
         </view>
101
         <view className='Bottom'>
82
         <view className='Bottom'>
102
-          <view>
103
-            <text onClick={shareTimeline} className='iconfont icon-pengyouquan1'></text>
104
-            <text onClick={shareTimeline}>分享朋友圈</text>
83
+          <view onClick={() => showShareTimeline(true)}>
84
+            <text className='iconfont icon-pengyouquan1'></text>
85
+            <text>分享朋友圈</text>
105
           </view>
86
           </view>
106
           <view>
87
           <view>
107
             <text className='iconfont icon-shoucang' style={isSave ? { color: 'red' } : undefined} onClick={handleFavor}></text>
88
             <text className='iconfont icon-shoucang' style={isSave ? { color: 'red' } : undefined} onClick={handleFavor}></text>