From 75a9abca4f4cf0ebe579705abc369489cfe20e7c Mon Sep 17 00:00:00 2001 From: litian <C21AF165> Date: 星期五, 28 六月 2024 11:16:37 +0800 Subject: [PATCH] 小程序,课程 --- pages/digitalCourses/digitalCoursesDetails/components/testTree/index.wxss | 0 pages/digitalTextbooks/index.wxml | 7 pages/index/resourceCover.js | 30 pages/digitalCourses/digitalCoursesDetails/components/question/question.wxss | 148 +++ packagePersonal/pages/myCollection/index.js | 5 pages/digitalCourses/digitalCoursesDetails/components/testTree/index.wxml | 55 + pages/digitalCourses/digitalCoursesDetails/components/tree/index.js | 105 ++ assets/js/middleGround/api/store.js | 4 pages/digitalCourses/digitalCoursesDetails/components/question/question.wxml | 65 + pages/digitalCourses/digitalCoursesDetails/components/tree/index.wxss | 0 services/home/home.js | 4 pages/digitalCourses/digitalCoursesDetails/components/tree/index.wxml | 73 + pages/digitalCourses/digitalCoursesDetails/index.wxss | 163 ++- pages/digitalCourses/index.js | 2 pages/digitalCourses/digitalCoursesDetails/index.wxml | 81 + pages/digitalCourses/digitalCoursesDetails/components/note/note.json | 17 packageBookService/pages/bookServices/detail/components/tree/index.js | 86 packageBookService/pages/bookServices/detail/index.js | 101 + pages/digitalTextbooks/digitalTextbooksDetails/index.js | 8 pages/digitalCourses/digitalCoursesDetails/index.js | 357 +++++++ packageDomain/pages/resourceDetails/myVideo/index.js | 1 pages/digitalCourses/digitalCoursesDetails/components/tree/index.json | 0 packageDomain/pages/resourceDetails/myAudio/index.js | 6 pages/digitalCourses/digitalCoursesDetails/components/question/question.json | 17 pages/digitalCourses/digitalCoursesDetails/index.json | 6 pages/digitalCourses/digitalCoursesDetails/components/question/question.js | 252 +++++ pages/digitalCourses/digitalCoursesDetails/components/testTree/index.js | 92 ++ /dev/null | 322 ------- pages/digitalCourses/digitalCoursesDetails/components/note/note.js | 345 +++++++ packageDomain/pages/resourceDetails/document/index.js | 5 pages/digitalCourses/digitalCoursesDetails/components/testTree/index.json | 13 pages/digitalTextbooks/digitalTextbooksDetails/index.wxss | 1 pages/digitalCourses/digitalCoursesDetails/components/note/note.wxss | 162 +++ pages/digitalCourses/digitalCoursesDetails/components/note/note.wxml | 132 ++ static/images/digitalCourses/bianji.png | 0 packageBookService/pages/bookServices/detail/components/testTree/index.js | 23 36 files changed, 2,127 insertions(+), 561 deletions(-) diff --git a/assets/js/middleGround/api/store.js b/assets/js/middleGround/api/store.js index 3a70e5a..f4ec27c 100644 --- a/assets/js/middleGround/api/store.js +++ b/assets/js/middleGround/api/store.js @@ -175,6 +175,7 @@ Icon: [], TypeId: [], RefCode: [], + Description: [], ChildrenCount: [], ChildrenFolderCount: [], CreateDate: [], @@ -200,6 +201,7 @@ Icon: [], TypeId: [], RefCode: [], + Description: [], ChildrenCount: [], ChildrenFolderCount: [], CreateDate: [], @@ -224,6 +226,7 @@ Icon: [], TypeId: [], RefCode: [], + Description: [], LinkTypes: [linkType.linkType], PageQuery: { Start: 0, @@ -260,6 +263,7 @@ Name: [], Icon: [], RefCode: [], + Description: [], TypeId: [], SysType: [], State: [], diff --git a/packageBookService/pages/bookServices/detail/components/testTree/index.js b/packageBookService/pages/bookServices/detail/components/testTree/index.js index ad201da..4b8c534 100644 --- a/packageBookService/pages/bookServices/detail/components/testTree/index.js +++ b/packageBookService/pages/bookServices/detail/components/testTree/index.js @@ -1,7 +1,3 @@ -const util = require("./components/util"); // 寮曞叆灏佽杩囩殑鍔犺浇鎻愮ず -import { - loginInfo -} from "../../../../../../assets/js/login"; const app = getApp(); Component({ properties: { @@ -46,25 +42,6 @@ }; this.triggerEvent("goTest", myEventDetail); - }, - // 璺宠浆闊宠棰戞挱鏀惧櫒 - goPlayer(e) { - // 妫�鏌ョ櫥褰曠姸鎬� - const token = wx.getStorageSync(app.config.tokenKey); - if (token) { - const item = e.currentTarget.dataset.item; - const parent = e.currentTarget.dataset.parent; - console.log('item', item); - const parentProductLinkPath = parent ? - parent.productLinkPath : - wx.getStorageSync("teachResourcesPath"); - const parentName = parent ? parent.name : "鏁欏璧勬簮"; - let url; - 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}&applyState=${this.properties.applyState}&deadline=${this.properties.deadline}`, - }); - - } }, }, }); \ No newline at end of file diff --git a/packageBookService/pages/bookServices/detail/components/testTree/tree/components/util.js b/packageBookService/pages/bookServices/detail/components/testTree/tree/components/util.js deleted file mode 100644 index c316097..0000000 --- a/packageBookService/pages/bookServices/detail/components/testTree/tree/components/util.js +++ /dev/null @@ -1,27 +0,0 @@ -/* 鍔犺浇鍔ㄧ敾鐩稿叧 */ -const showLoading = (tips = '鍔犺浇涓�...') => { - wx.showNavigationBarLoading() - wx.showLoading({ - title: tips, - }) -} - -const hideLoading = () => { - wx.hideLoading() - wx.hideNavigationBarLoading() -} - -const hideLoadingWithErrorTips = (err = '璧勬簮涓嶅彲鐢紝璇疯仈绯荤鐞嗗憳') => { - hideLoading() - wx.showToast({ - title: err, - icon: 'error', - duration: 2000 - }) -} - -module.exports = { - showLoading: showLoading, - hideLoading: hideLoading, - hideLoadingWithErrorTips: hideLoadingWithErrorTips, -} \ No newline at end of file diff --git a/packageBookService/pages/bookServices/detail/components/testTree/tree/index.js b/packageBookService/pages/bookServices/detail/components/testTree/tree/index.js deleted file mode 100644 index f1caa20..0000000 --- a/packageBookService/pages/bookServices/detail/components/testTree/tree/index.js +++ /dev/null @@ -1,640 +0,0 @@ -const util = require("./components/util"); // 寮曞叆灏佽杩囩殑鍔犺浇鎻愮ず -import { - loginInfo -} from "../../../../../../assets/js/login"; -const app = getApp(); -Component({ - properties: { - treeList: { - type: Array, - value: [], - }, - learnList: { - type: Array, - value: [], - }, - bookInfo: { - type: Object, - value: {}, - }, - buyIds: { - type: Array, - value: [], - }, - tab: { - type: String, - value: "", - }, - applyState: { - type: String, - value: "", - }, - openIds: { - type: Array, - value: [], - }, - isShowCheck: { - type: Boolean, - value: false, - }, - paymentPage: { - type: Boolean, - value: false, - }, - superior: { - type: Boolean, - value: false, - }, - checkAllState: { - type: Boolean, - }, - deadline: { - type: String, - }, - }, - data: { - sonPurchaseSaleMethodId: "", - superiorPurchaseSaleMethodId: [], - activeValues: [1, 2], - webpageSrc: "", - cloudShoppingCart: [], - selectAll: [], - shoppingCart: true, - stop: false, - cart: true, - canExecute: true - }, - ready() {}, - - onLoad() { - this.setData({ - sonPurchaseSaleMethodId: [], - }); - }, - observers: { - treeList: function (newValue) { - const list = []; - let checked = ""; - this.properties.treeList.forEach((item) => { - if (item.children && item.children.length > 0) { - list.push(...this.flattenTree([item])); - } - }); - const flag = list.findIndex((item) => item.checked == true); - }, - }, - - 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, - }); - }, - 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) { - 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) { - if (data.saleMethod[0].State == "Disable") return false; - const isSHow = this.properties.buyIds.some( - (item) => item == data.saleMethod[0].Id - ); - return !isSHow; - } else { - return false; - } - }, - // 璺宠浆闊宠棰戞挱鏀惧櫒 - goPlayer(e) { - // 妫�鏌ョ櫥褰曠姸鎬� - const token = wx.getStorageSync(app.config.tokenKey); - if (token) { - const item = e.currentTarget.dataset.item; - const parent = e.currentTarget.dataset.parent; - console.log('item', item); - const parentProductLinkPath = parent ? - parent.productLinkPath : - wx.getStorageSync("teachResourcesPath"); - const parentName = parent ? parent.name : "鏁欏璧勬簮"; - let url; - if (item.selectType == 'zip') { - if (this.properties.applyState == 'Normal') { - return wx.showToast({ - icon: 'error', - title: '璇峰墠寰�PC绔笅杞�', - }) - } else { - return wx.showToast({ - icon: 'error', - title: '璇峰厛鐢宠涓嬭浇', - }) - } - } - if (this.properties.isShowCheck && this.resourceIsBuy(item)) { - return false; - } - if (item.selectType == "video" || item.learnSelectType == "video") { - url = "/packageDomain/pages/resourceDetails/myVideo/index"; - } else if ( - item.selectType == "audio" || - item.learnSelectType == "audio" - ) { - url = "/packageDomain/pages/resourceDetails/myAudio/index"; - } else if (item.selectType == "picture" || item.selectType == "zip") { - url = "/packageDomain/pages/resourceDetails/document/index"; - } - if ( - this.properties.tab == "jsek_cloudLearning" && - this.resourceIsBuy(item) - ) { - return wx.showToast({ - icon: "error", - title: item.saleMethod[0].Price > 0 ? - "璇峰厛璐拱璇ヨ祫婧�" : "璇峰厛鐐瑰嚮棰嗗彇鏌ョ湅鎸夐挳", - }); - } - 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.file || item.freeFile)) { - let file = item.fileMap[item.file] ? item.fileMap[item.file] : item.fileMap[item.freeFile] - if (file && file.protectType !== "Public") { - return wx.showToast({ - icon: "error", - title: "璧勬簮涓嶅彲鐢紝璇疯仈绯荤鐞嗗憳", - }); - } - } else if ((this.properties.tab == "jsek_teachingResources" || this.properties.tab == "jsek_cloudLearning") && (!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=${this.properties.tab}&applyState=${this.properties.applyState}&deadline=${this.properties.deadline}`, - }); - if (item.selectType == "pdf") { - const fileLink = item.file ? item.file : item.freeFile - console.log(fileLink); - wx.navigateTo({ - url: "/packageBookService/pages/components/webView/index?md5=" + - fileLink + - "&fileName=" + - item.name + - "&fileType=" + - item.selectType + "&bookBuy=true" - }); - } - if (item.selectType == "document") { - // freeFile - // if (item.selectType == "document") { - // item.selectType = "pptx"; - // } - const fileLink = item.file ? - app.config.requestCtx + "/file/api/ApiDownload?md5=" + item.file : - app.config.requestCtx + - "/file/api/ApiDownload?md5=" + - item.freeFile; - console.log(fileLink, "fileLink"); - //鎻愮ず鍔犺浇涓� - // 鍗曟涓嬭浇鍏佽鐨勬渶澶ф枃浠朵负 200MB - wx.downloadFile({ - url: fileLink, - // filePath: wx.env.USER_DATA_PATH + `/${item.name}.${item.selectType}`, - filePath: wx.env.USER_DATA_PATH + `/${item.name}.${item.selectType}`, - success: function (res) { - console.log(res, "wx.downloadFile success res"); - if (res.statusCode != 200) { - util.hideLoadingWithErrorTips(); - return false; - } - var Path = res.tempFilePath; //杩斿洖鐨勬枃浠朵复鏃跺湴鍧�锛岀敤浜庡悗闈㈡墦寮�鏈湴棰勮鎵�鐢� - let data = res.filePath; - wx.openDocument({ - filePath: data, - 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") { - this.setData({ - webpageSrc: item.jsek_link, - }); - } - } - }, - - // 鎷垮埌鎵�鏈夐」 - getAllChildren(id) { - let result = []; - - function findChildren(item) { - if (item.id === id) { - if (item.children && item.children.length > 0) { - item.children.forEach((child) => { - findChildren(child); - }); - } - } else { - if (item.children && item.children.length > 0) { - item.children.forEach((child) => { - findChildren(child); - }); - } - } - if (item.children && item.children.length > 0) { - result.push(...item.children); - } - } - console.log(this.properties.treeList, "this.properties.treeList"); - this.properties.treeList.forEach((item) => { - findChildren(item); - }); - return result; - }, - // 鎷垮埌褰撳墠椤瑰瓙椤� - flattenTree(tree) { - let result = []; - - function flatten(node) { - result.push(node); - if (node.children && node.children.length > 0) { - node.children.forEach((child) => { - flatten(child); - }); - } - } - tree.forEach((node) => { - flatten(node); - }); - // console.log(result, 'result'); - return result; - }, - - // 鍙樹负true - findAndUpdateItemsByIds(tree, ids, state) { - function findAndUpdate(node) { - if (ids.includes(node.id)) { - // console.log(node, 'node'); - node.checked = state; // 灏嗙洰鏍囬」鐨� check 灞炴�ц缃负 true - } - if (node.children && node.children.length > 0) { - for (let child of node.children) { - findAndUpdate(child); // 閫掑綊澶勭悊瀛愯妭鐐� - } - } - } - for (let node of tree) { - findAndUpdate(node); // 瀵规瘡涓《灞傝妭鐐规墽琛屾煡鎵惧拰鏇存柊鎿嶄綔 - } - return tree; // 杩斿洖淇敼鍚庣殑瀹屾暣鏁扮粍 - }, - - checkResoucrceInfo(tree, id) { - function findAndUpdate(node) { - if (node.sysType == "CmsFolder" && node.children.length > 0) { - for (let index = 0; index < node.children.length; index++) { - const element = node.children[index]; - findAndUpdate(element); - } - } else if (id == node.id && node.sysType == "CmsItem") { - node.checked = !node.checked; // 灏嗙洰鏍囬」鐨� check 灞炴�ц缃负 true - } - } - for (let node of tree) { - findAndUpdate(node); // 瀵规瘡涓《灞傝妭鐐规墽琛屾煡鎵惧拰鏇存柊鎿嶄綔 - } - return tree; // 杩斿洖淇敼鍚庣殑瀹屾暣鏁扮粍 - }, - // 鍏ㄩ�� - checkAll() { - const ids = []; - const list = []; - let checked = ""; - this.properties.treeList.forEach((item) => { - if (item.children && item.children.length > 0) { - list.push(...this.flattenTree([item])); - } - }); - list.forEach((item) => { - ids.push(item.id); - checked = item.checked; - }); - // const flag = - // list.findIndex((item) => item.checked == false) > -1 ? true : false; - const flag = this.properties.checkAllState; - // const updataList = this.findAndUpdateItemsByIds( - // this.properties.treeList, - // ids, - // flag - // ); - // this.setData({ - // treeList: updataList, - // }); - - var myEventDetail = { - ids, - flag, - }; // detail瀵硅薄锛屾彁渚涚粰浜嬩欢鐩戝惉鍑芥暟 - var myEventOption = { - bubbles: true, - composed: true, - }; // 瑙﹀彂浜嬩欢鐨勯�夐」 - this.triggerEvent("changeListChecked", myEventDetail, myEventOption); - - if (!checked) { - this.setData({ - selectAll: list, - }); - } - var myEventDetail = { - value: !flag, - }; // detail瀵硅薄锛屾彁渚涚粰浜嬩欢鐩戝惉鍑芥暟 - var myEventOption = { - bubbles: true, - composed: true, - }; // 瑙﹀彂浜嬩欢鐨勯�夐」 - this.triggerEvent("changeCheckAll", myEventDetail, myEventOption); - }, - - // 绔犺妭鍕鹃�� - checkResourceTitle(e) { - const flag = e.detail.checked; - // 杩欎釜鏃跺�檆hecked鐨勫�兼槸fals - let checkResourceTitleList = []; - const item = e.currentTarget.dataset.item; - const parent = this.findParentById(this.properties.learnList, item.id); - let childrenList; - let flagNum; - if (parent) - childrenList = parent.children.filter((citem) => citem.id !== item.id); - if (childrenList) - flagNum = childrenList.findIndex((item) => item.checked == false); - let list = this.flattenTree([item]); - let ids = []; - list.forEach((item) => { - if ( - item.sysType == "CmsFolder" || - (item.sysType == "CmsItem" && item.saleMethod.length) - ) - ids.push(item.id); - }); - var myEventDetail = { - ids, - flag, - }; // detail瀵硅薄锛屾彁渚涚粰浜嬩欢鐩戝惉鍑芥暟 - var myEventOption = { - bubbles: true, - composed: true, - }; // 瑙﹀彂浜嬩欢鐨勯�夐」 - this.triggerEvent("changeListChecked", myEventDetail, myEventOption); - if (flagNum == -1) { - let checkedState; - var myEventDetail = { - ids: [parent.id], - flag, - }; // detail瀵硅薄锛屾彁渚涚粰浜嬩欢鐩戝惉鍑芥暟 - var myEventOption = { - bubbles: true, - composed: true, - }; // 瑙﹀彂浜嬩欢鐨勯�夐」 - this.triggerEvent("changeListChecked", myEventDetail, myEventOption); - } - if (!list.checked) { - this.setData({ - superiorPurchaseSaleMethodId: list, - }); - } - list.forEach((items) => { - console.log(items.checked, "itesasd"); - if (!items.checked) { - this.setData({ - cloudShoppingCart: items, - }); - } - }); - this.setData({ - openIds: this.data.openIds, - }); - }, - // 瀛愰」鍕鹃�� - checkResource(e) { - const citem = e.currentTarget.dataset.item; - const parent = e.currentTarget.dataset.parent; - let outermost; - if (parent) - outermost = this.findParentById(this.properties.learnList, parent.id); - const childrenList = parent.children.filter( - (item) => item.id !== citem.id && item.saleMethod.length - ); - const flag = childrenList.findIndex((item) => item.checked == false); - // 鏀瑰彉璇ラ」checked - var myEventDetail = { - id: citem.id, - }; - var myEventOption = { - bubbles: true, - composed: true, - }; - this.triggerEvent("changeResourceChecked", myEventDetail, myEventOption); - // 閫氳繃鍒ゆ柇,鑱旈�氱埗绾hecked - if (flag == -1) { - let checkedState; - citem.checked == false ? (checkedState = true) : (checkedState = false); - var myEventDetail = { - ids: [parent.id], - flag: checkedState, - }; - var myEventOption = { - bubbles: true, - composed: true, - }; - this.triggerEvent("changeListChecked", myEventDetail, myEventOption); - } - // 鑱旈�氭渶澶栧眰绾hecked ,濡傛灉鏈変竴涓彇娑堝嬀閫�,涓斿綋鍓嶆渶澶栧眰鍕鹃��,鍒欏彇娑堟渶澶栧眰鐨勫嬀閫� - if (citem.checked && outermost && outermost.checked) { - var myEventDetail = { - ids: [outermost.id], - flag: false, - }; - var myEventOption = { - bubbles: true, - composed: true, - }; - this.triggerEvent("changeListChecked", myEventDetail, myEventOption); - } - // 鑱旈�氭渶澶栧眰绾hecked, 濡傛灉鎵�鏈夊瓙椤瑰嬀閫�, 涓斿綋鍓嶆渶澶栧眰鏈嬀閫�, 鍒欏姞涓婃渶澶栧眰鐨勫嬀閫� - if (!citem.checked && outermost) { - let allchildren = this.flattenTree([outermost]); - allchildren = allchildren.filter( - (item) => - item.sysType == "CmsItem" && - item.id !== citem.id && - item.saleMethod.length - ); - const satate = allchildren.findIndex((item) => item.checked == false); - if (satate == -1) { - var myEventDetail = { - ids: [outermost.id], - flag: true, - }; - var myEventOption = { - bubbles: true, - composed: true, - }; - this.triggerEvent("changeListChecked", myEventDetail, myEventOption); - } - } - if (!citem.checked) { - //閫変腑鐨勬椂鍊欐坊鍔爄d - let sonPurchaseSaleMethodId = this.data.sonPurchaseSaleMethodId || []; - if (this.properties.paymentPage) { - sonPurchaseSaleMethodId = []; - this.properties.paymentPage = false; - } - if (!this.properties.paymentPage) { - sonPurchaseSaleMethodId.push(citem.saleMethod[0].Id); - } - this.setData({ - sonPurchaseSaleMethodId: sonPurchaseSaleMethodId, - }); - } else { - // 鍙栨秷閫変腑鐨勬椂鍊欏垹闄d - } - }, - // 鍔犲叆璐墿杞� - async onCloudShoppingCart(e) { - let shoppingCartGetId = []; - - const item = e.currentTarget.dataset.item; - console.log(item.isShopCar); - const saleMethodId = e.currentTarget.dataset.item.saleMethod[0].Id; - console.log(saleMethodId); - let query = { - start: 0, - size: 999, - filterList: [], - searchList: [], - }; - const res = await app.MG.store.getShoppingCartProductList(query); - res.datas.forEach((item) => { - shoppingCartGetId.push(item.saleMethod.id); - }); - if (shoppingCartGetId.includes(saleMethodId)) { - // this.data.updateShoppingCartHidden(); - // this.data.updateCloudLearning(); - wx.showToast({ - icon: "error", - title: "宸叉坊鍔�", - }); - this.setData({ - shoppingCart: false, - }); - } else { - let query = { - requests: [{ - saleMethodId: saleMethodId, - storeEventId: null, - // agentCode: '鐢靛瓙涔�' - }, ], - }; - const addRes = await app.MG.store.addShoppingCart(query); - console.log(addRes, "addRes"); - if (addRes) { - wx.showToast({ - icon: "success", - title: "娣诲姞鎴愬姛", - }); - item.isShopCar = false; - this.triggerEvent("updateCloudLearning"); - } - } - }, - sadd() { - this.triggerEvent("updateShoppingCartHidden"); - this.triggerEvent("updateCloudLearning"); - }, - findParentById(arr, id) { - for (let i = 0; i < arr.length; i++) { - const item = arr[i]; - // 妫�鏌ュ綋鍓嶉」鏄惁鍖归厤锛堝嵆瀹冩槸涓嶆槸鎴戜滑瑕佹壘鐨勯」锛� - if (item.id === id) { - // 濡傛灉褰撳墠椤瑰氨鏄垜浠鎵剧殑椤癸紝鍒欏畠娌℃湁鐖剁骇锛岃繑鍥� null - return null; - } - // 閫掑綊鏌ユ壘褰撳墠椤圭殑瀛愰」 - const child = this.findChildById(item.children, id); - if (child) { - // 濡傛灉鍦ㄥ瓙椤逛腑鎵惧埌鍖归厤鐨勯」锛岃繑鍥炲綋鍓嶉」浣滀负鐖剁骇 - return item; - } - } - // 濡傛灉娌℃湁鎵惧埌鍖归厤鐨勭埗椤癸紝杩斿洖 null - return null; - }, - // 杈呭姪鍑芥暟锛岀敤浜庨�掑綊鏌ユ壘瀛愰」 - findChildById(children, id) { - if (!children) { - return null; - } - for (let i = 0; i < children.length; i++) { - const child = children[i]; - if (child.id === id) { - // 濡傛灉鎵惧埌鍖归厤鐨勯」锛岃繑鍥炲畠 - return child; - } - // 閫掑綊妫�鏌ュ瓙椤圭殑瀛愰」 - const subChild = this.findChildById(child.children, id); - if (subChild) { - return subChild; - } - } - // 濡傛灉娌℃湁鎵惧埌鍖归厤鐨勯」锛岃繑鍥� null - return null; - }, - }, -}); \ No newline at end of file diff --git a/packageBookService/pages/bookServices/detail/components/testTree/tree/index.wxml b/packageBookService/pages/bookServices/detail/components/testTree/tree/index.wxml deleted file mode 100644 index 6f8344d..0000000 --- a/packageBookService/pages/bookServices/detail/components/testTree/tree/index.wxml +++ /dev/null @@ -1,322 +0,0 @@ -<view class="tree"> - <t-collapse default-value="{{openIds}}" catchchange="handleChange"> - <view - wx:for="{{treeList}}" - wx:for-item="item" - wx:for-index="index" - wx:key="id" - wx:if="{{item.sysType== 'CmsItem' }}" - > - <view - class="listItems" - wx:if="{{item.childrenFolderCount <= 0 && item.sysType == 'CmsItem'}}" - > - <view class="itemsInfo" data-item="{{item}}" data-index="{{index}}"> - <view - class="contentBox" - bind:tap="goPlayer" - data-item="{{item}}" - data-parent="{{''}}" - > - <!-- 鏁欏璧勬簮 浜戝涔� 鍥炬爣 --> - <view class="box-image fl-cn" style="width: 80%"> - <view - class="checkBox" - wx:if="{{isShowCheck}}" - catchtap="catchTap" - > - <!-- checked="{{citem.checked}}" --> - <!-- <t-checkbox icon="rectangle" checked="{{citem.checked}}" disabled="{{citem.selectType=='webpage' || citem.isDownload != 1 || citem.fileMap[citem.file].protectType == 'Private'}}" catch:change="checkResource" data-item="{{citem}}" /> --> - <t-checkbox - disabled="{{!citem.saleMethod[0].Id}}" - icon="rectangle" - checked="{{item.checked}}" - data-item="{{item}}" - data-parent="{{item}}" - catch:change="checkResource" - /> - </view> - <!-- 鏁欏璧勬簮鍥炬爣 --> - <view class="teach-icon fl-cn"> - <image - wx:if="{{item.selectType == 'audio' || item.learnSelectType == 'audio'}}" - src="/static/images/bookService/detail/audioIcon.png" - mode="aspectFill" - /> - <image - wx:elif="{{item.selectType == 'video' || item.learnSelectType == 'video'}}" - src="/static/images/bookService/detail/video.png" - mode="aspectFill" - /> - <image - wx:elif="{{item.selectType == 'pdf'}}" - src="/static/images/bookService/detail/pdf.png" - mode="aspectFill" - /> - <image - wx:elif="{{item.selectType == 'webpage'}}" - src="/static/images/bookService/detail/net.png" - mode="aspectFill" - /> - <image - wx:elif="{{item.selectType == 'picture'}}" - src="/static/images/bookService/detail/picture.png" - mode="aspectFill" - /> - <image - wx:elif="{{item.selectType == 'zip'}}" - src="/static/images/bookService/detail/zip.png" - mode="aspectFill" - /> - <image - wx:elif="{{ item.fileMap[item.file].extension == 'doc' || item.fileMap[item.file].extension == 'docx'}}" - src="/static/images/bookService/detail/word.png" - mode="aspectFill" - /> - <image - wx:elif="{{ item.fileMap[item.file].extension == 'xlsx' || item.fileMap[item.file].extension == 'xlsx'}}" - src="/static/images/bookService/detail/excel.png" - mode="aspectFill" - /> - <image - wx:elif="{{ item.fileMap[item.file].extension == 'ppt' || item.fileMap[item.file].extension == 'pptx'}}" - src="/static/images/bookService/detail/PPT.png" - mode="aspectFill" - /> - <!-- 璧勬簮鏃犳枃浠跺唴瀹瑰浘鏍� --> - <image - wx:else - src="/static/images/bookService/detail/word.png" - mode="" - /> - </view> - <!-- 浜戝涔犲浘鏍� --> - <view> </view> - <!-- 鍚嶇О --> - <text class="name" style="width: 100%">{{item.name || '-'}}</text> - </view> - <!-- 鏁欏璧勬簮绫诲瀷 --> - <view class="teachClass fl-cn"> {{item.resourceClass}} </view> - <view class="teach-btn" wx:if="{{tab == 'jsek_teachingResources'}}"> - <!-- 涓嬭浇鎸夐挳 --> - <!-- <image - src="/static/images/bookService/detail/download-icon.png" - class="download-image" - data-value="{{citem}}" - catchtap="downloadTeach" - ></image> --> - </view> - <view wx:if="{{tab == 'jsek_cloudLearning'}}"> - <!-- 浜戝涔犺瘯鐪嬪浘鏍� --> - <image - src="/static/images/bookService/detail/shikan.png" - class="testSee" - wx:if="{{!item.isbuy ? false : item.freeFile ? true : false}}" - ></image> - <!-- 浜戝涔犲姞鍏ヨ喘鐗╄溅鍥炬爣 --> - <image - src="/static/images/bookService/detail/cart@2x.png" - wx:if="{{item.isShopCar}}" - class="shopCar" - data-item="{{item}}" - catch:tap="onCloudShoppingCart" - ></image> - <!-- 浜戝涔犺喘涔板浘鏍� --> - <image - src="/static/images/bookService/detail/need-buy.png" - class="need-buy" - wx:if="{{item.isbuy }}" - ></image> - </view> - </view> - </view> - </view> - </view> - <t-collapse-panel - wx:for="{{treeList}}" - wx:for-item="item" - wx:for-index="index" - wx:key="id" - value="{{item.id}}" - wx:if="{{item.sysType == 'CmsFolder' }}" - > - <view slot="header" class="header-title"> - <view class="title-checkBox" catchtap="catchTap"> - <t-checkbox - style="align-items: center" - icon="rectangle" - checked="{{item.checked}}" - data-item="{{item}}" - catchchange="checkResourceTitle" - wx:if="{{isShowCheck}}" - /> - <!-- 绔犺妭鍚� --> - <view class="title-box"> - <view class="title-name">{{item.name}} </view> - <view wx:if="{{item.sysType =='CmsFolder'}}" class="title-num"> - 锛坽{item.childrenItem}}锛� - </view> - </view> - </view> - </view> - <view - class="list" - wx:for="{{item.children}}" - wx:for-item="citem" - wx:for-index="cindex" - wx:key="cindex" - > - <!-- // 鍒ゆ柇 鏃犲瓙椤� 涓斾负鍟嗗搧item 鐩存帴鏄剧ず --> - <view - class="listItems" - wx:if="{{citem.childrenFolderCount <= 0 && citem.sysType == 'CmsItem'}}" - > - <view class="itemsInfo" data-item="{{citem}}" data-index="{{cindex}}"> - <view - class="contentBox" - bind:tap="goPlayer" - data-item="{{citem}}" - data-parent="{{item}}" - > - <!-- 鏁欏璧勬簮 浜戝涔� 鍥炬爣 --> - <view class="box-image fl-cn"> - <view - class="checkBox" - wx:if="{{isShowCheck}}" - catchtap="catchTap" - > - <!-- checked="{{citem.checked}}" --> - <!-- <t-checkbox icon="rectangle" checked="{{citem.checked}}" disabled="{{citem.selectType=='webpage' || citem.isDownload != 1 || citem.fileMap[citem.file].protectType == 'Private'}}" catch:change="checkResource" data-item="{{citem}}" /> --> - <t-checkbox - disabled="{{!citem.saleMethod[0].Id}}" - icon="rectangle" - checked="{{citem.checked}}" - data-item="{{citem}}" - data-parent="{{item}}" - catch:change="checkResource" - /> - </view> - <!-- 鏁欏璧勬簮鍥炬爣 --> - <view class="teach-icon fl-cn"> - <image - wx:if="{{citem.selectType == 'audio' || citem.learnSelectType == 'audio'}}" - src="/static/images/bookService/detail/audioIcon.png" - mode="aspectFill" - /> - <image - wx:elif="{{citem.selectType == 'video' || citem.learnSelectType == 'video'}}" - src="/static/images/bookService/detail/video.png" - mode="aspectFill" - /> - <image - wx:elif="{{citem.selectType == 'pdf'}}" - src="/static/images/bookService/detail/pdf.png" - mode="aspectFill" - /> - <image - wx:elif="{{citem.selectType == 'webpage'}}" - src="/static/images/bookService/detail/net.png" - mode="aspectFill" - /> - <image - wx:elif="{{citem.selectType == 'picture'}}" - src="/static/images/bookService/detail/picture.png" - mode="aspectFill" - /> - <image - wx:elif="{{citem.selectType == 'zip'}}" - src="/static/images/bookService/detail/zip.png" - mode="aspectFill" - /> - <image - wx:elif="{{ citem.fileMap[citem.file].extension == 'doc' || citem.fileMap[citem.file].extension == 'docx'}}" - src="/static/images/bookService/detail/word.png" - mode="aspectFill" - /> - <image - wx:elif="{{ citem.fileMap[citem.file].extension == 'xlsx' || citem.fileMap[citem.file].extension == 'xlsx'}}" - src="/static/images/bookService/detail/excel.png" - mode="aspectFill" - /> - <image - wx:elif="{{ citem.fileMap[citem.file].extension == 'ppt' || citem.fileMap[citem.file].extension == 'pptx'}}" - src="/static/images/bookService/detail/PPT.png" - mode="aspectFill" - /> - <!-- 璧勬簮鏃犳枃浠跺唴瀹瑰浘鏍� --> - <image - wx:else - src="/static/images/bookService/detail/word.png" - mode="" - /> - </view> - <!-- 浜戝涔犲浘鏍� --> - <view> </view> - <!-- 鍚嶇О --> - <text - class="name" - style="{{ tab == 'jsek_teachingResources' ? citem.resourceClass ? 'width: 420rpx' : 'width: 560rpx;' : (citem.isShopCar &&citem.isbuy ) ? 'width: 400rpx;' : (citem.isShopCar ||citem.isbuy) ? 'width:520rpx' : 'width:560rpx'}}" - >{{citem.name || '-'}}</text - > - </view> - <!-- 鏁欏璧勬簮绫诲瀷 --> - <view - class="teachClass fl-cn" - wx:if="{{citem.resourceClass && tab == 'jsek_teachingResources'}}" - > - {{citem.resourceClass}} - </view> - <view wx:if="{{tab == 'jsek_cloudLearning'}}"> - <!-- 浜戝涔犺瘯鐪嬪浘鏍� --> - <image - src="/static/images/bookService/detail/shikan.png" - class="testSee" - wx:if="{{!citem.isbuy ? false : citem.freeFile ? true : false}}" - ></image> - <!-- 浜戝涔犲姞鍏ヨ喘鐗╄溅鍥炬爣 --> - <image - src="/static/images/bookService/detail/cart@2x.png" - wx:if="{{citem.isShopCar}}" - class="shopCar" - data-item="{{citem}}" - catch:tap="onCloudShoppingCart" - ></image> - <!-- 浜戝涔犺喘涔板浘鏍� --> - <image - src="/static/images/bookService/detail/need-buy.png" - class="need-buy" - wx:if="{{citem.isbuy }}" - ></image> - </view> - </view> - </view> - </view> - <!-- // 鍒ゆ柇 涓嶆槸鍟嗗搧 鏈夊瓙椤� 閫掑綊缁勪欢 --> - <tree - wx:if="{{ citem.sysType == 'CmsFolder' }}" - isShowCheck="{{isShowCheck}}" - bookInfo="{{bookInfo}}" - treeList="{{[citem]}}" - learnList="{{learnList}}" - itemId="{{itemId}}" - tab="{{tab}}" - buyIds="{{buyIds}}" - openIds="{{openIds}}" - ></tree> - </view> - <!-- 鏆傛棤鏁版嵁 --> - <view wx:if="{{!item.children || !item.children.length}}" class="noData"> - <t-empty icon="folder-open" description="鏆傛棤鏁版嵁" /> - </view> - <view class="listItems" wx:if="{{children.length <= 0 && !loading}}"> - 鏆傛棤鏁版嵁 - </view> - <view class="loading" wx:if="{{loading}}"> - <t-loading theme="circular" size="40rpx" class="wrapper" /> - </view> - </t-collapse-panel> - </t-collapse> -</view> - -<web-view wx:if="{{webpageSrc}}" src="{{webpageSrc}}"></web-view> -<!-- <button bind:tap="sadd"> 65498</button> --> diff --git a/packageBookService/pages/bookServices/detail/components/tree/index.js b/packageBookService/pages/bookServices/detail/components/tree/index.js index f1caa20..3c8731f 100644 --- a/packageBookService/pages/bookServices/detail/components/tree/index.js +++ b/packageBookService/pages/bookServices/detail/components/tree/index.js @@ -208,7 +208,7 @@ 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}&applyState=${this.properties.applyState}&deadline=${this.properties.deadline}`, }); - if (item.selectType == "pdf") { + if (item.selectType == "pdf" || item.selectType == "document") { const fileLink = item.file ? item.file : item.freeFile console.log(fileLink); wx.navigateTo({ @@ -216,50 +216,50 @@ fileLink + "&fileName=" + item.name + - "&fileType=" + - item.selectType + "&bookBuy=true" + "&fileType=pdf" + + "&bookBuy=true" }); } - if (item.selectType == "document") { - // freeFile - // if (item.selectType == "document") { - // item.selectType = "pptx"; - // } - const fileLink = item.file ? - app.config.requestCtx + "/file/api/ApiDownload?md5=" + item.file : - app.config.requestCtx + - "/file/api/ApiDownload?md5=" + - item.freeFile; - console.log(fileLink, "fileLink"); - //鎻愮ず鍔犺浇涓� - // 鍗曟涓嬭浇鍏佽鐨勬渶澶ф枃浠朵负 200MB - wx.downloadFile({ - url: fileLink, - // filePath: wx.env.USER_DATA_PATH + `/${item.name}.${item.selectType}`, - filePath: wx.env.USER_DATA_PATH + `/${item.name}.${item.selectType}`, - success: function (res) { - console.log(res, "wx.downloadFile success res"); - if (res.statusCode != 200) { - util.hideLoadingWithErrorTips(); - return false; - } - var Path = res.tempFilePath; //杩斿洖鐨勬枃浠朵复鏃跺湴鍧�锛岀敤浜庡悗闈㈡墦寮�鏈湴棰勮鎵�鐢� - let data = res.filePath; - wx.openDocument({ - filePath: data, - showMenu: true, - success: function (res) { - console.log("鎵撳紑鎴愬姛"); - util.hideLoading(); - }, - }); - }, - fail: function (err) { - console.log(err, "wx.downloadFile fail err"); - util.hideLoadingWithErrorTips(); - }, - }); - } + // if (item.selectType == "document") { + // // freeFile + // // if (item.selectType == "document") { + // // item.selectType = "pptx"; + // // } + // const fileLink = item.file ? + // app.config.requestCtx + "/file/api/ApiDownload?md5=" + item.file : + // app.config.requestCtx + + // "/file/api/ApiDownload?md5=" + + // item.freeFile; + // console.log(fileLink, "fileLink"); + // //鎻愮ず鍔犺浇涓� + // // 鍗曟涓嬭浇鍏佽鐨勬渶澶ф枃浠朵负 200MB + // wx.downloadFile({ + // url: fileLink, + // // filePath: wx.env.USER_DATA_PATH + `/${item.name}.${item.selectType}`, + // filePath: wx.env.USER_DATA_PATH + `/${item.name}.${item.selectType}`, + // success: function (res) { + // console.log(res, "wx.downloadFile success res"); + // if (res.statusCode != 200) { + // util.hideLoadingWithErrorTips(); + // return false; + // } + // var Path = res.tempFilePath; //杩斿洖鐨勬枃浠朵复鏃跺湴鍧�锛岀敤浜庡悗闈㈡墦寮�鏈湴棰勮鎵�鐢� + // let data = res.filePath; + // wx.openDocument({ + // filePath: data, + // 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") { this.setData({ webpageSrc: item.jsek_link, diff --git a/packageBookService/pages/bookServices/detail/index.js b/packageBookService/pages/bookServices/detail/index.js index 57f03e7..e500b90 100644 --- a/packageBookService/pages/bookServices/detail/index.js +++ b/packageBookService/pages/bookServices/detail/index.js @@ -992,31 +992,45 @@ app.MG.store .getProductDetail(query) .then(async (res) => { - if (!res.datas.cmsDatas[0].datas.length) { - return this.setData({ - noResources: true, - loading: false, - }); - } // 浜戞祴璇曪紝閫掑綊璇锋眰閲屽眰鏁版嵁 if (type.refCode == "questionBank") { - const data = res.datas.cmsDatas[0].datas.filter((item) => item.type == 'questionBankFolder' && item.childrenFolderCount > 0); - if (data.length > 0) { - let list = [] - console.log(query.cmsPath, query.cmsPath.length) - // 娴嬭瘯 6浣�// 姝e紡 5浣�// 娴嬭瘯璋冪敤浼�20锛屽唴閮�7 姝e紡璋冪敤浼�17 鍐呴儴浼�6 - const addNum = query.cmsPath.length > 12 ? 7 : query.cmsPath.length > 14 ? 8 : 6 - const num = query.cmsPath.length + addNum - this.getTreeList(data, num, list, '\\', addNum) - list = this.ensureTreeConsistency(list) - let result = []; - this.findChildIds(list[0].children, result); - this.setData({ - test: list[0].children, - loading: false, - openTeachids: result, - }); - console.log(this.data.test, "test") + let data = [] + let result = []; + if (this.data.options.storeInfo == 'jsek_jslx') { + data = res.datas.cmsDatas[0].datas.filter((item) => item.type == 'questionBankFolder'); + if (data.length > 0) { + this.setData({ + test: data, + loading: false, + openTeachids: result, + }); + } else { + this.setData({ + noResources: true, + loading: false, + }); + } + } else { + data = res.datas.cmsDatas[0].datas.filter((item) => item.type == 'questionBankFolder' && item.childrenFolderCount > 0); + if (data.length > 0) { + let list = [] + // 娴嬭瘯 6浣�// 姝e紡 5浣�// 娴嬭瘯璋冪敤浼�20锛屽唴閮�7 姝e紡璋冪敤浼�17 鍐呴儴浼�6 + const addNum = query.cmsPath.length > 12 ? 7 : query.cmsPath.length > 14 ? 8 : 6 + const num = query.cmsPath.length + addNum + this.getTreeList(data, num, list, '\\', addNum) + list = this.ensureTreeConsistency(list) + this.findChildIds(list[0].children, result); + this.setData({ + test: list[0].children, + loading: false, + openTeachids: result, + }); + } else { + this.setData({ + noResources: true, + loading: false, + }); + } } } }) @@ -1112,30 +1126,33 @@ // 鑾峰彇灞曞紑椤� findChildIds(data, result) { let index = 0 - for (let i = 0; i < data.length; i++) { - if (index < 3) { - const item = data[i] - if (item.childrenFolderCount > 0) { - result.push(item.id) - for (let j = 0; j < item.children.length; j++) { - if (index < 3) { - const childrenItme = item.children[j] - if (item.childrenCount > 0) { - result.push(childrenItme.id) - index += 1 + if (data) + for (let i = 0; i < data.length; i++) { + if (index < 3) { + const item = data[i] + if (item.childrenFolderCount > 0) { + result.push(item.id) + if (item.children) { + for (let j = 0; j < item.children.length; j++) { + if (index < 3) { + const childrenItme = item.children[j] + if (item.childrenCount > 0) { + result.push(childrenItme.id) + index += 1 + } + } else { + break + } } - } else { - break } + } else if (item.childrenCount > 0) { + result.push(item.id) + index += 1 } - } else if (item.childrenCount > 0) { - result.push(item.id) - index += 1 + } else { + break } - } else { - break } - } }, // 鍥句功娣诲姞璐墿杞� diff --git a/packageDomain/pages/resourceDetails/document/index.js b/packageDomain/pages/resourceDetails/document/index.js index 0ca3e50..839ba57 100644 --- a/packageDomain/pages/resourceDetails/document/index.js +++ b/packageDomain/pages/resourceDetails/document/index.js @@ -16,6 +16,7 @@ navBarHeight: '', barHeight: '', activeId: '', + storeInfo: '', bookId: '', bookName: '', cmsId: '', @@ -55,6 +56,7 @@ activeId: options.activeId, bookId: options.bookId, bookName: options.bookName, + storeInfo: options.storeInfo, cmsId: options.cmsId, parentName: options.parentName, parentProductLinkPath: options.parentProductLinkPath, @@ -174,6 +176,9 @@ size: 999 } } + if (this.data.storeInfo) { + query.storeInfo = this.data.storeInfo + } app.MG.store.getProductDetail(query).then((res) => { console.log(res); res.datas.cmsDatas[0].datas.forEach((item) => { diff --git a/packageDomain/pages/resourceDetails/myAudio/index.js b/packageDomain/pages/resourceDetails/myAudio/index.js index 2e996c8..04285e2 100644 --- a/packageDomain/pages/resourceDetails/myAudio/index.js +++ b/packageDomain/pages/resourceDetails/myAudio/index.js @@ -19,6 +19,7 @@ dialogKey: false, style: 'border: 2rpx solid rgba(220,220,220,1);border-radius: 12rpx;', activeId: '', + storeInfo: '', bookId: '', bookName: '', cmsId: '', @@ -87,6 +88,7 @@ navBarHeight: navBarHeight, barHeight: systInfo.statusBarHeight, activeId: options.activeId, + storeInfo: options.storeInfo, bookId: options.bookId, bookName: options.bookName, cmsId: options.cmsId, @@ -251,7 +253,9 @@ size: 999 } } - + if (this.data.storeInfo) { + query.storeInfo = this.data.storeInfo + } app.MG.store.getProductDetail(query).then(res => { let selectedId = -1; // 鍒濆鍖栭�変腑椤圭储寮� let showDataUrl = ''; diff --git a/packageDomain/pages/resourceDetails/myVideo/index.js b/packageDomain/pages/resourceDetails/myVideo/index.js index 588d5d8..f20f1b1 100644 --- a/packageDomain/pages/resourceDetails/myVideo/index.js +++ b/packageDomain/pages/resourceDetails/myVideo/index.js @@ -79,6 +79,7 @@ formPath: options.formPath, flag: false }) + console.log(this.data.storeInfo,13) if (options.parentName !== "鏁欏璧勬簮" && options.parentName !== "浜戝涔�") { this.setData({ parentName: options.parentName, diff --git a/packagePersonal/pages/myCollection/index.js b/packagePersonal/pages/myCollection/index.js index 3c4adf6..d47e1ac 100644 --- a/packagePersonal/pages/myCollection/index.js +++ b/packagePersonal/pages/myCollection/index.js @@ -16,6 +16,11 @@ label: '璇剧▼', key: 1, linkType: 'Favoriteclass', + }, + { + label: '鏁板瓧鏁欐潗', + key: 2, + linkType: 'FavoriteTextBooks', } ], list: [], diff --git a/pages/digitalCourses/digitalCoursesDetails/components/note/note.js b/pages/digitalCourses/digitalCoursesDetails/components/note/note.js new file mode 100644 index 0000000..f09f7d7 --- /dev/null +++ b/pages/digitalCourses/digitalCoursesDetails/components/note/note.js @@ -0,0 +1,345 @@ +// pages/bookServices/detail/components/note/note.js +const app = getApp(); +Component({ + /** + * 缁勪欢鐨勫睘鎬у垪琛� + */ + properties: { + bookInfo: { + type: Object, + value: {}, + }, + }, + + /** + * 缁勪欢鐨勫垵濮嬫暟鎹� + */ + data: { + inputStyle: + "border: 2rpx solid rgba(220,220,220,1);border-radius: 12rpx; padding:16rpx", + placeholderstyle: "font-size:28rpx", + flag: false, // 杈撳叆妗嗘槸鍚︽樉绀� + submitType: "new", // 鏂板缓 or 缂栬緫 + showNoteDialog: false, + textvalue: "", + noteId: "", + showInput: false, + submitTitle: "", + pageCount: { + page: 1, + total: 0, + }, + isMore: null, + noteList: [], + activeValues: 0, + loading: false, + noList: false, + }, + /** + * 缁勪欢鐨勬柟娉曞垪琛� + */ + methods: { + onReachBottom() { + const flag = this.data.noteList.length < this.data.pageCount.total; + if (flag) { + this.setData({ + isMore: true, + "pageCount.page": this.data.pageCount.page + 1, + }); + this.getNoteList(); + } else { + this.setData({ + isMore: true, + }); + setTimeout(() => { + this.setData({ + isMore: false, + }); + }, 100); + } + }, + handleSubmitTitle() { + this.setData({ + submitTitle: this.properties.bookInfo.name, + }); + }, + openDialog() { + this.setData({ + submitTitle: this.properties.bookInfo.name, + showNoteDialog: true, + }); + }, + closeDialog() { + this.setData({ + flag: false, + showNoteDialog: false, + submitTitle: "", + textvalue: "", + }); + }, + textareaChange(e) { + this.setData({ + textvalue: e.detail.value, + }); + }, + textareaBlur() { + console.log("澶卞幓鐒︾偣"); + }, + // 鏍囬杈撳叆妗嗗�� + inputChange(e) { + this.setData({ + submitTitle: e.detail.value, + }); + }, + // 寮圭獥纭畾鎸夐挳 + confirmSuggest() { + const submitTitle = this.data.submitTitle.trim(); + const textvalue = this.data.textvalue.trim(); + if (!submitTitle.length) { + return wx.showToast({ + icon: "error", + title: "璇峰~鍐欑瑪璁版爣棰�", + }); + } else if (!textvalue.length) { + return wx.showToast({ + icon: "error", + title: "璇峰~鍐欑瑪璁板唴瀹�", + }); + } + if (this.data.submitType == "new") { + this.makeNote(); + } else if (this.data.submitType == "edit") { + this.updateNote(); + } + this.setData({ + showNoteDialog: false, + }); + }, + handleChange(e) { + this.setData({ + activeValues: e.detail.value, + }); + }, + // 鏍煎紡鍖栫瑪璁版椂闂� + convertTimestamp(timestamp) { + const isoDate = new Date(timestamp); + const year = isoDate.getFullYear(); + const month = String(isoDate.getMonth() + 1).padStart(2, "0"); + const day = String(isoDate.getDate()).padStart(2, "0"); + const hours = String(isoDate.getHours()).padStart(2, "0"); + const minutes = String(isoDate.getMinutes()).padStart(2, "0"); + const seconds = String(isoDate.getSeconds()).padStart(2, "0"); + const formattedDate = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`; + return formattedDate; + }, + changeLoading() { + this.setData({ + loading: true, + }); + }, + changeNoList() { + this.setData({ + noList: true, + }); + }, + // 鑾峰彇绗旇鍒楄〃 + async getNoteList() { + if (!this.data.isMore) { + this.setData({ + loading: true, + }); + } + this.setData({ + noList: false, + }); + let topicId; + await app.MG.ugc + .getProductUserSubmitTopic({ + productId: this.properties.bookInfo.id, + appRefCode: app.config.appRefCode, + }) + .then((res) => { + if (res) { + topicId = res.id; + } else { + return wx.showToast({ + icon: "error", + title: "鏌ヨ澶辫触", + }); + } + }); + // loadings.value.bookResource = true + let query = { + start: 0, + size: this.data.pageCount.page * 5, + messageType: "note", + sort: { + type: "Desc", + field: "CreateDate", + }, + appRefCode: app.config.appRefCode, + topicIdOrRefCode: topicId + "", + }; + await app.MG.ugc.getTopicMessageList(query).then((res) => { + if (!res.datas.length) { + return this.setData({ + loading: false, + noList: true, + noteList: res.datas, + }); + } + // notePage.value.total = res.totalSize + res.datas.forEach((item) => { + item.compliceHover = false; + item.deleteHover = false; + item.createDate = this.convertTimestamp(item.createDate); + }); + this.setData({ + "pageCount.total": res.totalSize, + noteList: res.datas, + loading: false, + noList: false, + }); + }); + }, + // 鏂板缓绗旇鎺ュ彛 + async makeNote() { + const token = wx.getStorageSync("jsek-token"); + if (!token) { + return wx.getUserProfile({ + desc: "鐢ㄦ埛鐧诲綍", + success: (res) => { + console.log(res); + }, + }); + } + let topicId; + await app.MG.ugc + .getProductUserSubmitTopic({ + productId: this.properties.bookInfo.id, + appRefCode: app.config.appRefCode, + }) + .then((res) => { + if (res) { + topicId = res.id; + } else { + return wx.showToast({ + icon: "error", + title: "鏂板缓澶辫触", + }); + } + }); + let query = { + topicIdOrRefCode: topicId + "", + name: this.data.submitTitle, + content: this.data.textvalue, + type: "note", + cmsTypeRefCode: "", + newDataListRequest: [], + }; + await app.MG.ugc.newTopicMessage(query).then((res) => { + wx.showToast({ + title: "鏂板缓鎴愬姛", + }); + this.closeDialog(); + this.getNoteList(); + }); + }, + // 鍒犻櫎绗旇 + deleteNote(e) { + const id = e.currentTarget.dataset.id; + const messageIds = []; + messageIds.push(id); + wx.showModal({ + title: "鎻愮ず", + content: "纭鍒犻櫎璇ョ瑪璁板悧锛�", //editable濡傛灉涓簍rue锛岃繖灏辨槸杈撳叆妗嗙殑鍐呭 + confirmColor: "#ff6c00", + cancelColor: "#949494", + editable: false, //鏄惁鏄剧ず杈撳叆妗� + placeholderText: "璇疯緭鍏ュ唴瀹瑰惂", //杈撳叆妗嗙殑榛樿鍐呭 + success: (res) => { + if (res.confirm) { + app.MG.ugc + .delTopicMessage({ + messageIds, + }) + .then((res) => { + wx.showToast({ + title: "鍒犻櫎鎴愬姛", + }); + // if ((notePage.value.total % 3) - 1 == 0) { + // notePage.value.page -= 1 + // } + this.getNoteList(); + }); + } else if (res.cancel) { + console.log("鐢ㄦ埛鐐瑰嚮鍙栨秷"); + } + }, + }); + }, + // 鏍囬鏀瑰彉 + changeTitle(e) { + this.setData({ + flag: e.currentTarget.dataset.value, + }); + }, + // 缂栬緫鎸夐挳 + editNote(e) { + const note = e.currentTarget.dataset.note; + this.setData({ + submitType: "edit", + textvalue: note.content, + submitTitle: note.name, + noteId: note.id, + }); + console.log(note.name, this.data.submitTitle); + this.setData({ + showNoteDialog: true, + }); + }, + // 缂栬緫绗旇鎺ュ彛 + updateNote() { + const token = wx.getStorageSync("jsek-token"); + if (!token) { + return wx.getUserProfile({ + desc: "鐢ㄦ埛鐧诲綍", + success: (res) => { + console.log(res); + }, + }); + } + if (!this.data.submitTitle) { + return wx.showToast({ + icon: "error", + title: "璇峰~鍐欑瑪璁版爣棰�", + }); + } else if (!this.data.textvalue) { + return wx.showToast({ + icon: "error", + title: "璇峰~鍐欑瑪璁板唴瀹�", + }); + } + let query = { + id: this.data.noteId, + name: this.data.submitTitle, + description: "string", + icon: "string", + type: "note", + content: this.data.textvalue, + newDataRequests: [], + updateDataRequests: [], + }; + app.MG.ugc.updateTopicMessage(query).then((res) => { + wx.showToast({ + title: "缂栬緫鎴愬姛", + }); + this.closeDialog(); + this.getNoteList(); + }); + this.setData({ + submitType: "new", + }); + }, + }, +}); diff --git a/pages/digitalCourses/digitalCoursesDetails/components/note/note.json b/pages/digitalCourses/digitalCoursesDetails/components/note/note.json new file mode 100644 index 0000000..141ed10 --- /dev/null +++ b/pages/digitalCourses/digitalCoursesDetails/components/note/note.json @@ -0,0 +1,17 @@ +{ + "component": true, + "usingComponents": { + "t-image": "tdesign-miniprogram/image/image", + "t-button": "tdesign-miniprogram/button/button", + "t-collapse": "tdesign-miniprogram/collapse/collapse", + "t-collapse-panel": "tdesign-miniprogram/collapse-panel/collapse-panel", + "t-dialog": "tdesign-miniprogram/dialog/dialog", + "t-textarea": "tdesign-miniprogram/textarea/textarea", + "t-input": "tdesign-miniprogram/input/input", + "t-loading": "tdesign-miniprogram/loading/loading", + "t-popup": "tdesign-miniprogram/popup/popup", + "t-icon": "tdesign-miniprogram/icon/icon", + "t-empty": "tdesign-miniprogram/empty/empty", + "t-skeleton": "tdesign-miniprogram/skeleton/skeleton" + } +} \ No newline at end of file diff --git a/pages/digitalCourses/digitalCoursesDetails/components/note/note.wxml b/pages/digitalCourses/digitalCoursesDetails/components/note/note.wxml new file mode 100644 index 0000000..c2e33aa --- /dev/null +++ b/pages/digitalCourses/digitalCoursesDetails/components/note/note.wxml @@ -0,0 +1,132 @@ +<!--pages/bookServices/detail/components/note/note.wxml--> +<view class="note"> + <view class="note-btn"> + <t-button + theme="primary" + class="make-note" + bind:tap="openDialog" + style="width: 240rpx" + > + <view slot="content" class="btn-content"> + <image src="/static/images/bookService/detail/makeNote.png" /> + <text class="note-btn-text">璁扮瑪璁�</text> + </view> + </t-button> + </view> + <view class="note-content"> + <t-collapse + value="{{activeValues}}" + bind:change="handleChange" + wx:if="{{!loading && noteList.length}}" + > + <t-collapse-panel + value="{{item.id}}" + expandIcon + wx:for="{{noteList}}" + wx:key="id" + > + <view slot="header" class="collapse-header"> + <t-image + class="note-icon" + src="/static/images/bookService/detail/note-icon.png" + ></t-image> + <view class="header-name">{{item.name}}</view> + </view> + <view> + <view class="note-content">{{item.content}}</view> + <view class="note-bottom"> + <view class="note-time">{{item.createDate}}</view> + <view class="bottom-btn"> + <image + src="/static/images/bookService/detail/compliceHover.png" + class="complice" + bind:tap="editNote" + data-note="{{item}}" + /> + <image + src="/static/images/bookService/detail/deleteHover.png" + class="delete" + bind:tap="deleteNote" + data-id="{{item.id}}" + /> + </view> + </view> + </view> + </t-collapse-panel> + </t-collapse> + <view wx:if="{{noList}}" class="noData"> + <t-empty icon="folder-open" description="鏆傛棤鏁版嵁" /> + </view> + </view> + <view class="bottom-box" wx:if="{{noteList.length}}"> + <t-loading wx:if="{{isMore == true}}"></t-loading> + <text wx:if="{{isMore == false}}">娌℃湁鏇村浜�</text> + </view> +</view> +<view class="loading-box" wx:if="{{loading}}"> + <t-skeleton + row-col="{{[1,1,1,1,1,1]}}" + theme="paragraph" + animation="gradient" + loading="{{loading}}" + ></t-skeleton> +</view> + +<!-- 璁扮瑪璁板脊绐� --> +<t-popup + visible="{{showNoteDialog}}" + bind:visible-change="onVisibleChange" + placement="center" +> + <view class="popup"> + <view slot="title"> + <view class="title-text" wx:if="{{!flag}}"> + <text class="note-title">{{submitTitle}}</text> + <t-image + src="/static/images/bookService/detail/edit.png" + class="edit-icon" + bind:tap="changeTitle" + data-value="{{true}}" + ></t-image> + </view> + <view wx:else> + <t-input + value="{{submitTitle}}" + data-value="{{false}}" + bind:enter="changeTitle" + bind:blur="changeTitle" + bind:change="inputChange" + maxlength="{{50}}" + style="{{inputStyle}}" + ></t-input> + </view> + </view> + <view slot="content" class="content"> + <t-textarea + value="{{textvalue}}" + t-class="external-class" + label="" + placeholder="璇疯緭鍏ョ瑪璁板唴瀹�" + maxcharacter="500" + disableDefaultPadding="{{true}}" + indicator + bind:change="textareaChange" + bind:blur="" + style="{{inputStyle}}" + placeholder-style="{{placeholderstyle}}" + /> + </view> + <view class="submit-btn"> + <t-button theme="primary" size="large" block bind:tap="confirmSuggest" + >鎻愪氦</t-button + > + </view> + </view> + <t-icon + t-class="close-btn" + name="close-circle" + size="32" + color="#fff" + bind:tap="closeDialog" + /> +</t-popup> diff --git a/pages/digitalCourses/digitalCoursesDetails/components/note/note.wxss b/pages/digitalCourses/digitalCoursesDetails/components/note/note.wxss new file mode 100644 index 0000000..164f953 --- /dev/null +++ b/pages/digitalCourses/digitalCoursesDetails/components/note/note.wxss @@ -0,0 +1,162 @@ +/* pages/bookServices/detail/components/note/note.wxss */ + +.note { + height: 100%; + padding-bottom: 50rpx; +} + +.popup { + padding: 40rpx; + width: 600rpx; +} + + +.note-btn { + /* height: 140rpx; */ + padding-bottom: 30rpx; + display: flex; + justify-content: flex-end; + align-items: center; + border-bottom: 1px solid #EFF0F1; + --td-button-primary-bg-color: #fff; + --td-button-primary-border-color: #ff6c00; + --td-button-primary-color: #ff6c00; + --td-button-primary-active-bg-color: #fff0e6; +} + +.note-btn image { + width: 28rpx; + height: 32rpx; + margin-right: 5rpx; +} + +.note-btn-text { + font-size: 28rpx; +} + + + +.note-title { + width: 90%; + height: 84rpx; + line-height: 84rpx; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +.make-note { + margin: 0; + margin-right: 40rpx; +} + +.title-text { + display: flex; + align-items: center; +} + +.edit-icon { + margin-left: 10rpx; + width: 30rpx; + height: 30rpx; +} + +.header { + display: flex; +} + +.note-icon { + width: 44rpx; + height: 48rpx; + margin-right: 20rpx; +} + +.collapse-header { + display: flex; +} + +.collapse-header .header-name { + font-size: 32rpx; + width: 500rpx; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} + +.note-content { + height: min-content; + font-size: 28rpx; + color: #949494; + margin-bottom: 20rpx; + text-align: justify; +} + +.wrapper { + height: 100%; +} + +.note-bottom { + display: flex; + justify-content: space-between; + align-items: center; +} + +.bottom-btn { + height: 40rpx; + display: flex; + align-items: center; +} + +.note-time { + color: #D9D9D9; +} + +.complice, +.delete { + width: 30rpx; + height: 30rpx; +} + +.delete { + margin-left: 40rpx; +} + +.loading-box { + width: 100%; + min-height: 550rpx; +} + +.content { + margin-top: 20rpx; +} + +.close-btn { + position: absolute; + left: 50%; + margin-left: -32rpx; + bottom: calc(-1 * (48rpx + 64rpx)); +} + +.submit-btn { + padding: 40rpx; + --td-button-border-radius: 60rpx; + --td-button-primary-bg-color: #ff6c00; + --td-button-primary-border-color: #ff6c00; + --td-button-primary-active-bg-color: #ff984d; + --td-button-primary-active-border-color: #ff984d; +} + +.bottom-box { + margin-top: 100rpx; + display: flex; + justify-content: center; +} + +.t-input__placeholder { + font-size: 28rpx !important +} + +.btn-content { + display: flex; + align-items: center; +} \ No newline at end of file diff --git a/pages/digitalCourses/digitalCoursesDetails/components/question/question.js b/pages/digitalCourses/digitalCoursesDetails/components/question/question.js new file mode 100644 index 0000000..f9a293d --- /dev/null +++ b/pages/digitalCourses/digitalCoursesDetails/components/question/question.js @@ -0,0 +1,252 @@ +// pages/bookServices/detail/components/note/note.js +const app = getApp(); +import moment from 'moment' +Component({ + /** + * 缁勪欢鐨勫睘鎬у垪琛� + */ + properties: { + bookInfo: { + type: Object, + value: {}, + }, + }, + + /** + * 缁勪欢鐨勫垵濮嬫暟鎹� + */ + data: { + inputStyle: "padding:10rpx", + placeholderstyle: "font-size:28rpx", + flag: false, // 杈撳叆妗嗘槸鍚︽樉绀� + submitType: "new", // 鏂板缓 or 缂栬緫 + showNoteDialog: false, + showInput: false, + userName: "", + mannder: "", + content: "", + lock: true, + phoneError: false, + pageCount: { + page: 1, + total: 0, + }, + isMore: null, + onlineQuestionsList: [], + activeValues: 0, + loading: false, + noList: false, + }, + onLoad() {}, + /** + * 缁勪欢鐨勬柟娉曞垪琛� + */ + methods: { + onReachBottom() { + const flag = this.data.noteList.length < this.data.pageCount.total; + if (flag) { + this.setData({ + isMore: true, + "pageCount.page": this.data.pageCount.page + 1, + }); + this.getDataList(); + } else { + this.setData({ + isMore: true, + }); + setTimeout(() => { + this.setData({ + isMore: false, + }); + }, 100); + } + }, + handleSubmitTitle() { + this.setData({ + submitTitle: this.properties.bookInfo.name, + }); + }, + openDialog() { + this.setData({ + submitTitle: this.properties.bookInfo.name, + showNoteDialog: true, + }); + }, + closeDialog() { + this.setData({ + flag: false, + showNoteDialog: false, + userName: "", + mannder: "", + content: "", + }); + }, + bindTnputBlur: function (e) { + this.setData({ + userName: e.detail.value, + }); + }, + onPhoneInput(e) { + const { + phoneError + } = this.data; + if (e.detail.value) { + const isPhoneNumber = /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/.test(e.detail.value); + if (phoneError === isPhoneNumber) { + this.setData({ + phoneError: !isPhoneNumber, + mannder: e.detail.value, + }); + } + } else { + this.setData({ + phoneError: false, + mannder: '' + }); + } + }, + bindTextAreaBlur: function (e) { + this.setData({ + content: e.detail.value, + }); + }, + // 寮圭獥纭畾鎸夐挳 + confirmSuggest() { + if (this.data.lock) { + this.data.lock = false; + if (this.data.userName.replace(/^\s*|\s*$/g, "") == '') { + this.data.lock = true; + wx.showToast({ + title: "鑱旂郴浜轰笉鑳戒负绌�", + icon: 'none', + duration: 1000 + }) + return + } + if (this.data.mannder.replace(/^\s*|\s*$/g, "") == '') { + this.data.lock = true; + wx.showToast({ + title: "鑱旂郴鏂瑰紡涓嶈兘涓虹┖", + icon: 'none', + duration: 1000 + }) + return + } + if (this.data.content.replace(/^\s*|\s*$/g, "") == '') { + this.data.lock = true; + wx.showToast({ + title: "鍙嶉鍐呭涓嶈兘涓虹┖", + icon: 'none', + duration: 1000 + }) + return + } + if (this.data.phoneError) { + this.data.lock = true; + return + } + + let submitData = { + content: this.data.content.replace(/^\s*|\s*$/g, ""), + name: this.data.userName.replace(/^\s*|\s*$/g, ""), + email: "", + phone: this.data.mannder.replace(/^\s*|\s*$/g, "") + }; + var data = { + topicIdOrRefCode: "onlineQuestioning", + name: "鎰忚鍙嶉", + content: JSON.stringify(submitData), + type: "ProductComment", + cmsTypeRefCode: "", + newDataListRequest: [] + }; + app.MG.ugc.newTopicMessage(data).then(res => { + this.data.lock = true; + if (res) { + wx.showToast({ + title: "鎻愪氦鎴愬姛", + icon: 'success', + duration: 1000, + }) + this.closeDialog(); + this.getDataList(); + } + }); + } + }, + handleChange(e) { + this.setData({ + activeValues: e.detail.value, + }); + }, + // 鏍煎紡鍖栫瑪璁版椂闂� + convertTimestamp(timestamp) { + const isoDate = new Date(timestamp); + const year = isoDate.getFullYear(); + const month = String(isoDate.getMonth() + 1).padStart(2, "0"); + const day = String(isoDate.getDate()).padStart(2, "0"); + const hours = String(isoDate.getHours()).padStart(2, "0"); + const minutes = String(isoDate.getMinutes()).padStart(2, "0"); + const seconds = String(isoDate.getSeconds()).padStart(2, "0"); + const formattedDate = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`; + return formattedDate; + }, + changeLoading() { + this.setData({ + loading: true, + }); + }, + changeNoList() { + this.setData({ + noList: true, + }); + }, + // 鑾峰彇鎻愰棶鍒楄〃 + getDataList() { + let that = this + if (!this.data.isMore) { + this.setData({ + loading: true, + }); + } + this.setData({ + noList: false, + }); + let topicId; + app.MG.ugc + .getTopicMessageList({ + appRefCode: app.config.appRefCode, + topicIdOrRefCode: 'onlineQuestioning', + start: that.data.pageCount.page * 5 - 5, + size: 5, + sort: { + type: 'Desc', + field: 'CreateDate' + }, + }).then((res) => { + if (!res.datas.length) { + return this.setData({ + loading: false, + noList: true, + noteList: res.datas, + }); + } + // notePage.value.total = res.totalSize + res.datas.forEach((item) => { + item.title = JSON.parse(item.content).content; + item.createDate = moment(item.createDate).format("YYYY-MM-DD HH:mm:ss"); + item.updateDate = moment(item.updateDate).format("YYYY-MM-DD HH:mm:ss"); + item.feedBack = item.feedBack ? item.feedBack : '-' + }); + this.setData({ + "pageCount.total": res.totalSize, + onlineQuestionsList: res.datas, + loading: false, + noList: false, + }); + console.log(this.data.onlineQuestionsList, 3456) + }); + }, + + }, +}); \ No newline at end of file diff --git a/pages/digitalCourses/digitalCoursesDetails/components/question/question.json b/pages/digitalCourses/digitalCoursesDetails/components/question/question.json new file mode 100644 index 0000000..141ed10 --- /dev/null +++ b/pages/digitalCourses/digitalCoursesDetails/components/question/question.json @@ -0,0 +1,17 @@ +{ + "component": true, + "usingComponents": { + "t-image": "tdesign-miniprogram/image/image", + "t-button": "tdesign-miniprogram/button/button", + "t-collapse": "tdesign-miniprogram/collapse/collapse", + "t-collapse-panel": "tdesign-miniprogram/collapse-panel/collapse-panel", + "t-dialog": "tdesign-miniprogram/dialog/dialog", + "t-textarea": "tdesign-miniprogram/textarea/textarea", + "t-input": "tdesign-miniprogram/input/input", + "t-loading": "tdesign-miniprogram/loading/loading", + "t-popup": "tdesign-miniprogram/popup/popup", + "t-icon": "tdesign-miniprogram/icon/icon", + "t-empty": "tdesign-miniprogram/empty/empty", + "t-skeleton": "tdesign-miniprogram/skeleton/skeleton" + } +} \ No newline at end of file diff --git a/pages/digitalCourses/digitalCoursesDetails/components/question/question.wxml b/pages/digitalCourses/digitalCoursesDetails/components/question/question.wxml new file mode 100644 index 0000000..78c9954 --- /dev/null +++ b/pages/digitalCourses/digitalCoursesDetails/components/question/question.wxml @@ -0,0 +1,65 @@ +<view class="note"> + <view class="note-btn"> + <view>鍏眥{pageCount.total}}涓�</view> + <t-button theme="primary" class="make-note" bind:tap="openDialog" style="width: 240rpx"> + <view slot="content" class="btn-content"> + <image src="/static/images/digitalCourses/bianji.png" /> + <text class="note-btn-text">鎻愰棶</text> + </view> + </t-button> + </view> + <view class="note-content"> + <t-collapse value="{{activeValues}}" bind:change="handleChange" wx:if="{{!loading && onlineQuestionsList.length}}"> + <t-collapse-panel value="{{item.id}}" expandIcon wx:for="{{onlineQuestionsList}}" wx:key="id"> + <view slot="header" class="collapse-header"> + <view class="note-icon"></view> + <view class="header-name">{{item.title}}</view> + </view> + <view> + <view class="note-content">{{item.feedBack}}</view> + <view class="note-bottom"> + <view class="note-time">{{item.createDate}}</view> + </view> + </view> + </t-collapse-panel> + </t-collapse> + <view wx:if="{{noList}}" class="noData"> + <t-empty icon="folder-open" description="鏆傛棤鏁版嵁" /> + </view> + </view> + <view class="bottom-box" wx:if="{{onlineQuestionsList.length}}"> + <t-loading wx:if="{{isMore == true}}"></t-loading> + <text wx:if="{{isMore == false}}">娌℃湁鏇村浜�</text> + </view> +</view> +<view class="loading-box" wx:if="{{loading}}"> + <t-skeleton row-col="{{[1,1,1,1,1,1]}}" theme="paragraph" animation="gradient" loading="{{loading}}"></t-skeleton> +</view> + +<!-- 璁扮瑪璁板脊绐� --> +<t-popup visible="{{showNoteDialog}}" bind:visible-change="onVisibleChange" placement="center"> + <view class="popup"> + <view class="from-item"> + <view class="label"><text class="icon">*</text> 鑱旂郴浜猴細 </view> + <view class="item-content"> + <t-input placeholder="璇疯緭鍏ヨ仈绯讳汉" borderless value="{{userName}}" bindchange="bindTnputBlur" style="{{inputStyle}}" /> + </view> + </view> + <view class="from-item"> + <view class="label"> <text class="icon">*</text>鑱旂郴鏂瑰紡锛� </view> + <view class="item-content"> + <t-input placeholder="杈撳叆鑱旂郴鏂瑰紡" borderless value="{{mannder}}" type="number" tips="{{phoneError ? '鎵嬫満鍙疯緭鍏ヤ笉姝g‘' : ''}}" bindchange="onPhoneInput" style="{{inputStyle}}" /> + </view> + </view> + <view class="from-item"> + <view class="label"> <text class="icon">*</text>鍙嶉鍐呭锛� </view> + <view class="item-content"> + <t-textarea placeholder="璇疯緭鍏ュ弽棣堝唴瀹�" value="{{content}}" disableDefaultPadding="{{true}}" autosize="{{true}}" maxlength="300" indicator bindchange="bindTextAreaBlur" style="{{inputStyle}}" /> + </view> + </view> + <view class="submit-btn"> + <t-button theme="primary" size="large" block bind:tap="confirmSuggest">鎻愪氦</t-button> + </view> + </view> + <t-icon t-class="close-btn" name="close-circle" size="32" color="#fff" bind:tap="closeDialog" /> +</t-popup> \ No newline at end of file diff --git a/pages/digitalCourses/digitalCoursesDetails/components/question/question.wxss b/pages/digitalCourses/digitalCoursesDetails/components/question/question.wxss new file mode 100644 index 0000000..ab89c97 --- /dev/null +++ b/pages/digitalCourses/digitalCoursesDetails/components/question/question.wxss @@ -0,0 +1,148 @@ +/* pages/bookServices/detail/components/note/note.wxss */ + +.note { + height: 100%; + padding-bottom: 50rpx; +} + +.popup { + padding: 40rpx; + width: 600rpx; +} + +.note-btn { + /* height: 140rpx; */ + padding-bottom: 30rpx; + display: flex; + justify-content: space-between; + align-items: center; + border-bottom: 1px solid #EFF0F1; + --td-button-primary-bg-color: #fff; + --td-button-primary-border-color: #ff6c00; + --td-button-primary-color: #ff6c00; + --td-button-primary-active-bg-color: #fff0e6; +} + +.note-btn image { + width: 28rpx; + height: 32rpx; + margin-right: 5rpx; +} + +.note-btn-text { + font-size: 28rpx; +} + +.make-note { + margin: 0; + margin-right: 40rpx; +} + +.header { + display: flex; +} + +.note-icon { + width: 60rpx; + height: 60rpx; + background: #E1E1E1; + border-radius: 50%; + margin-right: 20rpx; +} + +.collapse-header { + display: flex; +} + +.collapse-header .header-name { + font-size: 32rpx; + width: 500rpx; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} + +.note-content { + height: min-content; + font-size: 28rpx; + color: #949494; + margin-bottom: 20rpx; + text-align: justify; +} + +.wrapper { + height: 100%; +} + +.note-bottom { + display: flex; + justify-content: space-between; + align-items: center; +} + +.bottom-btn { + height: 40rpx; + display: flex; + align-items: center; +} + +.note-time { + color: #D9D9D9; +} + +.loading-box { + width: 100%; + min-height: 550rpx; +} + +.item-content { + margin: 20rpx 0; +} + +.t-input { + padding: 10rpx !important; +} + +.t-input__content, +.t-textarea { + border: 2rpx solid #D9D9D9 !important; + padding: 10rpx !important; +} + +.t-input__tips, +.from-item .label .icon { + color: #f56c6c !important; + margin-right: 5rpx; +} + +.t-input__placeholder, +.t-textarea__placeholder { + font-size: 28rpx !important; +} + +.close-btn { + position: absolute; + left: 50%; + margin-left: -32rpx; + bottom: calc(-1 * (48rpx + 64rpx)); +} + +.submit-btn { + padding: 40rpx; + --td-button-border-radius: 60rpx; + --td-button-primary-bg-color: #ff6c00; + --td-button-primary-border-color: #ff6c00; + --td-button-primary-active-bg-color: #ff984d; + --td-button-primary-active-border-color: #ff984d; +} + +.bottom-box { + margin-top: 100rpx; + display: flex; + justify-content: center; +} + +.btn-content { + display: flex; + align-items: center; +} \ No newline at end of file diff --git a/pages/digitalCourses/digitalCoursesDetails/components/testTree/index.js b/pages/digitalCourses/digitalCoursesDetails/components/testTree/index.js new file mode 100644 index 0000000..c2bd620 --- /dev/null +++ b/pages/digitalCourses/digitalCoursesDetails/components/testTree/index.js @@ -0,0 +1,92 @@ +const app = getApp(); +Component({ + properties: { + treeList: { + type: Array, + value: [], + }, + bookInfo: { + type: Object, + value: {}, + }, + tab: { + type: String, + value: "", + }, + openIds: { + type: Array, + value: [], + }, + }, + data: {}, + ready() {}, + + onLoad() { + console.log(this.properties.openIds, "1111") + }, + + methods: { + + // 鑺傜偣灞曞紑 + handleChange(e) { + console.log(e, 123) + this.setData({ + openIds: e.detail.value, + }); + }, + async goTest(e) { + console.log(e, 666) + const value = e.currentTarget.dataset.item; + const parent = e.currentTarget.dataset.parent; + const token = wx.getStorageSync("jsek-token"); + if (!token) { + return wx.getUserProfile({ + desc: "鐢ㄦ埛鐧诲綍", + success: (res) => { + console.log(res); + }, + }); + } + // 鑾峰彇绔犺妭涓嬫槸鍚︽湁棰樼洰 + let idPathList = []; + let query = { + storeInfo: app.config.digitalCourses, + path: "*", + queryType: "*", + productId: this.properties.bookInfo.id, + cmsPath: value.productLinkPath, + pading: { + start: 0, + size: 999, + }, + }; + if (value.childrenFolderCount == 0) { + wx.hideLoading(); + return wx.showToast({ + icon: "error", + title: "鏆傛棤鏁版嵁", + }); + } else { + const res = await app.MG.store.getProductDetail(query); + res.datas.cmsDatas[0].datas.forEach((item) => { + idPathList.push({ + id: item.id, + name: item.name, + productLinkPath: item.productLinkPath, + type: item.type, + }); + }); + } + wx.hideLoading(); + wx.navigateTo({ + url: `/packageBookService/pages/bookServices/examination/examination?bookId=${ + this.properties.bookInfo.id + }&productLinkPath=${value.productLinkPath}&rootCmsItemId=${ + this.properties.bookInfo.rootCmsItemId + }&idPathList=${JSON.stringify(idPathList)}&answerTitle=${ + value.name + }&answerType=${"option"}&storeInfo=${app.config.digitalCourses}`, + }); + }, + }, +}); \ No newline at end of file diff --git a/pages/digitalCourses/digitalCoursesDetails/components/testTree/index.json b/pages/digitalCourses/digitalCoursesDetails/components/testTree/index.json new file mode 100644 index 0000000..ae819a7 --- /dev/null +++ b/pages/digitalCourses/digitalCoursesDetails/components/testTree/index.json @@ -0,0 +1,13 @@ +{ + "component": true, + "usingComponents": { + "t-icon": "tdesign-miniprogram/icon/icon", + "t-image": "tdesign-miniprogram/image/image", + "t-collapse": "tdesign-miniprogram/collapse/collapse", + "t-collapse-panel": "tdesign-miniprogram/collapse-panel/collapse-panel", + "t-button": "tdesign-miniprogram/button/button", + "t-checkbox": "tdesign-miniprogram/checkbox/checkbox", + "tree": "/packageBookService/pages/bookServices/detail/components/testTree/index", + "t-empty": "tdesign-miniprogram/empty/empty" + } +} \ No newline at end of file diff --git a/pages/digitalCourses/digitalCoursesDetails/components/testTree/index.wxml b/pages/digitalCourses/digitalCoursesDetails/components/testTree/index.wxml new file mode 100644 index 0000000..a658307 --- /dev/null +++ b/pages/digitalCourses/digitalCoursesDetails/components/testTree/index.wxml @@ -0,0 +1,55 @@ +<view class="tree"> + <t-collapse default-value="{{openIds}}" catchchange="handleChange"> + <view wx:for="{{treeList}}" wx:for-item="item" wx:for-index="index" wx:key="id" wx:if="{{!item.children }}"> + <view class="listItems" wx:if="{{!item.children}}"> + <view class="itemsInfo" data-item="{{item}}" data-index="{{index}}"> + <view class="contentBox" bind:tap="goTest" data-item="{{item}}" data-parent="{{''}}"> + <view class="box-image fl-cn" style="width: 80%"> + <!-- 娴嬭瘯棰� --> + <view class="teach-icon fl-cn"> + <image src="/static/images/bookService/detail/test-icon.png" mode="" /> + </view> + <!-- 鍚嶇О --> + <text class="name" style="width: 100%">{{item.name || '-'}}</text> + </view> + <view> + <image src="/static/images/bookService/detail/lianxi-icon.png" class="testSee"></image> + </view> + </view> + </view> + </view> + </view> + <t-collapse-panel wx:for="{{treeList}}" wx:for-item="item" wx:for-index="index" wx:key="id" value="{{item.id}}" wx:if="{{item.children}}"> + <view slot="header" class="header-title"> + <view class="title-checkBox"> + <!-- 绔犺妭鍚� --> + <view class="title-box"> + <view class="title-name">{{item.name}} </view> + </view> + </view> + </view> + <view class="list" wx:for="{{item.children}}" wx:for-item="citem" wx:for-index="cindex" wx:key="cindex"> + <!-- // 鍒ゆ柇 鏃犲瓙椤� 涓斾负鍟嗗搧item 鐩存帴鏄剧ず --> + <view class="listItems" wx:if="{{!citem.children}}"> + <view class="itemsInfo" data-item="{{citem}}" data-index="{{cindex}}"> + <view class="contentBox" bind:tap="goTest" data-item="{{citem}}" data-parent="{{item}}"> + <view class="box-image fl-cn"> + <!-- 浜戞祴璇曞浘鏍� --> + <view class="teach-icon fl-cn"> + <image src="/static/images/bookService/detail/test-icon.png" mode="" /> + </view> + <!-- 鍚嶇О --> + <text class="name">{{citem.name || '-'}}</text> + </view> + <view> + <image src="/static/images/bookService/detail/lianxi-icon.png" class="testSee"></image> + </view> + </view> + </view> + </view> + <!-- // 鍒ゆ柇 涓嶆槸鍟嗗搧 鏈夊瓙椤� 閫掑綊缁勪欢 --> + <tree wx:if="{{ citem.children }}" bookInfo="{{bookInfo}}" treeList="{{[citem]}}" tab="{{tab}}" openIds="{{openIds}}"></tree> + </view> + </t-collapse-panel> + </t-collapse> +</view> \ No newline at end of file diff --git a/packageBookService/pages/bookServices/detail/components/testTree/tree/index.wxss b/pages/digitalCourses/digitalCoursesDetails/components/testTree/index.wxss similarity index 100% copy from packageBookService/pages/bookServices/detail/components/testTree/tree/index.wxss copy to pages/digitalCourses/digitalCoursesDetails/components/testTree/index.wxss diff --git a/pages/digitalCourses/digitalCoursesDetails/components/tree/index.js b/pages/digitalCourses/digitalCoursesDetails/components/tree/index.js new file mode 100644 index 0000000..2eecdd1 --- /dev/null +++ b/pages/digitalCourses/digitalCoursesDetails/components/tree/index.js @@ -0,0 +1,105 @@ +const app = getApp(); +Component({ + properties: { + treeList: { + type: Array, + value: [], + }, + learnList: { + type: Array, + value: [], + }, + bookInfo: { + type: Object, + value: {}, + }, + openIds: { + type: Array, + value: [], + }, + }, + data: { + sonPurchaseSaleMethodId: "", + superiorPurchaseSaleMethodId: [], + activeValues: [1, 2], + webpageSrc: "", + cloudShoppingCart: [], + selectAll: [], + shoppingCart: true, + stop: false, + cart: true, + canExecute: true + }, + ready() {}, + + onLoad() { + this.setData({ + sonPurchaseSaleMethodId: [], + }); + }, + 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; + console.log('item', item); + const parentProductLinkPath = parent ? + parent.productLinkPath : + wx.getStorageSync("teachResourcesPath"); + const parentName = parent ? parent.name : "鏁欏璧勬簮"; + let url; + if (item.selectType == 'zip') { + if (this.properties.applyState == 'Normal') { + return wx.showToast({ + icon: 'error', + title: '璇峰墠寰�PC绔笅杞�', + }) + } else { + return wx.showToast({ + icon: 'error', + title: '璇峰厛鐢宠涓嬭浇', + }) + } + } + if (item.learnSelectType == "video") { + url = "/packageDomain/pages/resourceDetails/myVideo/index"; + } else if (item.learnSelectType == "audio") { + url = "/packageDomain/pages/resourceDetails/myAudio/index"; + } else if (item.selectType == "picture" || item.selectType == "zip") { + 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}`, + }); + + } + }, + + + }, +}); \ No newline at end of file diff --git a/packageBookService/pages/bookServices/detail/components/testTree/tree/index.json b/pages/digitalCourses/digitalCoursesDetails/components/tree/index.json similarity index 100% rename from packageBookService/pages/bookServices/detail/components/testTree/tree/index.json rename to pages/digitalCourses/digitalCoursesDetails/components/tree/index.json diff --git a/pages/digitalCourses/digitalCoursesDetails/components/tree/index.wxml b/pages/digitalCourses/digitalCoursesDetails/components/tree/index.wxml new file mode 100644 index 0000000..baaec58 --- /dev/null +++ b/pages/digitalCourses/digitalCoursesDetails/components/tree/index.wxml @@ -0,0 +1,73 @@ +<view class="tree"> + <t-collapse default-value="{{openIds}}" catchchange="handleChange"> + <view wx:for="{{treeList}}" wx:for-item="item" wx:for-index="index" wx:key="id" wx:if="{{item.sysType== 'CmsItem' }}"> + <view class="listItems" wx:if="{{item.childrenFolderCount <= 0 && item.sysType == 'CmsItem'}}"> + <view class="itemsInfo" data-item="{{item}}" data-index="{{index}}"> + <view class="contentBox" bind:tap="goPlayer" data-item="{{item}}" data-parent="{{''}}"> + <!-- 浜戝涔� 鍥炬爣 --> + <view class="box-image fl-cn" style="width: 80%"> + <view class="teach-icon fl-cn"> + <image wx:if="{{item.selectType == 'audio' || item.learnSelectType == 'audio'}}" src="/static/images/bookService/detail/audioIcon.png" mode="aspectFill" /> + <image wx:elif="{{item.selectType == 'video' || item.learnSelectType == 'video'}}" src="/static/images/bookService/detail/video.png" mode="aspectFill" /> + <!-- 璧勬簮鏃犳枃浠跺唴瀹瑰浘鏍� --> + <image wx:else src="/static/images/bookService/detail/word.png" mode="" /> + </view> + <!-- 鍚嶇О --> + <text class="name" style="width: 100%">{{item.name || '-'}}</text> + </view> + <view> + <!-- 浜戝涔犺瘯鐪嬪浘鏍� --> + <image src="/static/images/bookService/detail/shikan.png" class="testSee" wx:if="{{!item.isbuy ? false : item.freeFile ? true : false}}"></image> + </view> + </view> + </view> + </view> + </view> + <t-collapse-panel wx:for="{{treeList}}" wx:for-item="item" wx:for-index="index" wx:key="id" value="{{item.id}}" wx:if="{{item.sysType == 'CmsFolder' }}"> + <view slot="header" class="header-title"> + <view class="title-checkBox" catchtap="catchTap"> + <!-- 绔犺妭鍚� --> + <view class="title-box"> + <view class="title-name">{{item.name}} </view> + </view> + </view> + </view> + <view class="list" wx:for="{{item.children}}" wx:for-item="citem" wx:for-index="cindex" wx:key="cindex"> + <!-- // 鍒ゆ柇 鏃犲瓙椤� 涓斾负鍟嗗搧item 鐩存帴鏄剧ず --> + <view class="listItems" wx:if="{{citem.childrenFolderCount <= 0 && citem.sysType == 'CmsItem'}}"> + <view class="itemsInfo" data-item="{{citem}}" data-index="{{cindex}}"> + <view class="contentBox" bind:tap="goPlayer" data-item="{{citem}}" data-parent="{{item}}"> + <!-- 浜戝涔� 鍥炬爣 --> + <view class="box-image fl-cn"> + <view class="teach-icon fl-cn"> + <image wx:if="{{citem.selectType == 'audio' || citem.learnSelectType == 'audio'}}" src="/static/images/bookService/detail/audioIcon.png" mode="aspectFill" /> + <image wx:elif="{{citem.selectType == 'video' || citem.learnSelectType == 'video'}}" src="/static/images/bookService/detail/video.png" mode="aspectFill" /> + <!-- 璧勬簮鏃犳枃浠跺唴瀹瑰浘鏍� --> + <image wx:else src="/static/images/bookService/detail/word.png" mode="" /> + </view> + <!-- 鍚嶇О --> + <text class="name" style="width:540rpx">{{citem.name || '-'}}</text> + </view> + <view> + <!-- 浜戝涔犺瘯鐪嬪浘鏍� --> + <image src="/static/images/bookService/detail/shikan.png" class="testSee" wx:if="{{!citem.isbuy ? false : citem.freeFile ? true : false}}"></image> + </view> + </view> + </view> + </view> + <!-- // 鍒ゆ柇 涓嶆槸鍟嗗搧 鏈夊瓙椤� 閫掑綊缁勪欢 --> + <tree wx:if="{{ citem.sysType == 'CmsFolder' }}" isShowCheck="{{isShowCheck}}" bookInfo="{{bookInfo}}" treeList="{{[citem]}}" learnList="{{learnList}}" itemId="{{itemId}}" openIds="{{openIds}}"></tree> + </view> + <!-- 鏆傛棤鏁版嵁 --> + <view wx:if="{{!item.children || !item.children.length}}" class="noData"> + <t-empty icon="folder-open" description="鏆傛棤鏁版嵁" /> + </view> + <view class="listItems" wx:if="{{children.length <= 0 && !loading}}"> + 鏆傛棤鏁版嵁 + </view> + <view class="loading" wx:if="{{loading}}"> + <t-loading theme="circular" size="40rpx" class="wrapper" /> + </view> + </t-collapse-panel> + </t-collapse> +</view> \ No newline at end of file diff --git a/packageBookService/pages/bookServices/detail/components/testTree/tree/index.wxss b/pages/digitalCourses/digitalCoursesDetails/components/tree/index.wxss similarity index 100% rename from packageBookService/pages/bookServices/detail/components/testTree/tree/index.wxss rename to pages/digitalCourses/digitalCoursesDetails/components/tree/index.wxss diff --git a/pages/digitalCourses/digitalCoursesDetails/index.js b/pages/digitalCourses/digitalCoursesDetails/index.js index 4c3d661..27e1095 100644 --- a/pages/digitalCourses/digitalCoursesDetails/index.js +++ b/pages/digitalCourses/digitalCoursesDetails/index.js @@ -1,5 +1,6 @@ // pages/digitalCourses/digitalCoursesDetails/index.js const app = getApp() +import moment from 'moment' import Toast from "tdesign-miniprogram/toast"; Page({ @@ -8,7 +9,9 @@ */ data: { loading: true, - digitalsData: [], + digitalsData: {}, + expire: false, //鍟嗗搧鎴栧瓙鍟嗗搧閿�鍞柟寮忔槸鍚﹁繃鏈� + isBuy: false, tabValue: 0, learnResourceIcon: { name: "/static/images/digitalTextbooks/shengshu-t@2x.png", @@ -43,20 +46,22 @@ }, dialogBox: false, - lecturerList: [{ - icon: '', - name: '鏋楀磭寰�', - title: '璁插笀', - introduce: '涓浗瀛︾敓鍙戝睍鏍稿績绱犲吇鐮斿埗棣栧腑涓撳锛屽洿缁曞ぇ涓皬瀛︽暀鏉愬缓璁惧紑灞曚簡涓�绯诲垪寮�鍒涙�с�佸鍩烘�у伐浣溿�傚缓绔嬪畬鍠勪簡鎴戝浗鍙戝睍蹇冪悊瀛︽暀鏉愪綋绯汇��' - }, - { - icon: '', - name: '鏋楀磭寰�', - title: '鏁欐巿', - introduce: '涓浗瀛︾敓鍙戝睍鏍稿績绱犲吇鐮斿埗棣栧腑涓撳锛屽洿缁曞ぇ涓皬瀛︽暀鏉愬缓璁惧紑灞曚簡涓�绯诲垪寮�鍒涙�с�佸鍩烘�у伐浣溿�傚缓绔嬪畬鍠勪簡鎴戝浗鍙戝睍蹇冪悊瀛︽暀鏉愪綋绯汇�備腑鍥藉鐢熷彂灞曟牳蹇冪礌鍏荤爺鍒堕甯笓瀹讹紝鍥寸粫澶т腑灏忓鏁欐潗寤鸿寮�灞曚簡涓�绯诲垪寮�鍒涙�с�佸鍩烘�у伐浣溿�傚缓绔嬪畬鍠勪簡鎴戝浗鍙戝睍蹇冪悊瀛︽暀鏉愪綋绯�' - } - ] - + lecturerList: [], + selectActive: 'learn', + learnList: [], + testList: [], + openTeachids: [], + onlineQuestionsList: [], + //鍒嗛〉 + page: 1, + limit: 6, + questionTotalCount: 0, + bottomLoading: false, + isMoreData: false, + noteList: [], + notePage: 1, + noteLimit: 6, + noteTotalCount: 0, }, formatDate(dateString) { if (!dateString) { @@ -162,7 +167,6 @@ }, digitalCoursesDetailsGet(digitalTextId) { - let query = { path: '*', queryType: '*', @@ -176,6 +180,7 @@ author: [], isbn: [], publicationDate: [], + speaker: [], bookClassification: [], paperPrice: [], JDLink: [], @@ -194,20 +199,59 @@ affiliatedUnit: [], publishingUnit: [], classHours: [], - productLinkPath: [] + productLinkPath: [], + //epub璇曡鐧惧垎姣� } } app.MG.store.getProductDetail(query).then(res => { console.log(res); + if (res.datas.purchasedSaleMethodIdList.includes(res.datas.defaultSaleMethodId)) { + this.setData({ + isBuy: true + }) + } else { + this.setData({ + isBuy: false + }) + } + let times = new Date(res.datas.defaultSaleMethod.endDate).getTime() + let startTime = new Date(res.datas.defaultSaleMethod.beginDate).getTime() + if (times < new Date().getTime() || new Date().getTime() < startTime) { + this.setData({ + expire: true + }) + } else { + this.setData({ + expire: res.false + }) + } res.datas.publicationDate = this.formatDate(res.datas.publicationDate) res.datas.price = res.datas.price.toFixed(2) wx.setNavigationBarTitle({ title: res.datas.name, }) + let lecturer = [] + if (res.datas.datas.speaker && res.datas.datas.speaker.length > 0) { + res.datas.datas.speaker.forEach(item => { + if (res.datas.subItems && res.datas.subItems.QueryCms.length > 0) { + res.datas.subItems.QueryCms.forEach(item1 => { + if (JSON.parse(item.Data.Value).items[0] == item1.id) { + lecturer.push({ + name: item1.name, + icon: item1.icon ? item1.icon : '', + description: item1.description ? item1.description : '', + }) + } + }) + + } + }) + } this.setData({ + lecturerList: lecturer, digitalsData: res.datas, loading: false }) @@ -219,9 +263,211 @@ tabValue: value }) console.log(this.data.tabValue); + if (this.data.tabValue == 2) { + this.getResource() + } + if (this.data.tabValue == 3) { + this.selectComponent("#note").getNoteList(); + } + if (this.data.tabValue == 4) { + this.selectComponent("#question").getDataList(); + } }, + selectChange(event) { + console.log(event) + const value = event.target.dataset.value + this.setData({ + selectActive: value + }) + this.getResource() + }, + getResource() { + let query = { + storeInfo: app.config.digitalCourses, + path: '*', + queryType: '*', + productId: this.data.digitalsData.id, + cmsPath: this.data.digitalsData.rootCmsItemId + '', + cmsType: '*', + itemFields: { + SysType: 'CmsFolder', + selectType: [], + freeFile: [], + file: [], + protectedFile: [], + resourcesClassification: [], + isDownload: [], + jsek_resourceBrief: [], + jsek_link: [], + jsek_questionBank: [], + learnSelectType: [] + }, + pading: { + start: 99, + size: 0 + } + } + app.MG.store.getProductDetail(query).then((res) => { + console.log(res.datas, 1111) + let test = [] + let learn = [] + if (res.datas.cmsDatas[0].datas.length > 0) { + res.datas.cmsDatas[0].datas.forEach((item) => { + if (item.type == 'questionBankFolder' || item.type == 'questionBankItem') { + test.push(item) + } else if (item.type != "resourceItem") { + learn.push(item) + } + }) + if (this.data.selectActive === 'learn') { + let list = [] + // 娴嬭瘯 6浣�// 姝e紡 5浣�// 娴嬭瘯璋冪敤浼�20锛屽唴閮�7 姝e紡璋冪敤浼�17 鍐呴儴浼�6 + let addNum = query.cmsPath.length > 5 ? 7 : query.cmsPath.length > 6 ? 8 : 6 + const num = query.cmsPath.length + addNum + if (learn.some((item) => item.sysType == 'CmsFolder')) { + this.getTreeList(learn, num, list, '\\', addNum) + list = this.ensureTreeConsistency(list) + } else { + list = learn + } + let result = []; + this.findChildIds(list, result) + if (list.length > 0) { + this.setData({ + learnList: list, + openTeachids: result, + }); + } + } else { + const data = test.filter( + (item) => item.type == 'questionBankFolder' && item.childrenFolderCount > 0 + ) + if (data.length > 0) { + let list = [] + let addNum = query.cmsPath.length > 5 ? 7 : query.cmsPath.length > 6 ? 8 : 6 + const num = query.cmsPath.length + addNum + this.getTreeList(data, num, list, '\\', addNum) + list = this.ensureTreeConsistency(list) + let result = []; + this.findChildIds(list[0].children, result) + this.setData({ + testList: list[0].children, + openTeachids: result, + }); + } + } + } + }) + }, + // 鎵佸钩鍖栨暟鎹浆鎹ree + getTreeList(rootList, pathLength, newArr, path, addNum) { + for (const item of rootList) { + // 姝ゅ鍘熸湰 item.productLinkPath.length == pathLength 浣� productLinkPath 闀垮害涓埆涔﹀瓨鍦�4銆�5浣嶄氦閿� + if ((pathLength - item.productLinkPath.length >= 0 && pathLength - item.productLinkPath.length <= 3) && item.productLinkPath.includes(path)) { + if (item.sysType == 'CmsItem') { + if (item.selectType == 'webpage') { + item.disabled = true + } else { + if (item.isDownload != 1) { + item.disabled = true + } + } + if (item.file && item.fileMap && item.fileMap[item.file]) { + if (item.fileMap[item.file].protectType == 'Private') item.disabled = true + } + } + // newArr.push(item) + // 鍦ㄦ彃鍏ヨ繃绋嬩腑瀵规暟鎹繘琛屾帓搴� + newArr = this.insertAndSortObjectsByProductLinkPath(newArr, item, addNum) + } + } + //缁欐暟缁勯噷闈㈠啀娣诲姞涓�涓猚hildren鐨勭┖鏁扮粍 + for (const i of newArr) { + i.children = [] + this.getTreeList(rootList, pathLength + addNum, i.children, i.productLinkPath, addNum) + if (i.children.length == 0) { + delete i.children + } + } + return newArr + }, + + // 鍘婚櫎鏍戠粨鏋勫浣欓」 + ensureTreeConsistency(tree) { + for (let index = 0; index < tree.length; index++) { + const item = tree[index]; + if (item.children && item.children.length) { + const isFloder = item.children.findIndex(citem => citem.sysType == 'CmsFolder') + const isItem = item.children.findIndex(citem => citem.sysType == 'CmsItem') + if (isFloder > -1 && isItem > -1) { + item.children = item.children.filter(ditem => ditem.sysType == 'CmsItem') + } + this.ensureTreeConsistency(item.children) + } + } + return tree + }, + + // 鎺掑簭鏁扮粍 鎸夌収productLinkPath + insertAndSortObjectsByProductLinkPath(array, newObj, addNum) { + // 鏌ユ壘鏂板璞″簲璇ユ彃鍏ョ殑浣嶇疆 + let insertIndex = array.findIndex(obj => Number(newObj.productLinkPath.substring(newObj.productLinkPath.length - addNum, newObj.productLinkPath.length)) < Number(obj.productLinkPath.substring(obj.productLinkPath.length - addNum, obj.productLinkPath.length))); + + // 濡傛灉娌℃湁鎵惧埌鍚堥�傜殑浣嶇疆锛屽垯鏀惧湪鏁扮粍鏈熬 + if (insertIndex === -1) { + insertIndex = array.length; + } + // 鎻掑叆鏂板璞″埌鏁扮粍 + array.splice(insertIndex, 0, newObj); + // 娴嬭瘯6 姝e紡5 + // 瀵规暟缁勮繘琛屾帓搴� + array.sort((a, b) => { + if (Number(a.productLinkPath.substring(a.productLinkPath.length - addNum, a.productLinkPath.length)) < Number(b.productLinkPath.substring(b.productLinkPath.length - addNum, b.productLinkPath.length))) { + return -1; + } + if (Number(a.productLinkPath.substring(a.productLinkPath.length - addNum, a.productLinkPath.length)) > Number(b.productLinkPath.substring(b.productLinkPath.length - addNum, b.productLinkPath.length))) { + return 1; + } + // a must be equal to b + return 0; + }); + + // 杩斿洖鏇存柊鍚庣殑鏁扮粍 + return array; + }, + + // 鑾峰彇灞曞紑椤� + findChildIds(data, result) { + let index = 0 + for (let i = 0; i < data.length; i++) { + if (index < 3) { + const item = data[i] + if (item.childrenFolderCount > 0) { + result.push(item.id) + for (let j = 0; j < item.children.length; j++) { + if (index < 3) { + const childrenItme = item.children[j] + if (item.childrenCount > 0) { + result.push(childrenItme.id) + index += 1 + } + } else { + break + } + } + } else if (item.childrenCount > 0) { + result.push(item.id) + index += 1 + } + } else { + break + } + } + }, + //瀛︿範绗旇 + //鍦ㄧ嚎鎻愰棶 // 鍥句功娣诲姞璐墿杞� async addBookShopcCar() { if (!this.data.expire) { @@ -277,7 +523,6 @@ }, //璐拱鎸夐挳 - async buyBtn() { if (!this.data.expire) { let bookOrdersId = ""; @@ -301,7 +546,6 @@ orderNum: bookOrdersId, }) .then((res) => { - this.digitalTextbooksDetailsGet(this.data.digitalTextId) if (res) { wx.showToast({ title: "棰嗗彇鎴愬姛", @@ -328,15 +572,8 @@ }); } }, - showDialog(e) { - const { - key - } = e.currentTarget.dataset; - this.setData({ - [key]: true, - dialogKey: key - }); - }, + + closeDialog() { const { @@ -346,9 +583,8 @@ [dialogKey]: false }); }, + //鐢宠璇佷功 onCertificate() { - - var page = getCurrentPages().pop(); // 鑾峰彇褰撳墠椤甸潰瀹炰緥 page.setData({ // 鍔ㄦ�佽缃姝㈡粴鍔ㄧ殑鏍峰紡 @@ -370,5 +606,64 @@ dialogBox: false, scrollJudge: true }) - } + }, + setCoolect() { + // 棣栭〉娴嬭瘯鐧诲綍鍔熻兘锛屽悗缁敞閲� + // 妫�鏌ョ櫥褰曠姸鎬� + const token = wx.getStorageSync(app.config.tokenKey) + if (!token) { + loginInfo(app, (data) => { + // 濡傛灉涓嶆槸绗竴娆$櫥褰曪紝浼氭墽琛屽洖璋� + if (data) { + if (this.data.digitalsData.isFavourite) { + app.MG.store + .delProductLink({ + productIds: [this.data.digitalsData.id], + linkType: 'Favoriteclass' + }) + .then(() => { + this.setData({ + "digitalsData.isFavourite": false + }) + }) + } else { + let params = { + productIds: [this.data.digitalsData.id], + linkType: 'Favoriteclass' + } + app.MG.store.addProductLink(params).then((res) => { + this.setData({ + "digitalsData.isFavourite": true + }) + }) + } + } else { + // 鍑虹幇閿欒锛岃繑鍥瀎alse + } + }) + } else { + if (this.data.digitalsData.isFavourite) { + app.MG.store + .delProductLink({ + productIds: [this.data.digitalsData.id], + linkType: 'Favoriteclass' + }) + .then(() => { + this.setData({ + "digitalsData.isFavourite": false + }) + }) + } else { + let params = { + productIds: [this.data.digitalsData.id], + linkType: 'Favoriteclass' + } + app.MG.store.addProductLink(params).then((res) => { + this.setData({ + "digitalsData.isFavourite": true + }) + }) + } + } + }, }) \ No newline at end of file diff --git a/pages/digitalCourses/digitalCoursesDetails/index.json b/pages/digitalCourses/digitalCoursesDetails/index.json index e247451..01f4e3f 100644 --- a/pages/digitalCourses/digitalCoursesDetails/index.json +++ b/pages/digitalCourses/digitalCoursesDetails/index.json @@ -8,6 +8,10 @@ "t-empty": "tdesign-miniprogram/empty/empty", "t-button": "tdesign-miniprogram/button/button", "t-input": "tdesign-miniprogram/input/input", - "t-dialog": "tdesign-miniprogram/dialog/dialog" + "t-dialog": "tdesign-miniprogram/dialog/dialog", + "tree": "/pages/digitalCourses/digitalCoursesDetails/components/tree/index", + "testTree": "/pages/digitalCourses/digitalCoursesDetails/components/testTree/index", + "note": "/pages/digitalCourses/digitalCoursesDetails/components/note/note", + "question": "/pages/digitalCourses/digitalCoursesDetails/components/question/question" } } \ No newline at end of file diff --git a/pages/digitalCourses/digitalCoursesDetails/index.wxml b/pages/digitalCourses/digitalCoursesDetails/index.wxml index cf6b740..8ee6835 100644 --- a/pages/digitalCourses/digitalCoursesDetails/index.wxml +++ b/pages/digitalCourses/digitalCoursesDetails/index.wxml @@ -1,6 +1,6 @@ <import src="index.skeleton.wxml" /> <template is="skeleton" wx:if="{{loading}}" /> -<view wx:else> +<view wx:else class="page-bookService"> <scroll-view scroll-y="{{true}}" class="outsideContentBox"> <view class="digital"> <view class="book-box"> @@ -68,16 +68,16 @@ <view class="course-content"> <view class="lecturer" wx:for="{{lecturerList}}" wx:key="index" wx:for-item="item"> <view class="lecturerImangBox"> - <image src="{{item.icon}}" mode="" /> + <image src="{{item.icon}}" mode="aspectFit" /> </view> <view class="lecturerInformation"> <view class="lecturerName"> <view class="name"> {{item.name}} </view> - <view class="title" style="font-weight: 400; font-size: 25rpx; color: #949494;">{{item.title}}</view> + <view class="title">{{item.title}}</view> </view> - <view class="lecturerContent">{{item.introduce}}</view> + <view class="lecturerContent">{{item.description}}</view> </view> </view> </view> @@ -102,30 +102,89 @@ </t-tab-panel> <t-tab-panel icon="{{ tabValue == '2' ? courseLearningClick : courseLearning}}" label="璇剧▼瀛︿範" value="2"> <view class="course-content"> - + <view class="tabsSelect"> + <view class="{{selectActive == 'learn' ? 'tabs-item selectActive' : 'tabs-item'}}" bind:tap="selectChange" data-value="{{'learn'}}">瀛︿範鍐呭</view> + <view class="{{selectActive == 'test' ? 'tabs-item selectActive' : 'tabs-item'}}" bind:tap="selectChange" data-value="{{'test'}}">鍦ㄧ嚎娴嬭瘯</view> + </view> + <view class="list-box"> + <view wx:if="{{selectActive == 'learn'}}"> + <tree id="test-tree" openIds="{{openTeachids}}" bookInfo="{{digitalsData}}" treeList="{{learnList}}" bind:goTest="goTest"> + </tree> + </view> + <view wx:if="{{selectActive == 'test'}}"> + <testTree id="tree" openIds="{{openTeachids}}" bookInfo="{{digitalsData}}" tab="{{tab}}" treeList="{{testList}}" bind:goTest="goTest"></testTree> + </view> + </view> </view> </t-tab-panel> <t-tab-panel icon="{{ tabValue == '3' ? learningNotesClick : learningNotes}}" label="瀛︿範绗旇" value="3"> <view class="course-content"> - + <note bookInfo="{{digitalsData}}" id="note" class="note-list"></note> + <!-- <view class="topBox"> + <view></view> + <view class="note-btn"> + <t-button theme="primary" class="make-note" bind:tap="openDialog" style="width: 200rpx"> + <view slot="content" class="btn-content"> + <image src="/static/images/bookService/detail/makeNote.png" /> + <text class="note-btn-text">璁扮瑪璁�</text> + </view> + </t-button> + </view> + </view> --> </view> </t-tab-panel> <t-tab-panel icon="{{ tabValue == '4' ? onlineQuestioningClick : onlineQuestioning}}" label="鍦ㄧ嚎鎻愰棶" value="4"> <view class="course-content"> - + <question bookInfo="{{digitalsData}}" id="question" class="note-list"></question> + <!-- <view class="topBox"> + <view>鍏眥{questionTotalCount}}涓�</view> + <view class="note-btn"> + <t-button theme="primary" class="make-note" bind:tap="openDialog" style="width: 240rpx"> + <view slot="content" class="btn-content"> + <image src="/static/images/digitalCourses/bianji.png" /> + <text class="note-btn-text">鎻愰棶</text> + </view> + </t-button> + </view> + </view> + <view class="list-box"> + <view wx:for="{{onlineQuestionsList}}" wx:key="index" wx:for-item="item" class="list-Item"> + <view class="quesTitle"> + <view class="titleLeft"> + <view class="icon"></view> + <text>{{ item.title }}</text> + </view> + <view class="titleRight"> + {{item.createDate}} + </view> + </view> + <view class="noteContent"> + {{ item.back }} + </view> + </view> + </view> --> </view> </t-tab-panel> </t-tabs> </view> <view class="box-bottom"> - <view class="application" bind:tap="onCertificate"> + <view class="bottom-btn" bind:tap="setCoolect"> + <view class="collectionImage"> + <image wx:if="{{!digitalsData.isFavourite}}" src="/static/images/digitalTextbooks/wodeshoucang@2x.png" mode="" /> + <image wx:else src="/static/images/bookService/detail/collecting.png" mode="" /> + </view> + <view class="btn-text"> + 鏀惰棌 + </view> + </view> + <view class="bottom-btn" bind:tap="onCertificate"> <view class="applicationImageBox"> <image src="/static/images/digitalCourses/zhengshushenqing@2x.png" mode="" /> </view> <view>璇佷功鐢宠</view> </view> - <view class="shopCarColor" bind:tap="addBookShopcCar" wx:if="{{!isBuy}}">鍔犲叆璐墿杞�</view> - <view class="buyColor" bind:tap="buyBtn" wx:if="{{!isBuy}}">绔嬪嵆璐拱</view> + <view class="bottom-btn shopCarColor" bind:tap="addBookShopcCar" wx:if="{{!isBuy}}">鍔犲叆璐墿杞�</view> + <view class="bottom-btn buyColor" bind:tap="buyBtn" wx:if="{{!isBuy}}">绔嬪嵆璐拱</view> </view> <t-toast id="t-toast" /> </scroll-view> @@ -140,7 +199,7 @@ <view class="dialog-title">瀛︿範璇佷功鐢宠</view> <view style="width: 100%; height: 2rpx; background-color: #F4F4F4;"></view> <view class="input-box"> - <t-input style="{{inputStyle}}" class="input" placeholder="璇疯緭鍏ョ湡瀹炲鍚�" value="{{input}}" bind:change="inputChange"></t-input> + <t-input class="input" borderless placeholder="璇疯緭鍏ョ湡瀹炲鍚�" value="{{input}}" bind:change="inputChange"></t-input> </view> </view> <view class="row-btn"> diff --git a/pages/digitalCourses/digitalCoursesDetails/index.wxss b/pages/digitalCourses/digitalCoursesDetails/index.wxss index e036714..dcbf52b 100644 --- a/pages/digitalCourses/digitalCoursesDetails/index.wxss +++ b/pages/digitalCourses/digitalCoursesDetails/index.wxss @@ -6,6 +6,17 @@ height: 100%; } +.page-bookService { + width: 100vw; + height: 100%; +} + +.outsideContentBox { + position: relative; + background-color: #F2F3F8; + height: calc(100vh - env(safe-area-inset-bottom) - 60px); +} + .digitalCoursesDetailsTitle { background: #FFFFFF; /* box-shadow: 0rpx 9rpx 18rpx 2rpx rgba(0, 0, 0, 0.08); */ @@ -64,7 +75,6 @@ right: -50rpx; z-index: 0; } - .tabBox { min-height: calc(100% - 800rpx); @@ -132,6 +142,7 @@ width: 140rpx; height: 180rpx; border: 2rpx solid #ccc; + position: relative; } .lecturerInformation { @@ -142,8 +153,17 @@ .lecturerName { display: flex; - justify-content: space-between; + /* justify-content: space-between; */ margin-bottom: 10rpx; +} + +.lecturerName .name { + color: #333; + width: 200rpx; +} + +.lecturerName .title { + color: #949494; } .lecturerContent { @@ -153,12 +173,60 @@ line-height: 35rpx; } -.outsideContentBox { - /* height: calc(100vh - 120rpx); */ - position: relative; - height: calc(100vh - env(safe-area-inset-bottom) - 60px); - background-color: #F2F3F8; +.tabsSelect { + width: 400rpx; + height: 68rpx; + margin: 0 auto; + display: flex; + align-items: center; + border: 2rpx solid #FF6C00; + border-radius: 10rpx; } + +.tabs-item { + height: 68rpx; + line-height: 68rpx; + text-align: center; + + flex: 1; +} + +.selectActive { + color: #fff; + border-radius: 8rpx; + background-color: #FF6C00; +} + +.topBox { + display: flex; + justify-content: space-between; + padding-bottom: 20rpx; + border-bottom: 2rpx solid #EFF0F1; +} + +.note-btn { + display: flex; + --td-button-primary-bg-color: #fff; + --td-button-primary-border-color: #ff6c00; + --td-button-primary-color: #ff6c00; + --td-button-primary-active-bg-color: #fff0e6; +} + +.note-btn image { + width: 28rpx; + height: 32rpx; + margin-right: 10rpx; +} + +.note-btn-text { + font-size: 28rpx; +} + +.btn-content { + display: flex; + align-items: center; +} + .box-bottom { position: fixed; @@ -172,9 +240,28 @@ border: 1px solid #DDD; } +.box-bottom image { + width: 38rpx; + height: 40rpx; +} + +.bottom-btn { + background-color: #fff; + width: 25%; + display: flex; + flex: 1; + align-items: center; + justify-content: center; + flex-direction: column; + box-sizing: border-box; +} + +.bottom-btn:nth-child(1), +.bottom-btn:nth-child(2) { + border-right: 1px solid #DDD; +} + .shopCarColor { - width: 200rpx; - height: 110rpx; border-right: 1px solid #DDD; color: #fff; background-color: #f0ad36; @@ -184,8 +271,6 @@ } .buyColor { - width: 200rpx; - height: 110rpx; border-right: 1px solid #DDD; color: #fff; background-color: #f04d3b; @@ -194,25 +279,6 @@ align-items: center; } -.application { - width: 351rpx; - /* height: 100rpx; */ - background: #FFF; - display: flex; - flex-direction: column; - justify-content: center; - align-items: center; - border-top: 2rpx solid #eee; - font-weight: 400; - font-size: 22rpx; - color: #010101; -} - -.applicationImageBox { - width: 35rpx; - height: 35rpx; - margin-bottom: 5rpx; -} .certificateChart { @@ -227,17 +293,6 @@ height: 325rpx; border: 1rpx solid #ccc; margin-right: 50rpx; -} - -.custom-panel { - /* min-height: 400px; */ -} - - - - -.wrapper { - margin-bottom: 32rpx; } .placeholder { @@ -327,16 +382,28 @@ color: white; } -.input { - --td-input-border-radius: 20rpx; - border-radius: 20rpx; - border: 2rpx solid #ccc; -} - .t-input { background-color: var(--td-input-bg-color, var(--td-bg-color-container, var(--td-font-white-1, #ffffff))); display: flex; align-items: center; flex: 1; - padding: var(--td-input-vertical-padding, 22rpx) !important; + padding: var(--td-input-vertical-padding, 10rpx) !important; +} + +.t-input__content, +.t-textarea { + border: 2rpx solid #D9D9D9 !important; + border-radius: 15rpx; + padding: 10rpx !important; +} + +.t-input__tips, +.from-item .label .icon { + color: #f56c6c !important; + margin-right: 5rpx; +} + +.t-input__placeholder, +.t-textarea__placeholder { + font-size: 28rpx !important; } \ No newline at end of file diff --git a/pages/digitalCourses/index.js b/pages/digitalCourses/index.js index 45505fc..0f69f19 100644 --- a/pages/digitalCourses/index.js +++ b/pages/digitalCourses/index.js @@ -128,8 +128,6 @@ loading: false }) this.getCourseList(newData[0]) - - }) }, diff --git a/pages/digitalTextbooks/digitalTextbooksDetails/index.js b/pages/digitalTextbooks/digitalTextbooksDetails/index.js index 68b6c40..30c7c1a 100644 --- a/pages/digitalTextbooks/digitalTextbooksDetails/index.js +++ b/pages/digitalTextbooks/digitalTextbooksDetails/index.js @@ -576,7 +576,7 @@ app.MG.store .delProductLink({ productIds: [this.data.digitalsData.id], - linkType: 'FavoriteBookCity' + linkType: 'FavoriteTextBooks' }) .then(() => { this.setData({ @@ -586,7 +586,7 @@ } else { let params = { productIds: [this.data.digitalsData.id], - linkType: 'FavoriteBookCity' + linkType: 'FavoriteTextBooks' } app.MG.store.addProductLink(params).then((res) => { this.setData({ @@ -603,7 +603,7 @@ app.MG.store .delProductLink({ productIds: [this.data.digitalsData.id], - linkType: 'FavoriteBookCity' + linkType: 'FavoriteTextBooks' }) .then(() => { this.setData({ @@ -613,7 +613,7 @@ } else { let params = { productIds: [this.data.digitalsData.id], - linkType: 'FavoriteBookCity' + linkType: 'FavoriteTextBooks' } app.MG.store.addProductLink(params).then((res) => { this.setData({ diff --git a/pages/digitalTextbooks/digitalTextbooksDetails/index.wxss b/pages/digitalTextbooks/digitalTextbooksDetails/index.wxss index 730ec39..04b3086 100644 --- a/pages/digitalTextbooks/digitalTextbooksDetails/index.wxss +++ b/pages/digitalTextbooks/digitalTextbooksDetails/index.wxss @@ -196,7 +196,6 @@ .page-bookService { width: 100vw; height: 100%; - /* position: relative; */ } .box-bottom { diff --git a/pages/digitalTextbooks/index.wxml b/pages/digitalTextbooks/index.wxml index 353200c..cef28e2 100644 --- a/pages/digitalTextbooks/index.wxml +++ b/pages/digitalTextbooks/index.wxml @@ -1,11 +1,7 @@ <!--pages/digitalTextbooks/digitalTextbooks.wxml--> <import src="index.skeleton.wxml" /> <template is="skeleton" wx:if="{{loading}}" /> - - <view wx:if="{{!loading}}"> - - <view style="width: 100%; height: {{barHeight}}px;"></view> <view class="nacigationBar" style="width: 70%; height: {{navBarHeight}}px;"> <view> @@ -13,9 +9,6 @@ </view> <t-search model:value="{{searchValue}}" shape="round" placeholder="璇疯緭鍏ュ叧閿瘝/涔﹀悕/ISBN/浣滆��" class="navBar-search" style="width: 464rpx" bind:submit="searchBook" /> </view> - - - <t-tabs defaultValue="{{0}}" bind:change="selectTab" t-class="custom-tabs" t-class-content="custom-panel"> <t-tab-panel wx:for="{{tabList}}" wx:key="index" wx:for-item="item" wx:for-index="index" label="{{item.name}}" value="{{index}}" style="{{tabPanelstyle}}"> diff --git a/pages/index/resourceCover.js b/pages/index/resourceCover.js index 79f79e8..22d3fb3 100644 --- a/pages/index/resourceCover.js +++ b/pages/index/resourceCover.js @@ -79,7 +79,7 @@ book.learnSelectType == "audio" ) { url = "/packageDomain/pages/resourceDetails/myAudio/index"; - } else if (book.selectType == "picture" || book.selectType == "zip") { + } else if (book.selectType == "picture") { url = "/packageDomain/pages/resourceDetails/document/index"; } this.setData({ @@ -91,22 +91,21 @@ formPath: book.learnSelectType ? 'jsek_cloudLearning' : '' }) wx.redirectTo({ - url: `${url}?productLinkPath=${this.data.productLinkPath}&parentProductLinkPath=${this.data.parentProductLinkPath}&bookId=${book.productLinkInfo.ProductId}&bookName=${book.productLinkInfo.Name}&cmsId=${book.id}&storeInfo=${book.storeInfo}&formPath=${this.data.formPath}`, + url: `${url}?productLinkPath=${this.data.productLinkPath}&parentProductLinkPath=${this.data.parentProductLinkPath}&bookId=${book.productLinkInfo.ProductId}&activeId=${book.id}&bookName=${book.productLinkInfo.Name}&cmsId=${book.id}&storeInfo=${book.storeInfo}&formPath=${this.data.formPath}`, }); - if (book.selectType == "pdf") { + if (book.selectType == "pdf" || book.selectType == 'document') { const fileLink = book.file ? book.file : book.freeFile console.log(fileLink); - wx.navigateTo({ + wx.redirectTo({ url: "/packageBookService/pages/components/webView/index?md5=" + fileLink + "&fileName=" + book.name + - "&fileType=" + - book.selectType + "&bookBuy=true" + "&fileType=pdf" + "&bookBuy=true" }); } - if (book.selectType == 'document') { + if (book.selectType == 'zip') { const fileLink = book.file ? app.config.requestCtx + "/file/api/ApiDownload?md5=" + book.file : app.config.requestCtx + @@ -121,24 +120,9 @@ success: function (res) { console.log(res, "wx.downloadFile success res"); if (res.statusCode != 200) { - util.hideLoadingWithErrorTips(); return false; } - var Path = res.tempFilePath; //杩斿洖鐨勬枃浠朵复鏃跺湴鍧�锛岀敤浜庡悗闈㈡墦寮�鏈湴棰勮鎵�鐢� - let data = res.filePath; - wx.openDocument({ - filePath: data, - showMenu: true, - success: function (res) { - console.log("鎵撳紑鎴愬姛"); - util.hideLoading(); - }, - }); - }, - fail: function (err) { - console.log(err, "wx.downloadFile fail err"); - util.hideLoadingWithErrorTips(); - }, + } }); } }) diff --git a/services/home/home.js b/services/home/home.js index e3f82b7..54faf19 100644 --- a/services/home/home.js +++ b/services/home/home.js @@ -35,8 +35,8 @@ text: '涓撻璁ㄨ', key: 4, icon: '/static/images/home/zhuantitaolun@2x.png', - // url: '/pages/specialDiscussion/index', - url: '' + url: '/pages/specialDiscussion/index', + // url: '' }, { text: '绾夸笂涔﹀睍', diff --git a/static/images/digitalCourses/bianji.png b/static/images/digitalCourses/bianji.png new file mode 100644 index 0000000..c8dc0b8 --- /dev/null +++ b/static/images/digitalCourses/bianji.png Binary files differ -- Gitblit v1.9.1