From 097cdcd70b1d95f5fc581ea2bedc4faeba8259f2 Mon Sep 17 00:00:00 2001 From: yiming <m13691596795@163.com> Date: 星期五, 15 三月 2024 18:36:24 +0800 Subject: [PATCH] fix: 购物车的样式 --- pages/bookServices/detail/components/tree/index.js | 82 ++++++++++++++++++++++++++++++++++++++-- 1 files changed, 77 insertions(+), 5 deletions(-) diff --git a/pages/bookServices/detail/components/tree/index.js b/pages/bookServices/detail/components/tree/index.js index 11f74cb..3b1bd8a 100644 --- a/pages/bookServices/detail/components/tree/index.js +++ b/pages/bookServices/detail/components/tree/index.js @@ -1,5 +1,6 @@ import Message from 'tdesign-miniprogram/message/message'; +const util = require('./components/util') // 寮曞叆灏佽杩囩殑鍔犺浇鎻愮ず const app = getApp() Component({ properties: { @@ -33,11 +34,14 @@ } }, data: { - activeValues: [0] + activeValues: [0], + webpageSrc: '' }, onShow() { }, + + methods: { // 鑺傜偣灞曞紑 handleChange(e) { @@ -80,12 +84,72 @@ goPlayer(e) { const item = e.currentTarget.dataset.item const parent = e.currentTarget.dataset.parent - console.log(item.selectType); - debugger + // "pages/resourceDetails/myAudio/index", + // "pages/resourceDetails/myVideo/index", + // "pages/resourceDetails/document/index", + + + + let url + if (item.selectType == 'video') { + url = '/pages/resourceDetails/myVideo/index' + } else if (item.selectType == 'audio') { + url = '/pages/resourceDetails/myAudio/index' + } else if (item.selectType == 'picture' || item.selectType == 'zip') { + url = '/pages/resourceDetails/document/index' + } + + // else { + // + // } 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}`, + url: `${url}?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); + + + if (item.selectType == 'document' || item.selectType == 'pdf') { + const fileLink = app.config.requestCtx + '/file/api/ApiDownload?md5=' + item.file + console.log(fileLink, 'fileLink'); + //鎻愮ず鍔犺浇涓� + util.showLoading() + // 鍗曟涓嬭浇鍏佽鐨勬渶澶ф枃浠朵负 200MB + wx.downloadFile({ + url: fileLink, // 鍦板潃宸叉墦鐮侊紝鑷繁鎹釜鍏朵粬鐨勫湴鍧�锛�"https://www.xxxxx.com/file/娴嬭瘯閫氱煡.pdf"锛� + success: function (res) { + console.log(res, "wx.downloadFile success res") + if (res.statusCode != 200) { + util.hideLoadingWithErrorTips() + return false + } + var Path = res.tempFilePath //杩斿洖鐨勬枃浠朵复鏃跺湴鍧�锛岀敤浜庡悗闈㈡墦寮�鏈湴棰勮鎵�鐢� + wx.openDocument({ + filePath: Path, + showMenu: true, + success: function (res) { + console.log('鎵撳紑鎴愬姛'); + util.hideLoading() + } + }) + }, + fail: function (err) { + console.log(err, "wx.downloadFile fail err"); + util.hideLoadingWithErrorTips() + } + }) + + + } + + if (item.selectType == 'webpage') { + console.log(11); + this.setData({ + webpageSrc: item.jsek_link + }) + console.log(this.data.webpageSrc, 'webpageSrc'); + } + + + }, // 鎷垮埌鎵�鏈夐」 getAllChildren(id) { @@ -108,6 +172,7 @@ result.push(...item.children); } } + console.log(this.properties.treeList); this.properties.treeList.forEach(item => { findChildren(item); }); @@ -172,6 +237,7 @@ // 绔犺妭鍕鹃�� checkResourceTitle(e) { const item = e.currentTarget.dataset.item + console.log(item, 'item'); let list = this.flattenTree([item]) let ids = [] list.forEach(item => { @@ -180,5 +246,11 @@ const tab = this.findAndUpdateItemsByIds([item], ids) console.log(ids, tab); } + }, + onCloudShoppingCart() { + console.log(this.properties.treeList); + }, + oncheckbox() { + console.log(111); } }) \ No newline at end of file -- Gitblit v1.9.1