| | |
| | | package com.okgoincar.slab |
| | | |
| | | import android.content.Context |
| | | import android.content.Intent |
| | | import android.os.Handler |
| | | import android.os.Looper |
| | | import android.widget.Toast |
| | |
| | | |
| | | override fun setOnclick() { |
| | | tv_login.clickDelay { |
| | | if (et_number.getContent().isNullOrEmpty()) { |
| | | toast("请输入工号") |
| | | return@clickDelay |
| | | } |
| | | var map = getMapByAny() |
| | | map["jobNum"] = et_number.getContent().trim() |
| | | callNet(true, Api.loginByJobNumber, map) { |
| | | toast("登录成功") |
| | | var bean = gson.fromJson<LoginBean>(it, LoginBean::class.java) |
| | | CacheKey.putKeyStr("jobNum",et_number.getContent().trim()) |
| | | CacheKey.putKeyStr("appid", bean.data.appid) |
| | | CacheKey.putKeyStr("token", bean.data.token) |
| | | CacheKey.putKeyStr("userId", bean.data.id.toString()) |
| | | CacheKey.putKeyStr("serverId", bean.data.serverId.toString()) |
| | | CacheKey.putKeyStr("terminalName", bean.data.terminalId.toString()) |
| | | finish() |
| | | startActivity<SlabMainActivity>() |
| | | } |
| | | // toLoginActivity(this,"452229198204010012") |
| | | // if (et_number.getContent().isNullOrEmpty()) { |
| | | // toast("请输入工号") |
| | | // return@clickDelay |
| | | // } |
| | | // var map = getMapByAny() |
| | | // map["jobNum"] = et_number.getContent().trim() |
| | | // callNet(true, Api.loginByJobNumber, map) { |
| | | // toast("登录成功") |
| | | // var bean = gson.fromJson<LoginBean>(it, LoginBean::class.java) |
| | | // CacheKey.putKeyStr("jobNum",et_number.getContent().trim()) |
| | | // CacheKey.putKeyStr("appid", bean.data.appid) |
| | | // CacheKey.putKeyStr("token", bean.data.token) |
| | | // CacheKey.putKeyStr("userId", bean.data.id.toString()) |
| | | // CacheKey.putKeyStr("serverId", bean.data.serverId.toString()) |
| | | // CacheKey.putKeyStr("terminalName", bean.data.terminalId.toString()) |
| | | // finish() |
| | | // startActivity<SlabMainActivity>() |
| | | // } |
| | | // 51168119911111447X 15928265276 11111q |
| | | // toLoginActivity(this,"51168119911111447X") |
| | | |
| | | } |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | // private fun toLoginActivity(context: Context?, driverCertificate: String?) { |
| | | // var map = getMapByAny() |
| | | // map["taxiAptitudeCard"] = driverCertificate |
| | | // callNet(context!!,Api.loginByTaxiAptitudeCard,map){ |
| | | // cn.sinata.xldutils.utils.toast("登录成功") |
| | | // var bean = Gson().fromJson<LoginBean>(it, LoginBean::class.java) |
| | | // CacheKey.putKeyStr("appid", bean.data.appid) |
| | | // CacheKey.putKeyStr("token", bean.data.token) |
| | | // CacheKey.putKeyStr("userId", bean.data.id.toString()) |
| | | // CacheKey.putKeyStr("serverId", bean.data.serverId.toString()) |
| | | // CacheKey.putKeyStr("terminalName", bean.data.terminalId.toString()) |
| | | // Handler(Looper.getMainLooper()).post { |
| | | // context.startActivity<SlabMainActivity>() |
| | | // } |
| | | // } |
| | | // } |
| | | |
| | | |
| | | private fun toLoginActivity(context: Context?, driverCertificate: String?) { |
| | | var map = getMapByAny() |
| | | map["identification"] = driverCertificate |
| | | callNet(context!!,Api.loginByIdentification,map){ |
| | | cn.sinata.xldutils.utils.toast("登录成功") |
| | | toast("登录成功") |
| | | var bean = Gson().fromJson<LoginBean>(it, LoginBean::class.java) |
| | | CacheKey.putKeyStr("identification", driverCertificate!!) |
| | | CacheKey.putKeyStr("appid", bean.data.appid) |
| | | CacheKey.putKeyStr("token", bean.data.token) |
| | | CacheKey.putKeyStr("userId", bean.data.id.toString()) |
| | | CacheKey.putKeyStr("serverId", bean.data.serverId.toString()) |
| | | CacheKey.putKeyStr("terminalName", bean.data.terminalId.toString()) |
| | | Handler(Looper.getMainLooper()).post { |
| | | context.startActivity<SlabMainActivity>() |
| | | var intent = Intent() |
| | | intent.setClass(context, SlabMainActivity::class.java) |
| | | intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK |
| | | context.startActivity(intent) |
| | | } |
| | | } |
| | | } |