<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, //书籍文件夹ID获取文件夹中资源
|
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, //书籍文件夹ID获取文件夹中资源
|
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>
|