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 { export default {
FetchNewBookRecommend, FetchNewBookRecommend,
FetchCoverByISBN, FetchCoverByISBN,
initNumberResoures, initNumberResoures,
getBookDetailsByISBN, getBookDetailsByISBN,
initSmartBookshelf
initSmartBookshelf,
FetchInitBookshelfDetails
} }

19
src/views/index.vue

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

Loading…
Cancel
Save