video.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. // index.js
  2. // 获取应用实例
  3. const app = getApp()
  4. Page({
  5. data: {
  6. code: '', //车辆编号
  7. showContent1: true,
  8. showContent2: false,
  9. showContent3: false,
  10. videoSrc: app.globalData.videoUrl + '/study/step_1.mp4'
  11. },
  12. // 切换视频源
  13. changeVideoSrc: function (newSrc) {
  14. this.setData({
  15. videoSrc: newSrc,
  16. });
  17. },
  18. // 显示内容2
  19. showContent2: function () {
  20. this.setData({
  21. showContent1: false,
  22. showContent2: true,
  23. showContent3: false,
  24. });
  25. this.changeVideoSrc(app.globalData.videoUrl + '/study/step_2.mp4');
  26. },
  27. // 显示内容3
  28. showContent3: function () {
  29. this.setData({
  30. showContent1: false,
  31. showContent2: false,
  32. showContent3: true
  33. });
  34. this.changeVideoSrc(app.globalData.videoUrl + '/study/step_3.mp4');
  35. },
  36. //完成学习
  37. complateLearn() {
  38. my.reLaunch({
  39. url: '/pages/use_bike/use_bike?code=' + this.data.code,
  40. })
  41. my.setStorageSync({
  42. 'key': 'videoLearn',
  43. data: true
  44. });
  45. },
  46. onLoad(options) {
  47. this.setData({
  48. code: options.code
  49. })
  50. },
  51. })