fix:出版社支持按作者过滤,选择作者后重新获取
This commit is contained in:
parent
bbad484273
commit
c834090eb8
@ -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 - 选择出版社
|
||||||
|
|||||||
@ -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}` : ''
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user