package com.zj365.mime.act

import android.text.Html
import com.alibaba.android.arouter.facade.annotation.Route
import com.xty.base.act.BaseVmAct
import com.xty.common.Const
import com.xty.common.arouter.ARouterUrl
import com.xty.common.setImage
import com.zj365.mime.R
import com.zj365.mime.databinding.ActElectronBinding
import com.zj365.mime.vm.ElectronicVm
import java.util.*

/**
 * 电子协议查看
 */
@Route(path = ARouterUrl.ELECTRONIC)
class ElectronicAct : BaseVmAct<ElectronicVm>() {
    val binding by lazy{ActElectronBinding.inflate(layoutInflater)}

    var time=""
    var picture=""
    override fun setLayout()=binding.root
    override fun initData() {
        super.initData()
        isDarkBar=true
        time=intent.extras!!.getString("time").toString()
        picture=intent.extras!!.getString("picture").toString()
    }
    override fun initView() {
        super.initView()
        statusBar(binding.title.mView)
        binding.title.mIvBack.setOnClickListener { finish() }
        binding.title.mTvTitle.text = getString(R.string.elec_protocol)
        mViewModel.getPrev(Const.AGREEMENT_6)
    }
    override fun liveObserver() {
        mViewModel.prevLive.observe(this){
            binding.mRich.text=Html.fromHtml(it.data.content)
            binding.mImage.setImage(this,picture)
            binding.mTvTime.text = "签约时间：$time"
        }
    }
}