中建365-二期优化
parent
4176e8ed0f
commit
69a139a865
@ -0,0 +1,43 @@
|
|||||||
|
package com.zj365.dc.activity
|
||||||
|
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.view.View
|
||||||
|
import androidx.fragment.app.Fragment
|
||||||
|
import com.alibaba.android.arouter.facade.annotation.Route
|
||||||
|
import com.xty.base.act.BaseVmAct
|
||||||
|
import com.xty.base.vm.BaseVm
|
||||||
|
import com.xty.common.arouter.ARouterUrl
|
||||||
|
import com.zj365.dc.databinding.ActWatchFamilyHealthBinding
|
||||||
|
import com.zj365.dc.fragment.DynamicManagementFrag
|
||||||
|
|
||||||
|
@Route(path = ARouterUrl.WATCH_FAMILY_HEALTH)
|
||||||
|
class WatchFamilyHealthAct : BaseVmAct<BaseVm>() {
|
||||||
|
|
||||||
|
val binding by lazy { ActWatchFamilyHealthBinding.inflate(layoutInflater) }
|
||||||
|
|
||||||
|
var showIdInfo = ""
|
||||||
|
override fun liveObserver() {
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun initView() {
|
||||||
|
super.initView()
|
||||||
|
statusBar(binding.title.mView)
|
||||||
|
binding.title.mTvTitle.text ="健康监测"
|
||||||
|
binding.title.mIvBack.setOnClickListener {
|
||||||
|
finish()
|
||||||
|
}
|
||||||
|
|
||||||
|
showIdInfo = intent.extras!!.getString("id","")
|
||||||
|
|
||||||
|
supportFragmentManager.beginTransaction().replace(binding.container.id, setArgumentFrag(DynamicManagementFrag(),showIdInfo)).commit()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun setArgumentFrag(frag: Fragment, id: String = ""): Fragment {
|
||||||
|
val bundle = Bundle()
|
||||||
|
bundle.putString("id", id)
|
||||||
|
frag.arguments = bundle
|
||||||
|
return frag
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun setLayout() = binding.root
|
||||||
|
}
|
@ -1,226 +0,0 @@
|
|||||||
/*
|
|
||||||
package com.zj365.dc.fragment
|
|
||||||
|
|
||||||
import android.view.View
|
|
||||||
import androidx.recyclerview.widget.*
|
|
||||||
import com.tencent.qcloud.tuikit.tuiconversation.classicui.util.TUIConversationUtils
|
|
||||||
import com.xty.base.fragment.BaseVmFrag
|
|
||||||
import com.xty.common.*
|
|
||||||
import com.xty.common.arouter.ARouterUrl
|
|
||||||
import com.xty.common.arouter.RouteManager
|
|
||||||
import com.xty.common.util.CommonUtils
|
|
||||||
import com.xty.network.model.ExpertBean
|
|
||||||
import com.xty.network.model.KeeperBean
|
|
||||||
import com.xty.network.model.ScienceBean
|
|
||||||
|
|
||||||
class ServerFrag : BaseVmFrag<ServerVm>() {
|
|
||||||
val binding by lazy { FragServerBinding.inflate(layoutInflater) }
|
|
||||||
val adapterSince by lazy { ScienceAdapter() }
|
|
||||||
val gjAdalter by lazy { GjAdapter() }
|
|
||||||
val proAdalter by lazy { ProAdapter() }
|
|
||||||
|
|
||||||
val sexIcon by lazy { arrayOf(R.mipmap.ic_male, R.mipmap.ic_female) }
|
|
||||||
var clickOnline: KeeperBean? = null
|
|
||||||
override fun setLayout(): View = binding.root
|
|
||||||
|
|
||||||
override fun setViewModel() = ServerVm()
|
|
||||||
|
|
||||||
override fun observer() {
|
|
||||||
mViewModel.keeperLive.observe(this) {
|
|
||||||
binding.mNoNetwork.root.visibility = View.GONE
|
|
||||||
if (!it.data.isNullOrEmpty()) {
|
|
||||||
val keeperBean = it.data[0]
|
|
||||||
clickOnline = keeperBean
|
|
||||||
binding.mDocName.text = keeperBean.realname
|
|
||||||
binding.mDocName.tag = keeperBean.id
|
|
||||||
binding.mPosition.text = keeperBean.positionName
|
|
||||||
binding.mImageSex.setImageResource(sexIcon[keeperBean.getGenderValue()])
|
|
||||||
binding.mTvLoc.text =
|
|
||||||
"${if (keeperBean.organization.isNullOrEmpty()) "无" else keeperBean.organization} ${if (keeperBean.dictName.isNullOrEmpty()) "无" else keeperBean.dictName}"
|
|
||||||
binding.mTitleGj.visibility = View.VISIBLE
|
|
||||||
// binding.mViewGj.visibility = View.VISIBLE
|
|
||||||
binding.mPhoto.tag =
|
|
||||||
if (keeperBean.avatar.isNullOrEmpty()) "" else getImageUrl(keeperBean.avatar)
|
|
||||||
binding.mPhoto.apply {
|
|
||||||
setImageUser(requireContext(), getImageUrl(keeperBean.avatar))
|
|
||||||
}
|
|
||||||
binding.llgj.visibility = View.VISIBLE
|
|
||||||
} else {
|
|
||||||
binding.llgj.visibility = View.GONE
|
|
||||||
binding.mTitleGj.visibility = View.GONE
|
|
||||||
// binding.mViewGj.visibility = View.GONE
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
mViewModel.keeperLiveList.observe(this) {
|
|
||||||
binding.mNoNetwork.root.visibility = View.GONE
|
|
||||||
var listAll = mutableListOf<List<KeeperBean>>()
|
|
||||||
var step = (0 until it.data.size).step(2)
|
|
||||||
for (i in step) {
|
|
||||||
var list = mutableListOf<KeeperBean>()
|
|
||||||
list.add(it.data[i])
|
|
||||||
if (it.data.size > i + 1) {
|
|
||||||
list.add(it.data[i + 1])
|
|
||||||
}
|
|
||||||
listAll.add(list)
|
|
||||||
}
|
|
||||||
gjAdalter.setNewInstance(it.data)
|
|
||||||
|
|
||||||
}
|
|
||||||
mViewModel.scinceLive.observe(this) {
|
|
||||||
binding.mNoNetwork.root.visibility = View.GONE
|
|
||||||
adapterSince.setNewInstance(it.data)
|
|
||||||
}
|
|
||||||
|
|
||||||
mViewModel.expertInfoList.observe(this) {
|
|
||||||
var listAll = mutableListOf<List<ExpertBean>>()
|
|
||||||
var step = (0 until it.data.records.size)
|
|
||||||
for (i in step) {
|
|
||||||
var list = mutableListOf<ExpertBean>()
|
|
||||||
list.add(it.data.records[i])
|
|
||||||
listAll.add(list)
|
|
||||||
}
|
|
||||||
proAdalter.setNewInstance(it.data.records)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun initView() {
|
|
||||||
super.initView()
|
|
||||||
statusBar(binding.mStatusBar)
|
|
||||||
initProAdapter()
|
|
||||||
initGjAdapter()
|
|
||||||
initAdapter()
|
|
||||||
binding.mNoNetwork.mRefreshBtn.isSelected = true
|
|
||||||
binding.mNoNetwork.mRefreshBtn.setOnClickListener {
|
|
||||||
mViewModel.getExpertInfoList(1, 20)
|
|
||||||
mViewModel.getKeeper()
|
|
||||||
mViewModel.getKeeperList()
|
|
||||||
mViewModel.getScinceList()
|
|
||||||
|
|
||||||
}
|
|
||||||
binding.mTvOnLine.setOnClickListener {
|
|
||||||
clickOnline?.let {
|
|
||||||
bundle.clear()
|
|
||||||
bundle.putSerializable("bean", clickOnline)
|
|
||||||
RouteManager.goAct(ARouterUrl.ONLINE_MAKE, bundle)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
binding.llNext.setOnClickListener {
|
|
||||||
onEventObject(requireContext(), UmengEventId.OperGuide)
|
|
||||||
RouteManager.goAct(ARouterUrl.GUIDE)
|
|
||||||
}
|
|
||||||
mViewModel.getExpertInfoList(1, 20)
|
|
||||||
mViewModel.getKeeper()
|
|
||||||
mViewModel.getKeeperList()
|
|
||||||
mViewModel.getScinceList()
|
|
||||||
|
|
||||||
binding.clGj.setOnClickListener {
|
|
||||||
bundle.clear()
|
|
||||||
CommonUtils.getMyUserInfo()?.let {
|
|
||||||
val name = binding.mDocName.text?.toString()
|
|
||||||
val toUserId = binding.mDocName.tag?.toString()
|
|
||||||
val fromUserId = id?.toString()
|
|
||||||
val chatImage = binding.mPhoto.tag?.toString()
|
|
||||||
if (toUserId.isNullOrEmpty() || fromUserId.isNullOrEmpty()) {
|
|
||||||
return@setOnClickListener
|
|
||||||
}
|
|
||||||
// bundle.putString("title",name)
|
|
||||||
// bundle.putString("toUserId",toUserId)
|
|
||||||
// bundle.putString("fromUserId", fromUserId)
|
|
||||||
// bundle.putString("chatImage", chatImage)
|
|
||||||
// RouteManager.goAct(ARouterUrl.CHAT_MSG,bundle)
|
|
||||||
TUIConversationUtils.startAYSingleChatActivity("man_$toUserId", name, chatImage);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
refresh()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onResume() {
|
|
||||||
super.onResume()
|
|
||||||
if (!checkNetworkAvailable(requireContext())) {
|
|
||||||
binding.mNoNetwork.root.visibility = View.VISIBLE
|
|
||||||
} else {
|
|
||||||
// if (binding.mNoNetwork.root.visibility == View.VISIBLE) {
|
|
||||||
LogUtils.e("yansu:4444444444444444444444")
|
|
||||||
mViewModel.getExpertInfoList(1, 20)
|
|
||||||
mViewModel.getKeeper()
|
|
||||||
mViewModel.getKeeperList()
|
|
||||||
// mViewModel.getScinceList()
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 刷新注册
|
|
||||||
private fun refresh() {
|
|
||||||
refresh.setRefresh(binding.mRefresh) {
|
|
||||||
mViewModel.getExpertInfoList(1, 20)
|
|
||||||
mViewModel.getKeeper()
|
|
||||||
mViewModel.getKeeperList()
|
|
||||||
mViewModel.getScinceList()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun initProAdapter() {
|
|
||||||
binding.mRecycleprofession.layoutManager =
|
|
||||||
LinearLayoutManager(requireContext(), RecyclerView.HORIZONTAL, false)
|
|
||||||
binding.mRecycleprofession.adapter = proAdalter
|
|
||||||
// val pageHelper = LinearSnapHelper()
|
|
||||||
// pageHelper.attachToRecyclerView(binding.mRecycleprofession)
|
|
||||||
gjAdalter.addChildClickViewIds(R.id.mImage, R.id.card1)
|
|
||||||
gjAdalter.setOnItemChildClickListener { adapter, view, position ->
|
|
||||||
when (view.id) {
|
|
||||||
R.id.mImage -> {
|
|
||||||
bundle.clear()
|
|
||||||
val bean = adapter.getItem(position) as KeeperBean;
|
|
||||||
bundle.putSerializable("url", bean.introUrl)
|
|
||||||
bundle.putString("titleName", requireContext().getString(R.string.title_name))
|
|
||||||
RouteManager.goAct(ARouterUrl.EXPERT_CHIEF, bundle)
|
|
||||||
}
|
|
||||||
R.id.card1 -> {
|
|
||||||
bundle.clear()
|
|
||||||
val bean = adapter.getItem(position) as KeeperBean;
|
|
||||||
bundle.putSerializable("bean", bean)
|
|
||||||
RouteManager.goAct(ARouterUrl.HOUSEKEEP_INFO, bundle)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
proAdalter.setOnItemClickListener { adapter, view, position ->
|
|
||||||
bundle.clear()
|
|
||||||
val bean = adapter.getItem(position) as ExpertBean;
|
|
||||||
bundle.putSerializable("url", bean.infoPhotoUrl)
|
|
||||||
RouteManager.goAct(ARouterUrl.EXPERT_CHIEF, bundle)
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun initGjAdapter() {
|
|
||||||
binding.mRecycle.layoutManager =
|
|
||||||
LinearLayoutManager(requireContext(), RecyclerView.HORIZONTAL, false)
|
|
||||||
binding.mRecycle.adapter = gjAdalter
|
|
||||||
// val pageHelper = LinearSnapHelper()
|
|
||||||
// pageHelper.attachToRecyclerView(binding.mRecycle)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun initAdapter() {
|
|
||||||
binding.mRecycleNews.layoutManager = LinearLayoutManager(requireContext())
|
|
||||||
binding.mRecycleNews.adapter = adapterSince
|
|
||||||
adapterSince.setOnItemClickListener { adapter, view, position ->
|
|
||||||
bundle.clear()
|
|
||||||
var bean = adapter.getItem(position) as ScienceBean
|
|
||||||
bundle.putSerializable("bean", bean)
|
|
||||||
onEventObject(requireContext(), UmengEventId.HealthScience, "${bean.name}")
|
|
||||||
RouteManager.goAct(ARouterUrl.SCIENCE_DETAIL, bundle)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}*/
|
|
@ -0,0 +1,17 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<include layout="@layout/title_white_bar"
|
||||||
|
android:id="@+id/title"/>
|
||||||
|
|
||||||
|
<FrameLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_marginTop="-12dp"
|
||||||
|
android:layout_below="@+id/title"
|
||||||
|
android:id="@+id/container"/>
|
||||||
|
|
||||||
|
</RelativeLayout>
|
Loading…
Reference in New Issue