|
@ -25,7 +25,7 @@ |
|
|
|
|
|
|
|
|
<script> |
|
|
<script> |
|
|
import BookDetails from './bookDetails.vue' |
|
|
import BookDetails from './bookDetails.vue' |
|
|
import { getBookDetailsByISBN, FetchCoverByISBN } from '@/api/bookshelf' |
|
|
|
|
|
|
|
|
import { getBookDetailsByISBN } from '@/api/bookshelf' |
|
|
export default { |
|
|
export default { |
|
|
name: 'BookList', |
|
|
name: 'BookList', |
|
|
components: { BookDetails }, |
|
|
components: { BookDetails }, |
|
@ -50,26 +50,13 @@ export default { |
|
|
}, |
|
|
}, |
|
|
methods: { |
|
|
methods: { |
|
|
handleDetails(index) { |
|
|
handleDetails(index) { |
|
|
console.log(this.bookdata[index]) |
|
|
|
|
|
const params = { |
|
|
const params = { |
|
|
isbn: this.bookdata[index].isbn.replace(/\-/g, '') |
|
|
isbn: this.bookdata[index].isbn.replace(/\-/g, '') |
|
|
} |
|
|
} |
|
|
console.log(params) |
|
|
|
|
|
getBookDetailsByISBN(params).then(res => { |
|
|
getBookDetailsByISBN(params).then(res => { |
|
|
console.log(res, '详情') |
|
|
|
|
|
this.$refs.detailDom.bookData = res |
|
|
this.$refs.detailDom.bookData = res |
|
|
this.$refs.detailDom.dialogVisible = true |
|
|
this.$refs.detailDom.dialogVisible = true |
|
|
}) |
|
|
}) |
|
|
}, |
|
|
|
|
|
getCoverByISBN(isbn, item) { |
|
|
|
|
|
const params = { |
|
|
|
|
|
isbn: isbn |
|
|
|
|
|
} |
|
|
|
|
|
FetchCoverByISBN(params).then((res) => { |
|
|
|
|
|
item.cover = window.URL.createObjectURL(res) |
|
|
|
|
|
console.log(res, 'res') |
|
|
|
|
|
this.bookData.push(item) |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|