Your Name 3 years ago
parent
commit
cd458fc8b1

+ 2
- 2
config/dev.js View File

3
     NODE_ENV: '"development"'
3
     NODE_ENV: '"development"'
4
   },
4
   },
5
   defineConstants: {
5
   defineConstants: {
6
-    HOST: '"https://xlk.njyz.tech"',
7
-    // HOST: '"http://127.0.0.1:8081"',
6
+    // HOST: '"https://xlk.njyz.tech"',
7
+    HOST: '"http://127.0.0.1:8081"',
8
     WSS_HOST: '"ws://127.0.0.1:8081"',
8
     WSS_HOST: '"ws://127.0.0.1:8081"',
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/"',

+ 2
- 1
src/constants/api.js View File

94
 export const API_SALES_BATCH = resolvePath('taSalesBatch')
94
 export const API_SALES_BATCH = resolvePath('taSalesBatch')
95
 export const API_ADDLIVE_NUM = resolvePath('addVisitNum')
95
 export const API_ADDLIVE_NUM = resolvePath('addVisitNum')
96
 export const API_LIVE_LIST = resolvePath('taLiveActivity')
96
 export const API_LIVE_LIST = resolvePath('taLiveActivity')
97
-// /wx/location/city?location=lon,lat
97
+export const API_VIDEO_LIST = resolvePath('videoActiveList')
98
+
98
 
99
 
99
 //sign
100
 //sign
100
 export const API_CONTRACT_USER = resolvePath('contract/user/add')
101
 export const API_CONTRACT_USER = resolvePath('contract/user/add')

+ 55
- 37
src/pages/video/index.jsx View File

3
 import withLayout from '@/layout'
3
 import withLayout from '@/layout'
4
 import { useSelector } from 'react-redux'
4
 import { useSelector } from 'react-redux'
5
 import { fetch } from '@/utils/request'
5
 import { fetch } from '@/utils/request'
6
-import { API_LIVE_LIST } from '@/constants/api'
6
+import { API_LIVE_LIST, API_VIDEO_LIST } from '@/constants/api'
7
 import './index.scss'
7
 import './index.scss'
8
 import '@/assets/css/iconfont.css'
8
 import '@/assets/css/iconfont.css'
9
 import VideoListItem from './components/VideoListItem/index'
9
 import VideoListItem from './components/VideoListItem/index'
10
 
10
 
11
-export default withLayout(() => {
11
+export default withLayout((props) => {
12
+  const { city } = props
12
 
13
 
13
-  const city = useSelector(state => state.city)
14
   const [IsPull, setPull] = useState(false)
14
   const [IsPull, setPull] = useState(false)
15
-  const [CurrnetMenuId, setCurrnetMenuId] = useState(null)
15
+  const [CurrnetMenuId, setCurrnetMenuId] = useState('all')
16
   const [MenuList] = useState([
16
   const [MenuList] = useState([
17
     { name: '全部', id: 'all' },
17
     { name: '全部', id: 'all' },
18
     { name: '预告', id: 'notice' },
18
     { name: '预告', id: 'notice' },
19
     { name: '直播中', id: 'live' },
19
     { name: '直播中', id: 'live' },
20
-    { name: '新房推荐', id: 'new' }
20
+    { name: '新房推荐', id: 'new' },
21
+    { name: '视频', id: 'video' }
21
   ])
22
   ])
22
   const [PullTimer, setPullTimer] = useState(null)
23
   const [PullTimer, setPullTimer] = useState(null)
23
-  const [OriginList, setOriginList] = useState([])
24
-  const [PageList, setPageList] = useState([])
24
+  // 全部或者新房的列表
25
+  const [activityList, setActivityList] = useState([])
26
+  // 预告与直播的列表
27
+  const [liveList, setLiveList] = useState([])
28
+  // 视频的列表
29
+  const [videoList, setVideoList] = useState([])
25
 
30
 
26
   useEffect(() => {
31
   useEffect(() => {
27
-    if (city.curCity.name) {
28
-      setOriginList([])
32
+    if (city?.id) {
29
       GetLiveList()
33
       GetLiveList()
30
     }
34
     }
31
-  }, [city])
35
+  }, [city?.id, CurrnetMenuId])
32
 
36
 
33
-  useEffect(() => {
34
-    if(OriginList.length && CurrnetMenuId === null) {
35
-      setCurrnetMenuId('all')
36
-    }
37
-  }, [OriginList])
38
 
37
 
39
-  useEffect(() => {
40
-    if (CurrnetMenuId === 'all') {
41
-      setPageList([...OriginList])
38
+  const GetLiveList = (params) => {
39
+    if (['all', 'new'].indexOf(CurrnetMenuId) > -1) {
40
+      // 全部与新房用的一个接口
41
+      fetch({ url: API_LIVE_LIST, payload: { ...params, cityId: city.id }, spin: true }).then((res) => {
42
+        setActivityList(res.records || [])
43
+      })
44
+    } else if (['notice', 'live'].indexOf(CurrnetMenuId) > -1) {
45
+      // 预告与直播是虽然是同一个接口, 但是返回值字段不一样
46
+      const process = 'notice' === CurrnetMenuId ? 1 : 2;
47
+      fetch({ url: API_LIVE_LIST, payload: { ...params, cityId: city.id, process }, spin: true}).then((res) => {
48
+        setLiveList(res.records || [])
49
+      })
42
     } else {
50
     } else {
43
-      let Arr = []
44
-      OriginList.map((item) => {
45
-        if (CurrnetMenuId === 'new') {
46
-          if(item.kind !== 'notice') {
47
-            Arr.push({...item})
48
-          }
49
-        } else {
50
-          if(item.kind === CurrnetMenuId) {
51
-            Arr.push({...item})
52
-          }
53
-        }
51
+      // 视频另外一个接口
52
+      fetch({ url: API_VIDEO_LIST, payload: { ...params, cityId: city.id }, spin: true }).then((res) => {
53
+        setVideoList(res.records || [])
54
       })
54
       })
55
-      setPageList([...Arr])
56
     }
55
     }
57
-  }, [CurrnetMenuId])
58
-
59
-  const GetLiveList = () => {
60
-    fetch({ url: API_LIVE_LIST, method: 'get', payload: { cityId: city.curCity.id, pageNum: 1, pageSize: 10000 } }).then((res) => {
61
-      setOriginList(res.records || [])
62
-    })
63
   }
56
   }
64
 
57
 
65
   const PageRefresh = () => { // 页面下拉刷新回调
58
   const PageRefresh = () => { // 页面下拉刷新回调
110
           <ScrollView scroll-y refresher-enabled refresher-triggered={IsPull} onrefresherrefresh={PageRefresh} refresher-background='#f8f8f8'>
103
           <ScrollView scroll-y refresher-enabled refresher-triggered={IsPull} onrefresherrefresh={PageRefresh} refresher-background='#f8f8f8'>
111
             <view className='PageContent'>
104
             <view className='PageContent'>
112
               {
105
               {
113
-                PageList.map((item, index) => (
106
+                /* 全部 与 新房 */
107
+                ['all', 'new'].indexOf(CurrnetMenuId) > -1 && activityList.map((item, index) => (
108
+                  <view className='ListItem' key={`List-${index}`}>
109
+                    <view>
110
+                      <view>
111
+                        <VideoListItem Data={item}></VideoListItem>
112
+                      </view>
113
+                    </view>
114
+                  </view>
115
+                ))
116
+              }
117
+              {
118
+                /* 预告 与 直播 */
119
+                ['notice', 'live'].indexOf(CurrnetMenuId) > -1 && activityList.map((item, index) => (
120
+                  <view className='ListItem' key={`List-${index}`}>
121
+                    <view>
122
+                      <view>
123
+                        <VideoListItem Data={item}></VideoListItem>
124
+                      </view>
125
+                    </view>
126
+                  </view>
127
+                ))
128
+              }
129
+              {
130
+                /* 视频 */
131
+                'video' === CurrnetMenuId && activityList.map((item, index) => (
114
                   <view className='ListItem' key={`List-${index}`}>
132
                   <view className='ListItem' key={`List-${index}`}>
115
                     <view>
133
                     <view>
116
                       <view>
134
                       <view>

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

1
 export default {
1
 export default {
2
-  navigationBarTitleText: '直播活动'
2
+  navigationBarTitleText: '直播活动',
3
+  enableShareAppMessage: true
3
 }
4
 }

+ 27
- 24
src/pages/video/liveDetail/index.jsx View File

1
 import { useState, useEffect } from "react";
1
 import { useState, useEffect } from "react";
2
 import Taro, { useDidShow, useReady } from "@tarojs/taro";
2
 import Taro, { useDidShow, useReady } from "@tarojs/taro";
3
 import withLayout from "@/layout";
3
 import withLayout from "@/layout";
4
-import {
5
-  Text,
6
-  View,
7
-  Picker,
8
-  Input,
9
-  ScrollView,
10
-  Image,
11
-  RichText,
12
-} from "@tarojs/components";
4
+import { Image } from "@tarojs/components";
5
+import { queryLiveDetail } from "@/services/item";
6
+import useParams from "@/utils/hooks/useParams";
7
+import useShare from "@/utils/hooks/useShare";
8
+import { getImgURL } from "@/utils/image";
13
 import "@/assets/css/iconfont.css";
9
 import "@/assets/css/iconfont.css";
14
 import "./index.scss";
10
 import "./index.scss";
15
-import {
16
-  // addActivityShareNum,
17
-  signupActivity,
18
-  favorActivity,
19
-  cancelFavorActivity,
20
-  queryActivityDetail,
21
-} from "@/services/activity";
22
-import {
23
-    queryLiveDetail
24
-  } from "@/services/item";
25
-
26
-import { getImgURL } from "@/utils/image";
27
 
11
 
28
 export default withLayout((props) => {
12
 export default withLayout((props) => {
29
-  const { id } = props.router.params;
13
+  const { router, shareContent, trackData, person, page } = props;
14
+  const { id } = router.params;
30
 
15
 
31
   const [data,setData] = useState({})
16
   const [data,setData] = useState({})
32
-console.log(id,'queryLiveDetail')
17
+  
18
+  // 本页面分享或者海报参数
19
+  const paramsRef = useParams({
20
+    id,
21
+    buildingId: data.buildingId,
22
+    person,
23
+    from: `${page.type}_share`,
24
+  });
25
+  const fullTrackData = { ...trackData, buildingId: data.buildingId };
26
+  
27
+  useShare(
28
+    {
29
+      title: shareContent.shareContentTitle || data?.name,
30
+      path: `${router.path}?${paramsRef.current}`,
31
+      image: shareContent.shareContentImg || getImgURL(data?.vide_img),
32
+    },
33
+    fullTrackData
34
+  );
35
+
33
   const getData = () => {
36
   const getData = () => {
34
     queryLiveDetail(id).then(res=>{
37
     queryLiveDetail(id).then(res=>{
35
         setData(res)
38
         setData(res)
47
        <view className='liveDetail-menu'>
50
        <view className='liveDetail-menu'>
48
            <view onClick={()=>{Taro.navigateTo({ url: `/pages/index/buildingDetail/index?id=${data.buildingId}` })}}><text className="iconfont icon-fenxiang"></text><text>查看楼盘</text></view>
51
            <view onClick={()=>{Taro.navigateTo({ url: `/pages/index/buildingDetail/index?id=${data.buildingId}` })}}><text className="iconfont icon-fenxiang"></text><text>查看楼盘</text></view>
49
            <view><text className="iconfont icon-camera"></text><text>观看直播</text></view>
52
            <view><text className="iconfont icon-camera"></text><text>观看直播</text></view>
50
-           <view><text className="iconfont icon-fenxiang"></text><text>分享好友</text></view>
53
+           <button openType="share"><text className="iconfont icon-fenxiang"></text><text>分享好友</text></button>
51
        </view></>}
54
        </view></>}
52
   </view>;
55
   </view>;
53
 });
56
 });

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

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

+ 28
- 6
src/pages/video/videoDetail/index.jsx View File

1
 import { useState, useEffect } from "react";
1
 import { useState, useEffect } from "react";
2
 import withLayout from "@/layout";
2
 import withLayout from "@/layout";
3
 import { ScrollView } from "@tarojs/components";
3
 import { ScrollView } from "@tarojs/components";
4
-import "@/assets/css/iconfont.css";
5
-import "./index.scss";
6
 import { fetch } from "@/utils/request";
4
 import { fetch } from "@/utils/request";
7
 import { API_VIDEO_DETAIL } from "@/constants/api";
5
 import { API_VIDEO_DETAIL } from "@/constants/api";
8
 import { formatDate } from "@/utils/chatDate";
6
 import { formatDate } from "@/utils/chatDate";
7
+import { getImgURL } from '@/utils/image'
8
+import useParams from "@/utils/hooks/useParams";
9
+import useShare from "@/utils/hooks/useShare";
10
+import "@/assets/css/iconfont.css";
11
+import "./index.scss";
9
 
12
 
10
 export default withLayout((props) => {
13
 export default withLayout((props) => {
11
-  const { id } = props.router.params;
14
+  const { router, shareContent, trackData, person, page } = props;
15
+  const { id } = router.params;
12
 
16
 
13
   const [data, setData] = useState({});
17
   const [data, setData] = useState({});
14
-  console.log(id, "queryLiveDetail");
18
+  
19
+  // 本页面分享或者海报参数
20
+  const paramsRef = useParams({
21
+    id,
22
+    buildingId: data.buildingId,
23
+    person,
24
+    from: `${page.type}_share`,
25
+  });
26
+  const fullTrackData = { ...trackData, buildingId: data.buildingId };
27
+  
28
+  useShare(
29
+    {
30
+      title: shareContent.shareContentTitle || data?.name,
31
+      path: `${router.path}?${paramsRef.current}`,
32
+      image: shareContent.shareContentImg || getImgURL(data?.vide_img),
33
+    },
34
+    fullTrackData
35
+  );
36
+
15
   const getData = () => {
37
   const getData = () => {
16
     fetch({ url: `${API_VIDEO_DETAIL}/${id}` }).then(res=>{
38
     fetch({ url: `${API_VIDEO_DETAIL}/${id}` }).then(res=>{
17
       setData(res)
39
       setData(res)
61
             </view>
83
             </view>
62
             <view className="Node"></view>
84
             <view className="Node"></view>
63
             {data.remark}
85
             {data.remark}
64
-            <view className="Share">
86
+            <button className="Share" openType="share">
65
               <text>分享好友</text>
87
               <text>分享好友</text>
66
-            </view>
88
+            </button>
67
           </view>
89
           </view>
68
         </view>
90
         </view>
69
       </ScrollView>
91
       </ScrollView>