司机注册跳转优化

This commit is contained in:
lijia 2024-04-25 15:23:35 +08:00
parent 34bff03c52
commit 720d580685
12 changed files with 294 additions and 123 deletions

View File

@ -13,6 +13,8 @@ import com.dahe.mylibrary.net.CommonResponseBean
import com.dahe.mylibrary.utils.ActivityUtils import com.dahe.mylibrary.utils.ActivityUtils
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
import io.reactivex.rxjava3.schedulers.Schedulers import io.reactivex.rxjava3.schedulers.Schedulers
import java.util.Timer
import java.util.TimerTask
/** /**
* @ClassName AuthRoleActivity * @ClassName AuthRoleActivity
@ -23,7 +25,9 @@ import io.reactivex.rxjava3.schedulers.Schedulers
class SelectRoleActivity : BaseActivity<ActivitySelectRoleBinding>() { class SelectRoleActivity : BaseActivity<ActivitySelectRoleBinding>() {
override fun initView(savedInstanceState: Bundle?) { override fun initView(savedInstanceState: Bundle?) {
setStatusBarColor(R.color.white) setStatusBarColor(R.color.white)
setTitleBar("选择角色", true) setTitleBar("选择角色"){
ActivityUtils.startActivity(mContext,LoginActivity::class.java)
}
binding.rlPerson.setOnClickListener { binding.rlPerson.setOnClickListener {
@ -58,4 +62,8 @@ class SelectRoleActivity : BaseActivity<ActivitySelectRoleBinding>() {
override fun initDate() { override fun initDate() {
} }
override fun onBackPressed() {
ActivityUtils.startActivity(mContext,LoginActivity::class.java)
}
} }

View File

@ -104,6 +104,16 @@ class AuthDriverActivity : BaseActivity<ActivityAuthDriverBinding>() {
if (driverInfoBean.licenseName != backLicName) { if (driverInfoBean.licenseName != backLicName) {
CommonPopUtils.getInstance().showCommCenterPop(mContext, content = "检测到主副页识别姓名不一致,是否继续上传?") { CommonPopUtils.getInstance().showCommCenterPop(mContext, content = "检测到主副页识别姓名不一致,是否继续上传?") {
upApi()
}
}else{
upApi()
}
}
fun upApi(){
DataManager.getInstance().setUpDriverLicense(driverInfoBean) DataManager.getInstance().setUpDriverLicense(driverInfoBean)
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
@ -126,10 +136,6 @@ class AuthDriverActivity : BaseActivity<ActivityAuthDriverBinding>() {
} }
})) }))
} }
}
}
private fun selFrontPic() { private fun selFrontPic() {

View File

@ -274,6 +274,16 @@ class AuthDrivingActivity : BaseActivity<ActivityAuthDrivingBinding>() {
if (upDrivingInfoBean.vehicleNum!=backLicCarNum){ if (upDrivingInfoBean.vehicleNum!=backLicCarNum){
CommonPopUtils.getInstance().showCommCenterPop(mContext, content = "检测到主副页识别车牌号内容不一致,是否继续上传?"){ CommonPopUtils.getInstance().showCommCenterPop(mContext, content = "检测到主副页识别车牌号内容不一致,是否继续上传?"){
upApi()
}
}else{
upApi()
}
}
fun upApi(){
DataManager.getInstance().addCar(upDrivingInfoBean) DataManager.getInstance().addCar(upDrivingInfoBean)
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
@ -297,10 +307,6 @@ class AuthDrivingActivity : BaseActivity<ActivityAuthDrivingBinding>() {
} }
})) }))
} }
}
}
/** /**

View File

@ -33,7 +33,7 @@ class AuthFaceActivity : BaseActivity<ActivityAuthFaceBinding>() {
isSupp = intent.extras?.getBoolean(AppConfig.IS_SUPPLEMENT, false) isSupp = intent.extras?.getBoolean(AppConfig.IS_SUPPLEMENT, false)
setTitleBar("实名认证") { setTitleBar("实名认证") {
if (isSupp == true) {//个人中心进来 if (isSupp == true) {//个人中心进来
finish() setResult(RESULT_OK)
} else { } else {
ActivityUtils.startActivity(mContext, HomeActivity::class.java) ActivityUtils.startActivity(mContext, HomeActivity::class.java)
} }
@ -94,6 +94,10 @@ class AuthFaceActivity : BaseActivity<ActivityAuthFaceBinding>() {
} }
} }
override fun onBackPressed() {
super.onBackPressed()
setResult(RESULT_OK)
finish()
}
} }

View File

@ -219,7 +219,19 @@ class AuthTrailerActivity : BaseActivity<ActivityAuthTrailerBinding>() {
} }
if (upDrivingInfoBean.vehicleNum != backLicCarNum) { if (upDrivingInfoBean.vehicleNum != backLicCarNum) {
CommonPopUtils.getInstance().showCommCenterPop(mContext, content = "检测到主副页识别车牌号内容不一致,是否继续上传?") { CommonPopUtils.getInstance().showCommCenterPop(
mContext,
content = "检测到主副页识别车牌号内容不一致,是否继续上传?"
) {
upApi()
}
} else
upApi()
}
fun upApi() {
DataManager.getInstance().addTrailer(upDrivingInfoBean) DataManager.getInstance().addTrailer(upDrivingInfoBean)
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
@ -229,9 +241,5 @@ class AuthTrailerActivity : BaseActivity<ActivityAuthTrailerBinding>() {
ActivityUtils.startActivity(mContext, AuthSuccActivity::class.java) ActivityUtils.startActivity(mContext, AuthSuccActivity::class.java)
} }
})) }))
}
}
} }
} }

View File

@ -11,6 +11,8 @@ import com.dahe.gldriver.net.BaseObserver
import com.dahe.gldriver.net.DataManager import com.dahe.gldriver.net.DataManager
import com.dahe.gldriver.net.RxHttpCallBack import com.dahe.gldriver.net.RxHttpCallBack
import com.dahe.gldriver.oss.OssServiceUtil import com.dahe.gldriver.oss.OssServiceUtil
import com.dahe.gldriver.ui.mine.activity.PersonInfoActivity
import com.dahe.gldriver.utils.UserUtils
import com.dahe.glex.bean.UserDetail import com.dahe.glex.bean.UserDetail
import com.dahe.mylibrary.base.BaseActivity import com.dahe.mylibrary.base.BaseActivity
import com.dahe.mylibrary.net.CommonResponseBean import com.dahe.mylibrary.net.CommonResponseBean
@ -33,7 +35,10 @@ class EditBankCardActivity : BaseActivity<ActivityAuthBankcardBinding>() {
var perInfoBean: UserDetail = UserDetail() var perInfoBean: UserDetail = UserDetail()
override fun initView(savedInstanceState: Bundle?) { override fun initView(savedInstanceState: Bundle?) {
setStatusBarColor(R.color.white) setStatusBarColor(R.color.white)
setTitleBar("更换银行卡", true) setTitleBar("更换银行卡"){
setResult(RESULT_OK)
finish()
}
binding.run { binding.run {
tvNote.visibility = View.GONE tvNote.visibility = View.GONE
@ -92,7 +97,12 @@ class EditBankCardActivity : BaseActivity<ActivityAuthBankcardBinding>() {
override fun onSuccess(t: CommonResponseBean<OcrPersonBean>) { override fun onSuccess(t: CommonResponseBean<OcrPersonBean>) {
super.onSuccess(t) super.onSuccess(t)
t.data?.data?.run { t.data?.data?.run {
ImageLoader.getInstance().loadRoundImage(mContext, data1.realPath, 12, binding.ivFront) ImageLoader.getInstance().loadRoundImage(
mContext,
data1.realPath,
12,
binding.ivFront
)
perInfoBean.driverBankcardPhotoUrl = oldPath perInfoBean.driverBankcardPhotoUrl = oldPath
binding.let { binding.let {
@ -127,10 +137,21 @@ class EditBankCardActivity : BaseActivity<ActivityAuthBankcardBinding>() {
override fun onSuccess(t: CommonResponseBean<Any>) { override fun onSuccess(t: CommonResponseBean<Any>) {
super.onSuccess(t) super.onSuccess(t)
showToast("修改成功") showToast("修改成功")
val goNextPersonInfo = UserUtils.instance.goNextPersonInfo(perInfoBean)
if (goNextPersonInfo != null) {
ActivityUtils.startActivity(mContext,goNextPersonInfo)
}
setResult(RESULT_OK) setResult(RESULT_OK)
finish() finish()
} }
})) }))
} }
} }
override fun onBackPressed() {
super.onBackPressed()
setResult(RESULT_OK)
finish()
}
} }

View File

@ -11,8 +11,10 @@ import com.dahe.gldriver.net.BaseObserver
import com.dahe.gldriver.net.DataManager import com.dahe.gldriver.net.DataManager
import com.dahe.gldriver.net.RxHttpCallBack import com.dahe.gldriver.net.RxHttpCallBack
import com.dahe.gldriver.oss.OssServiceUtil import com.dahe.gldriver.oss.OssServiceUtil
import com.dahe.gldriver.ui.mine.activity.PersonInfoActivity
import com.dahe.gldriver.utils.CommonPopUtils import com.dahe.gldriver.utils.CommonPopUtils
import com.dahe.gldriver.utils.OcrUtils import com.dahe.gldriver.utils.OcrUtils
import com.dahe.gldriver.utils.UserUtils
import com.dahe.glex.bean.UserDetail import com.dahe.glex.bean.UserDetail
import com.dahe.mylibrary.utils.PickerUtils import com.dahe.mylibrary.utils.PickerUtils
import com.dahe.mylibrary.base.BaseActivity import com.dahe.mylibrary.base.BaseActivity
@ -38,7 +40,10 @@ class EditDriverActivity : BaseActivity<ActivityAuthDriverBinding>() {
var backLicName = "" var backLicName = ""
override fun initView(savedInstanceState: Bundle?) { override fun initView(savedInstanceState: Bundle?) {
setStatusBarColor(R.color.white) setStatusBarColor(R.color.white)
setTitleBar("实名认证", true) setTitleBar("实名认证") {
setResult(RESULT_OK)
finish()
}
binding.run { binding.run {
btnOk.text = "确定" btnOk.text = "确定"
@ -148,6 +153,15 @@ class EditDriverActivity : BaseActivity<ActivityAuthDriverBinding>() {
if (driverInfoBean.licenseName != backLicName) { if (driverInfoBean.licenseName != backLicName) {
CommonPopUtils.getInstance() CommonPopUtils.getInstance()
.showCommCenterPop(mContext, content = "检测到主副页识别姓名不一致,是否继续上传?") { .showCommCenterPop(mContext, content = "检测到主副页识别姓名不一致,是否继续上传?") {
upApi()
}
} else
upApi()
}
private fun upApi() {
DataManager.getInstance().reUpDriverLicense(driverInfoBean) DataManager.getInstance().reUpDriverLicense(driverInfoBean)
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
@ -155,15 +169,16 @@ class EditDriverActivity : BaseActivity<ActivityAuthDriverBinding>() {
override fun onSuccess(t: CommonResponseBean<Any>) { override fun onSuccess(t: CommonResponseBean<Any>) {
super.onSuccess(t) super.onSuccess(t)
showToast("修改成功") showToast("修改成功")
val goNextPersonInfo =
UserUtils.instance.goNextPersonInfo(driverInfoBean)
if (goNextPersonInfo != null) {
ActivityUtils.startActivity(mContext, goNextPersonInfo)
}
setResult(RESULT_OK) setResult(RESULT_OK)
finish() finish()
} }
})) }))
} }
}
}
private fun selFrontPic() { private fun selFrontPic() {
@ -213,10 +228,17 @@ class EditDriverActivity : BaseActivity<ActivityAuthDriverBinding>() {
.loadRoundImage(mContext, picPath.locPic, 12, binding.ivBack) .loadRoundImage(mContext, picPath.locPic, 12, binding.ivBack)
driverInfoBean.licensePhotoBackUrl = picPath.picPath driverInfoBean.licensePhotoBackUrl = picPath.picPath
it?.run { it?.run {
backLicName = it.name
driverInfoBean.licenseRecordNumber = recordNumber driverInfoBean.licenseRecordNumber = recordNumber
} }
} }
} }
} }
override fun onBackPressed() {
super.onBackPressed()
setResult(RESULT_OK)
finish()
}
} }

View File

@ -4,6 +4,7 @@ import android.os.Bundle
import android.view.View import android.view.View
import com.dahe.gldriver.R import com.dahe.gldriver.R
import com.dahe.gldriver.base.AppConfig import com.dahe.gldriver.base.AppConfig
import com.dahe.gldriver.bean.CarDetail
import com.dahe.gldriver.bean.DiCarColor import com.dahe.gldriver.bean.DiCarColor
import com.dahe.gldriver.bean.UpDrivingInfoBean import com.dahe.gldriver.bean.UpDrivingInfoBean
import com.dahe.gldriver.databinding.ActivityAuthDrivingBinding import com.dahe.gldriver.databinding.ActivityAuthDrivingBinding
@ -14,6 +15,7 @@ import com.dahe.gldriver.ui.account.AuthSuccActivity
import com.dahe.gldriver.utils.CommonPopUtils import com.dahe.gldriver.utils.CommonPopUtils
import com.dahe.gldriver.utils.DicUtils import com.dahe.gldriver.utils.DicUtils
import com.dahe.gldriver.utils.OcrUtils import com.dahe.gldriver.utils.OcrUtils
import com.dahe.gldriver.utils.UserUtils
import com.dahe.mylibrary.base.BaseActivity import com.dahe.mylibrary.base.BaseActivity
import com.dahe.mylibrary.net.CommonResponseBean import com.dahe.mylibrary.net.CommonResponseBean
import com.dahe.mylibrary.utils.ActivityUtils import com.dahe.mylibrary.utils.ActivityUtils
@ -328,6 +330,15 @@ class EditDrivingActivity : BaseActivity<ActivityAuthDrivingBinding>() {
mContext, mContext,
content = "检测到主副页识别车牌号内容不一致,是否继续上传?" content = "检测到主副页识别车牌号内容不一致,是否继续上传?"
) { ) {
upApi()
}
} else
upApi()
}
fun upApi() {
DataManager.getInstance().editCar(upDrivingInfoBean) DataManager.getInstance().editCar(upDrivingInfoBean)
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
@ -340,10 +351,6 @@ class EditDrivingActivity : BaseActivity<ActivityAuthDrivingBinding>() {
} }
})) }))
} }
}
}
/** /**

View File

@ -11,7 +11,9 @@ import com.dahe.gldriver.databinding.ActivityAuthPersonBinding
import com.dahe.gldriver.net.BaseObserver import com.dahe.gldriver.net.BaseObserver
import com.dahe.gldriver.net.DataManager import com.dahe.gldriver.net.DataManager
import com.dahe.gldriver.net.RxHttpCallBack import com.dahe.gldriver.net.RxHttpCallBack
import com.dahe.gldriver.ui.mine.activity.PersonInfoActivity
import com.dahe.gldriver.utils.OcrUtils import com.dahe.gldriver.utils.OcrUtils
import com.dahe.gldriver.utils.UserUtils
import com.dahe.glex.bean.UserDetail import com.dahe.glex.bean.UserDetail
import com.dahe.mylibrary.base.BaseActivity import com.dahe.mylibrary.base.BaseActivity
import com.dahe.mylibrary.net.CommonResponseBean import com.dahe.mylibrary.net.CommonResponseBean
@ -35,12 +37,17 @@ import java.io.File
* @Date 2024/1/25 11:15 * @Date 2024/1/25 11:15
* @Description 身份证认证-编辑 * @Description 身份证认证-编辑
*/ */
@Suppress("ALWAYS_NULL")
class EditPersonActivity : BaseActivity<ActivityAuthPersonBinding>() { class EditPersonActivity : BaseActivity<ActivityAuthPersonBinding>() {
var perInfoBean: UserDetail = UserDetail() var perInfoBean: UserDetail = UserDetail()
private var firstMissingInfo = -1
override fun initView(savedInstanceState: Bundle?) { override fun initView(savedInstanceState: Bundle?) {
setStatusBarColor(R.color.white) setStatusBarColor(R.color.white)
setTitleBar("实名认证", true) setTitleBar("实名认证"){
setResult(RESULT_OK)
finish()
}
binding.run { binding.run {
btnOk.text = "确定" btnOk.text = "确定"
@ -71,6 +78,10 @@ class EditPersonActivity : BaseActivity<ActivityAuthPersonBinding>() {
override fun onSuccess(t: CommonResponseBean<Any>) { override fun onSuccess(t: CommonResponseBean<Any>) {
super.onSuccess(t) super.onSuccess(t)
showToast("修改成功") showToast("修改成功")
val goNextPersonInfo = UserUtils.instance.goNextPersonInfo(perInfoBean)
if (goNextPersonInfo != null) {
ActivityUtils.startActivity(mContext,goNextPersonInfo)
}
setResult(RESULT_OK) setResult(RESULT_OK)
finish() finish()
} }
@ -170,7 +181,7 @@ class EditPersonActivity : BaseActivity<ActivityAuthPersonBinding>() {
.subscribe(BaseObserver(mContext, object : RxHttpCallBack<UserDetail>() { .subscribe(BaseObserver(mContext, object : RxHttpCallBack<UserDetail>() {
override fun onSuccess(t: CommonResponseBean<UserDetail>) { override fun onSuccess(t: CommonResponseBean<UserDetail>) {
super.onSuccess(t) super.onSuccess(t)
if (t.data==null) if (t.data == null)
return return
perInfoBean = t.data perInfoBean = t.data
var isOnlyShow = var isOnlyShow =
@ -199,7 +210,11 @@ class EditPersonActivity : BaseActivity<ActivityAuthPersonBinding>() {
} }
} }
})) }))
}
override fun onBackPressed() {
super.onBackPressed()
setResult(RESULT_OK)
finish()
} }
} }

View File

@ -9,8 +9,10 @@ import com.dahe.gldriver.net.BaseObserver
import com.dahe.gldriver.net.DataManager import com.dahe.gldriver.net.DataManager
import com.dahe.gldriver.net.RxHttpCallBack import com.dahe.gldriver.net.RxHttpCallBack
import com.dahe.gldriver.oss.OssServiceUtil import com.dahe.gldriver.oss.OssServiceUtil
import com.dahe.gldriver.ui.mine.activity.PersonInfoActivity
import com.dahe.gldriver.utils.OcrUtils import com.dahe.gldriver.utils.OcrUtils
import com.dahe.gldriver.utils.SPUtils import com.dahe.gldriver.utils.SPUtils
import com.dahe.gldriver.utils.UserUtils
import com.dahe.glex.bean.UserDetail import com.dahe.glex.bean.UserDetail
import com.dahe.mylibrary.utils.PickerUtils import com.dahe.mylibrary.utils.PickerUtils
import com.dahe.mylibrary.base.BaseActivity import com.dahe.mylibrary.base.BaseActivity
@ -32,7 +34,10 @@ class EditQualificationActivity : BaseActivity<ActivityAuthQualificationBinding>
var upQuaInfo = UserDetail() var upQuaInfo = UserDetail()
override fun initView(savedInstanceState: Bundle?) { override fun initView(savedInstanceState: Bundle?) {
setStatusBarColor(R.color.white) setStatusBarColor(R.color.white)
setTitleBar("实名认证", true) setTitleBar("实名认证"){
setResult(RESULT_OK)
finish()
}
binding.btnOk.setOnClickListener { binding.btnOk.setOnClickListener {
subMit() subMit()
} }
@ -112,10 +117,20 @@ class EditQualificationActivity : BaseActivity<ActivityAuthQualificationBinding>
override fun onSuccess(t: CommonResponseBean<Any>) { override fun onSuccess(t: CommonResponseBean<Any>) {
super.onSuccess(t) super.onSuccess(t)
showToast("修改成功") showToast("修改成功")
val goNextPersonInfo = UserUtils.instance.goNextPersonInfo(upQuaInfo)
if (goNextPersonInfo != null) {
ActivityUtils.startActivity(mContext,goNextPersonInfo)
}
setResult(RESULT_OK) setResult(RESULT_OK)
finish() finish()
} }
})) }))
} }
} }
override fun onBackPressed() {
super.onBackPressed()
setResult(RESULT_OK)
finish()
}
} }

View File

@ -275,6 +275,15 @@ class EditTrailerActivity : BaseActivity<ActivityAuthTrailerBinding>() {
mContext, mContext,
content = "检测到主副页识别车牌号内容不一致,是否继续上传?" content = "检测到主副页识别车牌号内容不一致,是否继续上传?"
) { ) {
upApi()
}
} else
upApi()
}
fun upApi() {
if (this@EditTrailerActivity.carId.toIntOrNull() != null) { if (this@EditTrailerActivity.carId.toIntOrNull() != null) {
DataManager.getInstance().addTrailer(upDrivingInfoBean) DataManager.getInstance().addTrailer(upDrivingInfoBean)
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
@ -300,9 +309,5 @@ class EditTrailerActivity : BaseActivity<ActivityAuthTrailerBinding>() {
} }
})) }))
} }
}
}
} }
} }

View File

@ -2,20 +2,34 @@ package com.dahe.gldriver.utils
import android.content.Context import android.content.Context
import android.content.Intent import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import androidx.viewbinding.ViewBinding
import com.dahe.gldriver.bean.CarDetail
import com.dahe.gldriver.bean.UpDrivingInfoBean
import com.dahe.gldriver.push.PushHelper import com.dahe.gldriver.push.PushHelper
import com.dahe.gldriver.ui.HomeActivity import com.dahe.gldriver.ui.HomeActivity
import com.dahe.gldriver.ui.LauncherActivity import com.dahe.gldriver.ui.LauncherActivity
import com.dahe.gldriver.ui.account.LoginActivity import com.dahe.gldriver.ui.account.LoginActivity
import com.dahe.gldriver.ui.account.SelectRoleActivity import com.dahe.gldriver.ui.account.SelectRoleActivity
import com.dahe.gldriver.ui.account.authperson.AuthFaceActivity
import com.dahe.gldriver.ui.account.authperson.EditBankCardActivity
import com.dahe.gldriver.ui.account.authperson.EditDriverActivity
import com.dahe.gldriver.ui.account.authperson.EditDrivingActivity
import com.dahe.gldriver.ui.account.authperson.EditPersonActivity
import com.dahe.gldriver.ui.account.authperson.EditQualificationActivity
import com.dahe.gldriver.ui.account.authperson.EditRoadActivity
import com.dahe.gldriver.ui.account.authperson.EditTrailerActivity
import com.dahe.glex.bean.UserBean import com.dahe.glex.bean.UserBean
import com.dahe.glex.bean.UserDetail
import com.dahe.mylibrary.base.BaseActivity
import com.dahe.mylibrary.utils.ActivityUtils import com.dahe.mylibrary.utils.ActivityUtils
import com.dahe.mylibrary.utils.BaseSPUtils import com.dahe.mylibrary.utils.BaseSPUtils
import com.dahe.mylibrary.utils.ToastUtils import com.dahe.mylibrary.utils.ToastUtils
import com.google.gson.Gson import com.google.gson.Gson
class UserUtils private constructor(){ class UserUtils private constructor() {
companion object{ companion object {
val instance = Holder.holder val instance = Holder.holder
} }
@ -23,9 +37,9 @@ class UserUtils private constructor(){
val holder = UserUtils() val holder = UserUtils()
} }
fun loginOut(context : Context){ fun loginOut(context: Context) {
SPUtils.instance.removeUserToken(context) SPUtils.instance.removeUserToken(context)
if (null== SPUtils.instance.getUserInfo(context)) if (null == SPUtils.instance.getUserInfo(context))
return return
//删除推送别名 //删除推送别名
PushHelper.delete(context) PushHelper.delete(context)
@ -36,10 +50,10 @@ class UserUtils private constructor(){
// ToastUtils.showToast(context, "您的账号再异地登录,请重新登录") // ToastUtils.showToast(context, "您的账号再异地登录,请重新登录")
} }
fun loginIn(context: Context,userBean: UserBean){ fun loginIn(context: Context, userBean: UserBean) {
SPUtils.instance.setUserInfo(context, Gson().toJson(userBean)) SPUtils.instance.setUserInfo(context, Gson().toJson(userBean))
//设置推送别名 //设置推送别名
PushHelper.setAlias(context,userBean) PushHelper.setAlias(context, userBean)
// ActivityUtils.startActivity( // ActivityUtils.startActivity(
// context, // context,
@ -57,7 +71,7 @@ class UserUtils private constructor(){
HomeActivity::class.java HomeActivity::class.java
) )
} }
ActivityUtils.finishToActivity(LoginActivity::class.java,true) ActivityUtils.finishToActivity(LoginActivity::class.java, true)
} }
@ -66,9 +80,49 @@ class UserUtils private constructor(){
* @param context Context * @param context Context
* @param userBean UserBean * @param userBean UserBean
*/ */
fun updateUser(context: Context,userBean: UserBean){ fun updateUser(context: Context, userBean: UserBean) {
SPUtils.instance.setUserInfo(context, Gson().toJson(userBean)) SPUtils.instance.setUserInfo(context, Gson().toJson(userBean))
//设置推送别名 //设置推送别名
PushHelper.setAlias(context,userBean) PushHelper.setAlias(context, userBean)
}
/**
* 司机证件跳转
* @param userBean UserDetail
* @return Class<out BaseActivity<out ViewBinding>>?
*/
fun goNextPersonInfo(userBean: UserDetail): Class<out BaseActivity<out ViewBinding>>? {
if (userBean.idcardNo.isNullOrBlank()) {
return EditPersonActivity::class.java
} else if (userBean.licenseNo.isNullOrEmpty()) {
return EditDriverActivity::class.java
} else if (userBean.qualificationCertificateEffectiveEnd.isNullOrEmpty()) {
return EditQualificationActivity::class.java
} else if (userBean.driverBankcardNumber.isNullOrEmpty()) {
return EditBankCardActivity::class.java
} else if (userBean.isRealName == "0") {
return AuthFaceActivity::class.java
} else {
return null
}
}
/**
* 车辆证件跳转
* @param carDetail CarDetail
* @return Class<out BaseActivity<out ViewBinding>>?
*/
fun goNextCarInfo(carDetail: CarDetail): Class<out BaseActivity<out ViewBinding>>? {
if (carDetail.vehicleNum.isNullOrEmpty()) {
return EditDrivingActivity::class.java
} else if (carDetail.isTrailer == "1" && carDetail.trailerVehicleNum.isNullOrEmpty()) {
return EditTrailerActivity::class.java
}else if (carDetail.roadLicense.isNullOrEmpty()){
return EditRoadActivity::class.java
}else
return null
} }
} }