package com.zj365.mime.act

import android.view.View
import com.alibaba.android.arouter.facade.annotation.Route
import com.xty.base.act.BaseVmAct
import com.xty.common.arouter.ARouterUrl
import com.xty.common.setImage
import com.zj365.mime.databinding.ActPersonInfoBinding
import com.zj365.mime.vm.PersonInfoVm
import com.xty.network.model.FriendInfo

@Route(path = ARouterUrl.PERSON_INFO)
class PersonInfoAct : BaseVmAct<PersonInfoVm>() {

    val binding by lazy { ActPersonInfoBinding.inflate(layoutInflater) }
    var personInfo: FriendInfo? = null
    override fun liveObserver() {
    }

    override fun setLayout(): View = binding.root

    override fun initData() {
        super.initData()
        personInfo = intent.getSerializableExtra("personInfo") as FriendInfo?
    }

    override fun initView() {
        super.initView()
        statusBar(binding.title.mView)
        binding.title.mTvTitle.text = "用户资料"
        binding.title.mIvBack.setOnClickListener {
            finish()
        }

        personInfo?.apply {
            binding.mImage.setImage(this@PersonInfoAct, avatarUrl)
            binding.mName.text = name
            binding.tvsex.text = if (sex == "1") {
                "男"
            } else {
                "女"
            }
            binding.mHeight.text ="${height}cm"
            binding.mWeight.text ="${weight}kg"
            binding.mAge.text = "${age}岁"
            binding.mArea.text = area
            binding.mHistoryMedic.text =historyName
            binding.mOtherName.text = urgent
            binding.mOtherPhone.text = urgentPhone
            binding.mRela.text = urgentRelation
        }
    }
}