Бамп версии до 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

@@ -5,8 +5,8 @@
private Dictionary<string, string> _links = new() private Dictionary<string, string> _links = new()
{ {
{ "Анкета", "/otchislenie/questionnaire" }, { "Анкета", "/questionnaire" },
{ "Заявление", "/otchislenie/statement" }, { "Заявление", "/statement" },
{ "Отправка", "/otchislenie/result" }, { "Отправка", "/otchislenie/result" },
{ "Свобода", "/otchislenie/congratulation" } { "Свобода", "/otchislenie/congratulation" }
}; };
@@ -17,11 +17,10 @@
base.OnInitialized(); base.OnInitialized();
switch (Navigation.ToBaseRelativePath(Navigation.Uri)) switch (Navigation.ToBaseRelativePath(Navigation.Uri))
{ {
case "otchislenie/questionnaire": case "questionnaire":
case "otchislenie":
_lvl = 1; _lvl = 1;
break; break;
case "otchislenie/statement": case "statement":
_lvl = 2; _lvl = 2;
break; break;
case "otchislenie/result": case "otchislenie/result":
@@ -37,7 +36,7 @@
<footer class="card fixed bottom-0 w-96 sm:w-[32rem] h-20 bg-base-200 rounded-badge p-4 mb-3"> <footer class="card fixed bottom-0 w-96 sm:w-[32rem] h-20 bg-base-200 rounded-badge p-4 mb-3">
<div class="flex justify-center items-center"> <div class="flex justify-center items-center">
<ul class="steps justify-center center w-full text-sm"> <ul class="steps justify-center center w-full text-sm">
<a href="/" class="step step-primary text-gray-500">Выбор</a> <a href="chooseinstitut" class="step step-primary text-gray-500">Выбор</a>
@foreach (int i in Enumerable.Range(1, 4)) @foreach (int i in Enumerable.Range(1, 4))
{ {
if (_lvl == 4 && i == 4) if (_lvl == 4 && i == 4)

View File

@@ -4,7 +4,5 @@
<div class="flex items-center accent-error justify-center min-h-screen font-roboto text-primary-content"> <div class="flex items-center accent-error justify-center min-h-screen font-roboto text-primary-content">
@Body @Body
<NavMenu/> <NavMenu/>
</div> </div>

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 @using Microsoft.AspNetCore.Components.Authorization
@inject AuthenticationStateProvider AuthenticationStateProvider @inject AuthenticationStateProvider AuthenticationStateProvider
@page "/" @page "/"
@attribute [DiscoverCollocatedJS]
<PageTitle>Отчислятор 3000</PageTitle> <PageTitle>Отчислятор 3000</PageTitle>
@code { <JS For="this" Args="[AuthenticationStateProvider.GetAuthenticationStateAsync().Result.User.Identity?.IsAuthenticated]" />
private MarkupString GetLinkIfAuth(string link) => new MarkupString(AuthenticationStateProvider.GetAuthenticationStateAsync().Result.User.Identity?.IsAuthenticated == true ? link : "MicrosoftIdentity/Account/SignIn");
}
<div class="relative"> <div class="relative">
@* TODO: Дописать модальное окно *@ @* TODO: Дописать модальное окно *@
@@ -27,7 +26,7 @@
<div class="card rounded-badge bg-base-200 p-4"> <div class="card rounded-badge bg-base-200 p-4">
<h2 class="card-title text-center text-3xl justify-center my-4">Мне нужно...</h2> <h2 class="card-title text-center text-3xl justify-center my-4">Мне нужно...</h2>
<div class="flex flex-col space-y-4 mt-1"> <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"> <div class="absolute bg-base-200 rounded-full right-1 w-14 h-14">
@{ @{
@@ -41,8 +40,8 @@
} }
} }
</div> </div>
</a> </button>
<button class="btn h-16 btn-primary rounded-full text-2xl relative"> <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"> <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"> <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> </div>
<i class="absolute text-sm bottom-0 text-base-200 font-medium">временно недоступно</i> <i class="absolute text-sm bottom-0 text-base-200 font-medium">временно недоступно</i>
</button> </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"> <div class="absolute bg-base-200 rounded-full right-1 w-14 h-14">
<img class="p-2" src="img/akadem.svg" alt=""/> <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 "/questionnaire"
@page "/otchislenie/questionnaire"
@using Otchinslator.Components.Layout @using Otchinslator.Components.Layout
@layout OtchislenieLayout @layout OtchislenieLayout
@using BlazorPageScript @using BlazorPageScript
@@ -175,7 +174,7 @@
class="relative btn btn-primary rounded-full flex-grow-0 w-[3rem] h-[3rem]"> class="relative btn btn-primary rounded-full flex-grow-0 w-[3rem] h-[3rem]">
<img class="absolute p-3" src="img/exit.svg" alt=""/> <img class="absolute p-3" src="img/exit.svg" alt=""/>
</a> </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> <button onclick="info_modal.showModal()" class="btn btn-primary rounded-full flex-grow-0 w-[3rem]">?</button>
</div> </div>
</div> </div>

View File

@@ -1,4 +1,11 @@
export function onLoad() { 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) { document.getElementById('phoneNumberInput').addEventListener('input', function (e) {
e.target.value = e.target.value.replace(/\D/g, '').slice(0, 10); // Limit to 10 digits 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 options = document.querySelectorAll('input[name="options"]');
const kursElements = document.querySelectorAll('input[name="kurs"]'); const kursElements = document.querySelectorAll('input[name="kurs"]');
const phoneNumberInput = document.getElementById('phoneNumberInput'); const phoneNumberInput = document.getElementById('phoneNumberInput');

View File

@@ -63,7 +63,7 @@
@* $1$ TODO: Сделать адаптив #1# *@ @* $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 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"> *@ @* <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> *@
@* <a href="/" class="btn w-96 h-14 btn-primary rounded-full text-2xl"> *@ @* <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 @using Otchinslator.Components.Layout
@layout OtchislenieLayout @layout OtchislenieLayout
@using BlazorPageScript @using BlazorPageScript

View File

@@ -7,4 +7,5 @@
@using Microsoft.AspNetCore.Components.Web.Virtualization @using Microsoft.AspNetCore.Components.Web.Virtualization
@using Microsoft.JSInterop @using Microsoft.JSInterop
@using Otchinslator @using Otchinslator
@using Otchinslator.Components @using Otchinslator.Components
@using BlazorJSComponents

View File

@@ -1,11 +1,11 @@
FROM mcr.microsoft.com/dotnet/aspnet:8.0.11-alpine3.20 AS base FROM mcr.microsoft.com/dotnet/aspnet:9.0.1-alpine3.21 AS base
USER root USER root
RUN apk update && apk add --no-cache curl icu tzdata musl-locales musl-locales-lang RUN apk update && apk add --no-cache curl icu tzdata musl-locales musl-locales-lang
USER $APP_UID USER $APP_UID
WORKDIR /app WORKDIR /app
EXPOSE 8080 EXPOSE 8080
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build FROM mcr.microsoft.com/dotnet/sdk:9.0.102-alpine3.21 AS build
ARG BUILD_CONFIGURATION=Release ARG BUILD_CONFIGURATION=Release
RUN apt update && apt install npm -y RUN apt update && apt install npm -y
WORKDIR /src WORKDIR /src

View File

@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web"> <Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net8.0</TargetFramework> <TargetFramework>net9.0</TargetFramework>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS> <DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
@@ -25,17 +25,20 @@
</Target> --> </Target> -->
<ItemGroup> <ItemGroup>
<PackageReference Include="BlazorJSComponents" Version="1.0.0" />
<PackageReference Include="BlazorPageScript" <PackageReference Include="BlazorPageScript"
Version="1.0.0" /> Version="1.0.0" />
<PackageReference Include="DocumentFormat.OpenXml" <PackageReference Include="DocumentFormat.OpenXml"
Version="3.2.0" /> Version="3.2.0" />
<PackageReference Include="Gotenberg.Sharp.API.Client" <PackageReference Include="Gotenberg.Sharp.API.Client"
Version="2.4.0" /> Version="2.4.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="9.0.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="9.0.1" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="9.0.1" />
<PackageReference Include="Microsoft.Identity.Web" <PackageReference Include="Microsoft.Identity.Web" Version="3.6.0" />
Version="3.2.2" /> <PackageReference Include="Microsoft.Identity.Web.UI" Version="3.6.0" />
<PackageReference Include="Microsoft.Identity.Web.UI"
Version="3.2.2" />
<PackageReference Include="NPetrovich" <PackageReference Include="NPetrovich"
Version="2.0.1" /> Version="2.0.1" />
</ItemGroup> </ItemGroup>

View File

@@ -29,9 +29,11 @@ builder.Services.Configure<ForwardedHeadersOptions>(options =>
// Add services to the container. // Add services to the container.
builder.Services.AddRazorComponents() builder.Services.AddRazorComponents()
.AddInteractiveServerComponents(); .AddInteractiveServerComponents();
builder.Services.AddJSComponents();
builder.Services.AddRazorPages(); ////////////// builder.Services.AddRazorPages(); //////////////
builder.Services.AddServerSideBlazor(); /////////////// builder.Services.AddServerSideBlazor(); //////////////
builder.Services.AddOptions<GotenbergSharpClientOptions>() builder.Services.AddOptions<GotenbergSharpClientOptions>()
.Bind(builder.Configuration.GetSection(nameof(GotenbergSharpClient))); .Bind(builder.Configuration.GetSection(nameof(GotenbergSharpClient)));
builder.Services.AddGotenbergSharpClient(); builder.Services.AddGotenbergSharpClient();

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 89 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 341 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB