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); } } })