Commit 6eeadfb6 by YKai

feat: 联想词搜索问题修复

parent c2f5d45c
......@@ -52,6 +52,8 @@ class HotSearchActivity : BaseMvpActivity<IHotSearchContract.View, IHotSearchCon
private var historyList: FixSizeLinkedList<String> = FixSizeLinkedList(15)
private val bannerList = ArrayList<String>()
private var lenovoResultSuccess = false // 联想结果 联想前false 联想成功后true
companion object {
private const val CACHE_CONSULT_SEARCH_HISTORY_DATA = "cache_consult_search_history_data"
private const val HOT_SEARCH_DOCTOR_NAME = "hot_search_doctor_name"
......@@ -111,7 +113,14 @@ class HotSearchActivity : BaseMvpActivity<IHotSearchContract.View, IHotSearchCon
// 搜索的关联词
var relatedWords = ""
var isRecommendWords = false
if (searchSuggestList.isNotEmpty() && searchSuggestList.size > 0) {
if (!lenovoResultSuccess){ // 如果每次输入内容后联想词结果还没返回结果则直接进行搜索
if (etSearch.text.toString().isNullOrEmpty()) {
doSearch(etSearch.hint.toString(), relatedWords, isRecommendWords)
} else {
doSearch(etSearch.text.toString(), relatedWords, isRecommendWords)
}
}else if (searchSuggestList.isNotEmpty() && searchSuggestList.size > 0) {
if (searchSuggestList[0].suggest_relations.size > 0) {
relatedWords = searchSuggestList[0].suggest_relations[0]
isRecommendWords = true
......@@ -120,7 +129,7 @@ class HotSearchActivity : BaseMvpActivity<IHotSearchContract.View, IHotSearchCon
relatedWords = searchSuggestList[0].suggest_content
}
if (searchSuggestList?.get(0)?.suggest_types?.contains(JUMP_WORD)) {
if (searchSuggestList[0].suggest_types.contains(JUMP_WORD)) {
NewH5Activity.start(this, H5Params(searchSuggestList[0].jump_url!!, null))
} else {
if (etSearch.text.toString().isNullOrEmpty()) {
......@@ -231,6 +240,7 @@ class HotSearchActivity : BaseMvpActivity<IHotSearchContract.View, IHotSearchCon
*/
private fun getSearchWords(searchContent: String, isClickWords: Boolean) {
if (!TextUtils.isEmpty(searchContent)) {
lenovoResultSuccess = false
mSearchContent = searchContent
val map = HashMap<String, Any>()
map["content"] = searchContent
......@@ -245,6 +255,7 @@ class HotSearchActivity : BaseMvpActivity<IHotSearchContract.View, IHotSearchCon
searchContent: String,
isClickWords: Boolean
) {
lenovoResultSuccess = true
if (isClickWords) {
//判断 suggest_classify_types 有值则通过 jump_url跳转
// 搜索的关联词
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment