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))