|
|
|
|
@ -51,9 +51,9 @@ class LoginActivity : BaseActivityOaToolbarViewBinding<ActivityLoginBinding>() {
|
|
|
|
|
SPUtils.put(this, Contans.XZ_WIFI_IP, Contans.BASE_URL_INTRANET) //行政IP内网
|
|
|
|
|
}
|
|
|
|
|
val saveUserAndPassword = SPUtils.get(
|
|
|
|
|
context,
|
|
|
|
|
Contans.SP.SAVE_USER_AND_PASSWORD,
|
|
|
|
|
java.lang.Boolean.TRUE
|
|
|
|
|
context,
|
|
|
|
|
Contans.SP.SAVE_USER_AND_PASSWORD,
|
|
|
|
|
java.lang.Boolean.TRUE
|
|
|
|
|
) as Boolean
|
|
|
|
|
binding.swRememberPwd.isChecked = saveUserAndPassword
|
|
|
|
|
|
|
|
|
|
@ -73,18 +73,18 @@ class LoginActivity : BaseActivityOaToolbarViewBinding<ActivityLoginBinding>() {
|
|
|
|
|
Contans.IP = Contans.IP_INTRANET //运行IP内网
|
|
|
|
|
Contans.BASE_URL = Contans.BASE_URL_INTRANET //行政IP内网
|
|
|
|
|
Contans.BASE_URL_COMPANY_SERVER =
|
|
|
|
|
Contans.BASE_URL_COMPANY_SERVER_INTRANET //智慧安防平台登录 电厂内网
|
|
|
|
|
Contans.BASE_URL_COMPANY_SERVER_INTRANET //智慧安防平台登录 电厂内网
|
|
|
|
|
Contans.BASE_URL_AI_3D_SERVER =
|
|
|
|
|
Contans.BASE_URL_AI_3D_SERVER_INTRANET //AI三维可视化安防平台登录 电厂外网
|
|
|
|
|
Contans.BASE_URL_AI_3D_SERVER_INTRANET //AI三维可视化安防平台登录 电厂外网
|
|
|
|
|
}
|
|
|
|
|
if (networkCheckType == "外网") {
|
|
|
|
|
binding.rg.check(R.id.rb2)
|
|
|
|
|
Contans.IP = Contans.IP_EXTRANET //运行IP外网
|
|
|
|
|
Contans.BASE_URL = Contans.BASE_URL_EXTRANET //行政IP外网
|
|
|
|
|
Contans.BASE_URL_COMPANY_SERVER =
|
|
|
|
|
Contans.BASE_URL_COMPANY_SERVER_EXTRANET //智慧安防平台登录 电厂外网
|
|
|
|
|
Contans.BASE_URL_COMPANY_SERVER_EXTRANET //智慧安防平台登录 电厂外网
|
|
|
|
|
Contans.BASE_URL_AI_3D_SERVER =
|
|
|
|
|
Contans.BASE_URL_AI_3D_SERVER_EXTRANET //AI三维可视化安防平台登录 电厂外网
|
|
|
|
|
Contans.BASE_URL_AI_3D_SERVER_EXTRANET //AI三维可视化安防平台登录 电厂外网
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
binding.rg.check(R.id.rb2)
|
|
|
|
|
@ -92,9 +92,9 @@ class LoginActivity : BaseActivityOaToolbarViewBinding<ActivityLoginBinding>() {
|
|
|
|
|
Contans.IP = Contans.IP_EXTRANET //运行IP外网
|
|
|
|
|
Contans.BASE_URL = Contans.BASE_URL_EXTRANET //行政IP外网
|
|
|
|
|
Contans.BASE_URL_COMPANY_SERVER =
|
|
|
|
|
Contans.BASE_URL_COMPANY_SERVER_EXTRANET //智慧安防平台登录 电厂外网
|
|
|
|
|
Contans.BASE_URL_COMPANY_SERVER_EXTRANET //智慧安防平台登录 电厂外网
|
|
|
|
|
Contans.BASE_URL_AI_3D_SERVER =
|
|
|
|
|
Contans.BASE_URL_AI_3D_SERVER_EXTRANET //AI三维可视化安防平台登录 电厂外网
|
|
|
|
|
Contans.BASE_URL_AI_3D_SERVER_EXTRANET //AI三维可视化安防平台登录 电厂外网
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
binding.rg.setOnCheckedChangeListener(RadioGroup.OnCheckedChangeListener { _, checkedId ->
|
|
|
|
|
@ -104,9 +104,9 @@ class LoginActivity : BaseActivityOaToolbarViewBinding<ActivityLoginBinding>() {
|
|
|
|
|
Contans.IP = Contans.IP_INTRANET //运行IP内网
|
|
|
|
|
Contans.BASE_URL = Contans.BASE_URL_INTRANET //行政IP内网
|
|
|
|
|
Contans.BASE_URL_COMPANY_SERVER =
|
|
|
|
|
Contans.BASE_URL_COMPANY_SERVER_INTRANET //智慧安防平台登录 电厂内网
|
|
|
|
|
Contans.BASE_URL_COMPANY_SERVER_INTRANET //智慧安防平台登录 电厂内网
|
|
|
|
|
Contans.BASE_URL_AI_3D_SERVER =
|
|
|
|
|
Contans.BASE_URL_AI_3D_SERVER_INTRANET //AI三维可视化安防平台登录 电厂外网
|
|
|
|
|
Contans.BASE_URL_AI_3D_SERVER_INTRANET //AI三维可视化安防平台登录 电厂外网
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
R.id.rb2 -> {
|
|
|
|
|
@ -114,9 +114,9 @@ class LoginActivity : BaseActivityOaToolbarViewBinding<ActivityLoginBinding>() {
|
|
|
|
|
Contans.IP = Contans.IP_EXTRANET //运行IP外网
|
|
|
|
|
Contans.BASE_URL = Contans.BASE_URL_EXTRANET //行政IP外网
|
|
|
|
|
Contans.BASE_URL_COMPANY_SERVER =
|
|
|
|
|
Contans.BASE_URL_COMPANY_SERVER_EXTRANET //智慧安防平台登录 电厂外网
|
|
|
|
|
Contans.BASE_URL_COMPANY_SERVER_EXTRANET //智慧安防平台登录 电厂外网
|
|
|
|
|
Contans.BASE_URL_AI_3D_SERVER =
|
|
|
|
|
Contans.BASE_URL_AI_3D_SERVER_EXTRANET //AI三维可视化安防平台登录 电厂外网
|
|
|
|
|
Contans.BASE_URL_AI_3D_SERVER_EXTRANET //AI三维可视化安防平台登录 电厂外网
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
@ -127,12 +127,12 @@ class LoginActivity : BaseActivityOaToolbarViewBinding<ActivityLoginBinding>() {
|
|
|
|
|
override fun initData() {
|
|
|
|
|
binding.tvVersionCode.text = getString(R.string.version_code) + getVersionName()
|
|
|
|
|
AndPermission.with(this).runtime().permission(
|
|
|
|
|
Permission.READ_PHONE_STATE,
|
|
|
|
|
Permission.READ_EXTERNAL_STORAGE,
|
|
|
|
|
Permission.WRITE_EXTERNAL_STORAGE,
|
|
|
|
|
Permission.CAMERA
|
|
|
|
|
Permission.READ_PHONE_STATE,
|
|
|
|
|
Permission.READ_EXTERNAL_STORAGE,
|
|
|
|
|
Permission.WRITE_EXTERNAL_STORAGE,
|
|
|
|
|
Permission.CAMERA
|
|
|
|
|
).onGranted { }.onDenied { }
|
|
|
|
|
.start()
|
|
|
|
|
.start()
|
|
|
|
|
|
|
|
|
|
val UserIDTemp = SPUtils.get(context, Contans.SP.USER_NAME, "") as String
|
|
|
|
|
val UserPwdTemp = SPUtils.get(context, Contans.SP.PASS_WORD, "") as String
|
|
|
|
|
@ -150,8 +150,8 @@ class LoginActivity : BaseActivityOaToolbarViewBinding<ActivityLoginBinding>() {
|
|
|
|
|
if (BuildConfig.LOG_ERROR) {
|
|
|
|
|
|
|
|
|
|
// 管理员
|
|
|
|
|
binding.etUsername.setText("ZHPS_Admin")
|
|
|
|
|
binding.etPassword.setText("Rehome.zhps@2020")
|
|
|
|
|
binding.etUsername.setText("ZHPS_Admin")
|
|
|
|
|
binding.etPassword.setText("Rehome.zhps@2020")
|
|
|
|
|
//
|
|
|
|
|
// binding.etUsername.setText("310665")
|
|
|
|
|
// binding.etPassword.setText("ABcd.123")
|
|
|
|
|
@ -162,15 +162,19 @@ class LoginActivity : BaseActivityOaToolbarViewBinding<ActivityLoginBinding>() {
|
|
|
|
|
// binding.etPassword.setText("Abc*00467309")
|
|
|
|
|
//
|
|
|
|
|
// //马
|
|
|
|
|
binding.etUsername.setText("310482")
|
|
|
|
|
binding.etPassword.setText("Maying0509?")
|
|
|
|
|
// binding.etUsername.setText("310482")
|
|
|
|
|
// binding.etPassword.setText("Maying0509?")
|
|
|
|
|
//
|
|
|
|
|
// //程宇翔
|
|
|
|
|
binding.etUsername.setText("310673")
|
|
|
|
|
binding.etPassword.setText("Abcd@1234")
|
|
|
|
|
// binding.etUsername.setText("310673")
|
|
|
|
|
// binding.etPassword.setText("Abcd@1234")
|
|
|
|
|
//李耿
|
|
|
|
|
// binding.etUsername.setText("310261")
|
|
|
|
|
// binding.etPassword.setText("!Lig770731")
|
|
|
|
|
binding.etUsername.setText("310261")
|
|
|
|
|
binding.etPassword.setText("#LIgeng770731")
|
|
|
|
|
//古舒敏
|
|
|
|
|
// binding.etUsername.setText("310585")
|
|
|
|
|
// binding.etPassword.setText("Lama520+_*")
|
|
|
|
|
|
|
|
|
|
//陈嘉
|
|
|
|
|
// binding.etUsername.setText("310408")
|
|
|
|
|
// binding.etPassword.setText("zhpCJ1981+")
|
|
|
|
|
@ -192,8 +196,8 @@ class LoginActivity : BaseActivityOaToolbarViewBinding<ActivityLoginBinding>() {
|
|
|
|
|
|
|
|
|
|
binding.textWjmm.setOnClickListener(View.OnClickListener {
|
|
|
|
|
val intent = Intent(
|
|
|
|
|
this,
|
|
|
|
|
WjmmGetVerificationCodeActivity::class.java
|
|
|
|
|
this,
|
|
|
|
|
WjmmGetVerificationCodeActivity::class.java
|
|
|
|
|
)
|
|
|
|
|
startActivity(intent)
|
|
|
|
|
})
|
|
|
|
|
@ -223,14 +227,14 @@ class LoginActivity : BaseActivityOaToolbarViewBinding<ActivityLoginBinding>() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private fun PackageManager.getPackageInfoCompat(
|
|
|
|
|
packageName: String,
|
|
|
|
|
flags: Int = 0
|
|
|
|
|
packageName: String,
|
|
|
|
|
flags: Int = 0
|
|
|
|
|
): PackageInfo =
|
|
|
|
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
|
|
|
|
getPackageInfo(packageName, PackageManager.PackageInfoFlags.of(flags.toLong()))
|
|
|
|
|
} else {
|
|
|
|
|
@Suppress("DEPRECATION") getPackageInfo(packageName, flags)
|
|
|
|
|
}
|
|
|
|
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
|
|
|
|
getPackageInfo(packageName, PackageManager.PackageInfoFlags.of(flags.toLong()))
|
|
|
|
|
} else {
|
|
|
|
|
@Suppress("DEPRECATION") getPackageInfo(packageName, flags)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private fun appLogin() {
|
|
|
|
|
val json: String = getPhoneInfo()
|
|
|
|
|
@ -249,51 +253,51 @@ class LoginActivity : BaseActivityOaToolbarViewBinding<ActivityLoginBinding>() {
|
|
|
|
|
if (userInfo.statusMsg == "success") { //登录成功
|
|
|
|
|
MiPushClient.setAlias(context, binding.etUsername.text.toString(), null)
|
|
|
|
|
SPUtils.put(
|
|
|
|
|
context,
|
|
|
|
|
Contans.SP.OLD_PWD,
|
|
|
|
|
RSAUtils.encryptBASE64StrLocal(binding.etPassword.text.toString())
|
|
|
|
|
context,
|
|
|
|
|
Contans.SP.OLD_PWD,
|
|
|
|
|
RSAUtils.encryptBASE64StrLocal(binding.etPassword.text.toString())
|
|
|
|
|
)
|
|
|
|
|
if (binding.swRememberPwd.isChecked) {
|
|
|
|
|
SPUtils.put(
|
|
|
|
|
context,
|
|
|
|
|
Contans.SP.USER_NAME,
|
|
|
|
|
RSAUtils.encryptBASE64StrLocal(binding.etUsername.text.toString())
|
|
|
|
|
context,
|
|
|
|
|
Contans.SP.USER_NAME,
|
|
|
|
|
RSAUtils.encryptBASE64StrLocal(binding.etUsername.text.toString())
|
|
|
|
|
)
|
|
|
|
|
SPUtils.put(
|
|
|
|
|
context,
|
|
|
|
|
Contans.SP.PASS_WORD,
|
|
|
|
|
RSAUtils.encryptBASE64StrLocal(binding.etPassword.text.toString())
|
|
|
|
|
context,
|
|
|
|
|
Contans.SP.PASS_WORD,
|
|
|
|
|
RSAUtils.encryptBASE64StrLocal(binding.etPassword.text.toString())
|
|
|
|
|
)
|
|
|
|
|
val strEncryptMqtt = RSAUtils.encryptBASE64StrMqtt(getPhoneInfoMqtt());
|
|
|
|
|
SPUtils.put(context, Contans.SP.PHONE_INFO, strEncryptMqtt)
|
|
|
|
|
SPUtils.put(
|
|
|
|
|
context,
|
|
|
|
|
Contans.SP.AF_PASS_WORD,
|
|
|
|
|
RSAUtils.encryptBASE64StrLocal(binding.etPassword.text.toString())
|
|
|
|
|
context,
|
|
|
|
|
Contans.SP.AF_PASS_WORD,
|
|
|
|
|
RSAUtils.encryptBASE64StrLocal(binding.etPassword.text.toString())
|
|
|
|
|
)
|
|
|
|
|
} else {
|
|
|
|
|
SPUtils.put(context, Contans.SP.USER_NAME, "")
|
|
|
|
|
SPUtils.put(context, Contans.SP.PASS_WORD, "")
|
|
|
|
|
}
|
|
|
|
|
SPUtils.put(
|
|
|
|
|
context,
|
|
|
|
|
Contans.BZBH,
|
|
|
|
|
if (userInfo.bzbh == null) "" else userInfo.bzbh
|
|
|
|
|
context,
|
|
|
|
|
Contans.BZBH,
|
|
|
|
|
if (userInfo.bzbh == null) "" else userInfo.bzbh
|
|
|
|
|
)
|
|
|
|
|
SPUtils.put(
|
|
|
|
|
context,
|
|
|
|
|
Contans.BZMC,
|
|
|
|
|
if (userInfo.bzmc == null) "" else userInfo.bzmc
|
|
|
|
|
context,
|
|
|
|
|
Contans.BZMC,
|
|
|
|
|
if (userInfo.bzmc == null) "" else userInfo.bzmc
|
|
|
|
|
)
|
|
|
|
|
SPUtils.put(
|
|
|
|
|
context,
|
|
|
|
|
Contans.SCBZBH,
|
|
|
|
|
if (userInfo.scbzbh == null) "" else userInfo.scbzbh
|
|
|
|
|
context,
|
|
|
|
|
Contans.SCBZBH,
|
|
|
|
|
if (userInfo.scbzbh == null) "" else userInfo.scbzbh
|
|
|
|
|
)
|
|
|
|
|
SPUtils.put(
|
|
|
|
|
context,
|
|
|
|
|
Contans.ISSCBM,
|
|
|
|
|
if (userInfo.isScBm == null) "" else userInfo.isScBm
|
|
|
|
|
context,
|
|
|
|
|
Contans.ISSCBM,
|
|
|
|
|
if (userInfo.isScBm == null) "" else userInfo.isScBm
|
|
|
|
|
)
|
|
|
|
|
// if (userInfo.isScBm == null) {
|
|
|
|
|
// Log.i("app", "userInfo.isScBm is null")
|
|
|
|
|
@ -306,9 +310,9 @@ class LoginActivity : BaseActivityOaToolbarViewBinding<ActivityLoginBinding>() {
|
|
|
|
|
// }
|
|
|
|
|
Contans.PERMISSIONSRESULT = userInfo.permissionsResult
|
|
|
|
|
SPUtils.put(
|
|
|
|
|
context,
|
|
|
|
|
Contans.PERMISSIONSRESULT,
|
|
|
|
|
if (userInfo.permissionsResult == null) "" else userInfo.permissionsResult
|
|
|
|
|
context,
|
|
|
|
|
Contans.PERMISSIONSRESULT,
|
|
|
|
|
if (userInfo.permissionsResult == null) "" else userInfo.permissionsResult
|
|
|
|
|
)
|
|
|
|
|
App.getInstance().userInfo = userInfo
|
|
|
|
|
val intent = Intent(context, MainActivity::class.java)
|
|
|
|
|
@ -319,7 +323,7 @@ class LoginActivity : BaseActivityOaToolbarViewBinding<ActivityLoginBinding>() {
|
|
|
|
|
} else {
|
|
|
|
|
Log.i("login", userInfo.statusMsg)
|
|
|
|
|
toastviewbymyself.makeText(context, userInfo.statusMsg, Toast.LENGTH_LONG)
|
|
|
|
|
.show()
|
|
|
|
|
.show()
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
showToast("服务器请求失败")
|
|
|
|
|
|