Browse Source

首页-新书推荐修改/api添加

master
xuhuajiao 3 years ago
parent
commit
f4b09fa805
  1. 12
      src/api/bookshelf.js
  2. 19
      src/views/index.vue

12
src/api/bookshelf.js

@ -47,10 +47,20 @@ export function initSmartBookshelf(params) {
})
}
// 智能书架-书架详情
export function FetchInitBookshelfDetails(params) {
return request({
url: '/dxhtsg/initBookshelfDetails',
method: 'get',
params
})
}
export default {
FetchNewBookRecommend,
FetchCoverByISBN,
initNumberResoures,
getBookDetailsByISBN,
initSmartBookshelf
initSmartBookshelf,
FetchInitBookshelfDetails
}

19
src/views/index.vue

@ -82,10 +82,9 @@ export default {
},
created() {
this.initSmartBookshelf()
this.getBookList()
this.getNewBookList()
this.rackList = data.bookList.splice(0, 1)
this.otherList = data.bookList.splice(-2)
// this.newList = data.newList
},
mounted() {
@ -94,10 +93,17 @@ export default {
toPath(path) {
this.$router.push(path)
},
getBookList() {
FetchNewBookRecommend().then(res => {
// -
getNewBookList() {
const params = {
libcode: this.libcode,
pageNo: 1,
pageSize: 4
}
FetchNewBookRecommend(params).then(res => {
console.log(res)
let data = []
data = res
data = res.newbookList
data.forEach(item => {
this.getCoverByISBN(item.isbn.replace(/\-/g, ''), item)
})
@ -105,6 +111,7 @@ export default {
this.$message.error('接口错误')
})
},
// isbn
getCoverByISBN(isbn, item) {
const params = {
isbn: isbn
@ -112,9 +119,9 @@ export default {
FetchCoverByISBN(params).then((res) => {
item.cover = window.URL.createObjectURL(res)
this.newList.push(item)
// this.newList.slice(0, 4)
})
},
//
initSmartBookshelf() {
const params = { leftShelfNo: '1201-03-001-A-01', rightShelfNo: '1201-03-001-B-01' }
initSmartBookshelf(params).then((res) => {

Loading…
Cancel
Save