new intarfece

This commit is contained in:
2026-04-06 12:15:09 +05:00
parent fe078b8560
commit 10fb240dcd
17 changed files with 197 additions and 129 deletions

View File

@@ -6,6 +6,7 @@ from info import AuthService
class LoginView(ft.View):
def __init__(self, page: ft.Page):
self._auth = AuthService(page)
self.pageS = page
self._username = ds.CastomTextField_input(
label="Логин",
@@ -21,7 +22,7 @@ class LoginView(ft.View):
can_reveal_password=True,
)
self._error = ft.Text("", color=ft.Colors.RED_400, size=14, visible=False)
self._error = ft.Text("", color=ft.Colors.RED_400, size=ds.s(14), visible=False)
self._btn = ds.CastomButton(
text="Войти",
@@ -29,9 +30,8 @@ class LoginView(ft.View):
)
self._reg_link = ft.TextButton(
content="Нет аккаунта? Зарегистрироваться",
style=ft.ButtonStyle(color=ds.clolors.ferst),
on_click=lambda e: page.run_task(page.push_route, "/reg"),
content=ft.Text("Нет аккаунта? Зарегистрироваться", color=ds.clolors.ferst, size=ds.s(14)),
on_click=self.open_dialog,
)
super().__init__(
@@ -39,22 +39,23 @@ class LoginView(ft.View):
bgcolor=ds.clolors.background,
horizontal_alignment=ft.CrossAxisAlignment.STRETCH,
vertical_alignment=ft.MainAxisAlignment.CENTER,
padding=ft.padding.symmetric(horizontal=16, vertical=24),
padding=ft.padding.symmetric(horizontal=ds.s(16), vertical=ds.s(24)),
scroll=ft.ScrollMode.AUTO,
)
self.controls = [
ft.Text("COPP", color=ds.clolors.ferst, size=30, weight=ft.FontWeight.BOLD,
ft.Text("ЦОПП", color=ds.clolors.ferst, size=ds.s(30), weight=ft.FontWeight.BOLD,
text_align=ft.TextAlign.CENTER),
ft.Container(height=8),
ft.Text("Вход в систему", color=ds.clolors.ferst, size=16,
ft.Container(height=ds.s(8)),
ft.Text("Это проект цопп по проведению иследовательских тестирований", color=ds.clolors.ferst, size=ds.s(16),
text_align=ft.TextAlign.CENTER),
ft.Container(height=24),
ft.Container(height=ds.s(24)),
ft.Container(
padding=ft.padding.all(24),
padding=ft.padding.all(ds.s(24)),
bgcolor=ds.clolors.laer3,
border_radius=16,
border_radius=ds.s(16),
alignment=ft.Alignment.CENTER,
content=ft.Column(
spacing=16,
spacing=ds.s(16),
controls=[
self._username,
self._password,
@@ -65,7 +66,16 @@ class LoginView(ft.View):
),
),
]
def open_dialog(self, e):
self.dialog = ds.AlterDiaalogApproval(
on_accept=lambda: self.pageS.run_task(self.pageS.push_route, "/reg")
)
self.dialog.open = True
self.pageS.overlay.append(self.dialog)
self.pageS.update()
async def _do_login(self):
username = self._username.value.strip()
password = self._password.value