Browse Source

信息修改

1002884655 3 years ago
parent
commit
e6ff7a0e15

+ 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: '"https://www.newhousehold.cn"',
6
+    // HOST: '"https://xlk.njyz.tech"',
7
+    HOST: '"https://www.newhousehold.cn"',
8
     // HOST: '"http://127.0.0.1:8567"',
8
     // HOST: '"http://127.0.0.1:8567"',
9
     WSS_HOST: '"wss://www.newhousehold.cn"',
9
     WSS_HOST: '"wss://www.newhousehold.cn"',
10
     // WSS_HOST: '"wss://xlk.njyz.tech"',
10
     // WSS_HOST: '"wss://xlk.njyz.tech"',

+ 0
- 1
src/pages/index/buildingList/index.jsx View File

147
     for (let key in e) {
147
     for (let key in e) {
148
       Data[key] = e[key]
148
       Data[key] = e[key]
149
     }
149
     }
150
-    console.log(Data)
151
     setFilterData({...Data})
150
     setFilterData({...Data})
152
   }
151
   }
153
 
152
 

+ 1
- 1
src/pages/index/components/LiveSale/index.jsx View File

50
             {
50
             {
51
               PageList.map((item, index) => (
51
               PageList.map((item, index) => (
52
                 <view className='ListItem' key={`List-${index}`} style={{display: CurrentId === 1 || (CurrentId === 2 && item.kind === 'notice') || (CurrentId === 3 && item.kind === 'live')  || (CurrentId === 4 && item.kind !== 'notice') ? 'inline-block' : 'none'}}>
52
                 <view className='ListItem' key={`List-${index}`} style={{display: CurrentId === 1 || (CurrentId === 2 && item.kind === 'notice') || (CurrentId === 3 && item.kind === 'live')  || (CurrentId === 4 && item.kind !== 'notice') ? 'inline-block' : 'none'}}>
53
-                  <Image mode='aspectFill' className='centerLabel' onClick={()=>{Taro.navigateTo({ url: `/pages/video/liveDetail/index?id=${item.id}` })}} src={`${getImgURL(item.images)}`} />
53
+                  <Image mode='aspectFill' className='centerLabel' onClick={()=>{Taro.navigateTo({ url: `/pages/video/liveDetail/index?id=${item.id}&type=${item.type}` })}} src={`${getImgURL(item.images)}`} />
54
                 </view>
54
                 </view>
55
               ))
55
               ))
56
             }
56
             }

+ 77
- 39
src/pages/video/liveDetail/index.jsx View File

4
 import withLayout from "@/layout";
4
 import withLayout from "@/layout";
5
 import { Image } from "@tarojs/components";
5
 import { Image } from "@tarojs/components";
6
 import { queryLiveDetail } from "@/services/item";
6
 import { queryLiveDetail } from "@/services/item";
7
+import { fetch } from '@/utils/request'
8
+import { API_VIDEO_DETAIL } from '@/constants/api'
7
 import useParams from "@/utils/hooks/useParams";
9
 import useParams from "@/utils/hooks/useParams";
8
 import useShare from "@/utils/hooks/useShare";
10
 import useShare from "@/utils/hooks/useShare";
9
 import { getImgURL } from "@/utils/image";
11
 import { getImgURL } from "@/utils/image";
13
 
15
 
14
 export default withLayout((props) => {
16
 export default withLayout((props) => {
15
   const { router, shareContent, trackData, person, page, setNavigationBarTitle } = props;
17
   const { router, shareContent, trackData, person, page, setNavigationBarTitle } = props;
16
-  const { id } = router.params;
18
+  const { id, type } = router.params;
17
 
19
 
18
   const [data, setData] = useState({})
20
   const [data, setData] = useState({})
21
+  const [CanPlay, setCanPlay] = useState(false)
19
   // 直播间信息
22
   // 直播间信息
20
   const livingRef = useRef()
23
   const livingRef = useRef()
21
 
24
 
38
   );
41
   );
39
 
42
 
40
   const getData = () => {
43
   const getData = () => {
41
-    queryLiveDetail(id).then(res => {
42
-      setData(res||{})
43
-      setNavigationBarTitle(res?.name)
44
-      if (res?.liveRoomParam) {
45
-        const { livingid } = JSON.parse(res.liveRoomParam)
46
-        getLivingCode(livingid).then((liveInfo) => {
47
-          livingRef.current = liveInfo
48
-        })
49
-      }
50
-    })
44
+    if(type === 'live') { // 直播
45
+      queryLiveDetail(id).then(res => {
46
+        setData(res||{})
47
+        setNavigationBarTitle(res?.name)
48
+        if (res?.liveRoomParam) {
49
+          const { livingid } = JSON.parse(res.liveRoomParam)
50
+          getLivingCode(livingid).then((liveInfo) => {
51
+            livingRef.current = liveInfo
52
+          })
53
+        }
54
+      })
55
+    } else { // 视频
56
+      fetch({url: `${API_VIDEO_DETAIL}/${id}`, method: 'get'}).then((res) => {
57
+        setData(res||{})
58
+        setNavigationBarTitle(res?.name)
59
+        livingRef.current = res
60
+      })
61
+    }
51
   };
62
   };
52
 
63
 
53
   useEffect(() => {
64
   useEffect(() => {
61
     }
72
     }
62
   }, [trackData, data])
73
   }, [trackData, data])
63
 
74
 
64
-  const handleLive = () => {
65
-    if (!livingRef.current) {
66
-      Taro.showToast({
67
-        title: '查询直播凭证失败, 请退出重试',
68
-        icon: 'none',
69
-      })
70
-      return;
75
+  const ended = () => {
76
+    return () => {
77
+      setCanPlay(false)
71
     }
78
     }
79
+  }
72
 
80
 
73
-    // https://work.weixin.qq.com/api/doc/90000/90135/93635
74
-    const { livingCode, status } = livingRef.current
75
-
76
-    //
77
-    if (status >= 3) {
78
-      Taro.showToast({
79
-        title: `直播活动已${status === 3 ? '过期' : '取消'}`,
80
-        icon: 'none',
81
+  const handleLive = () => {
82
+    if(type === 'live') {
83
+      if (!livingRef.current) {
84
+        Taro.showToast({
85
+          title: '查询直播凭证失败, 请退出重试',
86
+          icon: 'none',
87
+        })
88
+        return;
89
+      }
90
+  
91
+      // https://work.weixin.qq.com/api/doc/90000/90135/93635
92
+      const { livingCode, status } = livingRef.current
93
+  
94
+      //
95
+      if (status >= 3) {
96
+        Taro.showToast({
97
+          title: `直播活动已${status === 3 ? '过期' : '取消'}`,
98
+          icon: 'none',
99
+        })
100
+        return;
101
+      }
102
+  
103
+      // 如果已经结束的则播放回放
104
+      const replay = status === 2 ? '&replay=1' : ''
105
+  
106
+      // 跳转到直播
107
+      Taro.navigateToMiniProgram({
108
+        // 固定跳转到微信企业直播
109
+        appId: 'wx7424030d69bde86e',
110
+        path: `pages/watch/index?living_code=${encodeURIComponent(livingCode)}${replay}`,
81
       })
111
       })
82
-      return;
112
+    } else {
113
+      setCanPlay(true)
83
     }
114
     }
84
-
85
-    // 如果已经结束的则播放回放
86
-    const replay = status === 2 ? '&replay=1' : ''
87
-
88
-    // 跳转到直播
89
-    Taro.navigateToMiniProgram({
90
-      // 固定跳转到微信企业直播
91
-      appId: 'wx7424030d69bde86e',
92
-      path: `pages/watch/index?living_code=${encodeURIComponent(livingCode)}${replay}`,
93
-    })
94
   }
115
   }
95
 
116
 
96
   useEffect(() => {
117
   useEffect(() => {
100
   }, [id]);
121
   }, [id]);
101
   //   
122
   //   
102
   return <view className="liveDetail">
123
   return <view className="liveDetail">
103
-    {data.liveActivityId && <><Image mode='aspectFill' src={getImgURL(data.detailTypeImg)} className='liveImg'></Image>
124
+    {
125
+      type === 'video' && data.videoUrl && CanPlay &&
126
+      <view className="myVideo">
127
+        <video 
128
+          src={data.videoUrl}
129
+          enable-danmu 
130
+          danmu-btn 
131
+          show-center-play-btn={false}
132
+          show-play-btn
133
+          controls
134
+          autoplay
135
+          onended={ended()}
136
+          picture-in-picture-mode={['push', 'pop']}
137
+          object-fit='contain'
138
+        ></video>
139
+      </view>
140
+    }
141
+    {(data.liveActivityId || data.videoId) && <><Image mode='aspectFill' src={getImgURL(data.detailTypeImg || data.videImg)} className='liveImg'></Image>
104
       <view className='liveDetail-menu flex-h'>
142
       <view className='liveDetail-menu flex-h'>
105
         <view className='flex-item'>
143
         <view className='flex-item'>
106
           <view onClick={() => { Taro.navigateTo({ url: `/pages/index/buildingDetail/index?id=${data.buildingId}` }) }}><text className="iconfont icon-fenxiang"></text><text>查看楼盘</text></view>
144
           <view onClick={() => { Taro.navigateTo({ url: `/pages/index/buildingDetail/index?id=${data.buildingId}` }) }}><text className="iconfont icon-fenxiang"></text><text>查看楼盘</text></view>
107
         </view>
145
         </view>
108
         <view className='flex-item'>
146
         <view className='flex-item'>
109
-          <view onClick={handleLive}><text className="iconfont icon-camera"></text><text>观看直播</text></view>
147
+          <view onClick={handleLive}><text className="iconfont icon-camera"></text><text>观看{type === 'live' ? '直播' : '视频'}</text></view>
110
         </view>
148
         </view>
111
         <view className='flex-item'>
149
         <view className='flex-item'>
112
           <button openType="share"><text className="iconfont icon-fenxiang"></text><text>分享好友</text></button>
150
           <button openType="share"><text className="iconfont icon-fenxiang"></text><text>分享好友</text></button>

+ 14
- 0
src/pages/video/liveDetail/index.scss View File

40
       }
40
       }
41
     }
41
     }
42
   }
42
   }
43
+  >.myVideo{
44
+    width: 100vw;
45
+    height: 100vh;
46
+    position: fixed;
47
+    left: 0;
48
+    top: 0;
49
+    bottom: 0;
50
+    display: block;
51
+    z-index: 100;
52
+    >video {
53
+      width: 100%;
54
+      height: 100%;
55
+    }
56
+  }
43
 }
57
 }