闫增涛
2025-03-28 38cd76c5f05fd55855038e2d393074e27909c63d
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
119
120
121
122
123
124
125
const app = getApp();
import {
  loginInfo
} from '../../../../../assets/js/login';
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 == "webpage" || item.learnSelectType == "webpage") {
          // 网页类型跳转到网址复制页,因为url传参不能传 带参数的网络地址,所以此处要把网络地址里的传参摘出来,放到url里
          let urlData = ''
          const flags = item.jsek_link.indexOf("?")
          if (flags > -1) {
            urlData = item.jsek_link.slice(flags + 1, item.jsek_link.length)
          }
          url = '/packageBookService/pages/bookServices/linkPage/index'
          return wx.navigateTo({
            url: urlData ? url + `?path=${item.jsek_link.slice(0,flags)}` + '&' + urlData : url + `?path=${item.jsek_link}`
          })
        }
        if (item.selectType == 'zip' || item.learnSelectType == 'zip') {
          return wx.showToast({
            icon: 'error',
            title: '请前往PC端下载',
          })
        }
        if (item.learnSelectType == "video") {
          url = "/packageDomain/pages/resourceDetails/myVideo/index";
        } else if (item.learnSelectType == "audio") {
          url = "/packageDomain/pages/resourceDetails/myAudio/index";
        } else if (item.learnSelectType == "picture" || item.learnSelectType == 'document' || item.learnSelectType == 'pdf') {
          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}`,
        });
 
      } else {
        loginInfo(app, (data) => {})
      }
    },
  },
});