Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
ShenghuoquanBusiness
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
bp
ShenghuoquanBusiness
Commits
86b7d40d
Commit
86b7d40d
authored
Jun 22, 2021
by
yinjiacheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix SHQBD-213 SHQBD-175 SHQBD-159 商户管理中心加下拉刷新功能,同步生活号认证状态变化
parent
c81f1f49
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
118 additions
and
51 deletions
+118
-51
YdBaseApplication.kt
...mmon/src/main/java/com/yidian/common/YdBaseApplication.kt
+2
-2
MerchantCenterActivity.kt
...nghuoquan/newscontent/ui/center/MerchantCenterActivity.kt
+79
-27
activity_merchant_center.xml
...scontent/src/main/res/layout/activity_merchant_center.xml
+37
-22
No files found.
CommonLib/Common/src/main/java/com/yidian/common/YdBaseApplication.kt
View file @
86b7d40d
...
...
@@ -24,14 +24,14 @@ open class YdBaseApplication : Application() {
private
fun
initSmartRefreshLayout
()
{
//设置全局的Header构建器
SmartRefreshLayout
.
setDefaultRefreshHeaderCreator
{
context
,
layout
->
layout
.
setPrimaryColorsId
(
R
.
color
.
white
)
//全局设置主题颜色
layout
.
setPrimaryColorsId
(
android
.
R
.
color
.
transparent
)
//全局设置主题颜色
ClassicsHeader
(
context
)
//指定为经典Header,默认是 贝塞尔雷达Header
}
//设置全局的Footer构建器
SmartRefreshLayout
.
setDefaultRefreshFooterCreator
{
context
,
layout
->
layout
.
setEnableLoadMoreWhenContentNotFull
(
true
)
//内容不满一页时候启用加载更多
val
footer
=
ClassicsFooter
(
context
)
footer
.
setBackgroundResource
(
R
.
color
.
white
)
footer
.
setBackgroundResource
(
android
.
R
.
color
.
transparent
)
footer
.
setDrawableSize
(
20f
)
footer
.
spinnerStyle
=
SpinnerStyle
.
FixedBehind
//设置为固定在背后模式
footer
//指定为经典Footer,默认是 BallPulseFooter
...
...
Components/newscontent/src/main/java/com/yidian/shenghuoquan/newscontent/ui/center/MerchantCenterActivity.kt
View file @
86b7d40d
...
...
@@ -4,6 +4,8 @@ import android.os.Bundle
import
android.view.View
import
androidx.core.content.ContextCompat
import
androidx.recyclerview.widget.LinearLayoutManager
import
com.scwang.smart.refresh.layout.api.RefreshLayout
import
com.scwang.smart.refresh.layout.listener.OnRefreshListener
import
com.yidian.common.XEventConfig
import
com.yidian.common.XRouterPathConstants
import
com.yidian.common.base.BaseActivity
...
...
@@ -41,10 +43,10 @@ import org.greenrobot.eventbus.ThreadMode
* description: 商户管理中心
*/
class
MerchantCenterActivity
:
BaseActivity
<
ActivityMerchantCenterBinding
>(),
IGetConfigListCallback
,
IGetLifeAccountListCallback
,
MerchantSwitchDialog
.
OnMerchantSwitchCallback
,
IGetConfigListCallback
,
MerchantSwitchDialog
.
OnMerchantSwitchCallback
,
LifeAccountLabelView
.
OnLifeAccountLabelCallback
,
IGetLifeAccountInfoByIdCallback
,
MerchantCenterBottomHintDialog
.
OnMerchantCenterBottomHintCallback
,
IAuthMerchantCheckCallback
,
MerchantServiceFunctionAdapter
.
OnItemClickListener
,
CommonTopBarView
.
OnCommonTopBarActionCallback
{
MerchantServiceFunctionAdapter
.
OnItemClickListener
,
CommonTopBarView
.
OnCommonTopBarActionCallback
,
OnRefreshListener
{
companion
object
{
// 传递的生活号信息
...
...
@@ -61,6 +63,11 @@ class MerchantCenterActivity : BaseActivity<ActivityMerchantCenterBinding>(),
*/
private
lateinit
var
curLifeAccount
:
LifeAccountItemBean
.
Response
/**
* 当前配置数据
*/
private
lateinit
var
curConfigData
:
GetConfigListBean
.
Response
/**
* 功能-页面表
*/
...
...
@@ -99,27 +106,46 @@ class MerchantCenterActivity : BaseActivity<ActivityMerchantCenterBinding>(),
private
fun
initListener
()
{
viewBind
.
lvLifeAccountLabel
.
setOnLifeAccountLabelCallback
(
this
)
// 设置下拉刷新监听
viewBind
.
rlRefresh
.
setOnRefreshListener
(
this
)
// 禁用上拉加载更多
viewBind
.
rlRefresh
.
setEnableLoadMore
(
false
)
}
private
fun
initData
()
{
val
params
=
intent
.
getSerializableExtra
(
XRouterPathConstants
.
ParamsKey
)
?.
let
{
it
as
HashMap
<*,
*>
}
// 切换主体入口判断
val
params
=
intent
.
getSerializableExtra
(
XRouterPathConstants
.
ParamsKey
)
?.
let
{
it
as
HashMap
<*,
*>
}
// 切换主体入口是否展示判断
viewBind
.
bvTopBar
.
setActionVisibility
(
params
?.
get
(
EXTRA_IS_MULTI
)
?.
let
{
it
as
Boolean
}
?:
false
)
curLifeAccount
=
params
?.
get
(
EXTRA_LIFE_ACCOUNT_INFO
)
?.
let
{
it
as
LifeAccountItemBean
.
Response
}
?:
return
// 设置当前生活号信息
curLifeAccount
=
params
?.
get
(
EXTRA_LIFE_ACCOUNT_INFO
)
?.
let
{
it
as
LifeAccountItemBean
.
Response
}
?:
return
// 设置标签
viewBind
.
lvLifeAccountLabel
.
setLifeAccountData
(
curLifeAccount
)
// 展示底部浮窗
showMerchantCenterBottomHint
(
curLifeAccount
)
// 请求功能入口配置清单
ApiService
.
getConfigList
(
this
)
}
/**
* 刷新商户管理中心相关数据
*/
private
fun
refreshMerchantCenterData
(
data
:
LifeAccountItemBean
.
Response
)
{
// 设置标签
viewBind
.
lvLifeAccountLabel
.
setLifeAccountData
(
data
)
// 展示底部浮窗
showMerchantCenterBottomHint
(
data
)
// 生成当前生活号状态下的功能集
if
(
this
::
curConfigData
.
isInitialized
)
generateFunctionPermissionMap
(
curConfigData
,
data
.
tag
.
tag_key
)
}
// 判断是否提示认证升级或提示认证驳回
if
(
curLifeAccount
.
life_account_type
==
Constant
.
TYPE_LIFE_ACCOUNT_PERSONAL
&&
curLifeAccount
.
life_account_auth_status
==
Constant
.
STATUS_AUTH_NOT
&&
curLifeAccount
.
enterprise_audit_status
==
0
/**
* 展示商户管理中心底部浮窗
* 判断是否提示认证升级或提示认证驳回
* @param data 当前生活号数据
*/
private
fun
showMerchantCenterBottomHint
(
data
:
LifeAccountItemBean
.
Response
)
{
if
(
data
.
life_account_type
==
Constant
.
TYPE_LIFE_ACCOUNT_PERSONAL
&&
data
.
life_account_auth_status
==
Constant
.
STATUS_AUTH_NOT
&&
data
.
enterprise_audit_status
==
0
)
{
// 当前是个人未认证生活号 提示认证升级
MerchantCenterBottomHintDialog
(
...
...
@@ -127,7 +153,7 @@ class MerchantCenterActivity : BaseActivity<ActivityMerchantCenterBinding>(),
MerchantCenterBottomHintDialog
.
TYPE_AUTH_UPGRADE
,
this
).
show
()
}
if
(
curLifeAccount
.
enterprise_audit_status
==
Constant
.
STATUS_AUDIT_REJECT
)
{
if
(
data
.
enterprise_audit_status
==
Constant
.
STATUS_AUDIT_REJECT
)
{
// 当前企业认证驳回 提示修改
MerchantCenterBottomHintDialog
(
this
,
...
...
@@ -167,6 +193,8 @@ class MerchantCenterActivity : BaseActivity<ActivityMerchantCenterBinding>(),
* todo 优化逻辑
*/
private
fun
generateFunctionPermissionMap
(
data
:
GetConfigListBean
.
Response
,
tagKey
:
Int
)
{
if
(
data
.
merchant_manager_center
.
items
.
isEmpty
())
return
functionPermissionList
.
clear
()
when
(
tagKey
)
{
Constant
.
LIFE_ACCOUNT_TAG_COMMON_ENTERPRISE_AUTH
->
{
// 普通企业认证
...
...
@@ -243,6 +271,7 @@ class MerchantCenterActivity : BaseActivity<ActivityMerchantCenterBinding>(),
override
fun
getConfigListSuccess
(
result
:
GetConfigListBean
.
Response
?)
{
result
?.
let
{
curConfigData
=
it
generateFunctionPageMap
(
it
)
generateFunctionPermissionMap
(
it
,
curLifeAccount
.
tag
.
tag_key
)
filterMerchantServiceData
(
it
)
...
...
@@ -258,16 +287,6 @@ class MerchantCenterActivity : BaseActivity<ActivityMerchantCenterBinding>(),
}
override
fun
getLifeAccountListSuccess
(
result
:
ArrayList
<
LifeAccountItemBean
.
Response
>?)
{
// 生活号列表请求成功 弹出切换主体弹窗
result
?.
let
{
MerchantSwitchDialog
(
this
,
curLifeAccount
.
life_account_id
,
it
,
this
).
show
()
}
}
override
fun
getLifeAccountListFailure
(
message
:
String
?)
{
}
override
fun
onLifeAccountSelect
(
data
:
LifeAccountItemBean
.
Response
)
{
// 用户切换主体 更新当前生活号信息
curLifeAccount
=
data
...
...
@@ -423,7 +442,18 @@ class MerchantCenterActivity : BaseActivity<ActivityMerchantCenterBinding>(),
override
fun
onDoAction
()
{
// 切换主体 请求生活号列表接口
ApiService
.
getLifeAccountList
(
this
)
ApiService
.
getLifeAccountList
(
object
:
IGetLifeAccountListCallback
{
override
fun
getLifeAccountListSuccess
(
result
:
ArrayList
<
LifeAccountItemBean
.
Response
>?)
{
// 生活号列表请求成功 弹出切换主体弹窗
result
?.
let
{
MerchantSwitchDialog
(
this
@MerchantCenterActivity
,
curLifeAccount
.
life_account_id
,
it
,
this
@MerchantCenterActivity
).
show
()
}
}
override
fun
getLifeAccountListFailure
(
message
:
String
?)
{
}
})
}
@Subscribe
(
sticky
=
false
,
threadMode
=
ThreadMode
.
MAIN
)
...
...
@@ -436,4 +466,26 @@ class MerchantCenterActivity : BaseActivity<ActivityMerchantCenterBinding>(),
}
}
}
override
fun
onRefresh
(
refreshLayout
:
RefreshLayout
)
{
// 刷新数据
ApiService
.
getLifeAccountList
(
object
:
IGetLifeAccountListCallback
{
override
fun
getLifeAccountListSuccess
(
result
:
ArrayList
<
LifeAccountItemBean
.
Response
>?)
{
// 刷新成功
refreshLayout
.
finishRefresh
(
true
)
result
?.
forEach
{
if
(
curLifeAccount
.
life_account_id
==
it
.
life_account_id
)
{
curLifeAccount
=
it
// 刷新数据
refreshMerchantCenterData
(
it
)
}
}
}
override
fun
getLifeAccountListFailure
(
message
:
String
?)
{
// 刷新失败
refreshLayout
.
finishRefresh
(
false
)
}
})
}
}
Components/newscontent/src/main/res/layout/activity_merchant_center.xml
View file @
86b7d40d
...
...
@@ -14,30 +14,45 @@
app:CommonTopBarView_title_text=
"@string/management_center"
app:layout_constraintTop_toTopOf=
"parent"
/>
<com.yidian.shenghuoquan.newscontent.widget.LifeAccountLabelView
android:id=
"@+id/lv_life_account_label"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@id/bv_top_bar"
/>
<com.yidian.shenghuoquan.newscontent.widget.MerchantAssetView
android:id=
"@+id/av_merchant_asset"
android:layout_width=
"match_parent"
android:layout_height=
"125dp"
android:layout_marginStart=
"15dp"
android:layout_marginEnd=
"15dp"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@id/lv_life_account_label"
/>
<androidx.recyclerview.widget.RecyclerView
android:id=
"@+id/rv_service_group"
<com.scwang.smart.refresh.layout.SmartRefreshLayout
android:id=
"@+id/rl_refresh"
android:layout_width=
"match_parent"
android:layout_height=
"0dp"
android:layout_marginTop=
"10dp"
android:paddingStart=
"15dp"
android:paddingEnd=
"15dp"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@id/av_merchant_asset"
/>
app:layout_constraintTop_toBottomOf=
"@id/bv_top_bar"
>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
<com.yidian.shenghuoquan.newscontent.widget.LifeAccountLabelView
android:id=
"@+id/lv_life_account_label"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
/>
<com.yidian.shenghuoquan.newscontent.widget.MerchantAssetView
android:id=
"@+id/av_merchant_asset"
android:layout_width=
"match_parent"
android:layout_height=
"125dp"
android:layout_marginStart=
"15dp"
android:layout_marginEnd=
"15dp"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@id/lv_life_account_label"
/>
<androidx.recyclerview.widget.RecyclerView
android:id=
"@+id/rv_service_group"
android:layout_width=
"match_parent"
android:layout_height=
"0dp"
android:layout_marginTop=
"10dp"
android:paddingStart=
"15dp"
android:paddingEnd=
"15dp"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@id/av_merchant_asset"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</com.scwang.smart.refresh.layout.SmartRefreshLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment