feat:选择出版社时按出版社过滤更新作者

This commit is contained in:
ShenQiLun 2026-07-01 16:07:41 +08:00
parent 9e54df4fa2
commit 78d1aaca90
2 changed files with 51 additions and 25 deletions

View File

@ -1904,16 +1904,17 @@ export default {
try { try {
// //
var pressOpts = { phpsessid: this.kongfzToken || '' } var pressOpts = { phpsessid: this.kongfzToken || '' }
var authorOpts = { phpsessid: this.kongfzToken || '' }
// //
if (this.noIsbnAuthor) pressOpts.author = this.noIsbnAuthor if (this.noIsbnAuthor) pressOpts.author = this.noIsbnAuthor
//
if (this.noIsbnPublisher) authorOpts.publisher = this.noIsbnPublisher
var results = await Promise.all([ var results = await Promise.all([
searchCategories(bookName, { searchCategories(bookName, {
phpsessid: this.kongfzToken || '' phpsessid: this.kongfzToken || ''
}), }),
searchPresses(bookName, pressOpts), searchPresses(bookName, pressOpts),
searchAuthors(bookName, { searchAuthors(bookName, authorOpts)
phpsessid: this.kongfzToken || ''
})
]) ])
var catList = results[0] var catList = results[0]
var pressList = results[1] var pressList = results[1]
@ -3499,10 +3500,28 @@ export default {
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.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

View File

@ -372,39 +372,46 @@ export function searchPresses(keyword, options = {}) {
} }
/** /**
* 获取孔网作者列表根据书名 * 获取孔网作者列表根据书名可选按出版社过滤
* @param {string} keyword 书名 * @param {string} keyword 书名
* @param {object} options { phpsessid, userArea } * @param {object} options { phpsessid, userArea, publisher }
* @returns {Promise<Array<{showName:string}>>} 作者列表 * @returns {Promise<Array<{showName:string}>>} 作者列表
*/ */
export function searchAuthors(keyword, options = {}) { export function searchAuthors(keyword, options = {}) {
const { phpsessid = '', userArea = '1006000000' } = options const { phpsessid = '', userArea = '1006000000', publisher = '' } = options
return new Promise((resolve) => { return new Promise((resolve) => {
if (!keyword || !keyword.trim()) { if (!keyword || !keyword.trim()) {
resolve([]) resolve([])
return return
} }
var reqData = {
requestId: Math.random().toString(36).substring(2, 10),
platform: 'web',
searchType: 'keyword',
dataType: 0,
keyword: keyword.trim(),
hasStock: 'true',
isNewBook: 'false',
searchMode: 0,
userArea: userArea,
page: 1,
size: 50,
tplParams: '{}',
sortType: 0,
abGroup: 'B',
filterType: 'author'
}
if (publisher) {
reqData.press = publisher
reqData.actionPath = 'press'
reqData.notSelectSearchMode = 'false'
} else {
reqData.notSelectSearchMode = 'true'
}
uni.request({ uni.request({
url: 'https://search.kongfz.com/pc-gw/search-web/client/pc/product/keyword/more/author/facet', url: 'https://search.kongfz.com/pc-gw/search-web/client/pc/product/keyword/more/author/facet',
method: 'GET', method: 'GET',
data: { data: reqData,
requestId: Math.random().toString(36).substring(2, 10),
platform: 'web',
searchType: 'keyword',
dataType: 0,
keyword: keyword.trim(),
hasStock: 'true',
isNewBook: 'false',
searchMode: 0,
userArea: userArea,
page: 1,
size: 50,
tplParams: '{}',
sortType: 0,
abGroup: 'B',
notSelectSearchMode: 'true',
filterType: 'author'
},
header: { header: {
'Cookie': phpsessid ? `PHPSESSID=${phpsessid}` : '' 'Cookie': phpsessid ? `PHPSESSID=${phpsessid}` : ''
}, },