|
|
|
@ -1,6 +1,5 @@
|
|
|
|
|
package com.zj365.dc.fragment
|
|
|
|
|
|
|
|
|
|
import android.R.attr.path
|
|
|
|
|
import android.content.Intent
|
|
|
|
|
import android.provider.Settings
|
|
|
|
|
import android.view.View
|
|
|
|
@ -29,7 +28,6 @@ import com.xty.common.util.CommonUtils
|
|
|
|
|
import com.xty.network.model.BannerBean
|
|
|
|
|
import com.xty.network.model.FamilyBean
|
|
|
|
|
import com.xty.network.model.HomeLayoutBean
|
|
|
|
|
import com.xty.network.model.MainBean
|
|
|
|
|
import com.xty.network.model.ScienceBean
|
|
|
|
|
import com.youth.banner.indicator.RoundLinesIndicator
|
|
|
|
|
import com.youth.banner.listener.OnPageChangeListener
|
|
|
|
@ -45,6 +43,8 @@ import com.zj365.dc.vm.HomeVm
|
|
|
|
|
import com.zj365.dc.weight.AgainSignDialog
|
|
|
|
|
import com.zj365.health.weight.DialogTip
|
|
|
|
|
import com.zj365.mime.weight.NoticeSettingDialog
|
|
|
|
|
import kotlinx.coroutines.delay
|
|
|
|
|
import kotlinx.coroutines.launch
|
|
|
|
|
import org.greenrobot.eventbus.EventBus
|
|
|
|
|
import org.greenrobot.eventbus.Subscribe
|
|
|
|
|
import org.greenrobot.eventbus.ThreadMode
|
|
|
|
@ -149,6 +149,21 @@ HealthHomeFrag : BaseVmFrag<HomeVm>() {
|
|
|
|
|
bundle.putString("url", bannerBean.linkAddress)
|
|
|
|
|
RouteManager.goAct(ARouterUrl.WEB_ACT, bundle)
|
|
|
|
|
}
|
|
|
|
|
20 ->{
|
|
|
|
|
val appId = "wx032bacb749c0dcb0" // 填移动应用(App)的 AppId,非小程序的 AppID
|
|
|
|
|
|
|
|
|
|
val api = WXAPIFactory.createWXAPI(ApplicationContext.context, appId)
|
|
|
|
|
|
|
|
|
|
val req = WXLaunchMiniProgram.Req()
|
|
|
|
|
req.userName = bannerBean.wxId// 填小程序原始id
|
|
|
|
|
|
|
|
|
|
// req.path = it ////拉起小程序页面的可带参路径,不填默认拉起小程序首页,对于小游戏,可以只传入 query 部分,来实现传参效果,如:传入 "?foo=bar"。
|
|
|
|
|
|
|
|
|
|
req.miniprogramType =
|
|
|
|
|
WXLaunchMiniProgram.Req.MINIPTOGRAM_TYPE_RELEASE // 可选打开 开发版,体验版和正式版
|
|
|
|
|
|
|
|
|
|
api.sendReq(req)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -177,6 +192,22 @@ HealthHomeFrag : BaseVmFrag<HomeVm>() {
|
|
|
|
|
bundle.putString("url", bannerBean.linkAddress)
|
|
|
|
|
RouteManager.goAct(ARouterUrl.WEB_ACT, bundle)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
20 ->{
|
|
|
|
|
val appId = "wx032bacb749c0dcb0" // 填移动应用(App)的 AppId,非小程序的 AppID
|
|
|
|
|
|
|
|
|
|
val api = WXAPIFactory.createWXAPI(requireContext(), appId)
|
|
|
|
|
|
|
|
|
|
val req = WXLaunchMiniProgram.Req()
|
|
|
|
|
req.userName = bannerBean.wxId // 填小程序原始id
|
|
|
|
|
|
|
|
|
|
//req.path = it ////拉起小程序页面的可带参路径,不填默认拉起小程序首页,对于小游戏,可以只传入 query 部分,来实现传参效果,如:传入 "?foo=bar"。
|
|
|
|
|
|
|
|
|
|
req.miniprogramType =
|
|
|
|
|
WXLaunchMiniProgram.Req.MINIPTOGRAM_TYPE_RELEASE // 可选打开 开发版,体验版和正式版
|
|
|
|
|
|
|
|
|
|
api.sendReq(req)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
setOnClickListener()
|
|
|
|
@ -200,34 +231,12 @@ HealthHomeFrag : BaseVmFrag<HomeVm>() {
|
|
|
|
|
binding.mCom.rvLayout.adapter = layoutTopAdapter
|
|
|
|
|
layoutTopAdapter.setOnItemClickListener { adapter, view, position ->
|
|
|
|
|
|
|
|
|
|
CommonToastUtils.showToast("敬请期待")
|
|
|
|
|
/*var contentData = adapter.getItem(position) as HomeLayoutBean.HomeChildBean
|
|
|
|
|
|
|
|
|
|
var contentData = adapter.getItem(position) as HomeLayoutBean.HomeChildBean
|
|
|
|
|
when(contentData.jumpType){
|
|
|
|
|
1 ->{
|
|
|
|
|
contentData.jumpUrl?.let {
|
|
|
|
|
when(contentData.jumpUrl){
|
|
|
|
|
"AI_TONGUE" ->{ //AI 舌诊
|
|
|
|
|
onEventObject(requireContext(), UmengEventId.HealthRisk)
|
|
|
|
|
bundle.clear()
|
|
|
|
|
bundle.putString("id", showIdInfo)
|
|
|
|
|
RouteManager.goAct(ARouterUrl.TONGUE_MAIN_ACTIVITY, bundle)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
"AI_TUMOR" ->{ //防癌
|
|
|
|
|
bundle.clear()
|
|
|
|
|
bundle.putString("id", showIdInfo)
|
|
|
|
|
RouteManager.goAct(ARouterUrl.PRVENT_CANCER, bundle)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
"MEALS"->{ //膳食管理
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
else ->{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
CommonToastUtils.showToast("敬请期待")
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -241,16 +250,16 @@ HealthHomeFrag : BaseVmFrag<HomeVm>() {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
else ->{
|
|
|
|
|
3 ->{
|
|
|
|
|
contentData.jumpUrl?.let {
|
|
|
|
|
val appId = "wx032bacb749c0dcb0" // 填移动应用(App)的 AppId,非小程序的 AppID
|
|
|
|
|
|
|
|
|
|
val api = WXAPIFactory.createWXAPI(ApplicationContext.context, appId)
|
|
|
|
|
val api = WXAPIFactory.createWXAPI(requireContext(), appId)
|
|
|
|
|
|
|
|
|
|
val req = WXLaunchMiniProgram.Req()
|
|
|
|
|
req.userName = "gh_d43f693ca31f" // 填小程序原始id
|
|
|
|
|
req.userName = contentData.wxId // 填小程序原始id
|
|
|
|
|
|
|
|
|
|
req.path = it ////拉起小程序页面的可带参路径,不填默认拉起小程序首页,对于小游戏,可以只传入 query 部分,来实现传参效果,如:传入 "?foo=bar"。
|
|
|
|
|
// req.path = it ////拉起小程序页面的可带参路径,不填默认拉起小程序首页,对于小游戏,可以只传入 query 部分,来实现传参效果,如:传入 "?foo=bar"。
|
|
|
|
|
|
|
|
|
|
req.miniprogramType =
|
|
|
|
|
WXLaunchMiniProgram.Req.MINIPTOGRAM_TYPE_RELEASE // 可选打开 开发版,体验版和正式版
|
|
|
|
@ -259,7 +268,11 @@ HealthHomeFrag : BaseVmFrag<HomeVm>() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}*/
|
|
|
|
|
|
|
|
|
|
4 ->{
|
|
|
|
|
CommonToastUtils.showToast("敬请期待")
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -299,6 +312,10 @@ HealthHomeFrag : BaseVmFrag<HomeVm>() {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
"PSYCHOLOGY" ->{
|
|
|
|
|
CommonToastUtils.showToast("敬请期待")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
else ->{
|
|
|
|
|
CommonToastUtils.showToast("敬请期待")
|
|
|
|
|
}
|
|
|
|
@ -317,16 +334,16 @@ HealthHomeFrag : BaseVmFrag<HomeVm>() {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
else ->{
|
|
|
|
|
3 ->{
|
|
|
|
|
contentData.jumpUrl?.let {
|
|
|
|
|
val appId = "wx032bacb749c0dcb0" // 填移动应用(App)的 AppId,非小程序的 AppID
|
|
|
|
|
|
|
|
|
|
val api = WXAPIFactory.createWXAPI(ApplicationContext.context, appId)
|
|
|
|
|
val api = WXAPIFactory.createWXAPI(requireContext(), appId)
|
|
|
|
|
|
|
|
|
|
val req = WXLaunchMiniProgram.Req()
|
|
|
|
|
req.userName = "gh_d43f693ca31f" // 填小程序原始id
|
|
|
|
|
req.userName = contentData.wxId // 填小程序原始id
|
|
|
|
|
|
|
|
|
|
req.path = it ////拉起小程序页面的可带参路径,不填默认拉起小程序首页,对于小游戏,可以只传入 query 部分,来实现传参效果,如:传入 "?foo=bar"。
|
|
|
|
|
//req.path = it ////拉起小程序页面的可带参路径,不填默认拉起小程序首页,对于小游戏,可以只传入 query 部分,来实现传参效果,如:传入 "?foo=bar"。
|
|
|
|
|
|
|
|
|
|
req.miniprogramType =
|
|
|
|
|
WXLaunchMiniProgram.Req.MINIPTOGRAM_TYPE_RELEASE // 可选打开 开发版,体验版和正式版
|
|
|
|
@ -335,6 +352,10 @@ HealthHomeFrag : BaseVmFrag<HomeVm>() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
4 ->{
|
|
|
|
|
CommonToastUtils.showToast("敬请期待")
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -452,25 +473,6 @@ HealthHomeFrag : BaseVmFrag<HomeVm>() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private fun setOnClickListener() {
|
|
|
|
|
/*binding.mChildView.llAiConfectioner.setOnClickListener(onClickListener)
|
|
|
|
|
binding.mChildView.llAiSkinMeasurement.setOnClickListener(onClickListener)
|
|
|
|
|
binding.mChildView.llCancerScreening.setOnClickListener(onClickListener)
|
|
|
|
|
|
|
|
|
|
binding.mChildView.llMentalTest.setOnClickListener(onClickListener)
|
|
|
|
|
binding.mChildView.llAiTongueDiagnosis.setOnClickListener(onClickListener)
|
|
|
|
|
binding.mChildView.llDietManagement.setOnClickListener(onClickListener)*/
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
binding.mCom.llHealthRecords.setOnClickListener(onClickListener)
|
|
|
|
|
*//*binding.mChildHomeView.mRelInterDk.setOnClickListener(onClickListener)
|
|
|
|
|
binding.mChildHomeView.mRelInterBD.setOnClickListener(onClickListener)
|
|
|
|
|
binding.mChildHomeView.mRelInterFamily.setOnClickListener(onClickListener)*//*
|
|
|
|
|
binding.mCom.llHealthCode.setOnClickListener(onClickListener)
|
|
|
|
|
binding.mCom.llDailyBenefit.setOnClickListener(onClickListener)
|
|
|
|
|
binding.mCom.llVideoInterview.setOnClickListener(onClickListener)
|
|
|
|
|
*//*binding.mOrganView.llCompare.setOnClickListener(onClickListener)
|
|
|
|
|
binding.myManager.setOnClickListener(onClickListener)
|
|
|
|
|
binding.myHealthDa.setOnClickListener(onClickListener)*/
|
|
|
|
|
|
|
|
|
|
binding.tvMore.setOnClickListener {
|
|
|
|
|
RouteManager.goAct(ARouterUrl.SCIENCE_LIST)
|
|
|
|
@ -516,16 +518,21 @@ HealthHomeFrag : BaseVmFrag<HomeVm>() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private fun request() {
|
|
|
|
|
mViewModel.getBanners(CommonUtils.getMyUserId(),1)//当期登录用户id
|
|
|
|
|
mainScope.launch {
|
|
|
|
|
mViewModel.getBanners(CommonUtils.getMyUserId(),1)//当期登录用户id
|
|
|
|
|
|
|
|
|
|
delay(1000)
|
|
|
|
|
|
|
|
|
|
mViewModel.getBanners(CommonUtils.getMyUserId(),2)//当期登录用户id
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// mViewModel.getMyFamilyList()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mViewModel.getScinceList()
|
|
|
|
|
|
|
|
|
|
mViewModel.getHomeLayout()
|
|
|
|
|
|
|
|
|
|
mViewModel.getBanners(CommonUtils.getMyUserId(),2)//当期登录用户id
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -540,17 +547,24 @@ HealthHomeFrag : BaseVmFrag<HomeVm>() {
|
|
|
|
|
if (null == it) {
|
|
|
|
|
return@observe
|
|
|
|
|
}
|
|
|
|
|
if (it[1].isNullOrEmpty()){
|
|
|
|
|
binding.mBanner.visibility = View.GONE
|
|
|
|
|
}else{
|
|
|
|
|
binding.mBanner.visibility = View.VISIBLE
|
|
|
|
|
|
|
|
|
|
mBannerAdapter.setDatas(it[1])
|
|
|
|
|
mBannerAdapter.notifyDataSetChanged()
|
|
|
|
|
|
|
|
|
|
mBannerAdapter.setDatas(it[1])
|
|
|
|
|
}
|
|
|
|
|
if(it[2].isNullOrEmpty()){
|
|
|
|
|
binding.mBannerTwo.visibility = View.GONE
|
|
|
|
|
binding.mBannerCardTwo.visibility = View.GONE
|
|
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
binding.mBannerTwo.visibility = View.VISIBLE
|
|
|
|
|
binding.mBannerCardTwo.visibility = View.VISIBLE
|
|
|
|
|
mMiddleBannerAdapter.setDatas(it[2])
|
|
|
|
|
mMiddleBannerAdapter.notifyDataSetChanged()
|
|
|
|
|
// mMiddleBannerAdapter.notifyDataSetChanged()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
mViewModel.scinceLive.observe(this) {
|
|
|
|
@ -585,7 +599,13 @@ HealthHomeFrag : BaseVmFrag<HomeVm>() {
|
|
|
|
|
|
|
|
|
|
mViewModel.layoutLive.observe(this){
|
|
|
|
|
layoutTopAdapter.setNewInstance(it.data.top)
|
|
|
|
|
binding.mChildView.homeContentRv.layoutManager = GridLayoutManager(requireContext(),it.data.middle.size/2)
|
|
|
|
|
if(it.data.middle.size <= 6){
|
|
|
|
|
binding.mChildView.homeContentRv.layoutManager = GridLayoutManager(requireContext(),3)
|
|
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
binding.mChildView.homeContentRv.layoutManager = GridLayoutManager(requireContext(),4)
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
layoutContentAdapter.setNewInstance(it.data.middle)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -666,7 +686,7 @@ HealthHomeFrag : BaseVmFrag<HomeVm>() {
|
|
|
|
|
signDialog.dismiss()
|
|
|
|
|
}
|
|
|
|
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
|
|
|
|
fun LoginOrRegisterChange(event: LoginOrRegisterEvent){
|
|
|
|
|
fun loginOrRegisterChange(event: LoginOrRegisterEvent){
|
|
|
|
|
showIdInfo =if (MMkvHelper.getLong(Const.USER_ID).toString() == "0") {
|
|
|
|
|
""
|
|
|
|
|
} else {
|
|
|
|
|