package com.fuban.driver.ui.mine
|
|
import android.widget.TextView
|
import cn.sinata.xldutils.utils.clickDelay
|
import cn.sinata.xldutils.utils.getContent
|
import com.kuaiyun.emanagercar.ui.base.Local.BaseLoginActivity
|
import com.fuban.driver.R
|
import com.fuban.driver.base.BaseEvent
|
import com.fuban.driver.netUtls.Api
|
import com.fuban.driver.netUtls.callNet
|
import com.fuban.driver.netUtls.getMapByAny
|
import com.fuban.driver.utils.Cache.CacheKey
|
import kotlinx.android.synthetic.main.activity_safe_verify.*
|
import kotlinx.android.synthetic.main.include_login_code_no_tip.*
|
import org.jetbrains.anko.startActivity
|
import org.jetbrains.anko.toast
|
|
class SafeVerifyActivity: BaseLoginActivity() {
|
override fun tvInit(tv_code: TextView) {
|
et_login_code_send.text = "获取验证码"
|
}
|
|
override fun tvIniting(tv_code: TextView, time: String) {
|
et_login_code_send.text = time+"秒后重新获取"
|
}
|
|
override fun setContentView() {
|
setContentView(R.layout.activity_safe_verify)
|
}
|
|
override fun initView() {
|
setTitleText("安全验证")
|
}
|
|
override fun onResume() {
|
super.onResume()
|
showPhone()
|
}
|
|
fun showPhone(){
|
var phone = CacheKey.getUserInfo().phone
|
tv_phone.text = "设置密码需先验证您的手机号"+phone.substring(0,3)+"****"+phone.substring(7)
|
}
|
|
override fun setOnclick() {
|
et_login_code_send.setOnClickListener {
|
var map = getMapByAny()
|
map["phone"] = CacheKey.getUserInfo().phone
|
map["type"] = 4
|
callNet(Api.queryCaptcha, map) {
|
refreshTime(et_login_code_send)
|
}
|
}
|
|
tv_next.clickDelay {
|
if (et_login_pwd.getContent().isEmpty()){
|
toast("请输入验证码")
|
return@clickDelay
|
}
|
var phone = CacheKey.getUserInfo().phone
|
var map = getMapByAny()
|
map["code"] = et_login_pwd.getContent()
|
map["phone"] = phone
|
callNet(Api.checkCaptcha,map){
|
startActivity<SettingLoginPwdActivity>()
|
}
|
}
|
}
|
|
override fun onEventMainThread(event: BaseEvent?) {
|
super.onEventMainThread(event)
|
when(event?.code){
|
BaseEvent.CLOSE_ACT_SAFE_VER -> {
|
finish()
|
}
|
}
|
}
|
}
|