From ef37c59e055a990ce247b265b27d3fcef430a243 Mon Sep 17 00:00:00 2001 From: 杨磊 <505174330@qq.com> Date: 星期五, 15 八月 2025 10:19:18 +0800 Subject: [PATCH] first submit --- src/views/bookStore/detail.vue | 215 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 215 insertions(+), 0 deletions(-) diff --git a/src/views/bookStore/detail.vue b/src/views/bookStore/detail.vue new file mode 100644 index 0000000..bdddfb2 --- /dev/null +++ b/src/views/bookStore/detail.vue @@ -0,0 +1,215 @@ +<template> + <div style="background-color: #fff;" ref="contentData"> + <detailInfo :bookInfo="bookInfo" v-loading="loading"></detailInfo> + <div class="contentBox" style="display: flex;"> + <div> + <bookInfo :bookInfo="bookInfo" v-loading="loading" /> + <resource + :bookInfo="bookInfo" + :resourceSupportList="resourceSupportList" + :allResource="allResource" + v-loading="resourceLoading" + /> + </div> + <div> + <relatedRecommendation + :bookInfo="bookInfo" + :recommendKey="recommendKey" + @reloadPage="reloadPage" + ref="rela" + /> + <!-- <history @reloadPage="reloadPage" /> --> + </div> + </div> + </div> +</template> + +<script> +import config from "@/assets/js/config"; + +import detailInfo from "@/components/detail/detailInfo.vue"; +import relatedRecommendation from "@/components/detail/relatedRecommendation.vue"; +import bookInfo from "@/components/detail/bookInfo.vue"; +import resource from "@/components/detail/resource.vue"; +import history from "@/components/detail/history.vue"; +export default { + components: { + detailInfo, + relatedRecommendation, + bookInfo, + resource, + // history, + }, + created() { + if (this.$route.query.id && this.$route.query.cmsPath) { + this.currentId = this.$route.query.id; + this.currentCmsId = this.$route.query.cmsPath; + this.getData(); + } + window.scrollTo(0, 0); + this.getData(); + }, + data() { + return { + bookInfo: {}, + resourceSupportList: [], + allResource: [], + loading: true, + resourceLoading: true, + recommendKey: "", + }; + }, + methods: { + getData(data) { + this.loading = true; + let query = { + path: "*", + queryType: "*", + productId: data ? data.id : this.$route.query.id, + cmsPath: data ? data.rootCmsItemId : this.$route.query.cmsPath, //鑾峰彇涔︾睄鏂囦欢澶� + fields: { + caupress_author: [], + caupress_content: [], + caupress_seriesName: [], + caupress_publicationDate: [], + caupress_ISBN: [], + caupress_pubNumber: [], + caupress_authorAbout: [], + caupress_recommendationReason: [], + caupress_preface: [], + caupress_catalog: [], + caupress_pdfFreeFile: [], + caupress_paperBookJD: [], + caupress_paperBookDD: [], + caupress_catalogue: [], + caupress_projectTitle: [], + caupress_pdfFile: [], + caupress_contactEditor: [], + caupress_paperBookTmall: [], + caupress_isSell: [], + }, + linkTypes: [ + // 鑾峰彇鍏宠仈鐨勭紪杈戜俊鎭� + { + linkType: "caupress_editor", + fields: { + telephone: [], + phone: [], + qq: [], + }, + }, + ], + }; + // 鑾峰彇涔︾睄璇︽儏浠ュ強涔︾睄璧勬簮鏂囦欢澶� + this.MG.store.getProductDetail(query).then((res) => { + console.log(res, "res"); + this.bookInfo = res.datas; + if (this.bookInfo.caupress_catalogue) { + this.bookInfo.caupress_catalogue = JSON.parse( + this.bookInfo.caupress_catalogue + ); + // 鑾峰彇灞傛杩涜鐩稿叧鎺ㄨ崘 + + this.recommendKey = this.bookInfo.caupress_catalogue[0]; + console.log(this.recommendKey, "this.recommendKey"); + if (this.recommendKey.length > 0) { + this.catalogue = []; + this.recommendKey.forEach((item, index) => { + if (index == 0) { + this.catalogue.push(item); + } else { + this.catalogue.push("&" + item); + } + }); + } + this.$refs.rela.getData(this.catalogue); + } else { + this.recommendKey = "null"; + } + // 鑾峰彇鍏宠仈鐨勭紪杈戜俊鎭� + let query = this.bookInfo.cmsDatas.find( + (item) => item.queryTag == "QueryLink_" + "caupress_editor" + ); + if (query && query.datas.length) { + this.bookInfo.caupress_editor = { + name: query.datas[0].name, + telephone: query.datas[0].telephone, + phone: query.datas[0].phone, + qq: query.datas[0].qq, + }; + } + if (this.bookInfo.caupress_projectTitle) { + this.bookInfo.caupress_projectTitle = JSON.parse( + this.bookInfo.caupress_projectTitle + ); + } + if (this.bookInfo.caupress_projectTitle instanceof Array) { + if (this.bookInfo.caupress_projectTitle.length > 1) { + this.bookInfo.caupress_projectTitle = + this.bookInfo.caupress_projectTitle.join("銆�"); + } else { + this.bookInfo.caupress_projectTitle = + this.bookInfo.caupress_projectTitle[0]; + } + } + this.bookInfo.VirtualPrice = this.bookInfo.saleMethod[0]?.VirtualPrice; + this.bookInfo.caupress_seriesName = + config.seriesList[this.bookInfo.caupress_seriesName]; + if (this.bookInfo.caupress_pubNumber) { + this.bookInfo.caupress_pubNumber = + this.bookInfo.caupress_pubNumber.split("_")[1]; + } + this.loading = false; + this.$store.commit("setHistoryBook", this.bookInfo); + let folderList = res.datas.cmsDatas[0].datas; + folderList.forEach((item) => { + if (item.name == "閰嶅璧勬簮") { + this.MG.store + .getProductDetail({ + path: "*", + cmsPath: res.datas.rootCmsItemId + "\\" + item.id, //涔︾睄鏂囦欢澶笽D鑾峰彇鏂囦欢澶逛腑璧勬簮 + productId: this.currentId, + queryType: "*", + itemFields: { + caupress_fileType: [], + caupress_file: [], + caupress_allowDownload: [], + }, + }) + .then((dataRes) => { + console.log(dataRes, "resourceSupportList"); + this.resourceSupportList = dataRes.datas.cmsDatas[0].datas; + }); + } else { + this.MG.store + .getProductDetail({ + path: "*", + cmsPath: res.datas.rootCmsItemId + "\\" + item.id, //涔︾睄鏂囦欢澶笽D鑾峰彇鏂囦欢澶逛腑璧勬簮 + productId: this.currentId, + queryType: "*", + itemFields: { + caupress_fileType: [], + caupress_file: [], + caupress_allowDownload: [], + }, + }) + .then((dataRes) => { + console.log(dataRes, "allResource"); + this.allResource = dataRes.datas.cmsDatas[0].datas; + }); + } + }); + // 鑾峰彇鑱旂郴缂栬緫淇℃伅 + + this.resourceLoading = false; + }); + }, + reloadPage(data) { + this.getData(data); + window.scrollTo(0, 0); + }, + }, +}; +</script> + +<style></style> -- Gitblit v1.9.1