Бамп версии до 9 и добавил выбор института
Some checks failed
Build and deploy / Publish image (push) Failing after 1m25s

This commit is contained in:
2025-01-21 02:11:52 +03:00
parent e85cb89e1c
commit 32ba40801a
21 changed files with 127 additions and 30 deletions

View File

@@ -0,0 +1,46 @@
@using Otchinslator.Components.Layout
@layout OtchislenieLayout
@using BlazorPageScript
@using Microsoft.AspNetCore.Authorization
@attribute [Authorize]
@page "/chooseinstitut"
<PageTitle>Институт | Отчислятор 3000</PageTitle>
<PageScript Src="./Components/Pages/ChooseInstitut.razor.js"/>
<div class="relative w-96 sm:w-[32rem]">
<div
class="text-center font-bold text-4xl md:text-5xl w-max absolute left-1/2 -top-1/4 transform -translate-x-1/2 italic">
<br>Выбери свой институт
</div>
<div class="flex flex-col space-y-4 w-96 sm:w-[32rem]">
<div class="card rounded-badge bg-base-200 p-4">
<div class="grid grid-cols-2 gap-4 p-4">
<button id="ИКТИБ" class="institut-button btn h-auto card bg-white p-4 select-none">
<img src="img/iktib.jpg" alt="ИКТИБ" class="w-full h-32 object-contain rounded-md" draggable="false">
<p class="text-center mt-2">ИКТИБ</p>
</button>
<button id="ИРТСУ" class="institut-button btn h-auto card bg-white p-4 select-none">
<img src="img/irtsu.jpg" alt="ИРТСУ" class="w-full h-32 object-contain rounded-md" draggable="false">
<p class="text-center mt-2">ИРТСУ</p>
</button>
<button id="ИНЭП" class="institut-button btn h-auto card bg-white p-4 select-none">
<img src="img/inep.jpg" alt="ИНЭП" class="w-full h-32 object-contain rounded-md" draggable="false">
<p class="text-center mt-2">ИНЭП</p>
</button>
<button id="ИУЭС" class="institut-button btn h-auto card bg-white p-4 select-none">
<img src="img/iues.jpg" alt="ИУЭС" class="w-full h-32 object-contain rounded-md" draggable="false">
<p class="text-center mt-2">ИУЭС</p>
</button>
</div>
<a href="notsupported" class="btn rounded-full bg-white mt-1 mx-4 flex-grow w-30">другой</a>
</div>
</div>
<div class="text-center">
<a href="/"
class="relative btn rounded-full mt-4 min-h-2 min-w-2 w-10 h-10">
<img class="absolute p-2 min-w-2 min-h-0" src="img/exit.svg" alt=""/>
</a>
</div>
</div>

View File

@@ -0,0 +1,9 @@
export function onLoad() {
const buttons = document.querySelectorAll('.institut-button');
buttons.forEach(button => {
button.addEventListener('click', () => {
localStorage.setItem('institut', button.id);
window.location.href = '/questionnaire';
}
)});
}

View File

@@ -1,12 +1,11 @@
@using Microsoft.AspNetCore.Components.Authorization
@inject AuthenticationStateProvider AuthenticationStateProvider
@page "/"
@attribute [DiscoverCollocatedJS]
<PageTitle>Отчислятор 3000</PageTitle>
@code {
private MarkupString GetLinkIfAuth(string link) => new MarkupString(AuthenticationStateProvider.GetAuthenticationStateAsync().Result.User.Identity?.IsAuthenticated == true ? link : "MicrosoftIdentity/Account/SignIn");
}
<JS For="this" Args="[AuthenticationStateProvider.GetAuthenticationStateAsync().Result.User.Identity?.IsAuthenticated]" />
<div class="relative">
@* TODO: Дописать модальное окно *@
@@ -27,7 +26,7 @@
<div class="card rounded-badge bg-base-200 p-4">
<h2 class="card-title text-center text-3xl justify-center my-4">Мне нужно...</h2>
<div class="flex flex-col space-y-4 mt-1">
<a href="@GetLinkIfAuth("otchislenie")" class="btn h-16 btn-primary rounded-full text-2xl relative">
<button id="otchislenie" class="action-button btn h-16 btn-primary rounded-full text-2xl relative">
Отчислиться
<div class="absolute bg-base-200 rounded-full right-1 w-14 h-14">
@{
@@ -41,8 +40,8 @@
}
}
</div>
</a>
<button class="btn h-16 btn-primary rounded-full text-2xl relative">
</button>
<button id="downgrade" class="btn h-16 btn-primary rounded-full text-2xl relative">
Понизить курс
<div class="absolute bg-base-200 rounded-full right-1 w-14 h-14">
<svg class="p-2" fill="none" viewBox="0 0 24 24" id="down-trend-round" xmlns="http://www.w3.org/2000/svg">
@@ -51,7 +50,7 @@
</div>
<i class="absolute text-sm bottom-0 text-base-200 font-medium">временно недоступно</i>
</button>
<button class="btn h-16 btn-primary p-0 rounded-full text-2xl relative">
<button id="akadem" class="btn h-16 btn-primary p-0 rounded-full text-2xl relative">
Уйти в академ
<div class="absolute bg-base-200 rounded-full right-1 w-14 h-14">
<img class="p-2" src="img/akadem.svg" alt=""/>

View File

@@ -0,0 +1,17 @@
export default class extends BlazorJSComponents.Component {
setParameters(IsAuthenticated) {
const buttons = document.querySelectorAll('.action-button');
buttons.forEach(button => {
button.addEventListener('click', () => {
localStorage.setItem('action', button.id);
if (IsAuthenticated) {
window.location.href = '/chooseinstitut';
} else {
window.location.href = '/MicrosoftIdentity/Account/SignIn';
}
}
)
});
this.render();
}
}

View File

@@ -0,0 +1,17 @@
@using Microsoft.AspNetCore.Authorization
@attribute [Authorize]
@page "/notsupported"
<PageTitle>Не доступно | Отчислятор 3000</PageTitle>
<div class="relative w-96 sm:w-[32rem]">
<p class="text-center">Извините за неудобства, но пока что доступны только институты <p class="font-bold text-center">ИТА ЮФУ</p></p>
<div class="text-center">
<a href="/"
class="relative btn rounded-full mt-4 min-h-2 min-w-2 w-10 h-10">
<img class="absolute p-2 min-w-2 min-h-0" src="img/exit.svg" alt=""/>
</a>
</div>
</div>

View File

@@ -1,5 +1,4 @@
@page "/otchislenie"
@page "/otchislenie/questionnaire"
@page "/questionnaire"
@using Otchinslator.Components.Layout
@layout OtchislenieLayout
@using BlazorPageScript
@@ -175,7 +174,7 @@
class="relative btn btn-primary rounded-full flex-grow-0 w-[3rem] h-[3rem]">
<img class="absolute p-3" src="img/exit.svg" alt=""/>
</a>
<a href="otchislenie/statement" class="btn rounded-full btn-primary flex-grow w-30">Продолжим</a>
<a href="/statement" class="btn rounded-full btn-primary flex-grow w-30">Продолжим</a>
<button onclick="info_modal.showModal()" class="btn btn-primary rounded-full flex-grow-0 w-[3rem]">?</button>
</div>
</div>

View File

@@ -1,4 +1,11 @@
export function onLoad() {
if (localStorage.getItem('action') == null) {
window.location.href = '/';
}
if (localStorage.getItem('institut') == null) {
window.location.href = '/chooseinstitut';
}
// Подготовка поля ввода номера телефона
document.getElementById('phoneNumberInput').addEventListener('input', function (e) {
e.target.value = e.target.value.replace(/\D/g, '').slice(0, 10); // Limit to 10 digits
@@ -12,7 +19,7 @@ export function onLoad() {
}
});
const continueButton = document.querySelector('a[href="otchislenie/statement"]');
const continueButton = document.querySelector('a[href="/statement"]');
const options = document.querySelectorAll('input[name="options"]');
const kursElements = document.querySelectorAll('input[name="kurs"]');
const phoneNumberInput = document.getElementById('phoneNumberInput');

View File

@@ -63,7 +63,7 @@
@* $1$ TODO: Сделать адаптив #1# *@
@* <div class="mt-9 flex flex-col space-y-4 lg:flex-row lg:space-x-4 lg:space-y-0 w-96 mx-auto" > *@
@* <div class="mt-9 flex flex-col space-y-4 w-96 mx-auto"> *@
@* <a href="/otchislenie/statement" class="btn w-96 h-14 btn-primary rounded-full text-2xl"> *@
@* <a href="/statement" class="btn w-96 h-14 btn-primary rounded-full text-2xl"> *@
@* Назад *@
@* </a> *@
@* <a href="/" class="btn w-96 h-14 btn-primary rounded-full text-2xl"> *@

View File

@@ -1,4 +1,4 @@
@page "/otchislenie/statement"
@page "/statement"
@using Otchinslator.Components.Layout
@layout OtchislenieLayout
@using BlazorPageScript