Commit 9c5f7d00 by 霍志良

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

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