From eb3cf68faee31402822350045ee08f3fea28cd5c Mon Sep 17 00:00:00 2001 From: 闫增涛 <1829501689@qq.com> Date: 星期五, 26 四月 2024 11:02:49 +0800 Subject: [PATCH] 资源购买页去除已购买资源 --- packageBookService/pages/bookServices/detail/buyResource/index.js | 24 ++++++++++++++++++------ packageBookService/pages/bookServices/detail/components/tree/index.js | 21 +++++++++++++++++++-- packageBookService/pages/bookServices/detail/buyResource/index.wxml | 7 +++---- packageBookService/pages/bookServices/detail/buyResource/index.json | 1 + 4 files changed, 41 insertions(+), 12 deletions(-) diff --git a/packageBookService/pages/bookServices/detail/buyResource/index.js b/packageBookService/pages/bookServices/detail/buyResource/index.js index 92e8ef6..7e3cbad 100644 --- a/packageBookService/pages/bookServices/detail/buyResource/index.js +++ b/packageBookService/pages/bookServices/detail/buyResource/index.js @@ -19,7 +19,8 @@ checkAllState: true, productLinkPath: '', refCode: '', - haider: false + haider: false, + naData: false }, /** @@ -89,7 +90,6 @@ getTreeList(rootList, pathLength, newArr, path) { for (const item of rootList) { if (item.productLinkPath.length == pathLength && item.productLinkPath.includes(path)) { - item.checked = false; if (item.sysType == 'CmsItem') { if (item.selectType == 'webpage') { item.disabled = true @@ -101,9 +101,6 @@ if (item.file && item.fileMap && item.fileMap[item.file]) { if (item.fileMap[item.file].protectType == 'Private') item.disabled = true } - - item.isbuy = this.isShowNeedBuy(item); - item.isShopCar = this.isShoppingCart(item); } // newArr.push(item) // 鍦ㄦ彃鍏ヨ繃绋嬩腑瀵规暟鎹繘琛屾帓搴� @@ -239,7 +236,16 @@ } } }); - this.getTreeList(res.datas.cmsDatas[0].datas, 17, list, '\\') + // 鏄剧ず 闇�瑕佽喘涔扮殑鍜岄渶瑕佸厤璐归鍙栫殑 + const arr = res.datas.cmsDatas[0].datas.filter(item => this.resourceIsBuy(item)) + if (!arr.length) { + return this.setData({ + loading: false, + haider: true, + noData: true + }) + } + this.getTreeList(arr, 17, list, '\\') list = this.ensureTreeConsistency(list) console.log('淇敼鍚庝簯', list); let result = []; @@ -594,6 +600,12 @@ }, //璐拱鎸夐挳 batchPurchase() { + if (!this.data.learn.length) { + return wx.showToast({ + icon: "error", + title: '鏆傛棤鏁版嵁', + }) + } let saleMethodIds = []; let requests = []; let item = []; diff --git a/packageBookService/pages/bookServices/detail/buyResource/index.json b/packageBookService/pages/bookServices/detail/buyResource/index.json index 71422da..b6fb9e1 100644 --- a/packageBookService/pages/bookServices/detail/buyResource/index.json +++ b/packageBookService/pages/bookServices/detail/buyResource/index.json @@ -3,6 +3,7 @@ "t-icon": "tdesign-miniprogram/icon/icon", "tree": "/packageBookService/pages/bookServices/detail/components/tree/index", "t-loading": "tdesign-miniprogram/loading/loading", + "t-empty": "tdesign-miniprogram/empty/empty", "t-button": "tdesign-miniprogram/button/button" }, "navigationStyle": "custom", diff --git a/packageBookService/pages/bookServices/detail/buyResource/index.wxml b/packageBookService/pages/bookServices/detail/buyResource/index.wxml index 8a28b44..93a4918 100644 --- a/packageBookService/pages/bookServices/detail/buyResource/index.wxml +++ b/packageBookService/pages/bookServices/detail/buyResource/index.wxml @@ -38,11 +38,10 @@ bind:changeListChecked="changeListChecked" bind:changeResourceChecked="changeResourceChecked" /> + <view class="noData" wx:if="{{noData}}"> + <t-empty icon="folder-open" description="鏆傛棤鏁版嵁" /> + </view> </view> - - <!-- <view class="noData" wx:if="{{loading}}"> - <t-loading size="60rpx" loading="{{loading}}" /> -</view> --> <view class="page-bottom"> <t-button diff --git a/packageBookService/pages/bookServices/detail/components/tree/index.js b/packageBookService/pages/bookServices/detail/components/tree/index.js index 77b7035..da6920d 100644 --- a/packageBookService/pages/bookServices/detail/components/tree/index.js +++ b/packageBookService/pages/bookServices/detail/components/tree/index.js @@ -132,7 +132,6 @@ goPlayer(e) { // 妫�鏌ョ櫥褰曠姸鎬� const token = wx.getStorageSync(app.config.tokenKey); - if (token) { const item = e.currentTarget.dataset.item; const parent = e.currentTarget.dataset.parent; @@ -162,13 +161,31 @@ "璇峰厛璐拱璇ヨ祫婧�" : "璇峰厛鐐瑰嚮棰嗗彇鏌ョ湅鎸夐挳", }); } + if (item.saleMethod.length == 0 && item.sysType == 'CmsItem' && this.properties.tab == "jsek_cloudLearning") { + return wx.showToast({ + icon: 'error', + title: '鏆傛湭寮�濮嬮攢鍞紝璇疯仈绯荤鐞嗗憳', + }) + } + if (this.properties.tab == "jsek_teachingResources" && item.fileMap) { + if (item.file && item.fileMap[item.file].protectType !== "Public") { + return wx.showToast({ + icon: 'error', + title: '璧勬簮涓嶅彲鐢紝璇疯仈绯荤鐞嗗憳', + }) + } else if (item.freeFile && item.fileMap[item.freeFile].protectType !== "Public") { + 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=${this.properties.tab}`, }); if (item.selectType == "document" || item.selectType == "pdf") { - console.log(item, 'item789'); // freeFile const fileLink = item.file ? app.config.requestCtx + "/file/api/ApiDownload?md5=" + item.file : app.config.requestCtx + "/file/api/ApiDownload?md5=" + item.freeFile -- Gitblit v1.9.1