|
@@ -1,4 +1,6 @@
|
|
|
// pages/video/video.js
|
|
|
+const app = getApp()
|
|
|
+const host = app.globalData.host;
|
|
|
Page({
|
|
|
|
|
|
/**
|
|
@@ -7,7 +9,8 @@ Page({
|
|
|
data: {
|
|
|
title:'',
|
|
|
url:'',
|
|
|
- time:0
|
|
|
+ time:0,
|
|
|
+ currentTime:0
|
|
|
},
|
|
|
|
|
|
/**
|
|
@@ -19,12 +22,33 @@ Page({
|
|
|
this.setData({
|
|
|
title: options.title,
|
|
|
url: options.url,
|
|
|
- time: time[0]*60+time[1]
|
|
|
+ time: time[0]*60+time[1],
|
|
|
+ id:options.id
|
|
|
})
|
|
|
},
|
|
|
pause: function (event){
|
|
|
console.log(event)
|
|
|
},
|
|
|
+ timeupdate: function (event){
|
|
|
+ console.log(event)
|
|
|
+ let cur = event.detail.currentTime
|
|
|
+ if (cur - this.data.currentTime>=10){
|
|
|
+ this.setData({
|
|
|
+ currentTime:cur
|
|
|
+ })
|
|
|
+ wx.request({
|
|
|
+ url: host+'/api/wx/savevtime',
|
|
|
+ method:'post',
|
|
|
+ data:{
|
|
|
+ video_id: this.data.id,
|
|
|
+ time: cur
|
|
|
+ },
|
|
|
+ success:function(res){
|
|
|
+
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
/**
|
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
|
*/
|