refactor:统一通过fetchNoIsbnBookData一次获取全部分类/作者/出版社,避免多次请求
This commit is contained in:
parent
afd69c28c2
commit
36845e6657
@ -1965,7 +1965,8 @@ export default {
|
|||||||
this.noIsbnCategoryIndex = index
|
this.noIsbnCategoryIndex = index
|
||||||
var item = this.noIsbnCategoryList[index]
|
var item = this.noIsbnCategoryList[index]
|
||||||
this.noIsbnSelectedCategoryValue = item ? item.value : ''
|
this.noIsbnSelectedCategoryValue = item ? item.value : ''
|
||||||
// 选择分类后:重新搜索在售商品
|
// 选择分类后:一次获取出版社/分类/作者(全部) + 重搜在售商品
|
||||||
|
this.fetchNoIsbnBookData()
|
||||||
this.debouncedReSearch()
|
this.debouncedReSearch()
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -3413,9 +3414,9 @@ export default {
|
|||||||
if (texts.书名) this.noIsbnBookName = texts.书名
|
if (texts.书名) this.noIsbnBookName = texts.书名
|
||||||
if (texts.作者) {
|
if (texts.作者) {
|
||||||
this.noIsbnAuthor = texts.作者
|
this.noIsbnAuthor = texts.作者
|
||||||
// OCR识别出作者后,按作者过滤获取出版社
|
// OCR识别出作者后,一次获取出版社/分类/作者
|
||||||
this.$nextTick(function() {
|
this.$nextTick(function() {
|
||||||
this.fetchNoIsbnPressesByAuthor(this.noIsbnAuthor)
|
this.fetchNoIsbnBookData()
|
||||||
}.bind(this))
|
}.bind(this))
|
||||||
}
|
}
|
||||||
if (texts.出版社) this.noIsbnPublisher = texts.出版社
|
if (texts.出版社) this.noIsbnPublisher = texts.出版社
|
||||||
@ -3490,54 +3491,20 @@ export default {
|
|||||||
selectNoIsbnAuthor(item) {
|
selectNoIsbnAuthor(item) {
|
||||||
this.noIsbnAuthor = typeof item === 'string' ? item : (item.showName || '')
|
this.noIsbnAuthor = typeof item === 'string' ? item : (item.showName || '')
|
||||||
this.noIsbnAuthorDropdownVisible = false
|
this.noIsbnAuthorDropdownVisible = false
|
||||||
// 选择作者后:重新获取出版社(带作者过滤)+ 重新搜索在售商品
|
// 选择作者后:一次获取出版社/分类/作者(全部) + 重搜在售商品
|
||||||
this.fetchNoIsbnPressesByAuthor(this.noIsbnAuthor)
|
this.fetchNoIsbnBookData()
|
||||||
this.debouncedReSearch()
|
this.debouncedReSearch()
|
||||||
},
|
},
|
||||||
|
|
||||||
// 选择作者后重新获取出版社(按作者过滤)
|
|
||||||
async fetchNoIsbnPressesByAuthor(author) {
|
|
||||||
var bookName = (this.noIsbnBookName || '').trim()
|
|
||||||
if (!bookName || !author) return
|
|
||||||
try {
|
|
||||||
var pressList = await searchPresses(bookName, {
|
|
||||||
phpsessid: this.kongfzToken || '',
|
|
||||||
author: author
|
|
||||||
})
|
|
||||||
if (pressList.length > 0) {
|
|
||||||
this.noIsbnPublisherOptions = pressList.slice(0, 20)
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
console.error('按作者获取出版社失败:', e)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
// 无ISBN - 选择出版社
|
// 无ISBN - 选择出版社
|
||||||
selectNoIsbnPublisher(item) {
|
selectNoIsbnPublisher(item) {
|
||||||
this.noIsbnPublisher = typeof item === 'string' ? item : (item.showName || '')
|
this.noIsbnPublisher = typeof item === 'string' ? item : (item.showName || '')
|
||||||
this.noIsbnPublisherDropdownVisible = false
|
this.noIsbnPublisherDropdownVisible = false
|
||||||
// 选择出版社后:重新获取作者(按出版社过滤)+ 重新搜索在售商品
|
// 选择出版社后:一次获取出版社/分类/作者(全部) + 重搜在售商品
|
||||||
this.fetchNoIsbnAuthorsByPublisher(this.noIsbnPublisher)
|
this.fetchNoIsbnBookData()
|
||||||
this.debouncedReSearch()
|
this.debouncedReSearch()
|
||||||
},
|
},
|
||||||
|
|
||||||
// 选择出版社后重新获取作者(按出版社过滤)
|
|
||||||
async fetchNoIsbnAuthorsByPublisher(publisher) {
|
|
||||||
var bookName = (this.noIsbnBookName || '').trim()
|
|
||||||
if (!bookName || !publisher) return
|
|
||||||
try {
|
|
||||||
var authorList = await searchAuthors(bookName, {
|
|
||||||
phpsessid: this.kongfzToken || '',
|
|
||||||
publisher: publisher
|
|
||||||
})
|
|
||||||
if (authorList.length > 0) {
|
|
||||||
this.noIsbnAuthorOptions = authorList.map(function(item) { return item.showName }).slice(0, 20)
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
console.error('按出版社获取作者失败:', e)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
// 无ISBN - 选择开本
|
// 无ISBN - 选择开本
|
||||||
selectNoIsbnFormat(item) {
|
selectNoIsbnFormat(item) {
|
||||||
this.noIsbnFormat = item
|
this.noIsbnFormat = item
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user