|
@@ -59,6 +59,7 @@ import xn.xxp.room.bean.NoticeSummary
|
|
|
import xn.xxp.utils.QrTool
|
|
import xn.xxp.utils.QrTool
|
|
|
import xn.xxp.utils.Tool
|
|
import xn.xxp.utils.Tool
|
|
|
import xn.xxp.widget.ITitleBar
|
|
import xn.xxp.widget.ITitleBar
|
|
|
|
|
+import xn.xxp.HomeActivity
|
|
|
import xn.xxp.widget.NavViewCompat
|
|
import xn.xxp.widget.NavViewCompat
|
|
|
import xn.xxp.widget.WaringDialog
|
|
import xn.xxp.widget.WaringDialog
|
|
|
import java.math.BigDecimal
|
|
import java.math.BigDecimal
|
|
@@ -123,9 +124,10 @@ class MainActivity :
|
|
|
// }
|
|
// }
|
|
|
private var authType: AuthType = AuthType.FACE
|
|
private var authType: AuthType = AuthType.FACE
|
|
|
override fun onCreate(savedInstanceState: Bundle?) {
|
|
override fun onCreate(savedInstanceState: Bundle?) {
|
|
|
- super.onCreate(savedInstanceState)
|
|
|
|
|
-// mSerialPortHelper.bindService()
|
|
|
|
|
- authType = (intent.getSerializableExtra("authType") as AuthType?)!!
|
|
|
|
|
|
|
+ android.util.Log.e("MainActivity", "=== onCreate start, intent authType=${intent.getSerializableExtra("authType")}")
|
|
|
|
|
+ super.onCreate(savedInstanceState) // 注意:super.onCreate 内部会调用 initData(),此时 authType 尚未从 intent 赋值
|
|
|
|
|
+ authType = (intent.getSerializableExtra("authType") as AuthType?) ?: AuthType.FACE
|
|
|
|
|
+ android.util.Log.e("MainActivity", "=== onCreate end, authType=$authType")
|
|
|
// 实验室文化图 > 文化图
|
|
// 实验室文化图 > 文化图
|
|
|
val message = mBannerHandler.obtainMessage(WHAT_WORKBENCH)
|
|
val message = mBannerHandler.obtainMessage(WHAT_WORKBENCH)
|
|
|
mBannerHandler.sendMessageDelayed(message, BANNER_TIME_WORKBENCH)
|
|
mBannerHandler.sendMessageDelayed(message, BANNER_TIME_WORKBENCH)
|
|
@@ -423,19 +425,44 @@ class MainActivity :
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
lateinit var labConfig: LabConfig
|
|
lateinit var labConfig: LabConfig
|
|
|
|
|
+
|
|
|
override fun initData() {
|
|
override fun initData() {
|
|
|
- Tool.INSTANCE.openDoor(LabApp.userVo.userId,authType)
|
|
|
|
|
- labConfig = RoomTool.getInstance().labConfigDao().labConfig
|
|
|
|
|
|
|
+ android.util.Log.e("MainActivity", "=== initData called, LabApp.userVo=${LabApp.userVo}")
|
|
|
|
|
+ // 【改动1】登录态兜底:进程被杀重建 / 后端502导致 userVo 丢失
|
|
|
|
|
+ val userVo = LabApp.userVo
|
|
|
|
|
+ if (userVo == null) {
|
|
|
|
|
+ showToast("登录信息已失效,请重新验证")
|
|
|
|
|
+ val intent = Intent(this, HomeActivity::class.java)
|
|
|
|
|
+ intent.flags = Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_SINGLE_TOP
|
|
|
|
|
+ startActivity(intent)
|
|
|
|
|
+ finish()
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 【改动2】原来第一行,用已判空的 userVo
|
|
|
|
|
+ Tool.INSTANCE.openDoor(userVo.userId, authType)
|
|
|
|
|
+
|
|
|
|
|
+ val labConfigRaw = RoomTool.getInstance().labConfigDao().labConfig
|
|
|
|
|
+ android.util.Log.e("MainActivity", "=== labConfig from Room = $labConfigRaw")
|
|
|
|
|
+ labConfig = labConfigRaw
|
|
|
val laboratoryVo = LabApp.laboratory
|
|
val laboratoryVo = LabApp.laboratory
|
|
|
- if (null == laboratoryVo || null == labConfig) {
|
|
|
|
|
- showToast("暂无实验室信息,即将重新获取")
|
|
|
|
|
- Tool.INSTANCE.reStartApp("暂无实验室信息,即将重新获取")
|
|
|
|
|
|
|
+ android.util.Log.e("MainActivity", "=== LabApp.laboratory = $laboratoryVo")
|
|
|
|
|
+ if (null == laboratoryVo) {
|
|
|
|
|
+ showToast("暂无实验室信息,请重新进入")
|
|
|
|
|
+ val intent = Intent(this, HomeActivity::class.java)
|
|
|
|
|
+ intent.flags = Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_SINGLE_TOP
|
|
|
|
|
+ startActivity(intent)
|
|
|
|
|
+ finish()
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
binding.titleBar.setTitleInfoFromSp()
|
|
binding.titleBar.setTitleInfoFromSp()
|
|
|
|
|
|
|
|
|
|
+ android.util.Log.e("MainActivity", "=== initLaboratoryInfo start")
|
|
|
initLaboratoryInfo(laboratoryVo)
|
|
initLaboratoryInfo(laboratoryVo)
|
|
|
|
|
+ android.util.Log.e("MainActivity", "=== initLaboratoryInfo end")
|
|
|
|
|
+
|
|
|
// 开门按钮显示控制
|
|
// 开门按钮显示控制
|
|
|
|
|
+ android.util.Log.e("MainActivity", "=== labConfig.isRelationGuard=${labConfig?.isRelationGuard}")
|
|
|
if ("1" == labConfig.isRelationGuard) {
|
|
if ("1" == labConfig.isRelationGuard) {
|
|
|
binding.openDoor.visibility = View.VISIBLE
|
|
binding.openDoor.visibility = View.VISIBLE
|
|
|
val drawable =
|
|
val drawable =
|
|
@@ -447,8 +474,9 @@ class MainActivity :
|
|
|
ContextCompat.getDrawable(this, R.drawable.divider_transparent_main_right_v2)
|
|
ContextCompat.getDrawable(this, R.drawable.divider_transparent_main_right_v2)
|
|
|
binding.rightContent.dividerDrawable = drawable
|
|
binding.rightContent.dividerDrawable = drawable
|
|
|
}
|
|
}
|
|
|
- // 视频监控按钮显示控制
|
|
|
|
|
- if ("1" == LabApp.userVo.pageType) {
|
|
|
|
|
|
|
+
|
|
|
|
|
+ // 【改动3】原来这里用的是 LabApp.userVo.pageType,改成已判空的 userVo
|
|
|
|
|
+ if ("1" == userVo.pageType) {
|
|
|
binding.monitorGroup.visibility = View.VISIBLE
|
|
binding.monitorGroup.visibility = View.VISIBLE
|
|
|
} else {
|
|
} else {
|
|
|
binding.monitorGroup.visibility = View.GONE
|
|
binding.monitorGroup.visibility = View.GONE
|
|
@@ -462,7 +490,6 @@ class MainActivity :
|
|
|
queryCheckMachineMsgList()
|
|
queryCheckMachineMsgList()
|
|
|
queryNoticeMsgList()
|
|
queryNoticeMsgList()
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
private fun queryBanner() {
|
|
private fun queryBanner() {
|
|
|
val param = BannerImageReq().apply {
|
|
val param = BannerImageReq().apply {
|
|
|
imgCategory = "2"
|
|
imgCategory = "2"
|