|
|
@ -6,7 +6,7 @@ |
|
|
|
<div v-for="(item,index) in rankingList" :key="index" class="swiper-slide"> |
|
|
|
<div class="book-list-item"> |
|
|
|
<div class="book-img"> |
|
|
|
<img :src="item.coverUrl" :onerror="defaultImg"> |
|
|
|
<img :src="item.cover" :onerror="defaultImg"> |
|
|
|
</div> |
|
|
|
<div class="book-info"> |
|
|
|
<h4 class="title-item">{{ item.nbName }}</h4> |
|
|
@ -17,8 +17,6 @@ |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<!-- <div class="icon iconfont prev-btn"></div> --> |
|
|
|
<!-- <div class="icon iconfont next-btn"></div> --> |
|
|
|
<div class="icon iconfont prev-btn"> |
|
|
|
<svg class="icon svg-icon" aria-hidden="true"> |
|
|
|
<use xlink:href="#icon-zuohua" /> |
|
|
@ -73,33 +71,24 @@ export default { |
|
|
|
}, |
|
|
|
getBookList() { |
|
|
|
FetchNewBookRecommend().then(res => { |
|
|
|
this.rankingList = res |
|
|
|
console.log(res, 'res') |
|
|
|
this.rankingList = res.data |
|
|
|
this.rankingList.forEach(item => { |
|
|
|
this.getCoverByISBN(item.isbn.replace(/\-/g, '')) |
|
|
|
if (this.coverUrl) { |
|
|
|
item.coverUrl = this.coverUrl |
|
|
|
} else { |
|
|
|
item.coverUrl = '' |
|
|
|
} |
|
|
|
this.coverUrl = null |
|
|
|
this.getCoverByISBN(item.isbn.replace(/\-/g, ''), item) |
|
|
|
}) |
|
|
|
}).catch(() => { |
|
|
|
this.$message.error('接口错误') |
|
|
|
}) |
|
|
|
}, |
|
|
|
getCoverByISBN(isbn) { |
|
|
|
getCoverByISBN(isbn, item) { |
|
|
|
const params = { |
|
|
|
isbn: isbn |
|
|
|
} |
|
|
|
FetchCoverByISBN(params).then((res) => { |
|
|
|
try { |
|
|
|
this.coverUrl = res |
|
|
|
} catch (error) { |
|
|
|
this.coverUrl = window.URL.createObjectURL(res) |
|
|
|
} |
|
|
|
console.log(res, 'blob') |
|
|
|
item.cover = window.URL.createObjectURL(res) |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
</script> |
|
|
|