Revert "fix:孔夫子搜索errType=102时检测到登录过期后清除session跳转登录页"
This reverts commit ad8010bbd3.
This commit is contained in:
parent
ad8010bbd3
commit
9f89e5469f
@ -1343,23 +1343,6 @@ export default {
|
||||
searchFacet(keyword, { phpsessid, dataType: 1 })
|
||||
]).then(([productsData, onSaleFacet, soldFacet]) => {
|
||||
this.isLoading = false
|
||||
|
||||
// 检测孔夫子登录过期
|
||||
if (productsData.loginRequired || onSaleFacet.loginRequired || soldFacet.loginRequired) {
|
||||
uni.showModal({
|
||||
title: '系统提示',
|
||||
content: '孔夫子登录已过期,请重新登录',
|
||||
confirmText: '去登录',
|
||||
success: (modalRes) => {
|
||||
if (modalRes.confirm) {
|
||||
uni.removeStorageSync('kongfz_phpsessid')
|
||||
uni.navigateTo({ url: '/pages/login/login' })
|
||||
}
|
||||
}
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
if (productsData && productsData.total > 0) {
|
||||
// 在售商品列表(最多12条)
|
||||
const list = (productsData.list || []).slice(0, 12)
|
||||
@ -2581,23 +2564,6 @@ export default {
|
||||
searchFacet(keyword, { phpsessid, dataType: 1 })
|
||||
]).then(([productsData, onSaleFacet, soldFacet]) => {
|
||||
this.noIsbnLoading = false
|
||||
|
||||
// 检测孔夫子登录过期
|
||||
if (productsData.loginRequired || onSaleFacet.loginRequired || soldFacet.loginRequired) {
|
||||
uni.showModal({
|
||||
title: '系统提示',
|
||||
content: '孔夫子登录已过期,请重新登录',
|
||||
confirmText: '去登录',
|
||||
success: (modalRes) => {
|
||||
if (modalRes.confirm) {
|
||||
uni.removeStorageSync('kongfz_phpsessid')
|
||||
uni.navigateTo({ url: '/pages/login/login' })
|
||||
}
|
||||
}
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
// 收集作者和出版社选项
|
||||
const authorSet = new Set()
|
||||
const publisherSet = new Set()
|
||||
@ -2683,23 +2649,6 @@ export default {
|
||||
author: this.noIsbnAuthor
|
||||
}).then((productsData) => {
|
||||
this.noIsbnLoading = false
|
||||
|
||||
// 检测孔夫子登录过期
|
||||
if (productsData.loginRequired) {
|
||||
uni.showModal({
|
||||
title: '系统提示',
|
||||
content: '孔夫子登录已过期,请重新登录',
|
||||
confirmText: '去登录',
|
||||
success: (modalRes) => {
|
||||
if (modalRes.confirm) {
|
||||
uni.removeStorageSync('kongfz_phpsessid')
|
||||
uni.navigateTo({ url: '/pages/login/login' })
|
||||
}
|
||||
}
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
if (productsData && productsData.total > 0) {
|
||||
const list = (productsData.list || []).slice(0, 12)
|
||||
this.noIsbnProductList = list.map(item => {
|
||||
|
||||
@ -113,12 +113,9 @@ export function searchFacet(keyword, options = {}) {
|
||||
}
|
||||
})
|
||||
const totalFound = parseInt(res.data.data.totalFoundText || res.data.data.matchInfo?.totalFound || 0, 10)
|
||||
resolve({ newCount, oldCount, totalFound, loginRequired: false })
|
||||
} else if (res.data && res.data.errType === '102') {
|
||||
console.warn('孔夫子统计需要重新登录(errType=102)')
|
||||
resolve({ newCount: 0, oldCount: 0, totalFound: 0, loginRequired: true })
|
||||
resolve({ newCount, oldCount, totalFound })
|
||||
} else {
|
||||
resolve({ newCount: 0, oldCount: 0, totalFound: 0, loginRequired: false })
|
||||
resolve({ newCount: 0, oldCount: 0, totalFound: 0 })
|
||||
}
|
||||
},
|
||||
fail: (err) => {
|
||||
@ -189,7 +186,7 @@ export function fetchItems(token, params = {}, onProgress) {
|
||||
* 搜索孔夫子在售商品(需要登录Cookie)
|
||||
* @param {string} keyword ISBN或书名
|
||||
* @param {object} options {phpsessid, page}
|
||||
* @returns {Promise<{total: number, list: Array, loginRequired: boolean}>}
|
||||
* @returns {Promise<{total: number, list: Array}>}
|
||||
* list中每项: {id, title, author, press, priceText, imgBigUrl, shopName, qualityText, pubDateText, postage}
|
||||
*/
|
||||
export function searchProducts(keyword, options = {}) {
|
||||
@ -234,18 +231,13 @@ export function searchProducts(keyword, options = {}) {
|
||||
if (itemResp) {
|
||||
resolve({
|
||||
total: itemResp.total || 0,
|
||||
list: itemResp.list || [],
|
||||
loginRequired: false
|
||||
list: itemResp.list || []
|
||||
})
|
||||
} else {
|
||||
resolve({ total: 0, list: [], loginRequired: false })
|
||||
resolve({ total: 0, list: [] })
|
||||
}
|
||||
} else if (res.data && res.data.errType === '102') {
|
||||
// errType 102 = 需要登录
|
||||
console.warn('孔夫子搜索需要重新登录(errType=102)')
|
||||
resolve({ total: 0, list: [], loginRequired: true })
|
||||
} else {
|
||||
resolve({ total: 0, list: [], loginRequired: false })
|
||||
resolve({ total: 0, list: [] })
|
||||
}
|
||||
},
|
||||
fail: (err) => {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user