Commit 37a9a364 by upwork.021

feat: 排序接口以及逻辑修改代码提交

parent e4ed1517
...@@ -6,7 +6,7 @@ ext { ...@@ -6,7 +6,7 @@ ext {
// -------------- 业务模块 -------------- // -------------- 业务模块 --------------
//第三步 若干 //第三步 若干
"m-confide" : "0.0.49.72", "m-confide" : "0.0.49.72",
"m-consultant" : "0.0.60.21", "m-consultant" : "0.0.60.26",
"m-fm" : "0.0.30.08", "m-fm" : "0.0.30.08",
"m-user" : "0.0.62.04", "m-user" : "0.0.62.04",
"m-home" : "0.0.23.44", "m-home" : "0.0.23.44",
......
...@@ -349,9 +349,8 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres ...@@ -349,9 +349,8 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
private fun initData() { private fun initData() {
allFilter.showType.key = initShowType allFilter.showType.key = initShowType
allFilter.categories.clear()
getPresenter().fetchListHead()
getPresenter().fetchListHead()
v_loading.visibility = View.VISIBLE v_loading.visibility = View.VISIBLE
v_loading.setViewType(LogoLoadingView.TYPE_LOADING, null) v_loading.setViewType(LogoLoadingView.TYPE_LOADING, null)
...@@ -739,21 +738,29 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres ...@@ -739,21 +738,29 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
} else { } else {
bury(keyWord ?: "", data.size > 0, isRecommend, fromPages[fromPageType]) bury(keyWord ?: "", data.size > 0, isRecommend, fromPages[fromPageType])
} }
// 如果是第一页
if (curPage==1){ if (curPage==1){
hasMore = true if (data.size>=10){
doctorAdapter.hasMore = true hasMore = true
doctorAdapter.hasMore = true
}else{
hasMore = false
doctorAdapter.hasMore = false
}
doctorList.clear() doctorList.clear()
} }
if (extras==null||data.size==0) { if (data.size==0) { // data的长度为0的时候为最后一页
hasMore = false hasMore = false
doctorAdapter.hasMore = false doctorAdapter.hasMore = false
}else{
doctorList.addAll(data)
} }
doctorList.addAll(data)
doctorAdapter.notifyDataSetChanged() doctorAdapter.notifyDataSetChanged()
isDoSearch = false isDoSearch = false
isRecommend = false isRecommend = false
v_loading.visibility = View.GONE v_loading.visibility = View.GONE
ll_network_error.visibility = View.GONE ll_network_error.visibility = View.GONE
......
...@@ -222,11 +222,11 @@ class ExpertSearchPresenter : SimplePresenter<IExpertSearchView>() { ...@@ -222,11 +222,11 @@ class ExpertSearchPresenter : SimplePresenter<IExpertSearchView>() {
.subscribe(Consumer { .subscribe(Consumer {
// 当前页数 // 当前页数
val curPage = (it.skip/it.limit)+1 val curPage = (it.skip/it.limit)+1
if (null != it.objects && it.objects.isNotEmpty()) { if (curPage==1&&it.objects.size==0){
mView.fetchListEmpty("没有搜到相关信息,换个关键词看看吧")
}else{
mExtras = it.extras mExtras = it.extras
mView.onDoctorListFetched(it.objects, mExtras,curPage) mView.onDoctorListFetched(it.objects, mExtras,curPage)
} else if (curPage==1&&(null == it.objects || it.objects.isEmpty())){
mView.fetchListEmpty("没有搜到相关信息,换个关键词看看吧")
} }
}, object : ThrowableConsumer() { }, object : ThrowableConsumer() {
override fun accept(msg: String) { override fun accept(msg: String) {
......
...@@ -227,23 +227,23 @@ class ExpertSearchAdapter( ...@@ -227,23 +227,23 @@ class ExpertSearchAdapter(
holder.tvTeamCertifications.text = itemBean.title holder.tvTeamCertifications.text = itemBean.title
//咨询师标签 //咨询师标签
holder.ll_tags.removeAllViews() holder.ll_tags.removeAllViews()
itemBean.tagList?.let { itemBean.feature_tags?.let {
if (it.isNotEmpty()){ if (it.isNotEmpty()){
for (tag in itemBean.tagList){ for (tag in itemBean.feature_tags){
val view = LayoutInflater.from(context).inflate(R.layout.consultant_item_tag, holder.ll_tags, false) val view = LayoutInflater.from(context).inflate(R.layout.consultant_item_tag, holder.ll_tags, false)
tag.tagName?.let { name -> tag.tag_name.let { name ->
if (name.length>4){ if (name.length>4){
view.tvTag.text = "${name.substring(0,4)}…" view.tvTag.text = "${name.substring(0,4)}…"
}else{ }else{
view.tvTag.text = name view.tvTag.text = name
} }
} }
if (tag.isHigh==1){ if (tag.is_highlight){
view.tvTag.setBackgroundResource(R.drawable.consultant_bg_radius_line_eb892c) view.tvTag.setBackgroundResource(R.drawable.consultant_bg_radius_line_eb892c)
view.tvTag.setTextColor(ContextCompat.getColor(context,R.color.color_EB892C)) view.tvTag.setTextColor(ContextCompat.getColor(context,R.color.color_EB892C))
}else{ }else{
view.tvTag.setBackgroundResource(R.drawable.consultant_bg_radius_line_gray_1) view.tvTag.setBackgroundResource(R.drawable.consultant_bg_radius_line_gray_1)
view.tvTag.setTextColor(ContextCompat.getColor(context,R.color.platform_color_E0E0E0)) view.tvTag.setTextColor(ContextCompat.getColor(context,R.color.platform_color_666666))
} }
holder.ll_tags.addView(view) holder.ll_tags.addView(view)
} }
...@@ -320,6 +320,7 @@ class ExpertSearchAdapter( ...@@ -320,6 +320,7 @@ class ExpertSearchAdapter(
} else if (holder is FooterViewHolder) { } else if (holder is FooterViewHolder) {
LogUtil.e("${listData.size}") LogUtil.e("${listData.size}")
LogUtil.e("${hasMore}")
if (hasMore) { if (hasMore) {
holder.itemView.visibility = View.VISIBLE holder.itemView.visibility = View.VISIBLE
holder.pbLoading.visibility = View.VISIBLE holder.pbLoading.visibility = View.VISIBLE
...@@ -331,12 +332,12 @@ class ExpertSearchAdapter( ...@@ -331,12 +332,12 @@ class ExpertSearchAdapter(
} }
} }
override fun getItemCount(): Int = override fun getItemCount(): Int = listData.size + 1
if (listData.size < ExpertSearchActivity.PAGE_SIZE && hasMore) { // if (listData.size < ExpertSearchActivity.PAGE_SIZE && hasMore) {
listData.size // listData.size
} else { // } else {
listData.size + 1 // listData.size + 1
} // }
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder = override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder =
when (viewType) { when (viewType) {
......
...@@ -12,7 +12,7 @@ data class ExpertBean( ...@@ -12,7 +12,7 @@ data class ExpertBean(
val skip : Int = 0, val skip : Int = 0,
val limit : Int = 0, val limit : Int = 0,
val size : Int = 10, val size : Int = 10,
val objects : MutableList<ExpertServiceItem>?, val objects : MutableList<ExpertServiceItem>,
// 分页需要 // 分页需要
val extras: Extras?) val extras: Extras?)
......
...@@ -131,10 +131,12 @@ data class ExpertServiceItem( ...@@ -131,10 +131,12 @@ data class ExpertServiceItem(
/** /**
* 新标签分类 * 新标签分类
*/ */
val tagList: ArrayList<TagBean>? val feature_tags: ArrayList<FeatureTag>?
) )
data class TagBean( data class FeatureTag(
val tagName:String?, val tag_id:Int,
val isHigh:Int val tag_name:String,
val is_highlight:Boolean, // 是否高亮
val type:String // 标签类型
) )
\ No newline at end of file
...@@ -286,43 +286,42 @@ class FilterPopupWindow(private val context: Context, private val filterData: Fi ...@@ -286,43 +286,42 @@ class FilterPopupWindow(private val context: Context, private val filterData: Fi
//用户行为数据埋点 //用户行为数据埋点
biEvent(biEventName, biEventParams) biEvent(biEventName, biEventParams)
// sb.append("&page=").append(1) // ExpertSearchDataManager.getHttp().getFilterCount(sb.toString())
ExpertSearchDataManager.getHttp().getFilterCount(sb.toString()) // .subscribeOn(Schedulers.io())
.subscribeOn(Schedulers.io()) // .compose(RxUtils.resultJavaData())
.compose(RxUtils.resultJavaData()) // .map { it }
.map { it } // .filter { true }
.filter { true } // .observeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread()) // .subscribe({
.subscribe({ //
// contentView.btnConfirm.text = if (it > 0) "确定" else "暂无匹配咨询师"
contentView.btnConfirm.text = if (it > 0) "确定" else "暂无匹配咨询师" // //按钮置灰/解除置灰
//按钮置灰/解除置灰 // contentView.btnConfirm.isEnabled = it > 0
contentView.btnConfirm.isEnabled = it > 0 // if (it > 0) {
if (it > 0) { // contentView.btnConfirm.setTextColor(
contentView.btnConfirm.setTextColor( // ContextCompat.getColor(
ContextCompat.getColor( // context,
context, // R.color.platform_but_text_color
R.color.platform_but_text_color // )
) // )
) // contentView.btnConfirm.background =
contentView.btnConfirm.background = // ContextCompat.getDrawable(context, R.drawable.consultant_bg_radius_5_dark)
ContextCompat.getDrawable(context, R.drawable.consultant_bg_radius_5_dark) //// contentView.btnConfirm.setTextColor(ContextCompat.getColor(context,R.color.consultant_white))
// contentView.btnConfirm.setTextColor(ContextCompat.getColor(context,R.color.consultant_white)) // } else {
} else { // contentView.btnConfirm.setTextColor(
contentView.btnConfirm.setTextColor( // ContextCompat.getColor(
ContextCompat.getColor( // context,
context, // R.color.platform_text_light_color
R.color.platform_text_light_color // )
) // )
) // contentView.btnConfirm.background =
contentView.btnConfirm.background = // ContextCompat.getDrawable(context, R.drawable.consultant_bg_radius_5_light)
ContextCompat.getDrawable(context, R.drawable.consultant_bg_radius_5_light) //// contentView.btnConfirm.setTextColor(ContextCompat.getColor(context,R.color.color_999999))
// contentView.btnConfirm.setTextColor(ContextCompat.getColor(context,R.color.color_999999)) // }
} //
// }, {
}, { // ToastHelper.show(it.message!!)
ToastHelper.show(it.message!!) // })
})
} }
private fun biEvent(biEventName: String, biEventParams: String = "") { private fun biEvent(biEventName: String, biEventParams: String = "") {
......
...@@ -8,6 +8,6 @@ ...@@ -8,6 +8,6 @@
android:gravity="center" android:gravity="center"
android:layout_marginEnd="6dp" android:layout_marginEnd="6dp"
android:padding="3dp" android:padding="3dp"
android:textColor="@color/platform_color_999999" android:textColor="@color/platform_color_666666"
android:textSize="10sp" android:textSize="10sp"
tools:text="恋爱情感" /> tools:text="恋爱情感" />
...@@ -211,12 +211,11 @@ ...@@ -211,12 +211,11 @@
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="44dp" android:layout_height="44dp"
android:layout_marginStart="10dp" android:layout_marginStart="10dp"
android:layout_marginLeft="10dp"
android:layout_weight="1" android:layout_weight="1"
android:background="@drawable/consultant_bg_radius_5_light" android:background="@drawable/consultant_bg_radius_5_dark"
android:gravity="center" android:gravity="center"
android:hint="暂无匹配咨询师" android:hint="确定"
android:textColor="@color/platform_but_text_color" android:textColor="@color/white"
android:textColorHint="@color/platform_color_E0E0E0" android:textColorHint="@color/platform_color_E0E0E0"
android:textSize="16sp" /> android:textSize="16sp" />
</LinearLayout> </LinearLayout>
......
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