完善首页、新闻,直播列表

This commit is contained in:
wenc000 2020-06-26 19:32:52 +08:00
parent 92417388f2
commit 3cb1681230
12 changed files with 122 additions and 63 deletions

2
app.js
View File

@ -9,7 +9,7 @@ App({
venueUrl: 'http://192.168.0.109:8082/venuebooking',
activityUrl: 'http://192.168.0.111:8080/culturalactivity/',
volunteerUrl: 'http://192.168.0.111:8888/volunteer/',
liveUrl: 'http://192.168.0.113:8084/live',
restAjax: restAjax,
dialog: dialog,
onLaunch: function () {

View File

@ -3,6 +3,7 @@
"pages/index/index",
"pages/activityDialog/activityDialog",
"pages/teamDetail/teamDetail",
"pages/broadcast/broadcast",
"pages/center/center",
"pages/volunteerRegister/volunteerRegister",
"pages/volunteer/volunteer",
@ -11,7 +12,6 @@
"pages/venueDetail/venueDetail",
"pages/register/register",
"pages/login/login",
"pages/broadcast/broadcast",
"pages/newVolunteerActivity/newVolunteerActivity",
"pages/newTeam/newTeam",
"pages/volunteerTeam/volunteerTeam",

View File

@ -1,22 +1,57 @@
// pages/broadcast/broadcast.js
var app = getApp();
Page({
/**
* 页面的初始数据
*/
data: {
live: {
liveUrl: app.liveUrl,
liveList: []
},
goDetail: function () {
currentPage: 1,
rows: 10
},
doGetLiveList: function(page) {
var self = this;
app.dialog.loading('正在加载');
app.restAjax.get(app.restAjax.path('{liveUrl}/app/liveplan/listpageliveplanrelease', [self.data.live.liveUrl]), {
page: page,
rows: self.data.rows
}, null, function(code, data) {
if(data.rows.length == 0) {
app.dialog.msg('暂无数据');
return;
}
var liveArray;
if(page <= 1) {
liveArray = data.rows;
} else {
liveArray = self.data.live.liveList;
liveArray = liveArray.concat(data.rows);
}
self.setData({
currentPage: page,
'live.liveList': liveArray
})
}, function(code, data) {
app.dialog.msg(data.msg);
}, function() {
wx.stopPullDownRefresh();
wx.hideLoading();
});
},
goDetail: function (event) {
wx.navigateTo({
url: '../broadcastDetail/broadcastDetail',
url: '../broadcastDetail/broadcastDetail?livePlanId='+ event.currentTarget.dataset.livePlanId,
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
var self = this;
self.doGetLiveList(1);
},
/**
@ -51,14 +86,14 @@ Page({
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
this.doGetLiveList(1);
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
this.doGetLiveList(this.data.currentPage + 1);
},
/**

View File

@ -1,3 +1,5 @@
{
"usingComponents": {}
"usingComponents": {},
"enablePullDownRefresh": true,
"backgroundTextStyle": "dark"
}

View File

@ -1,20 +1,11 @@
<view class="broadcast">
<view class="broadcast-box" bindtap="goDetail">
<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="../../images/center-bg.png"></image>
<image src="{{live.liveUrl}}/route/file/downloadfile/true/{{item.livePlanPhoto}}"></image>
</view>
<view class="broadcast-info">
<view class="name">银保监会印发《关于加快推进意外险改直播标题</view>
<view class="time">2020-02-02 14:00:00至2020-02-03 14:00:00</view>
</view>
</view>
<view class="broadcast-box" bindtap="goDetail">
<view class="broadcast-img">
<image src="../../images/center-bg.png"></image>
</view>
<view class="broadcast-info">
<view class="name">银保监会印发《关于加快推进意外险改直播标题</view>
<view class="time">2020-02-02 14:00:00至2020-02-03 14:00:00</view>
<view class="name">{{item.livePlanName}}</view>
<view class="time">{{item.livePlanStart}}至{{item.livePlanEnd}}</view>
</view>
</view>
</view>

View File

@ -1,3 +1,4 @@
var app = getApp();
function getRandomColor() {
const rgb = []
for (let i = 0; i < 3; ++i) {
@ -10,7 +11,9 @@ function getRandomColor() {
Page({
data: {
src: '',
liveUrl: app.liveUrl,
liveDetail: {},
videoContext: null,
},
onShareAppMessage() {
@ -21,7 +24,21 @@ Page({
},
onReady() {
this.videoContext = wx.createVideoContext('myVideo')
// this.videoContext = wx.createVideoContext('myVideo')
},
getLivePlan(livePlanId) {
var self = this;
app.restAjax.get(app.restAjax.path('{liveUrl}/app/liveplan/getliveplanbyidrelease/{livePlanId}', [self.data.liveUrl, livePlanId]), {}, null, function(code, data) {
self.data.liveDetail = data;
self.videoContext = wx.createLivePlayerContext('liveVideo');
self.videoContext.play();
}, function(code, data) {
app.dialog.msg(data.msg);
});
},
onLoad(option) {
this.getLivePlan(option.livePlanId);
},
onHide() {

View File

@ -1,35 +1,22 @@
<view class="broadcast">
<view class="page-section tc">
<video
id="myVideo"
src="http://wxsnsdy.tc.qq.com/105/20210/snsdyvideodownload?filekey=30280201010421301f0201690402534804102ca905ce620b1241b726bc41dcff44e00204012882540400&bizid=1023&hy=SH&fileparam=302c020101042530230204136ffd93020457e3c4ff02024ef202031e8d7f02030f42400204045a320a0201000400"
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>
<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>
</view>
<view class="broadcast-title">银保监会印发《关于加快推进意外直播标题</view>
<view class="broadcast-title">{{liveDetail.livePlanName}}</view>
<view class="broadcast-time">
<view class="time">
<image src="../../images/time.png"></image>
<text>开始时间:</text>
2020-02-03 14:00:00
{{liveDetail.livePlanStart}}
</view>
<view class="time">
<image src="../../images/time.png"></image>
<text>结束时间:</text>
2020-02-03 14:00:00
{{liveDetail.livePlanEnd}}
</view>
</view>
<view class="broadcast-intro">
<view class="broadcast-intro-title">直播介绍</view>
<view class="intro-text">光拉便半运县写员二到院细天县见运命运感知争公着解全得律号深共权发市以家情军少先意单理样好族权达保很具你住红许气已第白知题候其然知王公众我头务族观经市指或七比生。适基历然题和低是局着先重信知议过说心龙素标安放大支入完二种设力果每角解收美约声里历美节办约管运但然新分活们心毛手过共点家或。革解快和特技县应精术被心走小器风育明油备己世国生往支因叫正心在备什新候流广这地。离克的却五北林越用变义按地界你值名证所局的况果被半去量片来参例形极别色部米老近和住例外七强可学变山意断群济。到报还省边速低起分力少族。</view>
<view class="broadcast-intro-title">介绍</view>
<view class="intro-text">{{liveDetail.livePlanRecord}}</view>
</view>

View File

@ -20,6 +20,10 @@ Page({
},
activity: {
activityUrl: app.activityUrl
},
live: {
liveUrl: app.liveUrl,
liveList: []
}
},
doLogin: function () {
@ -85,6 +89,19 @@ Page({
app.dialog.msg(data.msg);
});
},
doGetLiveList: function() {
var self = this;
app.restAjax.get(app.restAjax.path('{liveUrl}/app/liveplan/listpageliveplanrelease', [self.data.live.liveUrl]), {
page: 1,
rows: 4
}, null, function(code, data) {
self.setData({
'live.liveList': data.rows
})
}, function(code, data) {
app.dialog.msg(data.msg);
});
},
goNewsDetail: function () {
wx.navigateTo({
url: '../newsDetail/newsDetail',
@ -133,6 +150,7 @@ Page({
self.doLogin();
self.doGetLibrary();
self.doGetNewsList();
self.doGetLiveList();
},
/**

View File

@ -124,14 +124,8 @@
</view>
</view>
<view class="broadcast-container">
<view class="broadcast-box" bindtap="goBroadcastDetail">
<image src="../../images/center-bg.png"></image>
</view>
<view class="broadcast-box" bindtap="goBroadcastDetail">
<image src="../../images/center-bg.png"></image>
</view>
<view class="broadcast-box" bindtap="goBroadcastDetail">
<image src="../../images/center-bg.png"></image>
<view class="broadcast-box" bindtap="goBroadcastDetail" 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>
</view>
</view>

View File

@ -1,7 +1,6 @@
// pages/newsList/newsList.js
var app = getApp();
Page({
/**
* 页面的初始数据
*/

View File

@ -1,5 +1,6 @@
{
"usingComponents": {},
"enablePullDownRefresh": true,
"backgroundTextStyle": "dark",
"onReachBottomDistance": 50
}

View File

@ -32,3 +32,18 @@
height: 150rpx;
margin-right: 20rpx;
}
.transverse-news{
flex-direction: row;
justify-content: space-between;
}
.news-row-img{
width: 30%;
height: 150rpx;
}
.news-row-img image{
width: 100%;
height: 100%;
}
.news-row-info{
width: 68%;
}