fix:出版社支持按作者过滤,选择作者后重新获取

This commit is contained in:
ShenQiLun 2026-07-01 14:13:57 +08:00
parent bbad484273
commit c834090eb8
2 changed files with 48 additions and 21 deletions

View File

@ -3445,6 +3445,26 @@ export default {
selectNoIsbnAuthor(item) { selectNoIsbnAuthor(item) {
this.noIsbnAuthor = item this.noIsbnAuthor = item
this.noIsbnAuthorDropdownVisible = false this.noIsbnAuthorDropdownVisible = false
//
this.fetchNoIsbnPressesByAuthor(item)
},
//
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.map(function(item) { return item.showName })
this.noIsbnPublisherDropdownVisible = true
}
} catch (e) {
console.error('按作者获取出版社失败:', e)
}
}, },
// ISBN - // ISBN -

View File

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