package com.swago.user.level

import com.alibaba.android.arouter.launcher.ARouter
import com.bumptech.glide.Glide
import com.swago.baseswago.constant.ARouteConstant
import com.swago.baseswago.fragment.BaseXFragment
import com.swago.baseswago.util.AppContext
import com.swago.baseswago.util.NoDoubleClickListener
import com.swago.baseswago.util.UserInfo
import com.swago.user.R
import com.swago.user.databinding.FragmentRichLevelBinding

/**
 *@date 2021/11/21 12:39
 *description:
 */
class RichLevelFragment : BaseXFragment<FragmentRichLevelBinding>() {

    override fun loadData() {
    }

    override fun initOther() {
        UserInfo.getUserInfo()?.let {
            binding.tvLevel.text = it.user_wealth_level
            binding.tvStart.text = it.user_wealth_level
            binding.tvEnd.text = it.next_wealth_level
            binding.tvNeedToExp.text = AppContext.getContext().resources.getString(R.string.level_up_exp).format(it.next_wealth_need_jingyan)
            Glide.with(this).load(it.user_head_img_url)
                .placeholder(R.mipmap.default_avatar)
                .error(R.mipmap.default_avatar).into(binding.ivAvatar)
        }

        binding.tvGetExp.setOnClickListener(object:NoDoubleClickListener(){
            override fun onClick() {
                ARouter.getInstance().build(ARouteConstant.User.recharge).navigation()
            }
        })

        binding.tvKnowDetail.setOnClickListener(object:NoDoubleClickListener(){
            override fun onClick() {

            }
        })


    }

    override fun initLiveData() {
    }
}