From 1db595ef455aa22bebb13386765600b947d0d3bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E7=BF=94=E5=AE=87-=E6=97=85=E7=AE=A1=E5=AE=B6?= <153298343@qq.com> Date: Fri, 6 Jan 2023 15:10:12 +0800 Subject: [PATCH] up --- src/api/bookStore/interface.js | 4 +- src/views/bookStore/bookIndex.vue | 2 +- src/views/bookStore/components/addBook.vue | 48 +++++++++++++--------- src/views/bookStore/components/putIn.vue | 32 ++++++++++++--- vue.config.js | 6 +-- 5 files changed, 60 insertions(+), 32 deletions(-) diff --git a/src/api/bookStore/interface.js b/src/api/bookStore/interface.js index 078f26d..adc771b 100644 --- a/src/api/bookStore/interface.js +++ b/src/api/bookStore/interface.js @@ -35,10 +35,10 @@ export function request(api, params, callback) { export function get_isbn(params, callback) { - const api = "/ISBN" + const api = "/query" requestGet(api, { params: { - key: "376b36e8dc0771b23dc85ac4e7749c5f", + key: "417d45266d502c8f67235e96f1e891e2", ...params } }, callback) diff --git a/src/views/bookStore/bookIndex.vue b/src/views/bookStore/bookIndex.vue index f8dc10e..0a8e0f7 100644 --- a/src/views/bookStore/bookIndex.vue +++ b/src/views/bookStore/bookIndex.vue @@ -92,7 +92,7 @@ } } > ) + } style='width:120px;height:120px'> ) } }, { diff --git a/src/views/bookStore/components/addBook.vue b/src/views/bookStore/components/addBook.vue index ffbe82c..c205dde 100644 --- a/src/views/bookStore/components/addBook.vue +++ b/src/views/bookStore/components/addBook.vue @@ -53,7 +53,7 @@
- +
@@ -76,7 +76,7 @@
- +
@@ -178,7 +178,6 @@ get_isbn } from "@/api/bookStore/interface"; - import { uploadFile, uploadFileByUrl @@ -251,11 +250,16 @@ } else { this.id = '' this.type = '' - this.$refs['addActivity'].reset(); - - this.detail.small_cover = ""; - this.detail.big_cover = ""; + this.$refs['addActivity'].reset(); + + this.detail.small_cover = ""; + this.detail.big_cover = ""; } + let that = this; + this.$nextTick(function() { + console.log(that.$refs.inputisbn) + that.$refs.inputisbn.focus(); + }) } }, methods: { @@ -281,28 +285,28 @@ return false; } get_isbn({ - sub: e + isbn: e }, function(res) { console.log(res) if (res.error_code != 0) { that.$Message.error("存在错误" + res.error_code); } else { - let book = res.result; + let book = res.result.data; that.detail.name = book.title; that.detail.sub_title = book.subtitle; that.detail.author = book.author; - that.detail.bind_way = book.binding; - that.detail.publish_date = book.pubdate; + that.detail.bind_way = book.paper; + that.detail.publish_date = book.pubDate; that.detail.publish_house = book.publisher; - that.detail.font_total = book.pages; - that.detail.content = book.summary; + that.detail.font_total = book.wordNum; + that.detail.content = book.gist; - if (book.images_medium && book.images_medium != '') { - that.downloadByBlob(book.images_medium, "small_cover", "small_cover_id"); + if (book.smallImg && book.smallImg != '') { + that.downloadByBlob(book.smallImg, "small_cover", "small_cover_id"); } - if (book.images_large && book.images_large != '') { - that.downloadByBlob(book.images_medium, "big_cover", "big_cover_id"); + if (book.img && book.img != '') { + that.downloadByBlob(book.img, "big_cover", "big_cover_id"); } } @@ -376,7 +380,7 @@ editor() { if (this.detail.id == "") { - let _arr = []; + let _arr = []; console.log(this.detail.stockNum) for (var i = 0; i < this.detail.stockNum; i++) { _arr.push({ @@ -384,7 +388,7 @@ remark: "", status: 0, }) - } + } console.log(this.detail.id) this.detail.details = _arr; } @@ -409,7 +413,11 @@ }) }, mounted() { - + let that = this; + that.$nextTick(function() { + console.log(that.$refs.inputisbn) + that.$refs.inputisbn.focus(); + }) } } diff --git a/src/views/bookStore/components/putIn.vue b/src/views/bookStore/components/putIn.vue index 181d18d..b71dd5e 100644 --- a/src/views/bookStore/components/putIn.vue +++ b/src/views/bookStore/components/putIn.vue @@ -3,12 +3,23 @@ + @@ -42,15 +53,17 @@ return { isShow: false, - id: "", - bookid:"", + id: "", + bookid: "", type: "add", detail: { book_id: "", id: "", no: "", enter_date: "", - remark: "" + remark: "", + status: 0, + booknum: 1 }, rules: { enter_date: [{ @@ -83,11 +96,17 @@ Object.assign(this.detail, res); }, editor() { - saveDetail(this.detail).then(res => { + + for (var i = 1; i <= this.detail.booknum;i++) { + saveDetail(this.detail).then(res => { + + }) + } + this.isShow = false this.$Message.success("操作成功"); this.$emit('refresh') - }) + }, }, @@ -96,6 +115,7 @@ }, created() { let that = this; + that.detail.enter_date = this.$moment().format("YYYY-MM-DD") }, mounted() { diff --git a/vue.config.js b/vue.config.js index fd07d30..7ab996f 100644 --- a/vue.config.js +++ b/vue.config.js @@ -45,12 +45,12 @@ module.exports = { }, //before: require('./mock/mock-server.js'), proxy: { - '^/ISBN': { - target: "http://feedback.api.juhe.cn/ISBN", + '^/query': { + target: "http://apis.juhe.cn/isbn/query", secure: true, changeOrigin: true, //配置跨域 pathRewrite: { - "^/ISBN": "", + "^/query": "", } }, [process.env.VUE_APP_BASE_API]: {