package com.zswc.creativity.activity

import android.os.Bundle
import android.text.TextUtils
import com.zswc.creativity.base.MBActivity
import com.zswc.creativity.databinding.ActivityAuthenBinding
import com.zswc.creativity.databinding.ActivityPaySuessBinding
import com.zswc.creativity.databinding.ActivityWithdrawBinding
import com.zswc.creativity.databinding.ActivityWithdrawSuessBinding
import com.zswc.creativity.model.User
import com.zswc.creativity.vmodel.AuthenVModel
import com.zswc.creativity.vmodel.PaySuessVModel
import com.zswc.creativity.vmodel.WithdrawSuessVModel

/**
 * 认证成功界面
 *Created by shihuiyun
 *on 2020/9/24
 */
class AuthenActivity : MBActivity<AuthenVModel, ActivityAuthenBinding>() {

    override fun init(savedInstanceState: Bundle?) {
        super.init(savedInstanceState)

        var user=User.get()
        var name=user?.true_name
        var id_card=user?.id_card
        if(!TextUtils.isEmpty(name)) {
            var ss = name!!.substring(name!!.length - 1, name!!.length)

            var s1 = ""
            for (index in 0..name!!.length) {
                if (index < name!!.length - 1) {
                    s1 = "$s1*"
                }
            }
            s1 += ss
            vm.name.value=s1
        }

        if(!TextUtils.isEmpty(id_card)) {
            var ss = id_card!!.substring(id_card!!.length - 1, id_card!!.length)
            var s2= id_card!!.substring(0, 1)

            var s1 = ""
            for (index in 0..id_card!!.length) {
                if (index>0&&index < id_card!!.length - 1) {
                    s1 = "$s1*"
                }
            }
           s1=s2+s1+ss
            vm.card.value=s1
        }



    }

    override fun binding(): ActivityAuthenBinding {
       return ActivityAuthenBinding.inflate(layoutInflater)
    }

    override fun vmClass(): Class<AuthenVModel> {
        return AuthenVModel::class.java
    }

    override fun title(): String? {
        return "实名认证"
    }


}
