Commit 9c5f7d00 by 霍志良

feat:首页金刚位跳转传递参数

parent f0c45081
......@@ -40,7 +40,6 @@ import com.yidianling.common.tools.LogUtil
import com.yidianling.common.tools.RxImageTool
import com.yidianling.common.tools.ToastUtil
import com.yidianling.consultant.adapter.ExpertSearchAdapter
import com.yidianling.consultant.bean.FunctionWordConsultBean
import com.yidianling.consultant.constants.ConsultBIConstants
import com.yidianling.consultant.constants.ConsultBIConstants.ConsultEvent.Companion.YDL_USER_CONSULT_SEARCH_CLICK
import com.yidianling.consultant.listener.OnCategoriesSelectedListener
......@@ -64,6 +63,7 @@ import org.json.JSONObject
import java.util.concurrent.Executors
import java.util.concurrent.TimeUnit
@Route(path = "/consult/list")
class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPresenter>(),
View.OnClickListener, IExpertSearchView,
......@@ -107,6 +107,7 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
}
companion object {
const val GO_CRITERIA = "go_criteria"
const val EXTRA_CATEGORY = "category"
const val EXTRA_CATEGORY_NAME = "category_name"
const val EXTRA_SHOW_TYPE = "showType"
......@@ -198,6 +199,7 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
private var hasMore = true
private var initCategory = "0"
private var initShowType: Int = 1
private lateinit var mapFilter: HashMap<String, Any>
private lateinit var doctorAdapter: ExpertSearchAdapter
private lateinit var onScrollListener: EndlessRecyclerViewScrollListener
private var headData: HeadData? = null //筛选数据
......@@ -341,7 +343,7 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
override fun onLoadMore(page: Int, totalItemsCount: Int, view: RecyclerView?) {
if (hasMore) {
getPresenter().fetchListData(allFilter, getPresenter().mExtras)
getPresenter().fetchListData(allFilter, getPresenter().mExtras, mapFilter)
}
}
}
......@@ -388,6 +390,18 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
fromPageType = mIntent.getIntExtra(EXTRA_FROM_PAGE, -1)
initCategory = mIntent.getStringExtra(EXTRA_CATEGORY) ?: ""
initShowType = mIntent.getIntExtra(EXTRA_SHOW_TYPE, 0)
//首页金刚位传递过来的动态Map参数
val jsonObject: JSONObject = JSONObject(mIntent.getStringExtra(GO_CRITERIA))
mapFilter = HashMap<String, Any>()
val iterator = jsonObject.keys()
while (iterator.hasNext()) {
val key = iterator.next()
mapFilter[key] = jsonObject[key]
}
initCategory = mIntent.getStringExtra("cateId")
cateName = mIntent.getStringExtra("cateTitle")
mSign2 = cateName!!
initShowType = mIntent.getStringExtra("showType").toInt()
val relatedWord = mIntent.getStringExtra(EXTRA_RELATED_WORD) // 搜索内容的联想词
searchWord = mIntent.getStringExtra(EXTRA_SEARCH_WORD)
val isRecommendWords = mIntent.getBooleanExtra(EXTRA_IS_RECCOMMEND_WORD, false)
......@@ -1533,7 +1547,7 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
srlContainer.isRefreshing = isShowRefresh!!
onScrollListener.resetState()
getPresenter().mExtras = null
getPresenter().fetchListData(allFilter, getPresenter().mExtras)
getPresenter().fetchListData(allFilter, getPresenter().mExtras, mapFilter)
rvExperts.scrollToPosition(0)
}
......@@ -1622,6 +1636,6 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
override fun onPriceItemSelected(priceRangesItem: PriceRangesItem) {
//价格筛选回调
allFilter.priceRanges = priceRangesItem
getPresenter().fetchListData(allFilter, getPresenter().mExtras)
getPresenter().fetchListData(allFilter, getPresenter().mExtras, mapFilter)
}
}
......@@ -294,7 +294,7 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
override fun onLoadMore(page: Int, totalItemsCount: Int, view: RecyclerView?) {
if (hasMore) {
getPresenter().fetchListData(allFilter, getPresenter().mExtras)
getPresenter().fetchListData(allFilter, getPresenter().mExtras, null)
}
}
}
......@@ -1451,7 +1451,7 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
}
onScrollListener.resetState()
getPresenter().mExtras = null
getPresenter().fetchListData(allFilter, getPresenter().mExtras)
getPresenter().fetchListData(allFilter, getPresenter().mExtras, null)
rvExperts.scrollToPosition(0)
}
......@@ -1522,6 +1522,6 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
override fun onPriceItemSelected(priceRange: PriceRangesItem) {
//价格筛选回调
allFilter.priceRanges = priceRange
getPresenter().fetchListData(allFilter, getPresenter().mExtras)
getPresenter().fetchListData(allFilter, getPresenter().mExtras, null)
}
}
......@@ -63,7 +63,7 @@ class ExpertSearchPresenter : SimplePresenter<IExpertSearchView>() {
}
@SuppressLint("CheckResult")
fun fetchListData(allFilter: AllFilter, extras: Extras?) {
fun fetchListData(allFilter: AllFilter, extras: Extras?, mapFilter: HashMap<String, Any>?) {
//是否亲子教育字段
// ConsultAssistantDialogUtils.REALATION_EDUCATION = allFilter.categories.size == 1 && allFilter.categories[0].cateId == "23"
......@@ -197,12 +197,16 @@ class ExpertSearchPresenter : SimplePresenter<IExpertSearchView>() {
}
}
}
if (gender.size>0){
if (gender.size > 0) {
val genderMap = HashMap<String, Any>()
genderMap["in"] = gender
filterMap["gender"] = genderMap
}
}
//首页金刚位传过来的搜索MAP结果集
if (mapFilter != null) {
filterMap.putAll(mapFilter)
}
map["filter"] = filterMap
// sorts
......
......@@ -79,7 +79,9 @@ open class HomeBaseImpl : IHomeBaseEvent {
?: ""
)
if (!ModularServiceManager.provide(IUserService::class.java).loginByOneKeyLogin(mContext as Context,true)) {
if (!ModularServiceManager.provide(IUserService::class.java)
.loginByOneKeyLogin(mContext as Context, true)
) {
//跳转登录
return
}
......@@ -165,11 +167,18 @@ open class HomeBaseImpl : IHomeBaseEvent {
}
ActionCountUtils.count(HomeBIConstants.YDL_USER_TELEPHONE_CUSTOMER_SERVICE_CLICK)
val tel =
if (PlatformRamImpl.getInstance().getGlobalInfo() == null) "400-765-1010" else PlatformRamImpl.getInstance().getGlobalInfo()!!.info.tel
if (PlatformRamImpl.getInstance()
.getGlobalInfo() == null
) "400-765-1010" else PlatformRamImpl.getInstance().getGlobalInfo()!!.info.tel
var con = "\n400-765-1010\n早8:30-凌晨2:00"
if (PlatformRamImpl.getInstance().getGlobalInfo() != null && PlatformRamImpl.getInstance().getGlobalInfo()!!.info != null) {
if (PlatformRamImpl.getInstance()
.getGlobalInfo() != null && PlatformRamImpl.getInstance()
.getGlobalInfo()!!.info != null
) {
con =
PlatformRamImpl.getInstance().getGlobalInfo()?.info?.tel + "\n" + PlatformRamImpl.getInstance().getGlobalInfo()?.info?.work_time
PlatformRamImpl.getInstance()
.getGlobalInfo()?.info?.tel + "\n" + PlatformRamImpl.getInstance()
.getGlobalInfo()?.info?.work_time
}
val dialog = CommonDialog(mContext)
......@@ -231,7 +240,7 @@ open class HomeBaseImpl : IHomeBaseEvent {
}
override fun categoryClick(data: HomeHeaderBean.AskCategoryDataBean) {
override fun categoryClick(data: HomeHeaderBean.CategoryGoldListDataBean) {
// linkTo(data.url.toString())
if (Utils.isFastClick()) {
//防止连击
......@@ -239,18 +248,16 @@ open class HomeBaseImpl : IHomeBaseEvent {
}
ActionCountUtils.count(
HomeBIConstants.YDL_USER_CONSULT_CLASSIFICATION_CLICK,
data.cateId.toString(),
data.cateTitle
data.id.toString(),
data.title
?: ""
)
goExpertSearch(data)
}
private fun goExpertSearch(data: HomeHeaderBean.AskCategoryDataBean) {
if (!TextUtils.isEmpty(data.url) && data.url!!.endsWith("?")) {
data.url = data.url!!.substring(0, data.url!!.length - 1)
}
if ("全部类别" == data.cateTitle || "全部分类" == data.cateTitle) {
private fun goExpertSearch(data: HomeHeaderBean.CategoryGoldListDataBean) {
if ("全部类别" == data.title || "全部分类" == data.title) {
/*YDLRouterManager.router(
IYDLRouterConstant.ROUTER_H5_H5,
YDLRouterParams().putExtra(
......@@ -262,17 +269,33 @@ open class HomeBaseImpl : IHomeBaseEvent {
EventBus.getDefault().post(HomeModuleTabEvent(2))
} else {
//跳转咨询频道页 服务入口
YDLRouterManager.router(
IYDLRouterConstant.ROUTER_CONSULT_LIST,
YDLRouterParams().putExtra(
IYDLRouterConstant.EXTRA_CATEID,
data.cateId.toString()
).putExtra(
IYDLRouterConstant.EXTRA_CATETITLE, data.cateTitle!!
).putExtra(
IYDLRouterConstant.EXTRA_SHOWTYPE, "0"
)
)
/* YDLRouterManager.router(
IYDLRouterConstant.ROUTER_CONSULT_LIST,
data.goCriteria?.let {
YDLRouterParams().putExtra(
IYDLRouterConstant.EXTRA_CATEID,
data.id.toString()
).putExtra(
IYDLRouterConstant.EXTRA_CATETITLE, data.title.toString()
).putExtra(
IYDLRouterConstant.GO_CRITERIA, it)
.putExtra(
IYDLRouterConstant.EXTRA_SHOWTYPE, "0"
)
}
)*/
// YDLRouterManager.Companion.router(ROUTER_MUSE_PLAY,
// new YDLRouterParams().putExtra("MEDITATION_ID", String.valueOf(meditationId))
// .putExtra("MEDIA_ID", String.valueOf(mediaId))
// .putExtra("MEDITATION_TYPE", String.valueOf(meditationType))
// .putExtra("MEDIA_COVER_URL", mediaCoverUrl));
ARouter.getInstance().build("/consult/list")
.withString(IYDLRouterConstant.EXTRA_CATEID, data.id)
.withString(IYDLRouterConstant.EXTRA_SHOWTYPE, "0")
.withString(IYDLRouterConstant.EXTRA_CATETITLE, data.title)
.withString(IYDLRouterConstant.GO_CRITERIA, data.goCriteria)
.navigation()
}
}
......@@ -290,7 +313,7 @@ open class HomeBaseImpl : IHomeBaseEvent {
return
}
EventBus.getDefault().post(
HomeModuleTabEvent(2,"11")
HomeModuleTabEvent(2, "11")
)
ActionCountUtils.count(HomeBIConstants.YDL_USER_CONSULT_CLICK)
}
......@@ -303,7 +326,11 @@ open class HomeBaseImpl : IHomeBaseEvent {
ActionCountUtils.count(HomeBIConstants.YDL_USER_TALK_IN_TIME_CLICK)
//倾诉首页 ydl-user://confide/home
ActionCountUtils.record("listen_counselor_list_page", "listen_counselor_list_page_visit", "1")
ActionCountUtils.record(
"listen_counselor_list_page",
"listen_counselor_list_page_visit",
"1"
)
route(mContext, ConfideRoute.R_CONFIDE_HOME)
}
......@@ -346,7 +373,7 @@ open class HomeBaseImpl : IHomeBaseEvent {
* 倾述咨询师点击
* @param linkUrl 跳转地址
*/
override fun confideClick(linkUrl: String?, confideId:String, doctorId: Int, uid:String?) {
override fun confideClick(linkUrl: String?, confideId: String, doctorId: Int, uid: String?) {
if (Utils.isFastClick()) {
//防止连击
return
......@@ -377,7 +404,9 @@ open class HomeBaseImpl : IHomeBaseEvent {
//防止连击
return
}
if (!ModularServiceManager.provide(IUserService::class.java).loginByOneKeyLogin(mContext as Context,true)) {
if (!ModularServiceManager.provide(IUserService::class.java)
.loginByOneKeyLogin(mContext as Context, true)
) {
//判断登录状态内部已完成 跳转登录
return
}
......@@ -451,7 +480,9 @@ open class HomeBaseImpl : IHomeBaseEvent {
}
override fun askItemFocusClick(position: Int, id: String) {
if (!ModularServiceManager.provide(IUserService::class.java).loginByOneKeyLogin(mContext as Context,true)) {
if (!ModularServiceManager.provide(IUserService::class.java)
.loginByOneKeyLogin(mContext as Context, true)
) {
//判断登录状态内部已完成 跳转登录
return
}
......@@ -460,7 +491,9 @@ open class HomeBaseImpl : IHomeBaseEvent {
}
override fun askItemZanClick(position: Int, index: Int, id: String) {
if (!ModularServiceManager.provide(IUserService::class.java).loginByOneKeyLogin(mContext as Context,true)) {
if (!ModularServiceManager.provide(IUserService::class.java)
.loginByOneKeyLogin(mContext as Context, true)
) {
//判断登录状态内部已完成 跳转登录
return
}
......
......@@ -72,7 +72,7 @@ interface IHomeBaseEvent {
/**
* 首页分类跳转
*/
fun categoryClick(category: HomeHeaderBean.AskCategoryDataBean)
fun categoryClick(category: HomeHeaderBean.CategoryGoldListDataBean)
/**
* 心理咨询点击事件
......
package com.yidianling.home.model.bean
import com.google.gson.annotations.SerializedName
import com.yidianling.consultant.bean.Keyworks
/**
......@@ -7,29 +8,40 @@ import com.yidianling.consultant.bean.Keyworks
* Des:首页头部模块数据 Banner&分类
*/
class HomeHeaderBean : HomeItemBaseBean {
constructor():super(false)
constructor(isRealEmpty:Boolean):super(isRealEmpty)
constructor() : super(false)
constructor(isRealEmpty: Boolean) : super(isRealEmpty)
/**
* 活动弹窗数据
*/
var activityResponse: ActivityResponse? = null
/**
* 分类数据
*/
var askCategoryData: MutableList<AskCategoryDataBean>? = null
/**
* 新版分类数据
*/
var goldList: MutableList<CategoryGoldListDataBean>? = null
/**
* 焦点图数据
*/
var focusList: List<FocusListBean>? = null
/**
* 滚动销售数据
*/
var homeSaleData: List<HomeSaleDataBean>? = null
/**
* 搜索关键词数据
*/
var keywordData: MutableList<Keyworks>? = null
/**
* 倾诉分类
*/
......@@ -39,28 +51,42 @@ class HomeHeaderBean : HomeItemBaseBean {
* 咨询分类
*/
var consultCategoryData: List<ConsultCategoryDateBean>? = null
/**
* 专家名称
*/
var doctorName : String? = null
var doctorName: String? = null
/*
* 倾诉免费标识
* */
var listenFree : Boolean? = null
var listenFree: Boolean? = null
data class CategoryGoldListDataBean(
var id: String? = "",
var title: String? = "",
var icon: String? = "",
var goType: String? = "",
var goUrl: String? = "",
var goCriteria: String? = ""
)
class AskCategoryDataBean {
/**
* id
*/
var cateId: Int = 0
/**
* 名称
*/
var cateTitle: String? = null //
/**
* 跳转url
*/
var url: String? = null
/**
* 图片icon
*/
......@@ -72,22 +98,27 @@ class HomeHeaderBean : HomeItemBaseBean {
* 标题
*/
var title: String? = null
/**
* 跳转链接
*/
var linkUrl: String? = null
/**
* 图片
*/
var imageUrl: String? = null
/**
* iPhone X图片
*/
var imageIphonex: String? = null
/**
* 焦点图id
*/
var focId: Int = 0
/**
* 分享数据
*/
......@@ -104,26 +135,32 @@ class HomeHeaderBean : HomeItemBaseBean {
* 用户昵称
*/
var nickName: String? = null
/**
* 老师名字
*/
var doctorName: String? = null
/**
* 老师id
*/
var doctorId: Int = 0
/**
* 跳转专家主页
*/
var url: String? = null
/**
* 内容开头
*/
var contentBefore: String? = null
/**
* 内容结尾
*/
var contentAfter: String? = null
/**
* 创建时间
*/
......@@ -135,11 +172,11 @@ class HomeHeaderBean : HomeItemBaseBean {
var name: String? = null
}
class ActivityResponse{
var imageBanner:String? = null// 弹窗图片
var imageUrl: String?=null// 图片
var linkUrl:String?=null // 首页弹窗
var btnLinkurl:String?=null // 首页入口(左上角图标)
var title :String? = null// 标题
class ActivityResponse {
var imageBanner: String? = null// 弹窗图片
var imageUrl: String? = null// 图片
var linkUrl: String? = null // 首页弹窗
var btnLinkurl: String? = null // 首页入口(左上角图标)
var title: String? = null// 标题
}
}
......@@ -24,9 +24,10 @@ class HomeCategoryAdapter : PagerAdapter {
private var mContext : Context? = null
private var mHomeEvent : IHomeBaseEvent? = null
//源数据
private var mOriginList : MutableList<HomeHeaderBean.AskCategoryDataBean>? = null
private var mOriginList: MutableList<HomeHeaderBean.AskCategoryDataBean>? = null
//数据
private var list : MutableList<MutableList<HomeHeaderBean.AskCategoryDataBean>>? = null
private var list: MutableList<MutableList<HomeHeaderBean.CategoryGoldListDataBean>>? = null
init {
list = ArrayList()
......@@ -40,13 +41,13 @@ class HomeCategoryAdapter : PagerAdapter {
/**
* 更新数据
*/
fun updateItems(data : MutableList<HomeHeaderBean.AskCategoryDataBean>?){
if (null == data || data.isEmpty()){
fun updateItems(data: MutableList<HomeHeaderBean.CategoryGoldListDataBean>?) {
if (null == data || data.isEmpty()) {
return
}
Log.e("http","--------------data.size="+data!!.size)
Log.e("http", "--------------data.size=" + data!!.size)
list = this.averageAssign(data, HomeCategoryContainer.PAGE_ITEM_SIZE)
Log.e("http","--------------list.size="+list!!.size)
Log.e("http", "--------------list.size=" + list!!.size)
notifyDataSetChanged()
}
......
......@@ -51,11 +51,12 @@ class HomeCategoryContainer(private val mContext: Context, private var homeEvent
* 填充数据
*/
fun initData(bean: HomeHeaderBean?) {
mHomeCategoryAdapter?.updateItems(bean?.askCategoryData)
if (bean?.askCategoryData?.size!! > PAGE_ITEM_SIZE) {
if (bean?.goldList == null) return
mHomeCategoryAdapter?.updateItems(bean?.goldList)
if (bean?.goldList?.size!! > PAGE_ITEM_SIZE) {
count = Math.ceil(
Math.ceil(
bean.askCategoryData?.size?.toFloat()?.div(PAGE_ITEM_SIZE.toFloat())
bean.goldList?.size?.toFloat()?.div(PAGE_ITEM_SIZE.toFloat())
?.toDouble()!!
)
).toInt()
......
......@@ -28,7 +28,8 @@ class HomePagerBannerCategoryItemView(mContext: Context, homeEvent: IHomeBaseEve
/**
* 数据缓存
*/
var mDataList: ArrayList<HomeHeaderBean.AskCategoryDataBean>? = null
var mDataList: ArrayList<HomeHeaderBean.CategoryGoldListDataBean>? = null
/**
* 分类view宽度
*/
......@@ -102,7 +103,7 @@ class HomePagerBannerCategoryItemView(mContext: Context, homeEvent: IHomeBaseEve
}
//, homeSaleData: List<HomeHeaderBean.HomeSaleDataBean>?
fun initData(askCategoryDataBean: MutableList<HomeHeaderBean.AskCategoryDataBean>?) {
fun initData(askCategoryDataBean: MutableList<HomeHeaderBean.CategoryGoldListDataBean>?) {
if (null == askCategoryDataBean || askCategoryDataBean.isEmpty()) {
visibility = View.GONE
return
......@@ -122,15 +123,18 @@ class HomePagerBannerCategoryItemView(mContext: Context, homeEvent: IHomeBaseEve
/**
* 判断数据是否变化
*/
private fun getChange(bean: MutableList<HomeHeaderBean.AskCategoryDataBean>?, cacheBean: MutableList<HomeHeaderBean.AskCategoryDataBean>?): Boolean {
private fun getChange(
bean: MutableList<HomeHeaderBean.CategoryGoldListDataBean>?,
cacheBean: MutableList<HomeHeaderBean.CategoryGoldListDataBean>?
): Boolean {
if (bean?.size != cacheBean?.size) {
return true
}
for (index in 0 until bean?.size!!) {
if (!bean[index].url.equals(cacheBean!![index].url)
|| !bean[index].coverUrl.equals(cacheBean!![index].coverUrl)
|| !bean[index].cateTitle.equals(cacheBean!![index].cateTitle)
|| bean[index].cateId != cacheBean!![index].cateId) {
if (!bean[index].icon.equals(cacheBean!![index].icon)
|| !bean[index].title.equals(cacheBean!![index].title)
|| bean[index].id != cacheBean!![index].id
) {
return true
}
}
......@@ -189,9 +193,12 @@ class HomePagerBannerCategoryItemView(mContext: Context, homeEvent: IHomeBaseEve
/**
* 加载图片
*/
private fun bindIconData(imageView: ImageView, categoryBean: HomeHeaderBean.AskCategoryDataBean) {
GlideApp.with(context).load(categoryBean.coverUrl)
.centerCrop().into(imageView)
private fun bindIconData(
imageView: ImageView,
categoryBean: HomeHeaderBean.CategoryGoldListDataBean
) {
GlideApp.with(context).load(categoryBean.icon)
.centerCrop().into(imageView)
}
/**
......@@ -219,8 +226,11 @@ class HomePagerBannerCategoryItemView(mContext: Context, homeEvent: IHomeBaseEve
/**
* 设置文本
*/
private fun bindTextData(textView: TextView, categoryBean: HomeHeaderBean.AskCategoryDataBean) {
textView.text = categoryBean.cateTitle
private fun bindTextData(
textView: TextView,
categoryBean: HomeHeaderBean.CategoryGoldListDataBean
) {
textView.text = categoryBean.title
}
/**
......
......@@ -82,6 +82,7 @@ interface IYDLRouterConstant{
const val EXTRA_RED_PACKET = "by_red_packet"
const val EXTRA_CONFIDEDID = "confidedId"
const val EXTRA_DOCTORID = "doctorId"
const val GO_CRITERIA = "go_criteria"
/**
* 冥想模块额外参数
......
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