|
@@ -557,7 +557,7 @@ export default function () {
|
|
// 条件:1.精准搜索模式 2.返回无数据 3.有主关键词或附加词
|
|
// 条件:1.精准搜索模式 2.返回无数据 3.有主关键词或附加词
|
|
let autoSwitchModel = false
|
|
let autoSwitchModel = false
|
|
const { goback } = useRoute().query
|
|
const { goback } = useRoute().query
|
|
- function changeSearchMode () {
|
|
|
|
|
|
+ function changeSearchMode (searchType) {
|
|
const total = listState.total
|
|
const total = listState.total
|
|
const { searchMode, additionalWords, input } = inputKeywordsState.value
|
|
const { searchMode, additionalWords, input } = inputKeywordsState.value
|
|
const jzModel = searchMode === '0' && (additionalWords || input)
|
|
const jzModel = searchMode === '0' && (additionalWords || input)
|
|
@@ -565,7 +565,7 @@ export default function () {
|
|
if(!autoSwitchModel && jzModel && total === 0) {
|
|
if(!autoSwitchModel && jzModel && total === 0) {
|
|
autoSwitchModel = true
|
|
autoSwitchModel = true
|
|
inputKeywordsState.value.searchMode = '1'
|
|
inputKeywordsState.value.searchMode = '1'
|
|
- doQuery()
|
|
|
|
|
|
+ doQuery({}, searchType)
|
|
}
|
|
}
|
|
if(mhModel && autoSwitchModel) {
|
|
if(mhModel && autoSwitchModel) {
|
|
if( total > 0) {
|
|
if( total > 0) {
|
|
@@ -616,12 +616,6 @@ export default function () {
|
|
if (!onTheWhiteList.value) {
|
|
if (!onTheWhiteList.value) {
|
|
const searchKeywords = inputKeywordsState.value.input
|
|
const searchKeywords = inputKeywordsState.value.input
|
|
const hasOneKey = (filterState.value.buyer?.length || filterState.value.winner?.length || filterState.value.agency?.length) > 0
|
|
const hasOneKey = (filterState.value.buyer?.length || filterState.value.winner?.length || filterState.value.agency?.length) > 0
|
|
- // 切换三种筛选类型时候判断(切换tab时不弹窗)
|
|
|
|
- // if (!searchKeywords && !hasOneKey) {
|
|
|
|
- // if (from.indexOf('tab-') !== -1) {
|
|
|
|
- // return false
|
|
|
|
- // }
|
|
|
|
- // }
|
|
|
|
// 关键词去两边空格后为空
|
|
// 关键词去两边空格后为空
|
|
if (!searchKeywords && inputKeywordsState.value.additionalWords.length === 0) {
|
|
if (!searchKeywords && inputKeywordsState.value.additionalWords.length === 0) {
|
|
if (!hasOneKey) {
|
|
if (!hasOneKey) {
|
|
@@ -640,7 +634,7 @@ export default function () {
|
|
return true
|
|
return true
|
|
}
|
|
}
|
|
// 搜索前 处理一些事情
|
|
// 搜索前 处理一些事情
|
|
- function beforeSearch (pageNum) {
|
|
|
|
|
|
+ function beforeSearchSomthing (pageNum) {
|
|
// 列表清空
|
|
// 列表清空
|
|
list.value = []
|
|
list.value = []
|
|
listState.total = 0
|
|
listState.total = 0
|
|
@@ -681,16 +675,16 @@ export default function () {
|
|
if(!bSearch) {
|
|
if(!bSearch) {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
- beforeSearch (pageNum)
|
|
|
|
|
|
+ beforeSearchSomthing (pageNum)
|
|
// Ajax请求
|
|
// Ajax请求
|
|
return doRunQuery(getParams(params)).then((res) => {
|
|
return doRunQuery(getParams(params)).then((res) => {
|
|
- afterQueryAjax(res)
|
|
|
|
|
|
+ afterQueryAjax(res, searchType)
|
|
})
|
|
})
|
|
}
|
|
}
|
|
// 处理查询请求后的数据以及其他业务
|
|
// 处理查询请求后的数据以及其他业务
|
|
- function afterQueryAjax (res) {
|
|
|
|
|
|
+ function afterQueryAjax (res, searchType) {
|
|
// 变更搜索模式
|
|
// 变更搜索模式
|
|
- changeSearchMode()
|
|
|
|
|
|
+ changeSearchMode(searchType)
|
|
|
|
|
|
const { origin } = res
|
|
const { origin } = res
|
|
|
|
|
|
@@ -1214,8 +1208,8 @@ export default function () {
|
|
const originParams = packageFilter()
|
|
const originParams = packageFilter()
|
|
_storage.setItem(key, JSON.stringify(originParams))
|
|
_storage.setItem(key, JSON.stringify(originParams))
|
|
|
|
|
|
- // window.location.replace('/swordfish/page_big_pc/search/bidding?goback=true')
|
|
|
|
- window.location.replace(`/page_workDesktop/work-bench/page?link=${encodeURIComponent(goHref_ + '?goback=true')}`)
|
|
|
|
|
|
+ window.location.replace('/swordfish/page_big_pc/search/bidding?goback=true')
|
|
|
|
+ // window.location.replace(`/page_workDesktop/work-bench/page?link=${encodeURIComponent(goHref_ + '?goback=true')}`)
|
|
}
|
|
}
|
|
|
|
|
|
// 监听路由事件
|
|
// 监听路由事件
|
|
@@ -1319,6 +1313,10 @@ export default function () {
|
|
restoreSearchGroupFromLocal()
|
|
restoreSearchGroupFromLocal()
|
|
const defaultSelectType = ['title', 'content']
|
|
const defaultSelectType = ['title', 'content']
|
|
filterState.value.selectType = defaultSelectType
|
|
filterState.value.selectType = defaultSelectType
|
|
|
|
+ if(!goback) {
|
|
|
|
+ // 非工作台外跳转进入则默认搜索
|
|
|
|
+ firstSearch()
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
// vip 或者 桌面跳转回显筛选条件
|
|
// vip 或者 桌面跳转回显筛选条件
|
|
@@ -1335,9 +1333,17 @@ export default function () {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
})
|
|
})
|
|
|
|
+ } else {
|
|
|
|
+ firstSearch()
|
|
}
|
|
}
|
|
|
|
+ } else {
|
|
|
|
+ firstSearch()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ function firstSearch () {
|
|
|
|
+ return doQuery({}, 'firstSearch')
|
|
|
|
+ }
|
|
/**
|
|
/**
|
|
* 检查是否需要切换模糊搜索、是否展示提示
|
|
* 检查是否需要切换模糊搜索、是否展示提示
|
|
* 1. 精准搜索无数据 (自动切换模糊搜索)
|
|
* 1. 精准搜索无数据 (自动切换模糊搜索)
|