直播点播
This commit is contained in:
parent
6f01f7b5ee
commit
9a0df17f17
1
app.js
1
app.js
@ -10,6 +10,7 @@ App({
|
||||
activityUrl: 'http://192.168.0.111:8080/culturalactivity',
|
||||
volunteerUrl: 'http://192.168.0.111:8888/volunteer',
|
||||
liveUrl: 'http://192.168.0.113:8084/live',
|
||||
liveRecordUrl: 'http://192.168.0.113:8085',
|
||||
restAjax: restAjax,
|
||||
dialog: dialog,
|
||||
onLaunch: function () {
|
||||
|
10
app.json
10
app.json
@ -1,12 +1,12 @@
|
||||
{
|
||||
"pages": [
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
"pages/center/center",
|
||||
"pages/book/book",
|
||||
>>>>>>> master
|
||||
"pages/index/index",
|
||||
"pages/broadcast/broadcast",
|
||||
"pages/center/center",
|
||||
"pages/book/book",
|
||||
"pages/broadcastList/broadcastList",
|
||||
"pages/orderDetail/orderDetail",
|
||||
"pages/myVenueOrder/myVenueOrder",
|
||||
"pages/activityDialog/activityDialog",
|
||||
"pages/teamDetail/teamDetail",
|
||||
"pages/volunteerRegister/volunteerRegister",
|
||||
|
@ -1,18 +1,56 @@
|
||||
// pages/activityDialog/activityDialog.js
|
||||
var app = getApp();
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
|
||||
token: '',
|
||||
serviceId: ''
|
||||
},
|
||||
getToken: function() {
|
||||
var self = this;
|
||||
return new Promise(resolve =>{
|
||||
wx.getStorage({
|
||||
key: 'token',
|
||||
success(res) {
|
||||
self.setData({
|
||||
token: res.data
|
||||
})
|
||||
return resolve();
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
getActivityHis: function() {
|
||||
var self = this;
|
||||
app.restAjax.get(app.restAjax.path(app.volunteerUrl + '/wxminiapp/teamactivityhis/listpageteamactivityhis?serviceId=' + self.data.serviceId, []),
|
||||
{}, {
|
||||
headers: {
|
||||
token: self.data.token
|
||||
}
|
||||
}, function(code, data) {
|
||||
if('200' == code) {
|
||||
console.log(data)
|
||||
}
|
||||
}, function() {
|
||||
|
||||
}, function() {
|
||||
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
|
||||
var self = this;
|
||||
self.setData({
|
||||
serviceId: options.serviceId
|
||||
})
|
||||
this.getToken().then(result => {
|
||||
this.getActivityHis()
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -2,7 +2,10 @@
|
||||
<view class="broadcast-box" bindtap="goDetail" data-live-plan-id="{{item.livePlanId}}" wx:for="{{live.liveList}}" wx:for-index="idx" wx:for-item="item" wx:key="liveList">
|
||||
<view class="broadcast-img">
|
||||
<image src="{{live.liveUrl}}/route/file/downloadfile/true/{{item.livePlanPhoto}}"></image>
|
||||
<view class="broadcast-status">直播中</view>
|
||||
<view class="broadcast-status" wx:if="{{item.liveStatus == 0}}">已结束</view>
|
||||
<view class="broadcast-status" wx:elif="{{item.liveStatus == 1}}">未开始</view>
|
||||
<view class="broadcast-status" wx:elif="{{item.liveStatus == 2}}">直播中</view>
|
||||
<view class="broadcast-status" wx:else>错误</view>
|
||||
</view>
|
||||
<view class="broadcast-info">
|
||||
<view class="name">{{item.livePlanName}}</view>
|
||||
|
@ -39,6 +39,11 @@ Page({
|
||||
app.dialog.msg(data.msg);
|
||||
});
|
||||
},
|
||||
goLiveRecord(event) {
|
||||
wx.navigateTo({
|
||||
url: '../broadcastList/broadcastList?livePlanId='+ event.currentTarget.dataset.livePlanId,
|
||||
})
|
||||
},
|
||||
onLoad(option) {
|
||||
this.getLivePlan(option.livePlanId);
|
||||
},
|
||||
|
@ -1,8 +1,9 @@
|
||||
<view class="broadcast">
|
||||
<!-- <view class="page-section tc">
|
||||
<video id="myVideo" src="{{liveDetail.liveDeviceRtmpUrl}}" binderror="videoErrorCallback" danmu-list="{{danmuList}}" enable-danmu show-center-play-btn='{{false}}' show-play-btn="{{true}}" controls autoplay="{{true}}" picture-in-picture-mode="{{['push', 'pop']}}" bindenterpictureinpicture='bindVideoEnterPictureInPicture' bindleavepictureinpicture='bindVideoLeavePictureInPicture'></video>
|
||||
</view> -->
|
||||
<live-player id="liveVideo" src="{{liveDetail.liveDeviceRtmpUrl}}" mode="live" object-fit="contain" style="width: 100%; height: 400rpx;"/>
|
||||
<image src="{{liveUrl}}/route/file/downloadfile/true/{{liveDetail.livePlanPhoto}}" wx:if="{{liveDetail.liveStatus == 0}}" style="width:100%; height:100%;"></image>
|
||||
<view class="play-button-box" wx:if="{{liveDetail.liveStatus == 0}}" bindtap="goLiveRecord" data-live-plan-id="{{liveDetail.livePlanId}}">
|
||||
<view class="play-button"></view>
|
||||
</view>
|
||||
<live-player id="liveVideo" src="{{liveDetail.liveDeviceRtmpUrl}}" mode="live" object-fit="contain" style="width: 100%; height: 400rpx;" wx:if="{{liveDetail.liveStatus == 2}}"/>
|
||||
</view>
|
||||
<view class="broadcast-title">{{liveDetail.livePlanName}}</view>
|
||||
<view class="broadcast-time">
|
||||
|
@ -41,4 +41,31 @@ video{
|
||||
color: #5F5F5F;
|
||||
line-height: 40rpx;
|
||||
margin-top: 15rpx;
|
||||
}
|
||||
}
|
||||
.play-button-box {
|
||||
width: 200rpx;
|
||||
height: 200rpx;
|
||||
position: fixed;
|
||||
z-index: 100;
|
||||
top: 100rpx;
|
||||
left: 50%;
|
||||
margin-left: -100rpx;
|
||||
background-color: rgba(0, 0, 0, 0.5);
|
||||
border: 1rpx dotted rgba(255, 255, 255, 0.8);
|
||||
border-radius: 100rpx;
|
||||
}
|
||||
.play-button-box .play-button {
|
||||
border-top-width: 60rpx;
|
||||
border-bottom-width: 60rpx;
|
||||
border-left-width: 100rpx;
|
||||
border-style: solid;
|
||||
border-top-color: transparent;
|
||||
border-left-color: red;
|
||||
border-bottom-color: transparent;
|
||||
border-right-color: transparent;
|
||||
width: 0;
|
||||
height: 0;
|
||||
position: absolute;
|
||||
top: 40rpx;
|
||||
left: 60rpx;
|
||||
}
|
||||
|
159
pages/broadcastList/broadcastList.js
Normal file
159
pages/broadcastList/broadcastList.js
Normal file
@ -0,0 +1,159 @@
|
||||
// pages/broadcastList/broadcastList.js
|
||||
var app = getApp();
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
liveUrl: app.liveUrl,
|
||||
liveRecordUrl: app.liveRecordUrl,
|
||||
liveRecordSrc: null,
|
||||
livePlanId: '',
|
||||
liveRecoreList: [],
|
||||
videoContext: null,
|
||||
currentPage: 1,
|
||||
rows: 20,
|
||||
isPlay: false
|
||||
},
|
||||
getLivePlanRecordList: function(page) {
|
||||
var self = this;
|
||||
app.dialog.loading('正在加载');
|
||||
app.restAjax.get(app.restAjax.path('{liveUrl}/app/liverecord/listpageliverecordrelease/{planId}', [self.data.liveUrl, self.data.livePlanId]), {
|
||||
page: page,
|
||||
rows: self.data.rows
|
||||
}, null, function(code, data) {
|
||||
if(data.rows.length == 0) {
|
||||
app.dialog.msg('暂无数据');
|
||||
return;
|
||||
}
|
||||
var liveRecoreArray;
|
||||
if(page <= 1) {
|
||||
liveRecoreArray = data.rows;
|
||||
} else {
|
||||
liveRecoreArray = self.data.liveRecoreList;
|
||||
liveRecoreArray = liveRecoreArray.concat(data.rows);
|
||||
}
|
||||
self.setData({
|
||||
currentPage: page,
|
||||
'liveRecoreList': liveRecoreArray
|
||||
})
|
||||
}, function(code, data) {
|
||||
app.dialog.msg(data.msg);
|
||||
}, function() {
|
||||
wx.stopPullDownRefresh();
|
||||
wx.hideLoading();
|
||||
})
|
||||
},
|
||||
doChangeSrc: function(event) {
|
||||
var self = this;
|
||||
self.setData({
|
||||
liveRecordSrc: event.currentTarget.dataset.liveRecordSrc
|
||||
})
|
||||
self.videoContext.play({
|
||||
success: function() {
|
||||
self.setData({
|
||||
isPlay: true
|
||||
})
|
||||
}
|
||||
});
|
||||
},
|
||||
onPlayStateChange: function(event) {
|
||||
console.log(event.detail.code)
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
this.videoContext = wx.createLivePlayerContext('liveRecordVideo');
|
||||
this.setData({
|
||||
livePlanId: options.livePlanId
|
||||
})
|
||||
this.getLivePlanRecordList(1);
|
||||
},
|
||||
doPlay: function() {
|
||||
var self = this;
|
||||
if(!self.data.liveRecordSrc) {
|
||||
if(self.data.liveRecoreList.length == 0) {
|
||||
app.dialog.msg('无播放内容');
|
||||
return;
|
||||
}
|
||||
self.setData({
|
||||
liveRecordSrc : self.data.liveRecoreList[0].recordFilePath
|
||||
});
|
||||
self.videoContext.play({
|
||||
success: function() {
|
||||
self.setData({
|
||||
isPlay: true
|
||||
})
|
||||
}
|
||||
});
|
||||
} else {
|
||||
self.videoContext.play({
|
||||
success: function() {
|
||||
self.setData({
|
||||
isPlay: true
|
||||
})
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
doStop: function() {
|
||||
var self = this;
|
||||
self.videoContext.pause({
|
||||
success: function() {
|
||||
self.setData({
|
||||
isPlay: false
|
||||
})
|
||||
}
|
||||
});
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh: function () {
|
||||
this.getLivePlanRecordList(1);
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom: function () {
|
||||
this.getLivePlanRecordList(this.data.currentPage + 1);
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage: function () {
|
||||
|
||||
}
|
||||
})
|
5
pages/broadcastList/broadcastList.json
Normal file
5
pages/broadcastList/broadcastList.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"usingComponents": {},
|
||||
"enablePullDownRefresh": true,
|
||||
"backgroundTextStyle": "dark"
|
||||
}
|
9
pages/broadcastList/broadcastList.wxml
Normal file
9
pages/broadcastList/broadcastList.wxml
Normal file
@ -0,0 +1,9 @@
|
||||
<view class="broadcast">
|
||||
<view class="play-button-box" wx:if="{{!isPlay}}" bindtap="doPlay">
|
||||
<view class="play-button"></view>
|
||||
</view>
|
||||
<live-player id="liveRecordVideo" bindtap="doStop" src="{{liveRecordUrl}}/{{liveRecordSrc}}" bindstatechange="onPlayStateChange" mode="live" object-fit="contain" style="width: 100%; height: 400rpx;" wx:if="{{liveRecordSrc}}"/>
|
||||
</view>
|
||||
<view class="broadcast-list">
|
||||
<view class="broadcast-title" bindtap="doChangeSrc" data-live-record-src="{{item.recordFilePath}}" wx:for="{{liveRecoreList}}" wx:for-index="index" wx:for-item="item" wx:key="liveRecoreList">{{index + 1}}.{{item.recordFileName}}</view>
|
||||
</view>
|
49
pages/broadcastList/broadcastList.wxss
Normal file
49
pages/broadcastList/broadcastList.wxss
Normal file
@ -0,0 +1,49 @@
|
||||
.broadcast{
|
||||
width: 100%;
|
||||
height: 400rpx;
|
||||
background: #000000;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
}
|
||||
video{
|
||||
width: 100%;
|
||||
height: 400rpx;
|
||||
}
|
||||
.broadcast-title{
|
||||
padding: 30rpx;
|
||||
font-size: 34rpx;
|
||||
color: #242424;
|
||||
border-bottom: 5px solid #FBFBFB;
|
||||
}
|
||||
.broadcast-list{
|
||||
margin-top: 400rpx;
|
||||
}
|
||||
.play-button-box {
|
||||
width: 200rpx;
|
||||
height: 200rpx;
|
||||
position: fixed;
|
||||
z-index: 100;
|
||||
top: 100rpx;
|
||||
left: 50%;
|
||||
margin-left: -100rpx;
|
||||
background-color: rgba(0, 0, 0, 0.5);
|
||||
border: 1rpx dotted rgba(255, 255, 255, 0.8);
|
||||
border-radius: 100rpx;
|
||||
}
|
||||
.play-button-box .play-button {
|
||||
border-top-width: 60rpx;
|
||||
border-bottom-width: 60rpx;
|
||||
border-left-width: 100rpx;
|
||||
border-style: solid;
|
||||
border-top-color: transparent;
|
||||
border-left-color: red;
|
||||
border-bottom-color: transparent;
|
||||
border-right-color: transparent;
|
||||
width: 0;
|
||||
height: 0;
|
||||
position: absolute;
|
||||
top: 40rpx;
|
||||
left: 60rpx;
|
||||
}
|
@ -143,9 +143,9 @@ Page({
|
||||
url: '../venue/venue',
|
||||
})
|
||||
},
|
||||
goBroadcastDetail: function () {
|
||||
goBroadcastDetail: function (event) {
|
||||
wx.navigateTo({
|
||||
url: '../broadcastDetail/broadcastDetail',
|
||||
url: '../broadcastDetail/broadcastDetail?livePlanId='+ event.currentTarget.dataset.livePlanId,
|
||||
})
|
||||
},
|
||||
goActivity: function () {
|
||||
|
@ -115,10 +115,14 @@
|
||||
</view>
|
||||
</view>
|
||||
<view class="broadcast-container">
|
||||
<view class="broadcast-box" bindtap="goBroadcastDetail" wx:for="{{live.liveList}}" wx:for-index="index" wx:for-item="item" wx:key="liveList">
|
||||
<view class="broadcast-box" bindtap="goBroadcastDetail" data-live-plan-id="{{item.livePlanId}}" wx:for="{{live.liveList}}" wx:for-index="index" wx:for-item="item" wx:key="liveList">
|
||||
<image src="{{live.liveUrl}}/route/file/downloadfile/true/{{item.livePlanPhoto}}"></image>
|
||||
<view class="broadcast-text">文字</view>
|
||||
<view class="broadcast-status">直播中</view>
|
||||
<view class="broadcast-text">{{item.livePlanName}}</view>
|
||||
<view class="broadcast-status">直播中</view>
|
||||
<view class="broadcast-status" wx:if="{{item.liveStatus == 0}}">已结束</view>
|
||||
<view class="broadcast-status" wx:elif="{{item.liveStatus == 1}}">未开始</view>
|
||||
<view class="broadcast-status" wx:elif="{{item.liveStatus == 2}}">直播中</view>
|
||||
<view class="broadcast-status" wx:else>错误</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
@ -224,11 +224,21 @@ Page({
|
||||
|
||||
})
|
||||
},
|
||||
toActivityHis: function() {
|
||||
var self = this;
|
||||
wx.navigateTo({
|
||||
url: '../activityDialog/activityDialog?serviceId=' + self.data.serviceId,
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
var id = options.id;
|
||||
var self = this;
|
||||
self.setData({
|
||||
serviceId: id
|
||||
})
|
||||
this.getToken().then(result => {
|
||||
this.getDetail(id);
|
||||
this.getMyTeam();
|
||||
|
@ -22,7 +22,10 @@
|
||||
</view>
|
||||
<view class="activity-container">
|
||||
<view class="part">
|
||||
<view class="part-title">活动详情</view>
|
||||
<view class="part-title">
|
||||
活动详情
|
||||
<view class="comment-btn" bindtap="toActivityHis">评论列表</view>
|
||||
</view>
|
||||
<rich-text class="part-content" nodes="{{dataMap.introduce}}"></rich-text>
|
||||
</view>
|
||||
</view>
|
||||
|
@ -51,6 +51,15 @@
|
||||
padding-left: 10rpx;
|
||||
font-size: 30rpx;
|
||||
margin-bottom: 10rpx;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
.comment-btn{
|
||||
padding: 0 10rpx;
|
||||
background: #9F1512;
|
||||
color: #fff;
|
||||
font-size: 28rpx;
|
||||
border-radius: 10rpx;
|
||||
}
|
||||
.part-content{
|
||||
font-size: 28rpx;
|
||||
|
@ -7,6 +7,7 @@ Page({
|
||||
*/
|
||||
data: {
|
||||
token: '',
|
||||
volunteerMsg: [],
|
||||
isAgree: false, // 是否同意志愿者注册协议
|
||||
openExperience: 0,
|
||||
tempObj: {}, // 用于临时存储字典表返回的数据
|
||||
@ -180,7 +181,7 @@ Page({
|
||||
icon: 'none',
|
||||
duration: 1500
|
||||
})
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
var volunteerVO = {
|
||||
serviceCity: self.data.teamCity[self.data.teamCityIndex] != ''
|
||||
@ -203,7 +204,13 @@ Page({
|
||||
agree: self.data.isAgree,
|
||||
openExperience : self.data.openExperience
|
||||
};
|
||||
app.restAjax.post(app.restAjax.path(app.volunteerUrl + '/wxminiapp/volunteer/savevolunteer', []),
|
||||
var url;
|
||||
if(!self.data.volunteerMsg) {
|
||||
url = '/wxminiapp/volunteer/savevolunteer';
|
||||
}else {
|
||||
url = '/wxminiapp/volunteer/updatevolunteer/' + self.data.volunteerMsg.volunteerId;
|
||||
}
|
||||
app.restAjax.post(app.restAjax.path(app.volunteerUrl + url, []),
|
||||
volunteerVO, {
|
||||
headers: {
|
||||
'token': self.data.token
|
||||
@ -263,31 +270,55 @@ Page({
|
||||
})
|
||||
})
|
||||
},
|
||||
getVolunteerMsg() {
|
||||
var self = this;
|
||||
return new Promise(resolve => {
|
||||
app.restAjax.get(app.restAjax.path(app.volunteerUrl + '/wxminiapp/volunteer/getvolunteerbyuserid', []),
|
||||
{}, {
|
||||
headers: {
|
||||
'token': self.data.token
|
||||
}
|
||||
}, function(code, data) {
|
||||
if('200' == code) {
|
||||
self.setData({
|
||||
volunteerMsg: data
|
||||
})
|
||||
}
|
||||
return resolve();
|
||||
}, function() {
|
||||
|
||||
}, function() {
|
||||
|
||||
})
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
var self = this;
|
||||
this.getToken().then(result => {
|
||||
this.getDataFromDict('a223b308-014a-4e89-93fa-035a564e7fda', 1).then(result => {
|
||||
self.setData({
|
||||
serviceType: self.data.tempObj,
|
||||
tempObj: {}
|
||||
})
|
||||
}).then(result => {
|
||||
this.getDataFromDict('7b213c37-8575-4db3-bda1-86c4e38589f7', 1).then(result => {
|
||||
this.getVolunteerMsg().then(result => {
|
||||
this.getDataFromDict('a223b308-014a-4e89-93fa-035a564e7fda', 1).then(result => {
|
||||
self.setData({
|
||||
serviceIndustry: self.data.tempObj,
|
||||
serviceType: self.data.tempObj,
|
||||
tempObj: {}
|
||||
})
|
||||
})
|
||||
}).then(result => {
|
||||
this.getDataFromDict('4a03e904-81e2-48e9-9006-e15ea4a6bc69', 2).then(result => {
|
||||
self.setData({
|
||||
teamCity: self.data.tempObj,
|
||||
teamCityArray: self.data.tempArray,
|
||||
tempObj: {},
|
||||
tempArray: []
|
||||
}).then(result => {
|
||||
this.getDataFromDict('7b213c37-8575-4db3-bda1-86c4e38589f7', 1).then(result => {
|
||||
self.setData({
|
||||
serviceIndustry: self.data.tempObj,
|
||||
tempObj: {}
|
||||
})
|
||||
})
|
||||
}).then(result => {
|
||||
this.getDataFromDict('4a03e904-81e2-48e9-9006-e15ea4a6bc69', 2).then(result => {
|
||||
self.setData({
|
||||
teamCity: self.data.tempObj,
|
||||
teamCityArray: self.data.tempArray,
|
||||
tempObj: {},
|
||||
tempArray: []
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user