From f4b09fa80569bd9b7ed56c78d7c1461c1f8bf46f Mon Sep 17 00:00:00 2001 From: xuhuajiao <13476289682@163.com> Date: Tue, 27 Sep 2022 14:08:30 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A6=96=E9=A1=B5-=E6=96=B0=E4=B9=A6=E6=8E=A8?= =?UTF-8?q?=E8=8D=90=E4=BF=AE=E6=94=B9/api=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/bookshelf.js | 12 +++++++++++- src/views/index.vue | 19 +++++++++++++------ 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/src/api/bookshelf.js b/src/api/bookshelf.js index 7b90504..c967408 100644 --- a/src/api/bookshelf.js +++ b/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 } diff --git a/src/views/index.vue b/src/views/index.vue index e5c6d76..a3b85da 100644 --- a/src/views/index.vue +++ b/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) => {