|
@@ -10,14 +10,16 @@ Page({
|
|
title:'',
|
|
title:'',
|
|
url:'',
|
|
url:'',
|
|
time:0,
|
|
time:0,
|
|
- duration:0
|
|
|
|
|
|
+ duration:0,
|
|
|
|
+ recommend:[],
|
|
|
|
+ currentTime:0,
|
|
|
|
+ marTime:0
|
|
},
|
|
},
|
|
|
|
|
|
/**
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
*/
|
|
onLoad: function (options) {
|
|
onLoad: function (options) {
|
|
- console.log(options)
|
|
|
|
let time = options.time.split(':')
|
|
let time = options.time.split(':')
|
|
this.setData({
|
|
this.setData({
|
|
title: options.title,
|
|
title: options.title,
|
|
@@ -25,11 +27,31 @@ Page({
|
|
time: time[0]*60+time[1],
|
|
time: time[0]*60+time[1],
|
|
id:options.id
|
|
id:options.id
|
|
})
|
|
})
|
|
|
|
+ let _this = this;
|
|
|
|
+ wx.request({
|
|
|
|
+ url: host + '/api/wx/video/info',
|
|
|
|
+ method: 'get',
|
|
|
|
+ header: {
|
|
|
|
+ openid: app.globalData.openid
|
|
|
|
+ },
|
|
|
|
+ data: {
|
|
|
|
+ video_id: this.data.id,
|
|
|
|
+ time: this.data.duration
|
|
|
|
+ },
|
|
|
|
+ success: function (res) {
|
|
|
|
+ _this.setData({
|
|
|
|
+ recommend: res.data.data.recommends
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ })
|
|
},
|
|
},
|
|
end: function (event){
|
|
end: function (event){
|
|
wx.request({
|
|
wx.request({
|
|
url: host + '/api/wx/savevtime',
|
|
url: host + '/api/wx/savevtime',
|
|
method: 'post',
|
|
method: 'post',
|
|
|
|
+ header: {
|
|
|
|
+ openid: app.globalData.openid
|
|
|
|
+ },
|
|
data: {
|
|
data: {
|
|
video_id: this.data.id,
|
|
video_id: this.data.id,
|
|
time: this.data.duration
|
|
time: this.data.duration
|
|
@@ -40,11 +62,14 @@ Page({
|
|
})
|
|
})
|
|
},
|
|
},
|
|
timeupdate: function (event){
|
|
timeupdate: function (event){
|
|
- if (!this.data.duration){
|
|
|
|
|
|
+ let currentTime = parseInt(event.detail.currentTime)
|
|
|
|
+ if (!this.data.duration||true){
|
|
this.setData({
|
|
this.setData({
|
|
- duration: event.detail.duration
|
|
|
|
|
|
+ duration: currentTime
|
|
})
|
|
})
|
|
-
|
|
|
|
|
|
+ }
|
|
|
|
+ if( currentTime/10>=1 && currentTime % 10 == 0){
|
|
|
|
+ this.end();
|
|
}
|
|
}
|
|
},
|
|
},
|
|
/**
|
|
/**
|