Commit 95c0a5d6 authored by yinjiacheng's avatar yinjiacheng

update 商品发布成功后动态切换审核中列表

parent 003ce9be
......@@ -27,6 +27,13 @@ import org.greenrobot.eventbus.ThreadMode
class CommodityManagementActivity : BaseMvvmActivity<CommodityActivityCommodityManagementBinding, CommodityManagementViewModel>(),
XPageViewProtocol {
companion object {
// 审核中 tabId
private const val ID_COMMODITY_AUDIT = 2
}
private var auditPageIndex: Int = -1
override val layoutId: Int = R.layout.commodity_activity_commodity_management
override val vm: CommodityManagementViewModel by viewModels()
......@@ -48,6 +55,13 @@ class CommodityManagementActivity : BaseMvvmActivity<CommodityActivityCommodityM
) { tab, position ->
tab.text = it[position].name
}.attach()
// 记录审核中页面下标
it.forEachIndexed { index, commodityStatus ->
if (commodityStatus.tabId == ID_COMMODITY_AUDIT) {
auditPageIndex = index
}
}
})
// 请求商品状态列表
vm.requestCommodityStatusList()
......@@ -78,8 +92,8 @@ class CommodityManagementActivity : BaseMvvmActivity<CommodityActivityCommodityM
when (event?.name) {
XEventConfig.COMMODITY_PUBLISH_SUCCESS -> {
// 商品发布成功 跳转审核中列表并刷新列表
binding.vpCommodityList.currentItem = 1
(supportFragmentManager.findFragmentByTag("f1") as CommodityListFragment).refreshCommodityList()
binding.vpCommodityList.currentItem = auditPageIndex
(supportFragmentManager.findFragmentByTag("f$auditPageIndex") as CommodityListFragment).refreshCommodityList()
}
}
}
......
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