|
|
@ -21,7 +21,7 @@ export const bookListCrud = { |
|
|
|
methods: { |
|
|
|
// 获取热门/新书图书list
|
|
|
|
getBookData() { |
|
|
|
const linkSrc = process.env.NODE_ENV === 'production' ? window.g.ApiUrl : process.env.VUE_APP_BASE_API |
|
|
|
// const linkSrc = process.env.NODE_ENV === 'production' ? window.g.ApiUrl : process.env.VUE_APP_BASE_API
|
|
|
|
this.bookLoading = true |
|
|
|
const bookType = this.$route.query.bookType |
|
|
|
const params = { |
|
|
@ -32,35 +32,35 @@ export const bookListCrud = { |
|
|
|
if (bookType === 'hot') { |
|
|
|
FetchHotBookRecommend(params).then(res => { |
|
|
|
this.pageCount = res.page.totalPages |
|
|
|
// res.hotbookList.forEach(item => {
|
|
|
|
// this.getCoverByISBN(item.isbn.replace(/\-/g, ''), item)
|
|
|
|
// })
|
|
|
|
this.bookData = res.hotbookList.map((item, index) => { |
|
|
|
if (item.nbImgPath) { |
|
|
|
item.cover = linkSrc + '/downloadFile' + item.nbImgPath |
|
|
|
} else { |
|
|
|
item.cover = null |
|
|
|
} |
|
|
|
return item |
|
|
|
res.hotbookList.forEach(item => { |
|
|
|
this.getCoverByISBN(item.isbn.replace(/\-/g, ''), item) |
|
|
|
}) |
|
|
|
// this.bookData = res.hotbookList.map((item, index) => {
|
|
|
|
// if (item.nbImgPath) {
|
|
|
|
// item.cover = linkSrc + '/downloadFile' + item.nbImgPath
|
|
|
|
// } else {
|
|
|
|
// item.cover = null
|
|
|
|
// }
|
|
|
|
// return item
|
|
|
|
// })
|
|
|
|
this.bookLoading = false |
|
|
|
}).catch(() => { |
|
|
|
this.$message.error('接口错误') |
|
|
|
}) |
|
|
|
} else { |
|
|
|
FetchNewBookRecommend(params).then(res => { |
|
|
|
this.bookData = res.newbookList.map((item, index) => { |
|
|
|
if (item.nbImgPath) { |
|
|
|
item.cover = linkSrc + '/downloadFile' + item.nbImgPath |
|
|
|
} else { |
|
|
|
item.cover = null |
|
|
|
} |
|
|
|
return item |
|
|
|
}) |
|
|
|
this.bookLoading = false |
|
|
|
// res.newbookList.forEach(item => {
|
|
|
|
// this.getCoverByISBN(item.isbn.replace(/\-/g, ''), item)
|
|
|
|
// this.bookData = res.newbookList.map((item, index) => {
|
|
|
|
// if (item.nbImgPath) {
|
|
|
|
// item.cover = linkSrc + '/downloadFile' + item.nbImgPath
|
|
|
|
// } else {
|
|
|
|
// item.cover = null
|
|
|
|
// }
|
|
|
|
// return item
|
|
|
|
// })
|
|
|
|
this.bookLoading = false |
|
|
|
res.newbookList.forEach(item => { |
|
|
|
this.getCoverByISBN(item.isbn.replace(/\-/g, ''), item) |
|
|
|
}) |
|
|
|
}).catch(() => { |
|
|
|
this.$message.error('接口错误') |
|
|
|
}) |
|
|
@ -101,21 +101,21 @@ export const bookListCrud = { |
|
|
|
}, |
|
|
|
// 点击查看详情
|
|
|
|
handleDetails(index) { |
|
|
|
const linkSrc = process.env.NODE_ENV === 'production' ? window.g.ApiUrl : process.env.VUE_APP_BASE_API |
|
|
|
// const linkSrc = process.env.NODE_ENV === 'production' ? window.g.ApiUrl : process.env.VUE_APP_BASE_API
|
|
|
|
const params = { |
|
|
|
isbn: this.bookData[index].isbn.replace(/\-/g, '') |
|
|
|
} |
|
|
|
getBookDetailsByISBN(params).then(res => { |
|
|
|
if (res) { |
|
|
|
// this.$refs.detailDom.bookData = res
|
|
|
|
console.log('res', res) |
|
|
|
Object.keys(res).forEach(key => { |
|
|
|
if (key === 'srcUrl' && res[key]) { |
|
|
|
res[key] = linkSrc + '/downloadFile' + res[key] |
|
|
|
} |
|
|
|
}) |
|
|
|
this.$refs.detailDom.bookData = res |
|
|
|
console.log('ddd', this.$refs.detailDom.bookData) |
|
|
|
// console.log('res', res)
|
|
|
|
// Object.keys(res).forEach(key => {
|
|
|
|
// if (key === 'srcUrl' && res[key]) {
|
|
|
|
// res[key] = linkSrc + '/downloadFile' + res[key]
|
|
|
|
// }
|
|
|
|
// })
|
|
|
|
// this.$refs.detailDom.bookData = res
|
|
|
|
// console.log('ddd', this.$refs.detailDom.bookData)
|
|
|
|
this.$refs.detailDom.dialogVisible = true |
|
|
|
} else { |
|
|
|
this.$message.error('暂无图书内容~') |
|
|
|