zlisen 3 年前
父节点
当前提交
30fd5057ae

+ 3
- 0
src/constants/api.js 查看文件

@@ -274,3 +274,6 @@ export const API_BRAND_INFO = resolvePath('brand')
274 274
 //特价房
275 275
 export const API_BUILDINGSPECIALROOM_LIST = resolvePath('buildingSpecialRoom')
276 276
 export const API_BUILDINGSPECIALROOM_BUILDING_LIST = resolvePath('buildingSpecialRoom/building')
277
+
278
+// video
279
+export const API_VIDEO_DETAIL = resolvePath('detail')

+ 13
- 1
src/pages/video/components/VideoListItem/index.jsx 查看文件

@@ -1,11 +1,23 @@
1
+import Taro from '@tarojs/taro'
1 2
 import { getImgURL } from '@/utils/image'
2 3
 import { Image } from '@tarojs/components'
3 4
 import './index.scss'
4 5
 
5 6
 export default function VideoListItem (props) {
6 7
   const { Data = {} } = props
8
+
9
+  const toDetail=()=>{
10
+    console.log(Data,'------------')
11
+    if(Data.type=='video'){
12
+      Taro.navigateTo({ url: `/pages/video/videoDetail/index?id=${Data.id}` })
13
+    }else{
14
+      Taro.navigateTo({ url: `/pages/video/liveDetail/index?id=${Data.id}` })
15
+    }
16
+    // 
17
+  }
18
+  // onClick={()=>{}
7 19
   return (
8
-    <view className='components VideoListItem'>
20
+    <view className='components VideoListItem' onClick={()=>toDetail()}>
9 21
       <view className='Img'>
10 22
         <view>
11 23
           <Image mode='aspectFill' className='centerLabel' src={getImgURL(Data.images) || null} />

+ 54
- 24
src/pages/video/videoDetail/index.jsx 查看文件

@@ -1,44 +1,74 @@
1
+import { useState, useEffect } from "react";
2
+import withLayout from "@/layout";
3
+import { ScrollView } from "@tarojs/components";
4
+import "@/assets/css/iconfont.css";
5
+import "./index.scss";
6
+import { fetch } from "@/utils/request";
7
+import { API_VIDEO_DETAIL } from "@/constants/api";
8
+import getDateFormat from "@/utils/chatDate";
1 9
 
2
-import withLayout from '@/layout'
3
-import { ScrollView } from '@tarojs/components'
4
-import '@/assets/css/iconfont.css'
5
-import './index.scss'
10
+export default withLayout((props) => {
11
+  const { id } = props.router.params;
6 12
 
7
-export default withLayout(() => {
13
+  const [data, setData] = useState({});
14
+  console.log(id, "queryLiveDetail");
15
+  const getData = () => {
16
+    fetch({ url: `${API_VIDEO_DETAIL}/${id}` }).then(res=>{
17
+      setData(res)
18
+    });
19
+  };
20
+
21
+  useEffect(() => {
22
+    if (id) {
23
+      getData();
24
+    }
25
+  }, [id]);
8 26
 
9 27
   return (
10
-    <view className='Page videoDetail'>
28
+    <view className="Page videoDetail">
11 29
       <ScrollView scroll-y>
12
-        <view className='Content'>
13
-
30
+        <view className="Content">
14 31
           {/* 视频 */}
15
-          <view className='VideoContainer'>
16
-            <view>
17
-
18
-            </view>
32
+          <view className="VideoContainer">
33
+            <video
34
+              id="myVideo"
35
+              src={data.videoUrl}
36
+              // binderror="videoErrorCallback"
37
+              // danmu-list="{{danmuList}}"
38
+              // enable-danmu
39
+              // danmu-btn
40
+              // show-center-play-btn='{{false}}'
41
+              // show-play-btn="{{true}}"
42
+              // controls
43
+              // picture-in-picture-mode="{{['push', 'pop']}}"
44
+              // bindenterpictureinpicture='bindVideoEnterPictureInPicture'
45
+              // bindleavepictureinpicture='bindVideoLeavePictureInPicture'
46
+            ></video>
19 47
           </view>
20 48
 
21 49
           {/* 视频信息 */}
22
-          <view className='Info'>
23
-            <text className='Name'>视频看好房,直播抢优惠!</text>
24
-            <text className='Time'>时间:2021年7月6日  13:00</text>
50
+          <view className="Info">
51
+            <text className="Name">{data.name}</text>
52
+            <text className="Time">时间:{getDateFormat(
53
+            new Date(data.createdTime).valueOf(),
54
+            true,
55
+            'yyyy年M月d日'
56
+          )}</text>
25 57
           </view>
26 58
 
27 59
           {/* 详情 */}
28
-          <view className='Detail'>
29
-            <view className='Title'>
60
+          <view className="Detail">
61
+            <view className="Title">
30 62
               <text>视频详情</text>
31 63
             </view>
32
-            <view className='Node'>
33
-
34
-            </view>
35
-            <view className='Share'>
64
+            <view className="Node"></view>
65
+            {data.remark}
66
+            <view className="Share">
36 67
               <text>分享好友</text>
37 68
             </view>
38 69
           </view>
39
-
40 70
         </view>
41 71
       </ScrollView>
42 72
     </view>
43
-  )
44
-})
73
+  );
74
+});

+ 1
- 1
src/pages/video/videoDetail/index.scss 查看文件

@@ -15,7 +15,7 @@
15 15
         position: relative;
16 16
         overflow: hidden;
17 17
         background: #eee;
18
-        >view {
18
+        >video {
19 19
           width: 100%;
20 20
           position: absolute;
21 21
           left: 0;