This commit is contained in:
wans 2020-09-15 16:34:17 +08:00
commit 4aaac4e997
5 changed files with 197 additions and 51 deletions

View File

@ -10,6 +10,37 @@ Page({
liveUrl: app.liveUrl,
liveRecordUrl: app.liveRecordUrl,
livePlanId: null,
page: 1,
rows: 20,
liveRecordList: [],
videoPath: ''
},
getLivePlanRecordList: function () {
var self = this
app.restAjax.get(app.restAjax.path('{liveUrl}/app/liverecord/listpageliverecordrelease/' + self.data.livePlanId, [app.liveUrl]), {
page: self.data.page,
rows: self.data.rows
}, null,
function (code, data) {
if (data.rows.length > 0) {
self.setData({
liveRecordList: data.rows
})
} else {
wx.showToast({
title: '暂无更多',
icon: "none",
duration: 1500
})
}
console.log(self.data.liveRecordList)
}
)
},
playVideo: function (e) {
this.setData({
videoPath: e.currentTarget.dataset.url
})
},
/**
* 生命周期函数--监听页面加载
@ -18,7 +49,7 @@ Page({
this.setData({
livePlanId: options.livePlanId
})
// this.getLivePlanRecordList(1);
this.getLivePlanRecordList();
},
/**
* 生命周期函数--监听页面初次渲染完成
@ -52,14 +83,20 @@ Page({
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
this.getLivePlanRecordList(1);
this.setData({
page: this.data.page + 1
})
this.getLivePlanRecordList()
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
this.getLivePlanRecordList(this.data.currentPage + 1);
this.setData({
page: this.data.page + 1
})
this.getLivePlanRecordList()
},
/**

View File

@ -1 +1,6 @@
<web-view src="{{liveRecordContentUrl}}/flv/index.html?livePlanId={{livePlanId}}&liveUrl={{liveUrl}}&liveRecordUrl={{liveRecordUrl}}" wx:if="{{livePlanId}}"></web-view>
<view class="video">
<video src="{{videoPath}}" autoplay="autoplay"></video>
</view>
<view class="select-list">
<view class="select-video {{item.recordFilePath == videoPath ? 'active': ''}}" wx:for="{{liveRecordList}}" data-url="{{item.recordFilePath}}" bindtap="playVideo">{{index+1}}.{{item.recordFileName}}</view>
</view>

View File

@ -1,49 +1,25 @@
.broadcast{
width: 100%;
height: 400rpx;
background: #000000;
.video{
position: fixed;
top: 0;
left: 0;
right: 0;
}
video{
width: 100%;
height: 400rpx;
height: 475rpx;
}
.broadcast-title{
padding: 30rpx;
font-size: 34rpx;
color: #242424;
border-bottom: 5px solid #FBFBFB;
.video video{
width: 100%;
height: 100%;
}
.broadcast-list{
margin-top: 400rpx;
.select-list{
margin-top: 475rpx;
padding: 0 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;
.select-video{
border-bottom: 1px solid #DEDEDE;
line-height: 80rpx;
font-size: 32rpx;
color: #000;
}
.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;
.select-video.active{
color: #9F1512;
}

View File

@ -6,18 +6,18 @@ Page({
* 页面的初始数据
*/
data: {
randomName: true,
showPhone: true,
gotCode: false,
restTime: 120,
timer: '',
userAvatar: '',
token: '',
userInfo: {},
usercenterUrl: app.usercenterUrl,
sourcePath: '/route/file/downloadfile/true/',
randomName: '',
showPhone: true,
phone: '',
code: '',
gotCode: false,
restTime: 120,
timer: ''
code: ''
},
// 选择头像来源
changeAvatar: function () {
@ -152,10 +152,138 @@ Page({
url: '../order/order',
})
},
// 获取输入的手机号
phoneNum: function (res) {
this.setData({
phone: res.detail.value
})
},
// 校验手机号
testPhone: function () {
var self = this
if (self.data.phone) {
if (!/^1(3|4|5|6|7|8|9)\d{9}$/.test(self.data.phone)) {
wx.showToast({
title: '请输入正确的手机号',
icon: 'none',
duration: 1500
})
} else {
self.getCode()
}
} else {
wx.showToast({
title: '手机号不能为空',
icon: 'none',
duration: 1500
})
}
},
// 获取验证码
getCode: function () {
var self = this;
self.setData({
gotCode: true
})
self.data.timer = setInterval(function () {
var cur = self.data.restTime - 1
if (cur == 0) {
clearInterval(self.data.timer)
self.setData({
restTime: 120,
gotCode: false
})
} else {
self.setData({
restTime: cur
})
}
}, 1000)
app.restAjax.get(app.restAjax.path('{usercenterUrl}/api/sms/getverificationcode/' + self.data.phone, [app.usercenterUrl]), {}, null,
function (code, data) {},
function (code, data) {
wx.showToast({
title: data.msg,
icon: 'none',
duration: 1500
})
})
},
// 提交绑定手机
submitPhone: function () {
var self = this;
self.setData({
isConfirm: true
})
app.restAjax.put(app.restAjax.path('{usercenterUrl}/app/user/updateminiappdefaultusername', [app.usercenterUrl]), {
phone: self.data.phone,
verificationCode: self.data.code
}, {
headers: {
token: self.data.token
}
}, function (code, data) {
wx.setStorageSync('token', data.data);
wx.setStorageSync('isRandomUsername', 0)
clearInterval(self.data.timer)
self.setData({
showPhone: false
})
wx.showTabBar();
self.getUserInfo()
}, function (code, data) {
app.dialog.msg(data.msg);
self.setData({
isConfirm: false
})
})
},
// 验证码
inputCode: function (e) {
this.setData({
code: e.detail.value
})
},
// 判断用户是否为随机名称
isRandomName: function () {
var self = this
wx.getStorage({
key: 'isRandomUsername',
success: function (res) {
if (res.data == 1) {
wx.hideTabBar()
self.setData({
randomName: true
})
} else {
wx.hideTabBar()
self.setData({
randomName: false
})
}
}
})
},
// 获取用户信息
getUserInfo: function () {
var self = this
app.restAjax.get(app.restAjax.path('{usercenterUrl}/app/user/getappuser', [app.usercenterUrl]), {}, {
headers: {
token: self.data.token
}
}, function (code, data) {
self.setData({
userInfo: data
})
}, function (code, data) {
app.dialog.msg(data.msg);
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.isRandomName();
this.getToken()
},

View File

@ -134,7 +134,7 @@
</view>
</view>
</view>
<view class="set-phone" wx:if="{{randomName && showPhone}}">
<!-- <view class="set-phone" wx:if="{{randomName && showPhone}}">
<view class="set-phone-box">
<view class="tips">您还没有绑定手机号,请先绑定手机号</view>
<view class="phone-input">
@ -149,4 +149,4 @@
<view class="set-phone-btn" bindtap="submitPhone" wx:if="{{!isConfirm}}">确认</view>
</view>
</view>
</view>
</view> -->