闫增涛
2024-03-06 b89898ad46d6f233c00888837a8ba5ecea9392ac
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
 
import Message from 'tdesign-miniprogram/message/message';
const app = getApp()
Component({
  properties: {
    treeList: {
      type: Array,
      value: []
    },
    bookInfo: {
      type: Object,
      value: {}
    },
    buyIds: {
      type: Array,
      value: []
    },
    tab: {
      type: String,
      value: ''
    },
    applyState: {
      type: String,
      value: ''
    }
  },
  data: {
    activeValues: [0]
  },
  onShow() {
 
  },
  methods: {
    // 节点展开
    handleChange(e) {
      this.setData({
        activeValues: e.detail.value,
      });
      console.log('传递', this.properties.buyIds);
    },
    handleCheck(data) {
      for (let index = 0; index < data.length; index++) {
        const element = data[index];
        element.checked = true
        if (element.childrenCount && element.type == "productFolder") {
          handleCheck(element.children)
        }
      }
    },
    downloadTeach(e) {
      console.log('点击了', e);
      const value = e.currentTarget.dataset.value
      var myEventDetail = {
        value,
      } // detail对象,提供给事件监听函数
      var myEventOption = {
        bubbles: true,
        composed: true
      } // 触发事件的选项
      this.triggerEvent('downloadTeach', myEventDetail, myEventOption)
    },
    // 判断资源是否购买
    resourceIsBuy(data) {
      if (data.saleMethod && data.saleMethod.length) {
        const isSHow = buyIdList.value.some((item) => item == data.saleMethod[0].Id)
        return !isSHow
      } else {
        return false
      }
    },
    // 跳转音视频播放器
    goPlayer(e) {
      const item = e.currentTarget.dataset.item
      const parent = e.currentTarget.dataset.parent
      console.log(this.properties.bookInfo);
      wx.navigateTo({
        url: `/pages/resourceDetails/index?productLinkPath=${item.productLinkPath}&parentProductLinkPath=${parent.productLinkPath}&parentName=${parent.name}&activeId=${item.id}&bookId=${this.properties.bookInfo.id}&bookName=${this.properties.bookInfo.name}&cmsId=${this.properties.bookInfo.rootCmsItemId}`,
      })
      console.log(e);
    }
  }
})