// index.js
// 获取应用实例
const app = getApp()

Page({
  data: {
    code: '', //车辆编号
    showContent1: true,
    showContent2: false,
    showContent3: false,
    videoSrc: app.globalData.videoUrl + '/study/step_1.mp4'
  },
  // 切换视频源
  changeVideoSrc: function (newSrc) {
    this.setData({
      videoSrc: newSrc,
    });
  },
  // 显示内容2  
  showContent2: function () {
    this.setData({
      showContent1: false,
      showContent2: true,
      showContent3: false,
    });
    this.changeVideoSrc(app.globalData.videoUrl + '/study/step_2.mp4');
  },
  // 显示内容3  
  showContent3: function () {
    this.setData({
      showContent1: false,
      showContent2: false,
      showContent3: true
    });
    this.changeVideoSrc(app.globalData.videoUrl + '/study/step_3.mp4');
  },
  //完成学习
  complateLearn() {
    my.reLaunch({
      url: '/pages/use_bike/use_bike?code=' + this.data.code,
    })
    my.setStorageSync({
      'key': 'videoLearn',
      data: true
    });
  },
  onLoad(options) {
    this.setData({
      code: options.code
    })
  },
})