litian
2024-09-07 ce3a08b28c16f5cce2185167f8a9030ee16898ed
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
const app = getApp();
Component({
  properties: {
    treeList: {
      type: Array,
      value: [],
    },
    learnList: {
      type: Array,
      value: [],
    },
    bookInfo: {
      type: Object,
      value: {},
    },
    openIds: {
      type: Array,
      value: [],
    },
    isBuy: {
      type: Boolean,
      value: false,
    },
  },
  data: {
    sonPurchaseSaleMethodId: "",
    superiorPurchaseSaleMethodId: [],
    activeValues: [1, 2],
    webpageSrc: "",
    cloudShoppingCart: [],
    selectAll: [],
    shoppingCart: true,
    stop: false,
    cart: true,
    canExecute: true,
    isBuy: false,
  },
  ready() {},
 
  onLoad() {
    this.setData({
      sonPurchaseSaleMethodId: [],
      isBuy: this.properties.isBuy
    });
  },
  methods: {
    handleList(tree) {
      for (let index = 0; index < tree.length; index++) {
        const item = tree[index];
        if (item.sysType == "CmsItem" && !item.checked) {}
        if (item.children && item.children.length > 0) {
          this.handleList(item.children);
        }
      }
    },
    // 节点展开
    handleChange(e) {
      this.setData({
        openIds: e.detail.value,
      });
    },
 
    // 跳转音视频播放器
    goPlayer(e) {
      // 检查登录状态
      const token = wx.getStorageSync(app.config.tokenKey);
      if (token) {
 
        const item = e.currentTarget.dataset.item;
        const parent = e.currentTarget.dataset.parent;
        const isTry = e.currentTarget.dataset.istry;
        const parentProductLinkPath = parent ?
          parent.productLinkPath :
          wx.getStorageSync("teachResourcesPath");
        const parentName = parent ? parent.name : "教学资源";
        let url;
        if (!isTry && !this.data.isBuy) {
          return wx.showToast({
            icon: 'error',
            title: '请先购买该课程',
          })
        }
        if (item.selectType == 'zip') {
          if (this.properties.applyState == 'Normal') {
            return wx.showToast({
              icon: 'error',
              title: '请前往PC端下载',
            })
          } else {
            return wx.showToast({
              icon: 'error',
              title: '请先申请下载',
            })
          }
        }
        if (item.learnSelectType == "video") {
          url = "/packageDomain/pages/resourceDetails/myVideo/index";
        } else if (item.learnSelectType == "audio") {
          url = "/packageDomain/pages/resourceDetails/myAudio/index";
        } else if (item.selectType == "picture" || item.selectType == "zip") {
          url = "/packageDomain/pages/resourceDetails/document/index";
        }
        if ((!item.file && !item.freeFile && !item.protectedFile)) {
          return wx.showToast({
            icon: 'error',
            title: '暂无资源',
          })
        }
        wx.navigateTo({
          url: `${url}?productLinkPath=${item.productLinkPath}&parentProductLinkPath=${parentProductLinkPath}&parentName=${parentName}&activeId=${item.id}&bookId=${this.properties.bookInfo.id}&bookName=${this.properties.bookInfo.name}&cmsId=${this.properties.bookInfo.rootCmsItemId}&formPath=jsek_cloudLearning&storeInfo=${app.config.digitalCourses}`,
        });
 
      }
    },
 
 
  },
});