From c3f96e378a958e2105019d8213c60184f2fe7531 Mon Sep 17 00:00:00 2001 From: ShenQiLun <97694732@qq.com> Date: Thu, 2 Jul 2026 16:10:09 +0800 Subject: [PATCH] =?UTF-8?q?fix:fetchNoIsbnBookData=E5=8A=A0autoOpen?= =?UTF-8?q?=E5=8F=82=E6=95=B0,=E9=81=BF=E5=85=8D=E9=80=89=E6=8B=A9?= =?UTF-8?q?=E6=97=B6=E9=87=8D=E5=A4=8D=E5=B1=95=E5=BC=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/upload/upload.vue | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/pages/upload/upload.vue b/pages/upload/upload.vue index 9f1b530..c0c2699 100644 --- a/pages/upload/upload.vue +++ b/pages/upload/upload.vue @@ -1900,7 +1900,9 @@ export default { }, // 从孔网搜索图书分类和出版社 - async fetchNoIsbnBookData() { + // @param {boolean} autoOpen 是否自动展开下拉列表(输入书名时自动展开,选择作者/出版社时由调用方管控) + async fetchNoIsbnBookData(autoOpen) { + if (autoOpen === undefined) autoOpen = true var bookName = (this.noIsbnBookName || '').trim() if (!bookName) return this.noIsbnCategoryLoading = true @@ -1942,14 +1944,14 @@ export default { // 更新出版社(最多20条) if (pressList.length > 0) { this.noIsbnPublisherOptions = pressList.slice(0, 20) - this.noIsbnPublisherDropdownVisible = true + if (autoOpen) this.noIsbnPublisherDropdownVisible = true } else { this.noIsbnPublisherOptions = [] } // 更新作者(最多20条) if (authorList.length > 0) { this.noIsbnAuthorOptions = authorList.map(function(item) { return item.showName }).slice(0, 20) - this.noIsbnAuthorDropdownVisible = true + if (autoOpen) this.noIsbnAuthorDropdownVisible = true } else { this.noIsbnAuthorOptions = [] } @@ -1973,7 +1975,7 @@ export default { var item = this.noIsbnCategoryList[index] this.noIsbnSelectedCategoryValue = item ? item.value : '' // 选择分类后:一次获取出版社/分类/作者(全部) + 重搜在售商品 - this.fetchNoIsbnBookData() + this.fetchNoIsbnBookData(false) this.debouncedReSearch() }, @@ -3499,7 +3501,7 @@ export default { this.noIsbnAuthor = typeof item === 'string' ? item : (item.showName || '') this.noIsbnAuthorDropdownVisible = false // 选择作者后:展开出版社,一次获取出版社/分类/作者(全部) + 重搜在售商品 - this.fetchNoIsbnBookData() + this.fetchNoIsbnBookData(false) this.$nextTick(function() { this.noIsbnPublisherDropdownVisible = true }.bind(this)) @@ -3512,7 +3514,7 @@ export default { this.noIsbnSelectedPublisherValue = typeof item === 'object' && item.value ? item.value : '' this.noIsbnPublisherDropdownVisible = false // 选择出版社后:展开作者,一次获取出版社/分类/作者(全部) + 重搜在售商品 - this.fetchNoIsbnBookData() + this.fetchNoIsbnBookData(false) this.$nextTick(function() { this.noIsbnAuthorDropdownVisible = true }.bind(this))