|
|
@@ -11,6 +11,7 @@ import androidx.compose.foundation.layout.Column
|
|
|
import androidx.compose.foundation.layout.PaddingValues
|
|
|
import androidx.compose.foundation.layout.Row
|
|
|
import androidx.compose.foundation.layout.Spacer
|
|
|
+import androidx.compose.foundation.layout.fillMaxHeight
|
|
|
import androidx.compose.foundation.layout.fillMaxSize
|
|
|
import androidx.compose.foundation.layout.fillMaxWidth
|
|
|
import androidx.compose.foundation.layout.height
|
|
|
@@ -43,6 +44,7 @@ import androidx.compose.ui.text.font.FontWeight
|
|
|
import androidx.compose.ui.text.input.KeyboardType
|
|
|
import androidx.compose.ui.text.input.PasswordVisualTransformation
|
|
|
import androidx.compose.ui.text.input.VisualTransformation
|
|
|
+import androidx.compose.ui.text.style.TextAlign
|
|
|
import androidx.compose.ui.unit.dp
|
|
|
import androidx.compose.ui.unit.sp
|
|
|
import androidx.lifecycle.viewmodel.compose.viewModel
|
|
|
@@ -51,12 +53,14 @@ import com.iscs.bozzys.ui.common.PageBase
|
|
|
import com.iscs.bozzys.ui.pages.home.openPageHome
|
|
|
import com.iscs.bozzys.ui.pages.vm.VMLogin
|
|
|
import com.iscs.bozzys.ui.theme.Main
|
|
|
+import com.iscs.bozzys.ui.theme.SubMain
|
|
|
import com.iscs.bozzys.ui.theme.Text
|
|
|
import com.iscs.bozzys.ui.theme.TextDesc
|
|
|
import com.iscs.bozzys.utils.BiometricKeyStore
|
|
|
import com.iscs.bozzys.utils.LogUtil
|
|
|
import com.iscs.bozzys.utils.Storage
|
|
|
import com.iscs.bozzys.utils.SystemUtil
|
|
|
+import com.iscs.bozzys.utils.SystemUtil.getAppVersionInfo
|
|
|
|
|
|
/**
|
|
|
* 打开登录页面
|
|
|
@@ -138,41 +142,41 @@ class PageLogin : PageBase() {
|
|
|
) {
|
|
|
Text("欢迎登录", fontSize = 20.sp, fontWeight = FontWeight.SemiBold, color = Text, modifier = Modifier.padding(top = 30.dp))
|
|
|
Spacer(Modifier.weight(1f))
|
|
|
-// Row(
|
|
|
-// Modifier
|
|
|
-// .padding(top = 24.dp)
|
|
|
-// .size(335.dp, 47.dp)
|
|
|
-// .border(1.dp, color = Color(0xFFD1D5DB), shape = RoundedCornerShape(12.dp))
|
|
|
-// .clip(RoundedCornerShape(12.dp)),
|
|
|
-// verticalAlignment = Alignment.CenterVertically
|
|
|
-// ) {
|
|
|
-// Text(
|
|
|
-// "短信登录",
|
|
|
-// Modifier
|
|
|
-// .weight(1f)
|
|
|
-// .fillMaxHeight()
|
|
|
-// .background(if (state.loginType == 0) SubMain else Color.White)
|
|
|
-// .clickable(onClick = { vm.updateLoginType(0) }),
|
|
|
-// color = if (state.loginType == 0) Main else TextDesc,
|
|
|
-// lineHeight = 47.sp,
|
|
|
-// fontSize = 14.sp,
|
|
|
-// fontWeight = if (state.loginType == 0) FontWeight.SemiBold else FontWeight.Normal,
|
|
|
-// textAlign = TextAlign.Center
|
|
|
-// )
|
|
|
-// Text(
|
|
|
-// "密码登录",
|
|
|
-// Modifier
|
|
|
-// .weight(1f)
|
|
|
-// .fillMaxHeight()
|
|
|
-// .background(if (state.loginType == 1) SubMain else Color.White)
|
|
|
-// .clickable(onClick = { vm.updateLoginType(1) }),
|
|
|
-// color = if (state.loginType == 1) Main else TextDesc,
|
|
|
-// lineHeight = 47.sp,
|
|
|
-// fontSize = 14.sp,
|
|
|
-// fontWeight = if (state.loginType == 1) FontWeight.SemiBold else FontWeight.Normal,
|
|
|
-// textAlign = TextAlign.Center,
|
|
|
-// )
|
|
|
-// }
|
|
|
+ Row(
|
|
|
+ Modifier
|
|
|
+ .padding(top = 24.dp)
|
|
|
+ .size(335.dp, 47.dp)
|
|
|
+ .border(1.dp, color = Color(0xFFD1D5DB), shape = RoundedCornerShape(12.dp))
|
|
|
+ .clip(RoundedCornerShape(12.dp)),
|
|
|
+ verticalAlignment = Alignment.CenterVertically
|
|
|
+ ) {
|
|
|
+ Text(
|
|
|
+ "短信登录",
|
|
|
+ Modifier
|
|
|
+ .weight(1f)
|
|
|
+ .fillMaxHeight()
|
|
|
+ .background(if (state.loginType == 0) SubMain else Color.White)
|
|
|
+ .clickable(onClick = { vm.updateLoginType(0) }),
|
|
|
+ color = if (state.loginType == 0) Main else TextDesc,
|
|
|
+ lineHeight = 47.sp,
|
|
|
+ fontSize = 14.sp,
|
|
|
+ fontWeight = if (state.loginType == 0) FontWeight.SemiBold else FontWeight.Normal,
|
|
|
+ textAlign = TextAlign.Center
|
|
|
+ )
|
|
|
+ Text(
|
|
|
+ "密码登录",
|
|
|
+ Modifier
|
|
|
+ .weight(1f)
|
|
|
+ .fillMaxHeight()
|
|
|
+ .background(if (state.loginType == 1) SubMain else Color.White)
|
|
|
+ .clickable(onClick = { vm.updateLoginType(1) }),
|
|
|
+ color = if (state.loginType == 1) Main else TextDesc,
|
|
|
+ lineHeight = 47.sp,
|
|
|
+ fontSize = 14.sp,
|
|
|
+ fontWeight = if (state.loginType == 1) FontWeight.SemiBold else FontWeight.Normal,
|
|
|
+ textAlign = TextAlign.Center,
|
|
|
+ )
|
|
|
+ }
|
|
|
Row(
|
|
|
Modifier
|
|
|
.padding(top = 24.dp)
|
|
|
@@ -304,8 +308,8 @@ class PageLogin : PageBase() {
|
|
|
.clickable {
|
|
|
val cipher = BiometricKeyStore.decryptCipher(Storage.readTokenIv())
|
|
|
SystemUtil.showFingerAuth(this@PageLogin, cipher, Storage.readTokenIvValue()) {
|
|
|
- LogUtil.i("xiaoming", "当前 token -> ${Storage.readToken()}")
|
|
|
- LogUtil.i("xiaoming", "解密 token -> ${String(it)}")
|
|
|
+ // LogUtil.i("xiaoming", "当前 token -> ${Storage.readToken()}")
|
|
|
+ // LogUtil.i("xiaoming", "解密 token -> ${String(it)}")
|
|
|
}
|
|
|
}
|
|
|
.background(Color(0xFFF5F5F5))
|
|
|
@@ -345,7 +349,7 @@ class PageLogin : PageBase() {
|
|
|
.background(Color(0xFFEEEEEE))
|
|
|
)
|
|
|
Text("LOTO智能锁控·能量安全隔离", Modifier.padding(top = 20.dp, bottom = 4.dp), fontSize = 14.sp, color = Color(0xFF666666))
|
|
|
- Text("版本 v1.0.0", Modifier.padding(bottom = 20.dp), fontSize = 14.sp, color = Color(0xFF666666))
|
|
|
+ Text("版本 v${ctx.getAppVersionInfo().second}", Modifier.padding(bottom = 20.dp), fontSize = 14.sp, color = Color(0xFF666666))
|
|
|
}
|
|
|
Spacer(Modifier.weight(1f))
|
|
|
}
|