| | |
| | | package com.sinata.xqmuse.ui.login |
| | | |
| | | import android.content.Intent |
| | | import android.os.CountDownTimer |
| | | import cn.sinata.xldutils.utils.isValidPhone |
| | | import cn.sinata.xldutils.utils.myToast |
| | |
| | | override fun setContentView() = R.layout.activity_bind_phone |
| | | private lateinit var timer: CountDownTimer |
| | | |
| | | private val openid by lazy { intent.getStringExtra("openid") } |
| | | private val token by lazy { intent.getStringExtra("token") } |
| | | |
| | | override fun initClick() { |
| | | tv_action.onClick { |
| | | if (!cb_rule.isChecked) { |
| | |
| | | myToast("请输入6位验证码") |
| | | return@onClick |
| | | } |
| | | //TODO API |
| | | HttpManager.verifyCellPhone(token?:"",phone,code,openid?:"").request(this@BindPhoneActivity){_,data-> |
| | | val result = Intent() |
| | | result.putExtra("token",data?.accessToken?:"") |
| | | setResult(RESULT_OK,result) |
| | | finish() |
| | | } |
| | | } |
| | | |
| | | tv_code.onClick { |
| | |
| | | myToast("请输入正确的手机号") |
| | | else{ |
| | | tv_code.isEnabled = false |
| | | HttpManager.getCode(phone,2 ).request(this@BindPhoneActivity,success = { _, _-> |
| | | HttpManager.getCode(phone,4 ).request(this@BindPhoneActivity,success = { _, _-> |
| | | timer.start() |
| | | }){_,_-> |
| | | tv_code.isEnabled = true |