index.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. import {
  2. getSelfRead
  3. } from '~/api/user'
  4. let videoContext = null
  5. Page({
  6. /**
  7. * 页面的初始数据
  8. */
  9. data: {
  10. list: [],
  11. currentId: '',
  12. videoState: true
  13. },
  14. onLoad(options) {
  15. this.getSelfRead()
  16. },
  17. //获取自己作品列表
  18. async getSelfRead() {
  19. let list = await getSelfRead()
  20. this.setData({
  21. list
  22. })
  23. console.log(list[0]);
  24. },
  25. // 改变视频状态
  26. changStatus({
  27. detail
  28. }) {
  29. console.log(detail);
  30. this.setData(detail)
  31. },
  32. // 开始播放
  33. playVideo({
  34. currentTarget
  35. }) {
  36. this.setData({
  37. videoState: true,
  38. currentId: currentTarget.dataset.id
  39. })
  40. },
  41. /* 改变视频播放状态 ,暂时先不用*/
  42. changeVideoState() {
  43. this.videoContext = wx.createVideoContext('myVideo')
  44. console.log(this.data.videoState);
  45. let videoState = this.data.videoState
  46. if (videoState) {
  47. this.videoContext.pause()
  48. } else {
  49. this.videoContext.play()
  50. }
  51. this.setData({
  52. videoState: !videoState
  53. })
  54. },
  55. onShareAppMessage() {
  56. }
  57. })