liugl
2020-11-02 080f7b67b66121fb325d777ba066112a2ace6825
app/src/main/java/com/okgoincar/slab/SlabMainActivity.kt
@@ -106,7 +106,7 @@
                callVersion()
            }
        }else{
            toast("无网络")
            showNoneNetDialog()
        }
    }
@@ -124,6 +124,15 @@
    override fun onResume() {
        super.onResume()
        showNoneNetDialog()
        try {
            mainFragment?.refresh()
        }catch (e:Exception){
        }
    }
    fun showNoneNetDialog(){
        if (!NetUtils.isNetworkConnected(this)){
            popup = getSlabDelAndSurePopWindow(this,"刷新","取消","网络不通畅,是否刷新页面?",{}){
                if (!NetUtils.isNetworkConnected(this)){
@@ -137,12 +146,6 @@
                popup?.showCenter(window.decorView)
            }
        }
        try {
            mainFragment?.refresh()
        }catch (e:Exception){
        }
    }
    fun getSlabDelAndSurePopWindow(context: Context,sureStr:String,cancelStr:String,content:String,clickClose :() -> Unit,clickSure:() -> Unit): EasyPopup {
@@ -167,6 +170,7 @@
    private fun showUI(data: UserInfoBean?) {
        data?.let {
            tv_title_top.text = "服 务 监 督 卡"
            if (data.taxiAptitudeCard.length > 7){
                tv_code_num.text  = "资格证号:"+data.taxiAptitudeCard.substring(0,3)+"*******"+data.taxiAptitudeCard.substring(data.taxiAptitudeCard.length-4,data.taxiAptitudeCard.length)
            }else{
@@ -400,21 +404,8 @@
        var identification = CacheKey.getKeyStr("identification")
        if (jobNum.isNotEmpty()) {
            var map = getMapByAny()
            map["jobNum"] = jobNum
            callNet(true, Api.loginByJobNumber, map) {
                var bean = gson.fromJson<LoginBean>(it, LoginBean::class.java)
                CacheKey.putKeyStr("jobNum", jobNum)
                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())
                ok()
            }
        } else if (identification.isNotEmpty()) {
            var map = getMapByAny()
            map["identification"] = identification
            callNet(true, Api.loginByIdentification, map) {
            map["taxiAptitudeCard"] = identification
            callNet(this, Api.loginByTaxiAptitudeCard, map,{
                var bean = Gson().fromJson<LoginBean>(it, LoginBean::class.java)
                CacheKey.putKeyStr("identification", identification)
                CacheKey.putKeyStr("appid", bean.data.appid)
@@ -423,6 +414,23 @@
                CacheKey.putKeyStr("serverId", bean.data.serverId.toString())
                CacheKey.putKeyStr("terminalName", bean.data.terminalId.toString())
                ok()
            }) {
                ok()
            }
        } else if (identification.isNotEmpty()) {
            var map = getMapByAny()
            map["taxiAptitudeCard"] = identification
            callNet(this, Api.loginByTaxiAptitudeCard, map,{
                var bean = Gson().fromJson<LoginBean>(it, LoginBean::class.java)
                CacheKey.putKeyStr("identification", identification)
                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())
                ok()
            }) {
                ok()
            }
        } else {
            ok()