From 4ff508548b71346c97ef563b3dd5ba9291afe342 Mon Sep 17 00:00:00 2001 From: 闫增涛 <1829501689@qq.com> Date: 星期五, 12 七月 2024 17:37:02 +0800 Subject: [PATCH] 教学资源接口去掉childcount参数 --- packageBookService/pages/bookServices/detail/index.js | 17 +--- assets/js/middleGround/api/store.js | 189 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 194 insertions(+), 12 deletions(-) diff --git a/assets/js/middleGround/api/store.js b/assets/js/middleGround/api/store.js index f4ec27c..d842309 100644 --- a/assets/js/middleGround/api/store.js +++ b/assets/js/middleGround/api/store.js @@ -333,7 +333,196 @@ } }) }, + // 鑾峰彇鍟嗗搧璇︽儏(鏃� ChildrenCount ChildrenFolderCount ) 姝ゆ帴鍙d负婊¤冻涓婅堪瑕佹眰娣诲姞锛屼笉鏄腑鍙板師鏈� + getProductDetailNoChildren: ({ + path = '', + storeInfo = goodsStore, + channelInfo = '', + favoriteTypes = '', + queryType, + subAccess = [], + fields, + productId, + cmsPath, + cmsType, + coverSize, + itemId, + itemIds, + itemFields, + linkTypes, + filterList, + handelEBooK, + sort, + cmsSort, + source + }) => { + const subQuery = {} + if (cmsPath) { + subQuery['QueryCms'] = { + Path: cmsPath + '', + Type: cmsType || '\\', + Name: [], + Icon: [], + TypeId: [], + RefCode: [], + Description: [], + // ChildrenCount: [], + // ChildrenFolderCount: [], + CreateDate: [], + SysType: [], + SaleMethod: [], + PageQuery: { + Start: 0, + Size: 9999 + }, + SortQuery: cmsSort ? [cmsSort] : [{ + ProductLinkOrder: 'Asc' + }], + ProductLinkInfo: [], + ...itemFields + } + if (itemId) subQuery['QueryCms']['Id='] = [`${itemId}`] + if (itemIds) subQuery['QueryCms']['Id='] = itemIds + } else { + subQuery['QueryCms'] = { + Path: '*', + Type: '\\', + Name: [], + Icon: [], + TypeId: [], + RefCode: [], + Description: [], + ChildrenCount: [], + ChildrenFolderCount: [], + CreateDate: [], + SysType: [], + SaleMethod: [], + PageQuery: { + Start: 0, + Size: 9999 + }, + ProductLinkInfo: [] + } + } + // 鑾峰彇鍏宠仈璧勬簮 + let linkFields = {} + if (linkTypes && linkTypes.length) { + for (let i = 0; i < linkTypes.length; i++) { + const linkType = linkTypes[i] + subQuery['QueryLink_' + linkType.linkType] = { + Path: cmsPath + '', + Type: '\\', + Name: [], + Icon: [], + TypeId: [], + RefCode: [], + Description: [], + LinkTypes: [linkType.linkType], + PageQuery: { + Start: 0, + Size: 100 + }, + ProductLinkInfo: [], + ...linkType.fields + } + linkFields = { + ...linkFields, + ...linkType.fields + } + } + } + const query = { + AccessControl: { + Path: path, + StoreRefCode: storeInfo + '', + ChannelRefCode: channelInfo + '', + Type: queryType || '\\' + }, + FavoriteTypes: favoriteTypes ? [favoriteTypes] : [], + SubAccess: subAccess.length > 0 ? subAccess : [], + PageQuery: { + Start: '0', + Size: '1' + }, + 'Id=': [`${productId}`], + SortQuery: sort ? [sort] : [{ + LinkOrder: 'Desc' + }], + CreateDate: [], + Description: [], + Name: [], + Icon: [], + RefCode: [], + Description: [], + TypeId: [], + SysType: [], + State: [], + Tag: [], + BeginDate: [], + EndDate: [], + ProductLinkInfo: [], + AllowDonate: [], + DonatePriceList: [], + StoreEvent: [], + SaleMethod: [], + SaleMethodValid: [], + CmsItemValid: [], + ProductCmsQuery: [subQuery], + ...fields, + ...filterList + } + if (productId) query['Id='] = [`${productId}`] + const body = { + query: JSON.stringify({ + Query: [{ + Q1: query + }] + }) + } + + let token = wx.getStorageSync(tokenKey) ? wx.getStorageSync(tokenKey) : ''; + let url = token ? '/store/api/ApiQueryProductByAppUser' : '/store/api/ApiQueryProduct' + return request({ + url: url, + method: 'post', + data: body, + cancelToken: source?.token + }) + .then((resp) => { + if (resp.length > 0) { + const data = resp[0] + if (data.datas.length) { + + data.datas[0].subDatas = data.datas[0].cmsDatas + const datas = handleDetailQueryRequestData({ + item: data.datas[0], + fields, + itemFields: { + ...itemFields, + ...linkFields + }, + path, + coverSize, + handelEBooK + }) + return { + datas, + total: data.totalCount + } + } else { + return { + datas: [], + total: 0 + } + } + } + return { + datas: [], + total: 0 + } + }) + }, // 鑾峰彇浼樻儬鍒稿垪琛� getChannelPromoteCodeList(data) { return request({ diff --git a/packageBookService/pages/bookServices/detail/index.js b/packageBookService/pages/bookServices/detail/index.js index 9be7119..0253763 100644 --- a/packageBookService/pages/bookServices/detail/index.js +++ b/packageBookService/pages/bookServices/detail/index.js @@ -190,7 +190,7 @@ // this.getResourceClass(); // 鑾峰彇璧勬簮鎵�灞炲垎绫� const token = wx.getStorageSync(app.config.tokenKey); if (token) { - + this.getShoppingCartProductGet(); this.getApplyInfo(options.id); this.getAlreadyPBookList(); this.getAlreadyEBookList(); @@ -386,9 +386,6 @@ }; app.MG.store.getProductDetail(query).then(async (res) => { console.log(res.datas, 'res.datas'); - wx.setNavigationBarTitle({ - title: res.datas.name, - }) this.setData({ bookDetail: res.datas, buyIdList: res.datas.purchasedSaleMethodIdList, @@ -575,9 +572,6 @@ expire: false, }); } - } - if (!this.data.buy && this.data.bookDetail.isSell == '1') { - this.getShoppingCartProductGet(); } }); }, @@ -899,14 +893,13 @@ size: 999 }, } - app.MG.store.getProductDetail(query).then((res) => { + app.MG.store.getProductDetailNoChildren(query).then((res) => { if (!res.datas.cmsDatas[0].datas.length) { return this.setData({ noResources: true, loading: false, }); } - console.log(res.datas.cmsDatas[0].datas, "璧勬簮") let list = [] // 娴嬭瘯 6浣�// 姝e紡 5浣�// 娴嬭瘯璋冪敤浼�20锛屽唴閮�7 姝e紡璋冪敤浼�17 鍐呴儴浼�6 //鏁欏璧勬簮 浜戝涔� @@ -944,7 +937,7 @@ }) } } - const addNum = query.cmsPath.length > 11 ? 7 : query.cmsPath.length > 13 ? 8 : 6 + const addNum = query.cmsPath.length > 12 ? 7 : query.cmsPath.length > 14 ? 8 : 6 const num = query.cmsPath.length + addNum this.getTreeList(res.datas.cmsDatas[0].datas, num, list, '\\', addNum) list = this.ensureTreeConsistency(list) @@ -1035,7 +1028,7 @@ if (data.length > 0) { let list = [] // 娴嬭瘯 6浣�// 姝e紡 5浣�// 娴嬭瘯璋冪敤浼�20锛屽唴閮�7 姝e紡璋冪敤浼�17 鍐呴儴浼�6 - const addNum = query.cmsPath.length > 11 ? 7 : query.cmsPath.length > 13 ? 8 : 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) @@ -1150,7 +1143,7 @@ for (let i = 0; i < data.length; i++) { if (index < 3) { const item = data[i] - if (item.childrenFolderCount > 0) { + if (item.children && item.children.length > 0) { result.push(item.id) if (item.children) { for (let j = 0; j < item.children.length; j++) { -- Gitblit v1.9.1