diff --git a/src/assets/images/default-img.png b/src/assets/images/default-img.png index 8952025..65fa757 100644 Binary files a/src/assets/images/default-img.png and b/src/assets/images/default-img.png differ diff --git a/src/assets/images/default-img2.png b/src/assets/images/default-img2.png new file mode 100644 index 0000000..8952025 Binary files /dev/null and b/src/assets/images/default-img2.png differ diff --git a/src/views/bookRackList.vue b/src/views/bookRackList.vue index f2c8ab6..a809302 100644 --- a/src/views/bookRackList.vue +++ b/src/views/bookRackList.vue @@ -86,22 +86,22 @@ export default { }, 50) }, handleDetails(itemData) { - 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: itemData.isbn.replace(/\-/g, '') } getBookDetailsByISBN(params).then(res => { this.$refs.detailDom.dialogVisible = true 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) } else { this.$refs.detailDom.bookData = { srcUrl: itemData.bookAuthor, diff --git a/src/views/index.vue b/src/views/index.vue index 5f992f9..3ddf91c 100644 --- a/src/views/index.vue +++ b/src/views/index.vue @@ -110,26 +110,26 @@ export default { }, // 首页 - 新书推荐 getNewBookList() { - 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 = { libcode: this.libcode, pageNo: 1, pageSize: 4 } FetchNewBookRecommend(params).then(res => { - // let data = [] - // data = res.newbookList - // data.forEach(item => { - // this.getCoverByISBN(item.isbn.replace(/\-/g, ''), item) - // }) - this.newList = res.newbookList.map((item, index) => { - if (item.nbImgPath) { - item.cover = linkSrc + '/downloadFile' + item.nbImgPath - } else { - item.cover = null - } - return item + let data = [] + data = res.newbookList + data.forEach(item => { + this.getCoverByISBN(item.isbn.replace(/\-/g, ''), item) }) + // this.newList = res.newbookList.map((item, index) => { + // if (item.nbImgPath) { + // item.cover = linkSrc + '/downloadFile' + item.nbImgPath + // } else { + // item.cover = null + // } + // return item + // }) }).catch(() => { this.$message.error('接口错误') }) @@ -173,9 +173,9 @@ export default { // 处理数据格式 initBookData(bookList) { return bookList.map(async(item, 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 newItem = { - cover: linkSrc + '/downloadFile' + item.srcUrl, + cover: item.srcUrl, ranking: item.bookUID, nbName: item.bookName, isOtherBook: index !== 0, diff --git a/src/views/mixins/booklist.js b/src/views/mixins/booklist.js index 73ecbe7..0bf353c 100644 --- a/src/views/mixins/booklist.js +++ b/src/views/mixins/booklist.js @@ -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('暂无图书内容~') diff --git a/src/views/module/homeListItem.vue b/src/views/module/homeListItem.vue index 9eb83ce..93f3b55 100644 --- a/src/views/module/homeListItem.vue +++ b/src/views/module/homeListItem.vue @@ -67,22 +67,22 @@ export default { }, methods: { 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.listData[index].isbn.replace(/\-/g, '') } getBookDetailsByISBN(params).then(res => { this.$refs.detailDom.dialogVisible = true 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) } else { this.$refs.detailDom.bookData = { srcUrl: this.listData[index].cover,