From bd459420ad636263be458374319c20d3eeb6f61a Mon Sep 17 00:00:00 2001 From: litian <C21AF165> Date: 星期四, 19 九月 2024 21:09:04 +0800 Subject: [PATCH] detail --- packageBookService/pages/bookServices/detail/components/learnTask/index.js | 114 +++++++++++++++++++++++++++++---------------------------- 1 files changed, 58 insertions(+), 56 deletions(-) diff --git a/packageBookService/pages/bookServices/detail/components/learnTask/index.js b/packageBookService/pages/bookServices/detail/components/learnTask/index.js index 37f6086..71b76f3 100644 --- a/packageBookService/pages/bookServices/detail/components/learnTask/index.js +++ b/packageBookService/pages/bookServices/detail/components/learnTask/index.js @@ -7,6 +7,7 @@ data: { height: '', //灞忓箷楂樺害 bookId: '', + cmsPath: '', consumer: '', bookInfo: {}, menuList: [], @@ -48,9 +49,9 @@ */ onLoad(options) { if (options) { - console.log(options, 666) this.setData({ bookId: options.bookId, + cmsPath: options.cmsPath, taskId: options.bookId, consumer: options.consumer, userId: options.userId, @@ -58,6 +59,7 @@ }); if (options.consumer) { this.setData({ + cmsPath: options.cmsPath, bookId: options.bookId, taskId: options.bookId, consumer: options.consumer, @@ -83,7 +85,7 @@ path: '*', queryType: '*', productId: this.data.bookId, - cmsPath: 'jsek_learningTasks', + cmsPath: this.data.cmsPath, // cmsType: '*', itemFields: { SysType: 'CmsFolder' @@ -99,60 +101,69 @@ }); if (res.datas.cmsDatas[0].datas) { let list = res.datas.cmsDatas[0].datas + let dataList = [] + list.forEach((item) => { + if (item.childrenFolderCount > 0) { + let query = { + path: '*', + queryType: '*', + productId: this.data.bookId, + cmsPath: item.productLinkPath, + // cmsType: '*', + itemFields: { + SysType: 'CmsFolder' + }, + pading: { + start: 0, + size: 99 + } + } + app.MG.store.getProductDetail(query).then((res) => { + item.children = res.datas.cmsDatas[0].datas + }) + } + dataList.push(item) + }) this.setData({ - menuList: list, + menuList: dataList, + loading: false, }); if (this.data.taskId) { - this.data.menuList.forEach((item) => { - if (item.id == this.data.taskId) { + setTimeout(() => { + this.data.menuList.forEach((item) => { + if (item.id == this.data.taskId) { + this.setData({ + taskInfo: item, + }); + } else if (item.children) { + item.children.forEach((item1) => { + if (item1.id == this.data.taskId) { + this.setData({ + taskInfo: item1, + }); + } + }) + } + }) + }, 500) + } else { + setTimeout(() => { + if (this.data.menuList[0].children) { this.setData({ - taskInfo: item, + taskInfo: this.data.menuList[0].children[0], + }); + } else { + this.setData({ + taskInfo: this.data.menuList[0], }); } - }) - } else { - this.setData({ - taskInfo: this.data.menuList[0], - }); + }, 500) } } this.getTasksList() }) }, - getTask(e) { - console.log(e, 123) - let data = e.currentTarget.dataset.item - if (data.childrenFolderCount > 0) { - let query = { - path: '*', - queryType: '*', - productId: this.data.bookId, - cmsPath: data.productLinkPath, - // cmsType: '*', - itemFields: { - SysType: 'CmsFolder' - }, - pading: { - start: 0, - size: 99 - } - } - app.MG.store.getProductDetail(query).then((res1) => { - this.data.menuList.forEach((item) => { - if (item.id == data.id) { - item.children = res1.datas.cmsDatas[0].datas - } - }) - }) - } else { - this.setData({ - taskShow: true, - }); - } - this.taskSelect(data) - - }, onVisibleChange(e) { this.setData({ taskShow: e.detail.visible, @@ -180,7 +191,9 @@ this.setData({ tasksListData: res.datas, }); - this.taskSelect(this.data.taskInfo) + if (this.data.taskInfo) { + this.taskSelect(this.data.taskInfo) + } }) }, taskSelect(item) { @@ -192,12 +205,6 @@ if (this.data.tasksListData.length > 0) { this.data.tasksListData.forEach((item1) => { let content = JSON.parse(item1.content) - this.setData({ - name: content.userName, - school: content.school, - class: content.class, - learnTime: content.learnTime, - }); if (content.id == this.data.taskInfo.id) { if (content.userId == this.data.userId) { this.setData({ @@ -315,13 +322,11 @@ //浠诲姟濉啓 //鍙嶆�� onIntrospectionInput(e) { - console.log(e) let index = e.target.dataset.index let data = 'dataList[' + index + '].introspection' this.setData({ [data]: e.detail.value }); - console.log(this.data.dataList) }, //瀹屾垚鎯呭喌 onCompletionInput(e) { @@ -338,7 +343,6 @@ this.setData({ [data]: e.detail.value }); - console.log(this.data.dataList) }, //鍚屼即璇勪环 onMateInput(e) { @@ -461,7 +465,6 @@ }) }, onInviteeChange(e) { - console.log(e) this.setData({ invitee: e.detail.value }); @@ -478,7 +481,6 @@ wx.showShareMenu({ withShareTicket: true }); - console.log(888) }, submitComment() { let mateEvaluationList = [] -- Gitblit v1.9.1