From 86dab54700e5813367e58263fd04c3e9424cf95d Mon Sep 17 00:00:00 2001
From: 唐浩 <15928265276@163.com>
Date: 星期一, 28 九月 2020 10:48:45 +0800
Subject: [PATCH] commit 9.28

---
 app/src/main/java/com/okgoincar/slab/SlabMainActivity.kt |   54 +++++++++++++++++++++++++++++++-----------------------
 1 files changed, 31 insertions(+), 23 deletions(-)

diff --git a/app/src/main/java/com/okgoincar/slab/SlabMainActivity.kt b/app/src/main/java/com/okgoincar/slab/SlabMainActivity.kt
index d38a759..7ddaec8 100644
--- a/app/src/main/java/com/okgoincar/slab/SlabMainActivity.kt
+++ b/app/src/main/java/com/okgoincar/slab/SlabMainActivity.kt
@@ -91,7 +91,6 @@
     }
 
     override fun initView() {
-        tv_title_top.text = "服 务 监 督 卡 I"
         if (NetUtils.isNetworkConnected(this)){
             setTitleText("OK出行司机")
             showHeader(false)
@@ -107,7 +106,7 @@
                 callVersion()
             }
         }else{
-            toast("无网络")
+            showNoneNetDialog()
         }
     }
 
@@ -125,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)){
@@ -138,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 {
@@ -151,6 +153,7 @@
         var view = dialog.contentView
         view.tv_close_base.text = cancelStr
         view.tv_sure_base.text = sureStr
+        view.tv_close_base.gone()
         view.tv_close_base.setOnClickListener {
             dialog.dismiss()
             clickClose()
@@ -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()

--
Gitblit v1.7.1