riku
2023-11-29 9b09d13712c0c005891450a3bf4b6d848ec0ff37
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
// pages/module_common/pagevideo/pagevideo.js
import ListPage from '../../../base/ListPage'
import bFetch from '../behaviors/bFetch'
import bOpenFile from '../behaviors/bOpenFile'
 
const lawservice = require("../../../service/lawservice")
const moment = require('../../../utils/moment.min')
const app = getApp()
 
ListPage({
  behaviors: [bFetch, bOpenFile],
  /**
   * 页面的初始数据
   */
  data: {
    video: {},
    series: [],
 
    thisVideo: 1,
    showDialog: false,
    groups: [
      'actionSlot1',
    ]
  },
 
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {
    var that = this
    this.getOpenerEventChannel().on('acceptDataFromOpenerPage', function (data) {
      setTimeout(() => {
        that.setData({
          video: data
        })  
      }, 500);
      
      // 页面标题
      if (data.lrResourcetitle) {
        wx.setNavigationBarTitle({
          title: data.lrResourcetitle,
        })
      }
 
      // 视频所在合集
      if (data.lrExtension2 && data.lrExtension2 != '') {
        if (data.lrExtension3) {
          that.setData({
            thisVideo: parseInt(data.lrExtension3)
          }) 
        }
        that.getSerise(data.lrExtension2)
      }
    })
 
    this.getResources({fileType: 4})
  },
 
  getSerise(seriesId) {
    var that = this
    lawservice.getSerise(app.globalData.userInfo.guid, seriesId, {
      success(data) {
        that.setData({
          series: data
        })
      },
    })
  },
 
  showSeries() {
    this.setData({
      showDialog: true
    })
  },
 
  selectVideo(e) {
    let thisVideo = e.currentTarget.dataset.index
    const video = this.data.series[thisVideo]
    thisVideo++
    this.setData({
      video,
      thisVideo,
      showDialog: false
    })
  }
})