tanyanfei 4 years ago
parent
commit
41807338ce

+ 1 - 1
pages/online/online.js

@@ -7,7 +7,7 @@ Page({
    * 页面的初始数据
    */
   data: {
-    tab:0,
+    tab:1,
     array1: ['特种作业'],
     index1: 0,
     papers:[],

+ 2 - 2
pages/online/online.wxml

@@ -1,9 +1,9 @@
 <view class="tab">
-    <text data-id='0' bindtap="tabChange" class="{{tab==0?'act':''}}">视频课程</text>
     <text data-id='1' bindtap="tabChange" class="{{tab==1?'act':''}}">在线学习</text>
+    <text data-id='0' bindtap="tabChange" class="{{tab==0?'act':''}}">视频课程</text>
 </view>
 <view wx:if='{{tab==0}}' class="content">
-  <navigator wx:for="{{videos}}" wx:key="*this" url="../video/video?title={{item.title}}&&url={{item.url}}&&time={{item.finished_time}}" class="list">
+  <navigator wx:for="{{videos}}" wx:key="*this" url="../video/video?title={{item.title}}&&url={{item.url}}&&time={{item.finished_time}}&id={{item.id}}" class="list">
       <view class="img">
       <image  src="{{item.image}}" mode="scaleToFill"></image>
       <image class="play" src="../../images/play.png" mode="widthFix"></image>

+ 3 - 3
pages/plan/plan.wxml

@@ -42,12 +42,12 @@
     </view>
 </view>
 <view class="content">
-  <view class="list" wx:for="{{list}}" wx:key="*this">
+  <!-- <view class="list" wx:for="{{list}}" wx:key="*this"> -->
       <!-- <view class="title">{{item.type}}培训班</view> -->
-      <view class="kc" wx:for="{{item.classes}}" wx:for-item="class" wx:key="*this">
+      <view class="list kc" wx:for="{{list}}" wx:for-item="class" wx:key="*this">
           <text class="name" decode="{{true}}">{{class.name}}</text>
           <text decode="{{true}}">计划100人/已报名{{class.signuped_count}}</text>
           <navigator url="../post/post?class_id={{class.id}}&price={{class.price_new}}_{{class.price_re}}_{{class.price_change}}&&type=3"  class="apply">立即报名</navigator>
       </view>
-  </view>
+  <!-- </view> -->
 </view>

+ 12 - 5
pages/subject/subject.js

@@ -65,14 +65,21 @@ Page({
     }
     this.setData({
       ans:ans
-    })
-    
+    })  
   },
   next:function(){
     const idx=this.data.idx+1
-    this.setData({
-      idx:idx
-    })
+    if(this.data.ans.length!=this.data.idx){
+      wx.showToast({
+        title: '请选择答案',
+        icon: 'none',
+        duration: 2000
+      })
+    }else{
+      this.setData({
+        idx:idx
+      })
+    }
   },
   prev: function () {
     const idx = this.data.idx - 1

+ 1 - 1
pages/subject/subject.wxml

@@ -4,7 +4,7 @@
   <view class="count">倒计时 {{time}}</view>
 </view>
 <!-- 判断 -->
-<view class="content" wx:for="{{data.questions}}"  wx:if="{{idx == index+1}}">
+<view class="content" wx:for="{{data.questions}}"  hidden="{{idx != index+1}}">
     <view class="num">{{index+1}}、
     <image wx:if="{{item.type == 1}}" src="../../images/danx.svg" mode="widthFix"></image>
     <image wx:if="{{item.type == 2}}" src="../../images/duox.svg" mode="widthFix"></image>

+ 26 - 2
pages/video/video.js

@@ -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){
+
+          }
+        })
+    }
+  },
   /**
    * 生命周期函数--监听页面初次渲染完成
    */

+ 1 - 1
pages/video/video.wxml

@@ -1,2 +1,2 @@
-<video src='{{url}}' title="{{title}}" initial-time='{{time}}' bindpause='pause'></video>
+<video src='{{url}}' title="{{title}}" initial-time='{{time}}' bindtimeupdate='timeupdate' bindpause='pause'></video>
 <view>{{title}}</view>