Commit 37a9a364 by upwork.021

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

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