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) => {}) } }, }, });