[新增]增加了直播列表

This commit is contained in:
唐明明
2020-12-30 11:50:55 +08:00
parent 49a7bade36
commit aa90f73d69
9 changed files with 96 additions and 24 deletions

View File

@@ -15,6 +15,7 @@ import company from "./interfaces/company"
import companyModule from "./interfaces/home" import companyModule from "./interfaces/home"
import ticket from "./interfaces/ticket" import ticket from "./interfaces/ticket"
import address from "./interfaces/address" import address from "./interfaces/address"
import live from "./interfaces/live"
export default{ export default{
publics, publics,
@@ -28,5 +29,6 @@ export default{
company, company,
companyModule, companyModule,
ticket, ticket,
address address,
live
} }

View File

@@ -1,11 +1,11 @@
/* /*
* 电子名片 * 直播
*/ */
import {req} from "../request" import {req} from "../request"
const card = data => req({url: "cardpersonal" , data: data}) //名片信息 const rooms = () => req({url: "lives/rooms"}) //获取直播间列表
export default({ export default({
card rooms
}) })

View File

@@ -43,9 +43,6 @@ Component({
methods: { methods: {
// 视频滚动了 // 视频滚动了
changeVideo(e){ changeVideo(e){
console.log(e)
let videoLists = this.data.videoList, let videoLists = this.data.videoList,
current = e.detail.current, current = e.detail.current,
currentId = this.data.playId, currentId = this.data.playId,

View File

@@ -2,6 +2,7 @@
<swiper class="videoSwiper" vertical bindchange="changeVideo"> <swiper class="videoSwiper" vertical bindchange="changeVideo">
<swiper-item class="videoSwiperItem" wx:for="{{videoList}}" wx:key="videoItem" circular="{{videoList.length > 2}}"> <swiper-item class="videoSwiperItem" wx:for="{{videoList}}" wx:key="videoItem" circular="{{videoList.length > 2}}">
<video <video
class="videoSwiperItemVideo"
id="video{{item.video_id}}" id="video{{item.video_id}}"
src="{{item.path_url || ''}}" src="{{item.path_url || ''}}"
controls="{{controls}}" controls="{{controls}}"
@@ -12,8 +13,9 @@
bindplay="vipdeBindPlay" bindplay="vipdeBindPlay"
bindpause="vipdeBindPlay" bindpause="vipdeBindPlay"
loop loop
wx:if="{{item.video_id == playId}}"
> >
</video> </video>
<image src=""></image> <image class="videoCover" src="{{item.cover}}" mode="aspectFill"></image>
</swiper-item> </swiper-item>
</swiper> </swiper>

View File

@@ -15,7 +15,8 @@
-webkit-overflow-scrolling:touch; -webkit-overflow-scrolling:touch;
} }
.videoSwiperItem video{ .videoSwiperItemVideo,
.videoCover{
width: 100%; width: 100%;
height: 100%; height: 100%;
} }

View File

@@ -14,6 +14,7 @@ Page({
videoIndex : 0, //当前播放视频的下标 videoIndex : 0, //当前播放视频的下标
videoId : "", //当前播放的视频id videoId : "", //当前播放的视频id
playState : true, //视频播放状态 playState : true, //视频播放状态
rooms : [], //直播列表
}, },
/** /**
@@ -29,6 +30,18 @@ Page({
}) })
}, },
/**
* 获取直播间列表
*/
onShow(){
wx.$api.live.rooms().then(res=>{
console.log(res.list)
this.setData({
rooms: res.list
})
})
},
/*** /***
* 视频的播放状态 * 视频的播放状态
*/ */

View File

@@ -1,13 +1,5 @@
<view class="videos-content">
<navigator url="plugin-private://wx2b03c6e691cd7370/pages/live-player-plugin?room_id=4">进入直播间</navigator>
<view style="margin-top: 10vh">
<view bindtap="onId">改变全局id</view>
</view>
<view class="videos-content" wx:if="{{1 == 2}}">
<swiperViode <swiperViode
wx:if="{{videoList.length > 0}}" wx:if="{{videoList.length > 0}}"
class="swiper-viode" class="swiper-viode"
@@ -18,6 +10,14 @@
bind:swiperindex="swiperIndex" bind:swiperindex="swiperIndex"
> >
</swiperViode> </swiperViode>
<!-- 直播列表 -->
<view class="live-rooms">
<block wx:for="{{rooms}}" wx:key="rooms">
<navigator class="live-rooms-nav" url="plugin-private://wx2b03c6e691cd7370/pages/live-player-plugin?room_id={{item.roomid}}">
<image class="live-rooms-cover" src="{{item.cover_img}}" mode="aspectFill"></image>
</navigator>
</block>
</view>
<!-- 视频播放按钮 --> <!-- 视频播放按钮 -->
<view class="videoLayer-play {{!isPlay ? 'show': ''}}" src="/static/icons/play_icon.png"></view> <view class="videoLayer-play {{!isPlay ? 'show': ''}}" src="/static/icons/play_icon.png"></view>
<!-- 视频信息 --> <!-- 视频信息 -->

View File

@@ -7,7 +7,7 @@
page{ page{
/* background: #0e0c1a; */ background: #0e0c1a;
} }
.videoSwiper{ .videoSwiper{
@@ -19,13 +19,69 @@
.videos-content{ .videos-content{
position: relative; position: relative;
height: 100vh; height: 100vh;
display: none; box-sizing: border-box;
padding-bottom: calc(48px + env(safe-area-inset-bottom));
}
/* 直播信息 */
.live-rooms{
position: absolute;
top: calc(180rpx + env(safe-area-inset-bottom));
left: 30rpx;
}
.live-rooms-cover{
width: 98rpx;
height: 98rpx;
border-radius: 50%;
vertical-align: top;
}
.live-rooms-nav{
position: relative;
display: inline-block;
width: 98rpx;
height: 98rpx;
margin-left: 30rpx;
}
.live-rooms-nav:first-child{
margin-left: 0;
}
.live-rooms-nav::before,
.live-rooms-nav::after{
position: absolute;
content: "";
}
.live-rooms-nav::before{
width: 98rpx;
height: 98rpx;
border:solid 4rpx #FF8C37;
border-radius: 50%;
box-sizing: border-box;
}
.live-rooms-nav::after{
content: "直播中";
position: absolute;
bottom: 0;
left: 10rpx;
width: 78rpx;
background: #FF8C37;
color: white;
height: 32rpx;
line-height: 32rpx;
font-size: 20rpx;
text-align: center;
border-radius: 16rpx;
} }
/* 视频信息 */ /* 视频信息 */
.video-info{ .video-info{
position: absolute; position: absolute;
bottom: 50rpx; bottom: calc(78px + env(safe-area-inset-bottom));
left: 30rpx; left: 30rpx;
width: calc(100% - 218rpx); width: calc(100% - 218rpx);
} }
@@ -51,7 +107,7 @@
.video-tool{ .video-tool{
position: absolute; position: absolute;
right: 30rpx; right: 30rpx;
bottom: 50rpx; bottom: calc(78px + env(safe-area-inset-bottom));
} }
.video-tool-item{ .video-tool-item{

View File

@@ -40,7 +40,7 @@
}, },
"compileType": "miniprogram", "compileType": "miniprogram",
"libVersion": "2.13.2", "libVersion": "2.13.2",
"appid": "wx49efb36db851933d", "appid": "wxd931d03dfe955254",
"projectname": "%E8%A1%8C%E4%B8%9A%E7%89%88Saas", "projectname": "%E8%A1%8C%E4%B8%9A%E7%89%88Saas",
"debugOptions": { "debugOptions": {
"hidedInDevtools": [] "hidedInDevtools": []
@@ -59,7 +59,8 @@
"list": [] "list": []
}, },
"miniprogram": { "miniprogram": {
"list": [{ "list": [
{
"name": "登录", "name": "登录",
"pathName": "pages/login/login", "pathName": "pages/login/login",
"query": "", "query": "",