|
|
@ -27,10 +27,7 @@ import com.gyf.csams.BuildConfig |
|
|
|
import com.gyf.csams.R |
|
|
|
import com.gyf.csams.R |
|
|
|
import com.gyf.csams.account.model.AccountViewModel |
|
|
|
import com.gyf.csams.account.model.AccountViewModel |
|
|
|
import com.gyf.csams.account.model.DialogMessage |
|
|
|
import com.gyf.csams.account.model.DialogMessage |
|
|
|
import com.gyf.lib.uikit.BaseTextField |
|
|
|
import com.gyf.lib.uikit.* |
|
|
|
import com.gyf.lib.uikit.Body |
|
|
|
|
|
|
|
import com.gyf.lib.uikit.FormStatus |
|
|
|
|
|
|
|
import com.gyf.lib.uikit.ScaffoldModel |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
enum class AccountRoute { |
|
|
|
enum class AccountRoute { |
|
|
@ -43,12 +40,13 @@ class AccountActivity : ComponentActivity() { |
|
|
|
super.onCreate(savedInstanceState) |
|
|
|
super.onCreate(savedInstanceState) |
|
|
|
|
|
|
|
|
|
|
|
setContent { |
|
|
|
setContent { |
|
|
|
Body { nav -> |
|
|
|
TestBody { nav, scaffoldState -> |
|
|
|
NavHost(navController = nav, startDestination = AccountRoute.Login.name) { |
|
|
|
NavHost(navController = nav, startDestination = AccountRoute.Login.name) { |
|
|
|
composable(AccountRoute.Login.name) { |
|
|
|
composable(AccountRoute.Login.name) { |
|
|
|
Account( |
|
|
|
Account( |
|
|
|
route = AccountRoute.Login |
|
|
|
route = AccountRoute.Login |
|
|
|
) { isValidForm: Boolean, accountViewModel: AccountViewModel, scaffoldModel: ScaffoldModel -> |
|
|
|
) { isValidForm: Boolean, accountViewModel: AccountViewModel, scaffoldModel: ScaffoldModel -> |
|
|
|
|
|
|
|
|
|
|
|
Spacer(modifier = Modifier.height(10.dp)) |
|
|
|
Spacer(modifier = Modifier.height(10.dp)) |
|
|
|
OutlinedButton( |
|
|
|
OutlinedButton( |
|
|
|
onClick = { |
|
|
|
onClick = { |
|
|
@ -70,15 +68,16 @@ class AccountActivity : ComponentActivity() { |
|
|
|
finish() |
|
|
|
finish() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
OutlinedButton( |
|
|
|
OutlinedButton( |
|
|
|
onClick = { nav.navigate(AccountRoute.Register.name) }, |
|
|
|
onClick = { nav.navigate(AccountRoute.Register.name) }, |
|
|
|
modifier = Modifier.fillMaxWidth(), |
|
|
|
modifier = Modifier.fillMaxWidth(), |
|
|
|
colors = ButtonDefaults.outlinedButtonColors( |
|
|
|
colors = ButtonDefaults.outlinedButtonColors( |
|
|
|
contentColor = MaterialTheme.colors.onBackground |
|
|
|
contentColor = MaterialTheme.colors.onBackground |
|
|
|
) |
|
|
|
) |
|
|
|
) { |
|
|
|
) { |
|
|
|
Text(text = accountViewModel.goRegister) |
|
|
|
Text(text = accountViewModel.goRegister) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
ShowSnackbar(scaffoldState = scaffoldState) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
@ -147,10 +146,10 @@ class AccountActivity : ComponentActivity() { |
|
|
|
append(accountViewModel.name.formValue.value ?: "") |
|
|
|
append(accountViewModel.name.formValue.value ?: "") |
|
|
|
} |
|
|
|
} |
|
|
|
withStyle(style = MaterialTheme.typography.subtitle1.toSpanStyle()) { |
|
|
|
withStyle(style = MaterialTheme.typography.subtitle1.toSpanStyle()) { |
|
|
|
append(stringResource(id = R.string.welcome_start)) |
|
|
|
append(accountViewModel.welcomeStart) |
|
|
|
} |
|
|
|
} |
|
|
|
withStyle(style = MaterialTheme.typography.subtitle2.toSpanStyle()) { |
|
|
|
withStyle(style = MaterialTheme.typography.subtitle2.toSpanStyle()) { |
|
|
|
append(stringResource(id = R.string.welcome_end)) |
|
|
|
append(accountViewModel.welcomeEnd) |
|
|
|
} |
|
|
|
} |
|
|
|
withStyle( |
|
|
|
withStyle( |
|
|
|
style = MaterialTheme.typography.subtitle2.toSpanStyle() |
|
|
|
style = MaterialTheme.typography.subtitle2.toSpanStyle() |
|
|
@ -160,7 +159,7 @@ class AccountActivity : ComponentActivity() { |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
StudentId(checkRepeat = route == AccountRoute.Register) |
|
|
|
StudentId() |
|
|
|
Spacer(modifier = Modifier.height(10.dp)) |
|
|
|
Spacer(modifier = Modifier.height(10.dp)) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -184,7 +183,7 @@ class AccountActivity : ComponentActivity() { |
|
|
|
* @param accountViewModel |
|
|
|
* @param accountViewModel |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Composable |
|
|
|
@Composable |
|
|
|
private fun StudentId(accountViewModel: AccountViewModel = viewModel(), checkRepeat: Boolean) { |
|
|
|
private fun StudentId(accountViewModel: AccountViewModel = viewModel()) { |
|
|
|
Column { |
|
|
|
Column { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|